122 lines
3.1 KiB
C#
122 lines
3.1 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Text;
|
|||
|
using System.Linq;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
using DevExpress.XtraEditors;
|
|||
|
using UI.Framework.Forms;
|
|||
|
using Activity.Properties;
|
|||
|
using UI.Framework.Controls;
|
|||
|
using Api.Framework;
|
|||
|
using Activity.Entitys;
|
|||
|
using Api.Framework.Tools;
|
|||
|
|
|||
|
namespace Activity
|
|||
|
{
|
|||
|
public partial class MainForm : BaseForm
|
|||
|
{
|
|||
|
public MainForm()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
this.Text = Resources.MainFormTitle;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 窗体关闭
|
|||
|
/// </summary>
|
|||
|
public void CloseForm()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
this.Invoke(new Action(delegate
|
|||
|
{
|
|||
|
this.Close();
|
|||
|
this.Dispose();
|
|||
|
}));
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 在列表的最前面加一个序号
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
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 MainForm_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
pageControl1.Bind((page, size) =>
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
var param = session.NewParamMap();
|
|||
|
param.setPageParamters(page, size);
|
|||
|
var result = session.FindPage<fl_plugin_activity_info>("select * from fl_plugin_activity_info", param);
|
|||
|
return new PageControl.SerchResult() { Result = result.DataList, Total = result.Total };
|
|||
|
}, gridControl1, 40);
|
|||
|
}
|
|||
|
|
|||
|
#region 右击菜单操作
|
|||
|
private void 增加活动ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var editActivityForm = new EditActivityForm();
|
|||
|
editActivityForm.ShowDialog();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void 修改活动ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void 删除选中ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
Api.Framework.Tools.Util.Save(Class1.Config);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|