112 lines
3.2 KiB
C#
112 lines
3.2 KiB
C#
|
using Api.Framework;
|
|||
|
using Api.Framework.Tools;
|
|||
|
using Delivery.Plugin.Model;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
using UI.Framework.Forms;
|
|||
|
|
|||
|
namespace Delivery.Plugin
|
|||
|
{
|
|||
|
public partial class KuaidiForm : BaseForm
|
|||
|
{
|
|||
|
fl_plugin_delivery_group group;
|
|||
|
public KuaidiForm(fl_plugin_delivery_group group)
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
this.group = group;
|
|||
|
}
|
|||
|
|
|||
|
private void KuaidiForm_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
var _temp = session.Queryable<fl_plugin_delivery_kuaidi>().Where(f => f.group_id == group.id).ToList();
|
|||
|
this.gridControl1.DataSource = _temp;
|
|||
|
}
|
|||
|
catch (Exception)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void 增加ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
var obj = new fl_plugin_delivery_kuaidi() { group_id = group.id};
|
|||
|
new SettingForm(obj).ShowDialog();
|
|||
|
if (!string.IsNullOrEmpty(obj.name))
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
session.Insertable<fl_plugin_delivery_kuaidi>(obj).ExecuteCommand();
|
|||
|
KuaidiForm_Load(null, null);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void 修改ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var rows = this.gridView1.GetSelectedRows();
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
//获取选中数据
|
|||
|
var obj = this.gridView1.GetRow(rows[0]) as fl_plugin_delivery_kuaidi;
|
|||
|
new SettingForm(obj).ShowDialog();
|
|||
|
if (!string.IsNullOrEmpty(obj.name))
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
session.Saveable<fl_plugin_delivery_kuaidi>(obj).ExecuteCommand();
|
|||
|
KuaidiForm_Load(null, null);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
catch (Exception)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var rows = this.gridView1.GetSelectedRows();
|
|||
|
if (rows != null && rows.Length > 0)
|
|||
|
{
|
|||
|
//获取选中数据
|
|||
|
var obj = this.gridView1.GetRow(rows[0]) as fl_plugin_delivery_kuaidi;
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
session.ExcuteSQL("delete from fl_plugin_delivery_kuaidi where id="+obj.id);
|
|||
|
this.gridView1.DeleteRow(rows[0]);
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|