using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using DBUtility;
|
|
namespace SCM
|
{
|
public partial class Xt_UserNew : Form
|
{
|
public Xt_UserNew()
|
{
|
InitializeComponent();
|
}
|
|
public SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1();
|
public Pub_Class.ClsPub.Enum_InputMode InputMode; //¼Èë״̬±êÖ¾(0-·Ç¼Èë״̬ 1-Ôö¼Ó 2-ÐÞ¸Ä)
|
public string Czybm;
|
public Int64 HOrgID = -1;
|
//´°Ìå¼ÓÔØ
|
private void Xt_UserNew_Load(object sender, EventArgs e)
|
{
|
oWeb.Url = ClsPub1.WEBSURL;
|
lblError.Text = "";
|
LbYes.Items.Clear();
|
LbNo.Items.Clear();
|
//¼ÓÔØ×éÖ¯ÐÅÏ¢
|
Sub_AddOrdList();
|
Init();
|
Display();
|
}
|
|
//¼ÓÔØ×éÖ¯ÐÅÏ¢
|
private void Sub_AddOrdList()
|
{
|
DataSet ds;
|
ds = oWeb.get_ORGANIZATIONSList();
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
MessageBox.Show("»ñÈ¡×é֯ʧ°Ü");
|
return;
|
}
|
cmbHOrgID.Items.Clear();
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
cmbHOrgID.Items.Add(DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HName"]));
|
}
|
}
|
//²éÕÒÊý¾Ý----Óû§×é
|
private void Display()
|
{
|
if (InputMode == Pub_Class.ClsPub.Enum_InputMode.InputMode_AddNew)
|
{
|
try
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet oDs = new DataSet();
|
oDs = oWeb.getDataSetBySQL("select GroupID,GroupName from System_UserGroup order by GroupName", "System_UserGroup", ref ClsPub.sExeReturnInfo);
|
if (oDs == null)
|
{
|
MessageBox.Show("ÏÔʾʧ°Ü£¡ÔÒò£º" + ClsPub.sExeReturnInfo);
|
return;
|
}
|
//
|
for (int i = 0; i <= oDs.Tables[0].Rows.Count - 1; i++)
|
{
|
LbNo.Items.Add(oDs.Tables[0].Rows[i][0].ToString().Trim() + "-" + oDs.Tables[0].Rows[i][1].ToString().Trim());
|
}
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show(e.Message, "Ìáʾ");
|
return;
|
}
|
}
|
else
|
{
|
try
|
{
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet oDs = new DataSet();
|
DataSet oDS = new DataSet();
|
//¼ÓÔØ²»Êô×é
|
oDs = oWeb.getDataSetBySQL("select GroupID,GroupName from System_UserGroup"
|
+" where Groupid not IN (select Groupid from system_UserGroupInfo where userid='"+Czybm+"')", "System_UserGroup", ref ClsPub.sExeReturnInfo);
|
if (oDs == null)
|
{
|
MessageBox.Show("ÏÔʾʧ°Ü£¡ÔÒò£º" + ClsPub.sExeReturnInfo);
|
return;
|
}
|
//
|
if (oDs.Tables[0].Rows.Count != 0)
|
{
|
for (int i = 0; i <= oDs.Tables[0].Rows.Count - 1; i++)
|
{
|
|
LbNo.Items.Add(oDs.Tables[0].Rows[i][0].ToString().Trim() + "-" + oDs.Tables[0].Rows[i][1].ToString().Trim());
|
}
|
}
|
//¼ÓÔØÊôÓÚ×é
|
oDS = oWeb.getDataSetBySQL("select GroupID,GroupName from System_UserGroup"
|
+ " where Groupid IN (select Groupid from system_UserGroupInfo where userid='" + Czybm + "')", "System_UserGroup", ref ClsPub.sExeReturnInfo);
|
if (oDS == null)
|
{
|
MessageBox.Show("ÏÔʾʧ°Ü£¡ÔÒò£º" + ClsPub.sExeReturnInfo);
|
return;
|
}
|
//
|
if (oDS.Tables[0].Rows.Count != 0)
|
{
|
for (int i = 0; i <= oDS.Tables[0].Rows.Count - 1; i++)
|
{
|
|
LbYes.Items.Add(oDS.Tables[0].Rows[i][0].ToString().Trim() + "-" + oDS.Tables[0].Rows[i][1].ToString().Trim());
|
}
|
}
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show(e.Message, "Ìáʾ");
|
return;
|
}
|
}
|
}
|
//³õʼ»¯½çÃæ
|
private void Init()
|
{
|
txtHK3UserID.ReadOnly = true;
|
txtHKeeperID.ReadOnly = true;
|
txtHSecManagerID.ReadOnly = true;
|
txtHSellManID.ReadOnly = true;
|
txtHDeptID.ReadOnly = true;
|
txtHWhID.ReadOnly = true;
|
txtHSCWH.ReadOnly = true;
|
txtHSupID.ReadOnly = true;
|
txtHMouldWhID.ReadOnly = true;
|
txtHMouldSCWhID.ReadOnly = true;
|
if (InputMode == Pub_Class.ClsPub.Enum_InputMode.InputMode_AddNew)
|
{
|
txtCzybm.Text = "";
|
txtCzymc.Text = "";
|
txtCzymm.Text = "";
|
txtCzyyz.Text = "";
|
txtExplain.Text = "";
|
txtHEmpID.Text = "";
|
txtHK3UserID.Text = "";
|
txtHKeeperID.Text = "";
|
txtHSecManagerID.Text = "";
|
txtHSellManID.Text = "";
|
txtHDeptID.Text = "";
|
txtHWhID.Text = "";
|
txtHSCWH.Text = "";
|
txtHSupID.Text = "";
|
txtHMouldWhID.Text = "";
|
txtHMouldSCWhID.Text = "";
|
txtHCloudUserName.Text = "";
|
txtHCloudUserPsd.Text = "";
|
cmdAllRight.PerformClick();
|
|
//»ñÈ¡µ±Ç°×éÖ¯ÐÅÏ¢
|
DataSet Ds = oWeb.getDataSetBySQL("select * from Xt_ORGANIZATIONS where HItemID=" + ClsPub1.HOrgID, "Xt_ORGANIZATIONS", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (Ds.Tables[0].Rows.Count != 0)
|
{
|
cmbHOrgID.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HName"]);
|
}
|
}
|
else
|
{
|
txtCzybm.ReadOnly = true;
|
txtCzymm.ReadOnly = true;
|
txtCzyyz.ReadOnly = true;
|
ShowData(Czybm);
|
}
|
}
|
//¼ÓÔØ±íÍ·
|
private void ShowData(string sCzybm)
|
{
|
DataSet oDs = new DataSet();
|
SCM.ClsIF_User_View oUser = new SCM.ClsIF_User_View();
|
SCM.ClsIF_Employee_View oEmp = new SCM.ClsIF_Employee_View();
|
SCM.ClsXt_ORGANIZATIONS_View oORG = new ClsXt_ORGANIZATIONS_View();
|
SCM.ClsIF_Department_View oDep = new SCM.ClsIF_Department_View();
|
SCM.ClsIF_Warehouse_View oWh = new SCM.ClsIF_Warehouse_View();
|
SCM.ClsIF_Supplier_View oSup = new SCM.ClsIF_Supplier_View();
|
try
|
{
|
oDs = oWeb.getDataSetBySQL("select Czybm,Czymc,Explain,HEmpID,HK3UserID,HCloudUserName,HCloudUserPsd,HKeeperID,HKeeper,HSecManagerID,HSecManager,HSellManID,HSellMan,HDeptID,HDept,HWhID,HWHName,HSCWHID,HSCWHName,HSupID,HSupName,HUSEORGID,HMouldWhID,HMouldSCWhID from Gy_Czygl where Czybm='" + sCzybm + "'", "Gy_Czygl", ref ClsPub.sExeReturnInfo);
|
if (oDs == null)
|
{
|
MessageBox.Show("ÏÔʾʧ°Ü£¡ÔÒò£º" + ClsPub.sExeReturnInfo);
|
return;
|
}
|
else if (oDs.Tables[0].Rows.Count != 0)
|
{
|
txtCzybm.Text = oDs.Tables[0].Rows[0]["Czybm"].ToString().Trim();
|
txtCzymc.Text = oDs.Tables[0].Rows[0]["Czymc"].ToString().Trim();
|
txtCzymm.Text = "*****";
|
txtCzyyz.Text = "*****";
|
txtExplain.Text = oDs.Tables[0].Rows[0]["Explain"].ToString().Trim();
|
|
if (oORG.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
|
{
|
cmbHOrgID.Text = ClsPub.isStrNull(oORG.omodel.HName);
|
}
|
else
|
{
|
cmbHOrgID.Text = "";
|
}
|
if (oEmp.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HEmpID"])))
|
{
|
txtHEmpID.Text = ClsPub.isStrNull(oEmp.omodel.HName);
|
txtHEmpID.Tag = ClsPub.isLong(oEmp.omodel.HItemID);
|
}
|
else
|
{
|
txtHEmpID.Text = "";
|
txtHEmpID.Tag = 0;
|
}
|
if (oUser.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HK3UserID"])))
|
{
|
txtHK3UserID.Text = ClsPub.isStrNull(oUser.omodel.HName);
|
txtHK3UserID.Tag = ClsPub.isLong(oUser.omodel.HItemID);
|
}
|
else
|
{
|
txtHK3UserID.Text = "";
|
txtHK3UserID.Tag = 0;
|
}
|
if (oEmp.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HKeeperID"])))
|
{
|
txtHKeeperID.Text = ClsPub.isStrNull(oEmp.omodel.HName);
|
txtHKeeperID.Tag = ClsPub.isLong(oEmp.omodel.HItemID);
|
}
|
else
|
{
|
txtHKeeperID.Text = "";
|
txtHKeeperID.Tag = 0;
|
}
|
if (oEmp.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HSecManagerID"])))
|
{
|
txtHSecManagerID.Text = ClsPub.isStrNull(oEmp.omodel.HName);
|
txtHSecManagerID.Tag = ClsPub.isLong(oEmp.omodel.HItemID);
|
}
|
else
|
{
|
txtHSecManagerID.Text = "";
|
txtHSecManagerID.Tag = 0;
|
}
|
if (oEmp.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HSellManID"])))
|
{
|
txtHSellManID.Text = ClsPub.isStrNull(oEmp.omodel.HName);
|
txtHSellManID.Tag = ClsPub.isLong(oEmp.omodel.HItemID);
|
}
|
else
|
{
|
txtHSellManID.Text = "";
|
txtHSellManID.Tag = 0;
|
}
|
if (oDep.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HDeptID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
|
{
|
txtHDeptID.Text = ClsPub.isStrNull(oDep.omodel.HName);
|
txtHDeptID.Tag = ClsPub.isLong(oDep.omodel.HItemID);
|
}
|
else
|
{
|
txtHDeptID.Text = "";
|
txtHDeptID.Tag = 0;
|
}
|
if (oWh.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HWhID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
|
{
|
txtHWhID.Text = ClsPub.isStrNull(oWh.omodel.HName);
|
txtHWhID.Tag = ClsPub.isLong(oWh.omodel.HItemID);
|
}
|
else
|
{
|
txtHWhID.Text = "";
|
txtHWhID.Tag = 0;
|
}
|
if (oWh.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HSCWHID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
|
{
|
txtHSCWH.Text = ClsPub.isStrNull(oWh.omodel.HName);
|
txtHSCWH.Tag = ClsPub.isLong(oWh.omodel.HItemID);
|
}
|
else
|
{
|
txtHSCWH.Text = "";
|
txtHSCWH.Tag = 0;
|
}
|
if (oSup.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HSupID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
|
{
|
txtHSupID.Text = ClsPub.isStrNull(oSup.omodel.HName);
|
txtHSupID.Tag = ClsPub.isLong(oSup.omodel.HItemID);
|
}
|
else
|
{
|
txtHSupID.Text = "";
|
txtHSupID.Tag = 0;
|
}
|
if (oWh.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HMouldWhID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
|
{
|
txtHMouldWhID.Text = ClsPub.isStrNull(oWh.omodel.HName);
|
txtHMouldWhID.Tag = ClsPub.isLong(oWh.omodel.HItemID);
|
}
|
else
|
{
|
txtHMouldWhID.Text = "";
|
txtHMouldWhID.Tag = 0;
|
}
|
if (oWh.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HMouldSCWhID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
|
{
|
txtHMouldSCWhID.Text = ClsPub.isStrNull(oWh.omodel.HName);
|
txtHMouldSCWhID.Tag = ClsPub.isLong(oWh.omodel.HItemID);
|
}
|
else
|
{
|
txtHMouldSCWhID.Text = "";
|
txtHMouldSCWhID.Tag = 0;
|
}
|
//txtHKeeperID.Text = oDs.Tables[0].Rows[0]["HKeeper"].ToString().Trim();
|
//txtHKeeperID.Tag = oDs.Tables[0].Rows[0]["HKeeperID"].ToString().Trim();
|
//txtHSecManagerID.Text = oDs.Tables[0].Rows[0]["HSecManager"].ToString().Trim();
|
//txtHSecManagerID.Tag = oDs.Tables[0].Rows[0]["HSecManagerID"].ToString().Trim();
|
//txtHSellManID.Text = oDs.Tables[0].Rows[0]["HSellMan"].ToString().Trim();
|
//txtHSellManID.Tag = oDs.Tables[0].Rows[0]["HSellManID"].ToString().Trim();
|
//txtHDeptID.Text = oDs.Tables[0].Rows[0]["HDept"].ToString().Trim();
|
//txtHDeptID.Tag = oDs.Tables[0].Rows[0]["HDeptID"].ToString().Trim();
|
//txtHWhID.Text = oDs.Tables[0].Rows[0]["HWHName"].ToString().Trim();
|
//txtHWhID.Tag = oDs.Tables[0].Rows[0]["HWhID"].ToString().Trim();
|
//txtHSCWH.Text = oDs.Tables[0].Rows[0]["HSCWHName"].ToString().Trim();
|
//txtHSCWH.Tag = oDs.Tables[0].Rows[0]["HSCWHID"].ToString().Trim();
|
//txtHSupID.Text = oDs.Tables[0].Rows[0]["HSupName"].ToString().Trim();
|
//txtHSupID.Tag = oDs.Tables[0].Rows[0]["HSupID"].ToString().Trim();
|
txtHCloudUserName.Text = oDs.Tables[0].Rows[0]["HCloudUserName"].ToString().Trim();
|
txtHCloudUserPsd.Text = oDs.Tables[0].Rows[0]["HCloudUserPsd"].ToString().Trim();
|
}
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show(e.Message, "Ìáʾ");
|
return;
|
}
|
}
|
|
//È¡Ïû
|
private void cmdCancel_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
//×óÒÆ
|
private void cmdLeft_Click(object sender, EventArgs e)
|
{
|
if (this.LbNo.SelectedItems.Count > 0)
|
{
|
int i = this.LbNo.SelectedIndex;
|
this.LbYes.Items.Add(this.LbNo.SelectedItem.ToString());
|
this.LbNo.Items.RemoveAt(i);
|
}
|
}
|
//È«²¿×óÒÆ
|
private void cmdAllLeft_Click(object sender, EventArgs e)
|
{
|
if (this.LbNo.Items.Count > 0)
|
{
|
for (int i = 0; i <= this.LbNo.Items.Count - 1; i++)
|
{
|
this.LbYes.Items.Add(this.LbNo.Items[i].ToString());
|
this.LbNo.Items.RemoveAt(i);
|
i--;
|
}
|
}
|
}
|
//ÓÒÒÆ
|
private void cmdRight_Click(object sender, EventArgs e)
|
{
|
if (this.LbYes.SelectedItems.Count > 0)
|
{
|
int i = this.LbYes.SelectedIndex;
|
this.LbNo.Items.Add(this.LbYes.SelectedItem.ToString());
|
this.LbYes.Items.RemoveAt(i);
|
}
|
}
|
//È«²¿ÓÒÒÆ
|
private void cmdAllRight_Click(object sender, EventArgs e)
|
{
|
if (this.LbYes.Items.Count > 0)
|
{
|
for (int i = 0; i <= this.LbYes.Items.Count - 1; i++)
|
{
|
this.LbNo.Items.Add(this.LbYes.Items[i].ToString());
|
this.LbYes.Items.RemoveAt(i);
|
i--;
|
}
|
}
|
}
|
//È·¶¨
|
private void cmdOK_Click(object sender, EventArgs e)
|
{
|
lblError.Text = "";
|
DataSet oDs = new DataSet();
|
if (!Sub_AllowSave()) //µ¥¾ÝÍêÕûÐÔÅжÏ
|
{
|
tabControl1.SelectedIndex = 0;
|
return;
|
}
|
|
HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (HOrgID == -1)
|
{
|
MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎó£¡");
|
return;
|
}
|
|
if (InputMode == Pub_Class.ClsPub.Enum_InputMode.InputMode_AddNew)
|
{
|
oWeb.getRunProc("insert into Gy_Czygl (Czybm,Czymc,Czmm,Explain,HempID,HK3UserID " +
|
",HKeeperID,HKeeper,HSecManagerID,HSecManager " +
|
",HSellManID,HSellMan,HDeptID,HDept " +
|
",HWhID,HWHName,HSupID,HSupName " +
|
",HSCWHID,HSCWHName " +
|
",HMouldWhID,HMouldWhName,HMouldSCWhID,HMouldSCWhName " +
|
",HCloudUserName,HCloudUserPsd,HUSEORGID)" +
|
"values ("
|
+ "'" + txtCzybm.Text.ToString() + "','" + txtCzymc.Text.ToString() + "','" + ClsPub.StrToPsd(txtCzymm.Text.ToString()) + "','" + txtExplain.Text.ToString() + "'," + ClsPub.isLong(txtHEmpID.Tag).ToString() + "," + ClsPub.isLong(txtHK3UserID.Tag).ToString() +
|
"," + ClsPub.isLong(txtHKeeperID.Tag).ToString() + ",'" + txtHKeeperID.Text.ToString() + "'," + ClsPub.isLong(txtHSecManagerID.Tag).ToString() + ",'" + txtHSecManagerID.Text.ToString() + "'" +
|
"," + ClsPub.isLong(txtHSellManID.Tag).ToString() + ",'" + txtHSellManID.Text.ToString() + "'," + ClsPub.isLong(txtHDeptID.Tag).ToString() + ",'" + txtHDeptID.Text.ToString() + "'" +
|
"," + ClsPub.isLong(txtHWhID.Tag).ToString() + ",'" + txtHWhID.Text.ToString() + "'," + ClsPub.isLong(txtHSupID.Tag).ToString() + ",'" + txtHSupID.Text.ToString() + "'" +
|
"," + ClsPub.isLong(txtHSCWH.Tag).ToString() + ",'" + txtHSCWH.Text.ToString() + "'" +
|
"," + ClsPub.isLong(txtHMouldWhID.Tag).ToString() + ",'" + txtHMouldWhID.Text.ToString() + "'," + ClsPub.isLong(txtHMouldSCWhID.Tag).ToString() + ",'" + txtHMouldSCWhID.Text.ToString() + "'" +
|
",'" + txtHCloudUserName.Text.ToString() + "','" + txtHCloudUserPsd.Text.ToString() + "'," + HOrgID +
|
")", ref DBUtility.ClsPub.sExeReturnInfo);
|
oDs = oWeb.getDataSetBySQL("Select * from Gy_Czygl where Czybm='" + txtCzybm.Text.ToString() + "'", "Gy_Czygl", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
MessageBox.Show("ÐÂÔöʧ°Ü£¡", "Ìáʾ");
|
}
|
this.Czybm = oDs.Tables[0].Rows[0]["Czybm"].ToString();
|
oWeb.getRunProc("delete from System_UserGroupInfo where UserId='" + Czybm.ToString() + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
for (int i = 0; i <= LbYes.Items.Count - 1; i++)
|
{
|
oWeb.getRunProc("insert into System_UserGroupInfo (GroupId,UserId) values (" + ClsPub.isLong(Get_Code(this.LbYes.Items[i].ToString())) + ",'" + Czybm.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
lblError.Text = "* ÐÂÔö³É¹¦£¡";
|
Init();
|
tabControl1.SelectedIndex = 0;
|
}
|
else
|
{
|
oWeb.getRunProc("update Gy_Czygl set Czymc='" + txtCzymc.Text.ToString() + "'" +
|
",Explain='" + txtExplain.Text.ToString() + "'" +
|
",HEmpID=" + ClsPub.isLong(txtHEmpID.Tag).ToString() +
|
",HK3UserID=" + ClsPub.isLong(txtHK3UserID.Tag).ToString() +
|
",HKeeperID=" + ClsPub.isLong(txtHKeeperID.Tag).ToString() +
|
",HKeeper='" + txtHKeeperID.Text.ToString() + "'" +
|
",HSecManagerID=" + ClsPub.isLong(txtHSecManagerID.Tag).ToString() +
|
",HSecManager='" + txtHSecManagerID.Text.ToString() + "'" +
|
",HSellManID=" + ClsPub.isLong(txtHSellManID.Tag).ToString() +
|
",HSellMan='" + txtHSellManID.Text.ToString() + "'" +
|
",HDeptID=" + ClsPub.isLong(txtHDeptID.Tag).ToString() +
|
",HDept='" + txtHDeptID.Text.ToString() + "'" +
|
",HWhID=" + ClsPub.isLong(txtHWhID.Tag).ToString() +
|
",HWHName='" + txtHWhID.Text.ToString() + "'" +
|
",HSCWHID=" + ClsPub.isLong(txtHSCWH.Tag).ToString() +
|
",HSCWHName='" + txtHSCWH.Text.ToString() + "'" +
|
",HSupID=" + ClsPub.isLong(txtHSupID.Tag).ToString() +
|
",HSupName='" + txtHSupID.Text.ToString() + "'" +
|
",HCloudUserName='" + txtHCloudUserName.Text.ToString() + "'" +
|
",HCloudUserPsd='" + txtHCloudUserPsd.Text.ToString() + "'" +
|
",HUSEORGID=" + HOrgID.ToString() +
|
",HMouldWhID=" + ClsPub.isLong(txtHMouldWhID.Tag).ToString() +
|
",HMouldWhName='" + txtHMouldWhID.Text.ToString() + "'" +
|
",HMouldSCWhID=" + ClsPub.isLong(txtHMouldSCWhID.Tag).ToString() +
|
",HMouldSCWhName='" + txtHMouldSCWhID.Text.ToString() + "'" +
|
"where Czybm='" + Czybm + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
//
|
oWeb.getRunProc("delete from System_UserGroupInfo where UserId='" + Czybm + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
for (int i = 0; i <= LbYes.Items.Count - 1; i++)
|
{
|
oWeb.getRunProc("insert into System_UserGroupInfo (GroupId,UserId) values (" + ClsPub.isLong(Get_Code(this.LbYes.Items[i].ToString())) + ",'" + Czybm + "')", ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
lblError.Text = "* Ð޸ijɹ¦£¡";
|
tabControl1.SelectedIndex = 0;
|
}
|
}
|
//µ¥¾ÝÍêÕûÐÔÅжÏ
|
private bool Sub_AllowSave()
|
{
|
if (txtCzybm.Text.Trim() == "")
|
{
|
lblError.Text = "* ±àÂë²»ÄÜΪ¿Õ£¡";
|
return false;
|
}
|
if (txtCzymc.Text.Trim() == "")
|
{
|
lblError.Text = "* Óû§Ãû²»ÄÜΪ¿Õ£¡";
|
return false;
|
}
|
// ÑéÖ¤ÃÜÂë
|
if (txtCzymm.Text.Trim() != "")
|
{
|
if (txtCzymm.Text.Trim() != txtCzyyz.Text.Trim())
|
{
|
lblError.Text = "* ÃÜÂëÑéÖ¤´íÎó£¡";
|
return false;
|
}
|
}
|
// Óû§±àÂëºÍÓû§Ãû ÊÇ·ñÖØ¸´
|
if (InputMode == Pub_Class.ClsPub.Enum_InputMode.InputMode_AddNew)
|
{
|
DataSet oDs = new DataSet();
|
DataSet oDS = new DataSet();
|
oDs = oWeb.getDataSetBySQL("select * from Gy_Czygl where Czybm='" + txtCzybm.Text.ToString() + "'", "Gy_Czygl", ref DBUtility.ClsPub.sExeReturnInfo);
|
oDS = oWeb.getDataSetBySQL("select * from Gy_Czygl where Czymc='" + txtCzymc.Text.ToString() + "'", "Gy_Czygl", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (oDs.Tables[0].Rows.Count != 0)
|
{
|
lblError.Text = "* ±àÂëÖØ¸´£¡";
|
return false;
|
}
|
if (oDS.Tables[0].Rows.Count != 0)
|
{
|
lblError.Text = "* Óû§ÃûÖØ¸´£¡";
|
return false;
|
}
|
}
|
return true;
|
}
|
//²ð·Ö
|
private string Get_Code(string sCode)
|
{
|
sCode = sCode.Trim();
|
char c = Convert.ToChar("-");
|
string[] s = sCode.Split(c);
|
if (s.Length > 1)
|
{
|
return s[0].Trim();
|
}
|
else
|
{
|
return "0";
|
}
|
}
|
|
//ÐÞ¸ÄÃÜÂë
|
private void cmdPassWord_Click(object sender, EventArgs e)
|
{
|
Xt_Password oPassword = new Xt_Password();
|
oPassword.Czybm = this.Czybm;
|
oPassword.ShowDialog();
|
}
|
#region ¶ÔÓ¦»ù´¡×ÊÁÏÉèÖÃ
|
|
//²éÕÒ½ÇÉ«
|
public int i = 0; //ÐеÄÏÂ±ê¿ØÖÆÆ÷ (*****¿ØÖÆ´ÓµÚ¼¸ÐпªÊ¼±éÀú*****)
|
public bool notNull = false; //µÝ¹é¿ØÖÆÆ÷ (*****¿ØÖÆÊÇ·ñ¿Éµ÷Óõݹé******)
|
private void cmdHGroup_Click(object sender, EventArgs e)
|
{
|
string sFind = txtHGroup.Text.Trim();
|
string sGroup = "";
|
for (int a = i; a <= LbNo.Items.Count - 1; a++)
|
{
|
sGroup = this.LbNo.Items[a].ToString();
|
if (sGroup.IndexOf(sFind) != -1)
|
{
|
this.LbNo.SelectedIndex = a;
|
i = a + 1; //ʹÏ´αéÀú´Ó¸ÃÐеÄÏÂÒ»ÐпªÊ¼²éÕÒ
|
notNull = true;
|
return; //ÉèÖÃnotNullÎªÕæ,Ìø³ö
|
}
|
}
|
if (notNull) //ʼÖÕδÕÒµ½Æ¥ÅäÏîÔò½øÈë
|
{
|
i = 0; //ÖØÖôӵÚÒ»ÐбéÀú
|
notNull = false; //ÉèÖÃnotNullΪ¼Ù,Èç¹ûÔÙÒ»´Î´ÓµÚÒ»ÐбéÀúδÕÒµ½Æ¥ÅäÏîÔò²»»áÔÙ½øÈëIFµ÷Óõݹé
|
cmdHGroup_Click(sender, e); //µÝ¹é
|
}
|
else
|
{
|
MessageBox.Show("δÕÒµ½£¡£¡");
|
}
|
}
|
|
private void cmdHEmpID_Click(object sender, EventArgs e)
|
{
|
SCM.ClsIF_Employee_View oEmp = new SCM.ClsIF_Employee_View();
|
string DeWhere = "";
|
DeWhere = " ";
|
if (oEmp.RefreshView(DeWhere))
|
{
|
this.txtHEmpID.Text = oEmp.oModel.HName;
|
this.txtHEmpID.Tag = oEmp.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHEmpID.Text = "";
|
this.txtHEmpID.Tag = 0;
|
}
|
}
|
|
private void txtHEmpID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHEmpID.Text.Trim() == "")
|
{
|
txtHEmpID.Tag = "0";
|
}
|
}
|
|
//-------------------------------------------------------
|
private void cmdHK3UserID_Click(object sender, EventArgs e)
|
{
|
SCM.ClsIF_User_View oUser = new SCM.ClsIF_User_View();
|
string DeWhere = "";
|
DeWhere = " ";
|
if (oUser.RefreshView(DeWhere))
|
{
|
this.txtHK3UserID.Text = oUser.oModel.HName;
|
this.txtHK3UserID.Tag = oUser.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHK3UserID.Text = "";
|
this.txtHK3UserID.Tag = 0;
|
}
|
}
|
|
private void txtHK3UserID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHK3UserID.Text.Trim() == "")
|
{
|
txtHK3UserID.Tag = "0";
|
}
|
}
|
|
private void cmdHKeeperID_Click(object sender, EventArgs e)
|
{
|
SCM.ClsIF_Employee_View oEmp = new SCM.ClsIF_Employee_View();
|
string DeWhere = "";
|
DeWhere = " ";
|
if (oEmp.RefreshView(DeWhere))
|
{
|
this.txtHKeeperID.Text = oEmp.oModel.HName;
|
this.txtHKeeperID.Tag = oEmp.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHKeeperID.Text = "";
|
this.txtHKeeperID.Tag = 0;
|
}
|
}
|
|
private void txtHKeeperID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHKeeperID.Text.Trim() == "")
|
{
|
txtHKeeperID.Tag = "0";
|
}
|
}
|
|
private void cmdHSecManagerID_Click(object sender, EventArgs e)
|
{
|
SCM.ClsIF_Employee_View oEmp = new SCM.ClsIF_Employee_View();
|
string DeWhere = "";
|
DeWhere = " ";
|
if (oEmp.RefreshView(DeWhere))
|
{
|
this.txtHSecManagerID.Text = oEmp.oModel.HName;
|
this.txtHSecManagerID.Tag = oEmp.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHSecManagerID.Text = "";
|
this.txtHSecManagerID.Tag = 0;
|
}
|
}
|
|
private void txtHSecManagerID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHSecManagerID.Text.Trim() == "")
|
{
|
txtHSecManagerID.Tag = "0";
|
}
|
}
|
|
private void cmdHSellManID_Click(object sender, EventArgs e)
|
{
|
SCM.ClsIF_Employee_View oEmp = new SCM.ClsIF_Employee_View();
|
string DeWhere = "";
|
DeWhere = " ";
|
if (oEmp.RefreshView(DeWhere))
|
{
|
this.txtHSellManID.Text = oEmp.oModel.HName;
|
this.txtHSellManID.Tag = oEmp.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHSellManID.Text = "";
|
this.txtHSellManID.Tag = 0;
|
}
|
}
|
|
private void txtHSellManID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHSellManID.Text.Trim() == "")
|
{
|
txtHSellManID.Tag = "0";
|
}
|
}
|
|
private void cmdHDeptID_Click(object sender, EventArgs e)
|
{
|
HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (HOrgID == -1)
|
{
|
MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
|
return;
|
}
|
|
SCM.ClsIF_Department_View oDep = new SCM.ClsIF_Department_View();
|
string DeWhere = "";
|
DeWhere = " and HUSEORGID = " + HOrgID;
|
if (oDep.RefreshView(DeWhere))
|
{
|
this.txtHDeptID.Text = oDep.oModel.HName;
|
this.txtHDeptID.Tag = oDep.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHDeptID.Text = "";
|
this.txtHDeptID.Tag = 0;
|
}
|
}
|
|
private void txtHDeptID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHDeptID.Text.Trim() == "")
|
{
|
txtHDeptID.Tag = "0";
|
}
|
}
|
|
private void cmdHWhID_Click(object sender, EventArgs e)
|
{
|
HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (HOrgID == -1)
|
{
|
MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
|
return;
|
}
|
|
SCM.ClsIF_Warehouse_View oWh = new SCM.ClsIF_Warehouse_View();
|
string DeWhere = "";
|
DeWhere = " and HUSEORGID = " + HOrgID;
|
if (oWh.RefreshView(DeWhere))
|
{
|
if (oWh.oModel.HItemID.ToString() == txtHSCWH.Tag.ToString())
|
{
|
MessageBox.Show("¶ÔÓ¦²Ö¿â²»ÄÜÓëµ÷Èë²Ö¿âÏàͬ£¡");
|
this.txtHWhID.Text = "";
|
return;
|
}
|
else
|
{
|
this.txtHWhID.Text = oWh.oModel.HName;
|
this.txtHWhID.Tag = oWh.oModel.HItemID.ToString();
|
}
|
}
|
else
|
{
|
this.txtHWhID.Text = "";
|
this.txtHWhID.Tag = 0;
|
}
|
}
|
|
private void txtHWhID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHWhID.Text.Trim() == "")
|
{
|
txtHWhID.Tag = "0";
|
}
|
}
|
|
//µ÷Èë²Ö¿â
|
private void cmdHSCWH_Click(object sender, EventArgs e)
|
{
|
HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (HOrgID == -1)
|
{
|
MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
|
return;
|
}
|
|
SCM.ClsIF_Warehouse_View oWh = new SCM.ClsIF_Warehouse_View();
|
string DeWhere = "";
|
DeWhere = " and HUSEORGID = " + HOrgID;
|
if (oWh.RefreshView(DeWhere))
|
{
|
if (oWh.oModel.HItemID.ToString() == txtHWhID.Tag.ToString())
|
{
|
MessageBox.Show("µ÷Èë²Ö¿â²»ÄÜÓë¶ÔÓ¦²Ö¿âÏàͬ£¡");
|
this.txtHSCWH.Text = "";
|
return;
|
}
|
else
|
{
|
this.txtHSCWH.Text = oWh.oModel.HName;
|
this.txtHSCWH.Tag = oWh.oModel.HItemID.ToString();
|
}
|
}
|
else
|
{
|
this.txtHSCWH.Text = "";
|
this.txtHSCWH.Tag = 0;
|
}
|
}
|
|
private void txtHSCWH_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHSCWH.Text.Trim() == "")
|
{
|
txtHSCWH.Tag = "0";
|
}
|
}
|
|
private void cmdHSupID_Click(object sender, EventArgs e)
|
{
|
HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (HOrgID == -1)
|
{
|
MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
|
return;
|
}
|
|
SCM.ClsIF_Supplier_View oSup = new SCM.ClsIF_Supplier_View();
|
string DeWhere = "";
|
DeWhere = " and HUSEORGID = " + HOrgID;
|
if (oSup.RefreshView(DeWhere))
|
{
|
this.txtHSupID.Text = oSup.oModel.HName;
|
this.txtHSupID.Tag = oSup.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHSupID.Text = "";
|
this.txtHSupID.Tag = 0;
|
}
|
}
|
|
private void txtHSupID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHSupID.Text.Trim() == "")
|
{
|
txtHSupID.Tag = "0";
|
}
|
}
|
|
|
#endregion
|
|
#region ¶ÔӦģ¾ß»ù´¡×ÊÁÏÉèÖÃ
|
|
//µ÷Èë²Ö¿â
|
private void cmdHMouldWhID_Click(object sender, EventArgs e)
|
{
|
HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (HOrgID == -1)
|
{
|
MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
|
return;
|
}
|
|
SCM.ClsIF_Warehouse_View oWh = new SCM.ClsIF_Warehouse_View();
|
string DeWhere = "";
|
DeWhere = " and HUSEORGID = " + HOrgID;
|
if (oWh.RefreshView(DeWhere))
|
{
|
if (oWh.oModel.HItemID.ToString() == txtHMouldSCWhID.Tag.ToString())
|
{
|
MessageBox.Show("¶ÔÓ¦²Ö¿â²»ÄÜÓëµ÷Èë²Ö¿âÏàͬ£¡");
|
this.txtHMouldWhID.Text = "";
|
return;
|
}
|
else
|
{
|
this.txtHMouldWhID.Text = oWh.oModel.HName;
|
this.txtHMouldWhID.Tag = oWh.oModel.HItemID.ToString();
|
}
|
}
|
else
|
{
|
this.txtHMouldWhID.Text = "";
|
this.txtHMouldWhID.Tag = 0;
|
}
|
}
|
|
private void txtHMouldWhID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHMouldWhID.Text.Trim() == "")
|
{
|
txtHMouldWhID.Tag = "0";
|
}
|
}
|
|
//µ÷³ö²Ö¿â
|
private void cmdHMouldSCWhID_Click(object sender, EventArgs e)
|
{
|
HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (HOrgID == -1)
|
{
|
MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
|
return;
|
}
|
|
SCM.ClsIF_Warehouse_View oWh = new SCM.ClsIF_Warehouse_View();
|
string DeWhere = "";
|
DeWhere = " and HUSEORGID = " + HOrgID;
|
if (oWh.RefreshView(DeWhere))
|
{
|
if (oWh.oModel.HItemID.ToString() == txtHMouldWhID.Tag.ToString())
|
{
|
MessageBox.Show("µ÷Èë²Ö¿â²»ÄÜÓë¶ÔÓ¦²Ö¿âÏàͬ£¡");
|
this.txtHMouldSCWhID.Text = "";
|
return;
|
}
|
else
|
{
|
this.txtHMouldSCWhID.Text = oWh.oModel.HName;
|
this.txtHMouldSCWhID.Tag = oWh.oModel.HItemID.ToString();
|
}
|
}
|
else
|
{
|
this.txtHMouldSCWhID.Text = "";
|
this.txtHMouldSCWhID.Tag = 0;
|
}
|
}
|
|
private void txtHMouldSCWhID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHMouldSCWhID.Text.Trim() == "")
|
{
|
txtHMouldSCWhID.Tag = "0";
|
}
|
}
|
|
#endregion
|
|
private void cmbHOrgID_TextChanged(object sender, EventArgs e)
|
{
|
txtHDeptID.Text = "";
|
txtHWhID.Text = "";
|
txtHSCWH.Text = "";
|
txtHSupID.Text = "";
|
txtHMouldWhID.Text = "";
|
txtHMouldSCWhID.Text = "";
|
}
|
|
|
|
|
}
|
}
|