180 lines
7.4 KiB
C#
180 lines
7.4 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Drawing;
|
|||
|
using System.Data;
|
|||
|
using System.Text;
|
|||
|
using System.Linq;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
using DevExpress.XtraEditors;
|
|||
|
using Api.Framework;
|
|||
|
using Api.Framework.Model;
|
|||
|
using SqlSugar;
|
|||
|
using UI.Framework.Forms;
|
|||
|
using FLSystem.Events;
|
|||
|
using Api.Framework.Enums;
|
|||
|
|
|||
|
namespace FLSystem.Forms
|
|||
|
{
|
|||
|
public partial class cps_order_refund_alimama : DevExpress.XtraEditors.XtraUserControl
|
|||
|
{
|
|||
|
public cps_order_refund_alimama(string textedit = "")
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
this.textEdit1.Text = textedit;
|
|||
|
this.comboBoxEdit1.SelectedIndex = string.IsNullOrEmpty(textedit) ? 0 : 1;
|
|||
|
this.dateTimePicker1.Value = DateTime.Parse(DateTime.Today.AddDays(-30).ToString("yyyy-MM-01"));
|
|||
|
this.dateTimePicker2.Value = DateTime.Parse(DateTime.Now.AddDays(30).ToString("yyyy-MM-dd HH:mm:ss"));
|
|||
|
this.gridView1.CustomDrawRowIndicator += gridView1_CustomDrawRowIndicator;
|
|||
|
this.checkBox1.Checked = false;
|
|||
|
|
|||
|
this.pageControl1.Bind(SerchData, this.gridControl1, 50, true, true);
|
|||
|
MainEvent.CommonEvents += Main_CommonEvents;
|
|||
|
this.Disposed += Control_Disposed;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
BaseForm.ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
private void Control_Disposed(object sender, EventArgs e)
|
|||
|
{
|
|||
|
MainEvent.CommonEvents -= Main_CommonEvents;
|
|||
|
}
|
|||
|
private void Main_CommonEvents(object sender, CommonEvents e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (e.Commons != null && e.Commons.Count != 0)
|
|||
|
{
|
|||
|
if (e.Commons.ContainsKey("type") && e.Commons.ContainsKey("trade_parent_id"))
|
|||
|
{
|
|||
|
if (e.Commons["type"].ToString() == "阿里妈妈维权订单")
|
|||
|
{
|
|||
|
textEdit1.Text = e.Commons["trade_parent_id"].ToString();
|
|||
|
comboBoxEdit1.SelectedIndex = 1;
|
|||
|
comboBoxEdit2.SelectedIndex = 0;
|
|||
|
checkBox1.Checked = false;
|
|||
|
pageControl1.GotoPage(1);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
BaseForm.ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
private UI.Framework.Controls.PageControl.SerchResult SerchData(int index, int pagesize)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
|
|||
|
List<fl_order_refund_alimama> result = null;
|
|||
|
List<IConditionalModel> conModels = new List<IConditionalModel>();
|
|||
|
if (this.checkBox1.Checked)
|
|||
|
{
|
|||
|
conModels.Add(new ConditionalModel() { FieldName = "refundcreatetime", ConditionalType = ConditionalType.GreaterThanOrEqual, FieldValue = this.dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss") });
|
|||
|
conModels.Add(new ConditionalModel() { FieldName = "refundcreatetime", ConditionalType = ConditionalType.LessThanOrEqual, FieldValue = this.dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss") });
|
|||
|
}
|
|||
|
StringBuilder sb_time = new StringBuilder();
|
|||
|
DateTime startTime = DateTime.Now;
|
|||
|
string where = string.Empty;
|
|||
|
string keyword = this.textEdit1.Text.Trim();
|
|||
|
if (!string.IsNullOrEmpty(keyword))
|
|||
|
{
|
|||
|
switch (this.comboBoxEdit1.Text)
|
|||
|
{
|
|||
|
case "订单编号":
|
|||
|
if (keyword.Length == 6) conModels.Add(new ConditionalModel() { FieldName = "tbtradeparentid", ConditionalType = ConditionalType.LikeRight, FieldValue = keyword });
|
|||
|
else conModels.Add(new ConditionalModel() { FieldName = "tbtradeparentid", ConditionalType = ConditionalType.Equal, FieldValue = keyword });
|
|||
|
break;
|
|||
|
case "商品标题":
|
|||
|
conModels.Add(new ConditionalModel() { FieldName = "tbauctiontitle", ConditionalType = ConditionalType.Like, FieldValue = keyword });
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
startTime = DateTime.Now;
|
|||
|
if (comboBoxEdit2.Text != "全部数据")
|
|||
|
conModels.Add(new ConditionalModel() { FieldName = "showrefundstatus", ConditionalType = ConditionalType.Equal, FieldValue = comboBoxEdit2.Text });
|
|||
|
|
|||
|
startTime = DateTime.Now;
|
|||
|
//总记录数
|
|||
|
int totalNumber = 0;
|
|||
|
//result = session.Queryable<fl_order_refund_alimama>()
|
|||
|
// .Where(conModels)
|
|||
|
// .OrderBy(o => (string.IsNullOrWhiteSpace(o.refundcreatetime) ? DateTime.MinValue : DateTime.Parse(o.refundcreatetime)), OrderByType.Desc).ToPageList(index, pagesize, ref totalNumber);
|
|||
|
result = session.Queryable<fl_order_refund_alimama>()
|
|||
|
.Where(conModels).OrderBy(f => f.id, OrderByType.Desc)
|
|||
|
.ToPageList(index, pagesize, ref totalNumber);
|
|||
|
|
|||
|
return new UI.Framework.Controls.PageControl.SerchResult() { Result = result, Total = totalNumber };
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
if (!this.IsDisposed)
|
|||
|
this.UpdateUI(() =>
|
|||
|
{
|
|||
|
BaseForm.ShowError(ex);
|
|||
|
});
|
|||
|
}
|
|||
|
return null;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 代理委托更新UI
|
|||
|
/// </summary>
|
|||
|
/// <param name="act"></param>
|
|||
|
protected delegate void DelegateUpdateUI(Action act);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 代理委托更新UI
|
|||
|
/// </summary>
|
|||
|
/// <param name="act"></param>
|
|||
|
protected void UpdateUI(Action act)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (!InvokeRequired)
|
|||
|
{
|
|||
|
act.Invoke();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
DelegateUpdateUI delegateUpdateUI = new DelegateUpdateUI(UpdateUI);
|
|||
|
Invoke(delegateUpdateUI, act);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
BaseForm.ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
|
|||
|
{
|
|||
|
if (e.Info.IsRowIndicator && e.RowHandle >= 0) e.Info.DisplayText = (e.RowHandle + 1).ToString();
|
|||
|
}
|
|||
|
|
|||
|
private void ComboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.textEdit1.Enabled = comboBoxEdit1.SelectedIndex != 0;
|
|||
|
if (!textEdit1.Enabled)
|
|||
|
this.textEdit1.Text = string.Empty;
|
|||
|
}
|
|||
|
|
|||
|
private void CheckBox1_CheckedChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.dateTimePicker1.Enabled = this.dateTimePicker2.Enabled = this.checkBox1.Checked;
|
|||
|
}
|
|||
|
|
|||
|
private void SimpleButton1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.pageControl1.Go(sender, e);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|