150 lines
4.6 KiB
C#
150 lines
4.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using WMS.Frm.Base;
|
|
using WMS.Model.Base;
|
|
using WMS.Base.WebService;
|
|
using WMS.Common;
|
|
|
|
namespace WMS.FrmBaseData
|
|
{
|
|
/// <summary>
|
|
/// 窗体:快递公司信息编辑
|
|
/// </summary>
|
|
public partial class FrmLogisticsComInfoHandle : FormBase
|
|
{
|
|
#region 变量
|
|
private LogisticsComInfoModel LogisticsComInfoModel = new LogisticsComInfoModel();
|
|
public int flag = -1;//0:新增;1:修改;3:编辑导入的数据
|
|
#endregion
|
|
|
|
#region 初始化
|
|
|
|
/// <summary>
|
|
/// 构造函数 用于新增
|
|
/// </summary>
|
|
public FrmLogisticsComInfoHandle()
|
|
{
|
|
InitializeComponent();
|
|
|
|
flag = 0;
|
|
bsLogisticsComInfo.DataSource = LogisticsComInfoModel;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 构造函数 用于修改
|
|
/// </summary>
|
|
/// <param name="LogisticsComInfo"></param>
|
|
public FrmLogisticsComInfoHandle(LogisticsComInfoModel LogisticsComInfo)
|
|
{
|
|
InitializeComponent();
|
|
|
|
flag = 1;
|
|
LogisticsComInfoModel = LogisticsComInfo;
|
|
bsLogisticsComInfo.DataSource = LogisticsComInfoModel;
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// load
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void FrmLogisticsComInfoHandle_Load(object sender, EventArgs e)
|
|
{
|
|
}
|
|
#endregion
|
|
|
|
#region 按钮事件
|
|
|
|
/// <summary>
|
|
/// 确定按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void ctrlButtons1_Click(object sender, EventArgs e)
|
|
{
|
|
btnConfirm.Focus();
|
|
|
|
//非空验证
|
|
if (string.IsNullOrEmpty(txtComName.Text.Trim()))
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("快递公司名称不能为空");
|
|
txtComName.Focus();
|
|
return;
|
|
}
|
|
|
|
LogisticsComInfoModel model = LogisticsComInfoModel;
|
|
model.OPERATORID = userData.USER_ID;//操作人
|
|
if (flag == 1)//修改
|
|
{
|
|
string strLogisticsComInfoModel = Newtonsoft.Json.JsonConvert.SerializeObject(model);
|
|
string errText = string.Empty;
|
|
try
|
|
{
|
|
errText = WebLockConfig.Instance.WebLogisticsComInfo.InsOrUpdLogisticsComInfo(strLogisticsComInfoModel, 1);
|
|
if (string.IsNullOrEmpty(errText))
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("修改成功");
|
|
|
|
}
|
|
else
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("修改失败" + errText);
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|
}
|
|
}
|
|
else if (flag == 0)//新增
|
|
{
|
|
string strLogisticsComInfoModel = Newtonsoft.Json.JsonConvert.SerializeObject(model);
|
|
string errText = string.Empty;
|
|
try
|
|
{
|
|
errText = WebLockConfig.Instance.WebLogisticsComInfo.InsOrUpdLogisticsComInfo(strLogisticsComInfoModel, 0);
|
|
if (string.IsNullOrEmpty(errText))
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("新增成功");
|
|
}
|
|
else
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("新增失败" + errText);
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|
}
|
|
}
|
|
this.Close();
|
|
this.Dispose();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 退出按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void ctrlButtons2_Click(object sender, EventArgs e)
|
|
{
|
|
if (DialogResult.Yes != SystemCommon.ShowMessageBoxResult("确定放弃正在编辑的数据?"))
|
|
{
|
|
return;
|
|
}
|
|
this.Close();
|
|
this.Dispose();
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|