using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
|
namespace OAM
|
{
|
public partial class frm_add1 : Form
|
{
|
public frm_add1()
|
{
|
InitializeComponent();
|
}
|
|
public string id;
|
public bool zt;
|
public string oDeptid;
|
|
private void cmdCanCel_Click(object sender, EventArgs e)
|
{
|
txtFnumber.Text = "";
|
txtFname.Text = "";
|
txtTel.Text = "";
|
txtInnerTel.Text = "";
|
txtMobile.Text = "";
|
txtEmail.Text = "";
|
txtVirtual.Text = "";
|
txtFRemark.Text = "";
|
txtdeptlist.Text = "";
|
this.Close();
|
}
|
|
private void cmdOk_Click(object sender, EventArgs e)
|
{
|
//string parentid = CurNode.Name.Substring(1);
|
if (DBUtility.ClsPub.isStrNull(txtFnumber.Text) == "")
|
{
|
MessageBox.Show("´úÂë²»ÄÜΪ¿Õ£¡", "Ìáʾ");
|
return;
|
}
|
if (DBUtility.ClsPub.isStrNull(txtFname.Text) == "")
|
{
|
MessageBox.Show("Ãû³Æ²»ÄÜΪ¿Õ£¡", "Ìáʾ");
|
return;
|
}
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
|
if (zt == false)
|
{
|
|
oCn.RunProc("Update EmployeeCon set" +
|
" Fnumber='" + txtFnumber.Text.Trim() + "'" +
|
",Fname='" + txtFname.Text.Trim() + "'" +
|
",Tel='" + txtTel.Text.Trim() + "'" +
|
",InnerTel='" + txtInnerTel.Text.Trim() + "'" +
|
",Mobile='" + txtMobile.Text.Trim() + "'" +
|
",Email='" + txtEmail.Text.Trim() + "'" +
|
",Virtual='" + txtVirtual.Text.Trim() + "'" +
|
",FRemark='" + txtFRemark.Text.Trim() + "' where FitemID=" + id, ref DBUtility.ClsPub.sExeReturnInfo);
|
|
MessageBox.Show("Ð޸ijɹ¦");
|
txtFnumber.Text = "";
|
txtFname.Text = "";
|
txtTel.Text = "";
|
txtInnerTel.Text = "";
|
txtMobile.Text = "";
|
txtEmail.Text = "";
|
txtVirtual.Text = "";
|
txtFRemark.Text = "";
|
txtdeptlist.Text = "";
|
this.Close();
|
}
|
else
|
{
|
try
|
{
|
oCn.RunProc("Insert into EmployeeCon " +
|
" (Fnumber,Fname,Tel,InnerTel,Mobile,Email,Virtual,FRemark,Deptid) " +
|
" Values('" + txtFnumber.Text.Trim() + "','" + txtFname.Text.Trim() + "','" + txtTel.Text.Trim() + "'" +
|
",'" + txtInnerTel.Text.Trim() + "','" + txtMobile.Text.Trim() + "','" + txtEmail.Text.Trim() + "'" +
|
",'" + txtVirtual.Text.Trim() + "','" + txtFRemark.Text.Trim() + "'," + oDeptid + ")", ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
catch
|
{
|
if (oDeptid == "")
|
{
|
MessageBox.Show("ÇëÑ¡ÔñÐèÒªÐÂÔöÖ°Ô±µÄ²¿ÃÅ");
|
txtFnumber.Text = "";
|
txtFname.Text = "";
|
txtTel.Text = "";
|
txtInnerTel.Text = "";
|
txtMobile.Text = "";
|
txtEmail.Text = "";
|
txtVirtual.Text = "";
|
txtFRemark.Text = "";
|
txtdeptlist.Text = "";
|
this.Close();
|
return;
|
}
|
}
|
MessageBox.Show("ÐÂÔö³É¹¦");
|
|
this.Close();
|
txtFnumber.Text = "";
|
txtFname.Text = "";
|
txtTel.Text = "";
|
txtInnerTel.Text = "";
|
txtMobile.Text = "";
|
txtEmail.Text = "";
|
txtVirtual.Text = "";
|
txtFRemark.Text = "";
|
}
|
}
|
|
private void timer1_Tick(object sender, EventArgs e)
|
{
|
|
timer1.Enabled = false;
|
if (zt == false)
|
{
|
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet Ds;
|
Ds = oCn.RunProcReturn("Select * from EmployeeCon where FitemID='" + id + "'", "EmployeeCon");
|
if (Ds.Tables[0].Rows.Count == 0)
|
{
|
return;
|
}
|
oDeptid = Ds.Tables[0].Rows[0]["Deptid"].ToString().Trim();
|
DataSet Ds2;
|
Ds2 = oCn.RunProcReturn("Select * from deptlist where fitemid='" + oDeptid + "'", "deptlist");
|
if (Ds.Tables[0].Rows.Count == 0)
|
{
|
return;
|
}
|
//¸³Öµ
|
|
txtdeptlist.Text = Ds2.Tables[0].Rows[0]["Fname"].ToString().Trim();
|
txtFnumber.Text = Ds.Tables[0].Rows[0]["Fnumber"].ToString().Trim();
|
txtFname.Text = Ds.Tables[0].Rows[0]["Fname"].ToString().Trim();
|
txtTel.Text = Ds.Tables[0].Rows[0]["Tel"].ToString().Trim();
|
txtInnerTel.Text = Ds.Tables[0].Rows[0]["InnerTel"].ToString().Trim();
|
txtMobile.Text = Ds.Tables[0].Rows[0]["Mobile"].ToString().Trim();
|
txtEmail.Text = Ds.Tables[0].Rows[0]["Email"].ToString().Trim();
|
txtVirtual.Text = Ds.Tables[0].Rows[0]["Virtual"].ToString().Trim();
|
txtFRemark.Text = Ds.Tables[0].Rows[0]["FRemark"].ToString().Trim();
|
}
|
else
|
{
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DataSet Ds2;
|
Ds2 = oCn.RunProcReturn("Select * from deptlist where fitemid='" + oDeptid + "'", "deptlist");
|
|
txtdeptlist.Text = Ds2.Tables[0].Rows[0]["Fname"].ToString().Trim();
|
|
}
|
|
}
|
}
|
}
|