198 lines
7.9 KiB
C#
198 lines
7.9 KiB
C#
using Api.Framework;
|
|
using Api.Framework.Tools;
|
|
using System;
|
|
using UI.Framework.Forms;
|
|
using WeChatCollectMoney.Properties;
|
|
|
|
namespace WeChatCollectMoney.Forms
|
|
{
|
|
public partial class MainForm : BaseForm
|
|
{
|
|
public MainForm()
|
|
{
|
|
InitializeComponent();
|
|
this.Text = Resources.MainFormTitle;
|
|
dateTimePicker1.Enabled = dateTimePicker2.Enabled = false;
|
|
}
|
|
|
|
public void CloseForm()
|
|
{
|
|
try
|
|
{
|
|
if (!this.IsDisposed)
|
|
{
|
|
this.Invoke(new Action(delegate
|
|
{
|
|
this.Close();
|
|
this.Dispose();
|
|
}));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ShowError(ex);
|
|
}
|
|
}
|
|
|
|
private void simpleButton1_Click_1(object sender, EventArgs e)
|
|
{
|
|
this.pageControl1.GotoPage(1);
|
|
}
|
|
|
|
private void MainForm_Load(object sender, EventArgs e)
|
|
{
|
|
this.comboBoxEdit1.SelectedIndex = 0;
|
|
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.checkBox1.Checked = false;
|
|
this.pageControl1.Bind(delegate (int index, int pagesize)
|
|
{
|
|
try
|
|
{
|
|
var session = ApiClient.GetSession();
|
|
var map = session.NewParamMap();
|
|
if (this.checkBox1.Checked)
|
|
{
|
|
map.setParameter("start_time", this.dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
map.setParameter("end_time", this.dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
}
|
|
map.setPageParamters(index, pagesize);
|
|
map.setOrderFields("wc.invalidtime", true);
|
|
|
|
string where = string.Empty;
|
|
if (!string.IsNullOrEmpty(this.textEdit1.Text))
|
|
{
|
|
|
|
switch (this.comboBoxEdit1.Text)
|
|
{
|
|
case "转账编号":
|
|
where = "wc.transferid = @transferid";
|
|
map.setParameter("transferid", this.textEdit1.Text.Trim());
|
|
break;
|
|
case "客户编号":
|
|
where = "m.id = @member_id";
|
|
map.setParameter("member_id", this.textEdit1.Text.Trim());
|
|
break;
|
|
case "客户账号":
|
|
where = "u.username like @username";
|
|
map.setParameter("username", "%" + this.textEdit1.Text.Trim() + "%");
|
|
break;
|
|
case "客户昵称":
|
|
where = "u.usernick like (@usernick)";
|
|
map.setParameter("usernick", $"%{this.textEdit1.Text.Trim()}%");
|
|
break;
|
|
case "机器人号":
|
|
where = "r.name = @name";
|
|
map.setParameter("name", this.textEdit1.Text.Trim());
|
|
break;
|
|
case "机器人昵称":
|
|
where = "r.nick = @nicke";
|
|
map.setParameter("nicke", this.textEdit1.Text.Trim());
|
|
break;
|
|
}
|
|
}
|
|
|
|
Api.Framework.Tools.PageResult<wechatcollectmoney_temp> result = null;
|
|
if (map.ContainsKey("start_time"))
|
|
result = session.FindPage<wechatcollectmoney_temp>("select wc.money as money,wc.invalidtime as invalidtime,wc.transferid as transferid,wc.id as id,r.type as chattype,m.id as member_id,m.username as username,m.usernick as usernick,r.name as name,r.nick as nick from fl_plugin_wechatcollectmoney_log wc INNER JOIN fl_member_info m ON wc.member_id = m.id INNER JOIN fl_robot_info r on wc.robot_id = r.id where wc.invalidtime>=@start_time and wc.invalidtime<=@end_time " + (string.IsNullOrEmpty(where) ? string.Empty : " and " + where), map);
|
|
else
|
|
result = session.FindPage<wechatcollectmoney_temp>("select wc.money as money,wc.invalidtime as invalidtime,wc.transferid as transferid,wc.id as id,r.type as chattype,m.id as member_id,m.username as username,m.usernick as usernick,r.name as name,r.nick as nick from fl_plugin_wechatcollectmoney_log wc INNER JOIN fl_member_info m ON wc.member_id = m.id INNER JOIN fl_robot_info r on wc.robot_id = r.id " + (string.IsNullOrEmpty(where) ? string.Empty : " where " + where), map);
|
|
|
|
return new UI.Framework.Controls.PageControl.SerchResult() { Result = result.DataList, Total = result.Total };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
BaseForm.ShowError(ex);
|
|
}
|
|
return null;
|
|
}, this.gridControl1, 100, true, true);
|
|
|
|
}
|
|
|
|
public class wechatcollectmoney_temp
|
|
{
|
|
/// <summary>
|
|
/// id
|
|
/// </summary>
|
|
public long id { get; set; }
|
|
/// <summary>
|
|
/// 金额
|
|
/// </summary>
|
|
public decimal money { get; set; }
|
|
/// <summary>
|
|
/// 转账时间
|
|
/// </summary>
|
|
public DateTime invalidtime { get; set; }
|
|
/// <summary>
|
|
/// 用户id
|
|
/// </summary>
|
|
public long member_id { get; set; }
|
|
/// <summary>
|
|
/// 转账编码
|
|
/// </summary>
|
|
public string transferid { get; set; }
|
|
/// <summary>
|
|
/// 机器人昵称
|
|
/// </summary>
|
|
private string _nick { get; set; }
|
|
/// <summary>
|
|
/// 机器人昵称
|
|
/// </summary>
|
|
public string nick
|
|
{
|
|
get { return _nick; }
|
|
set { if (string.IsNullOrEmpty(value)) _nick = string.Empty; else _nick = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 机器人号
|
|
/// </summary>
|
|
private string _name { get; set; }
|
|
/// <summary>
|
|
/// 机器人号
|
|
/// </summary>
|
|
public string name
|
|
{
|
|
get { return _name; }
|
|
set { if (string.IsNullOrEmpty(value)) _name = string.Empty; else _name = value; }
|
|
}
|
|
|
|
private string _username;
|
|
/// <summary>
|
|
/// 用户账号
|
|
/// </summary>
|
|
public string username
|
|
{
|
|
get { return _username; }
|
|
set { if (string.IsNullOrEmpty(value)) _username = string.Empty; else _username = value; }
|
|
}
|
|
|
|
private string _usernick;
|
|
/// <summary>
|
|
/// 用户昵称
|
|
/// </summary>
|
|
public string usernick
|
|
{
|
|
get { return _usernick; }
|
|
set { if (string.IsNullOrEmpty(value)) _usernick = string.Empty; else _usernick = value; }
|
|
}
|
|
|
|
}
|
|
|
|
private void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (comboBoxEdit1.SelectedIndex == 0)
|
|
{
|
|
this.textEdit1.Enabled = false;
|
|
this.textEdit1.Text = "";
|
|
}
|
|
else this.textEdit1.Enabled = true;
|
|
}
|
|
|
|
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
dateTimePicker1.Enabled = dateTimePicker2.Enabled = checkBox1.Checked;
|
|
}
|
|
|
|
}
|
|
} |