public static DeptMapQuery GetInstance() { if (pqform == null || pqform.IsDisposed) { pqform = new DeptMapQuery(); } return(pqform); }
private void barButtonItem查询_ItemClick(object sender, ItemClickEventArgs e) { DeptMapQuery Frm = DeptMapQuery.GetInstance(); Frm.TopLevel = false; Frm.Parent = this; Frm.Show(); Frm.BringToFront(); }
private void DeptMap_Load(object sender, EventArgs e) { this.WindowState = FormWindowState.Maximized; DeptMapQuery Frm = DeptMapQuery.GetInstance(); Frm.TopLevel = false; Frm.Parent = this; Frm.Show(); Frm.BringToFront(); Frm.Height = this.Height - 20; }
private void DeptMapUpdate_Load(object sender, EventArgs e) { //this.WindowState = FormWindowState.Maximized; int deptid = 0; string cname = "", attendance = "", attendance3rd = "", attendance4th = ""; DeptMapQuery.GetInfo(ref deptid, ref cname, ref attendance, ref attendance3rd, ref attendance4th); Common.BasicDataBind("cost_dept", comboBoxDept); if (cname != "") { textEdit2nd.Text = attendance; textEdit3rd.Text = attendance3rd; textEdit4th.Text = attendance4th; comboBoxDept.SelectedIndex = -1; comboBoxDept.SelectedValue = deptid; textEditID.Text = deptid.ToString(); } }
private void barButtonItem修改_ItemClick(object sender, ItemClickEventArgs e) { int deptid = 0; string cname = "", attendance = "", attendance3rd = "", attendance4th = ""; DeptMapQuery.GetInfo(ref deptid, ref cname, ref attendance, ref attendance3rd, ref attendance4th); if (cname != "" && attendance4th != "") { DeptMapUpdate Frm = new DeptMapUpdate(); Frm.TopLevel = false; Frm.Parent = this; Frm.Show(); Frm.BringToFront(); } else { MessageBox.Show("该对照关系还不存在,请先新增!"); } }
private void simpleButtonOK_Click(object sender, EventArgs e) { int deptid = 0; string cname = "", attendance = "", attendance3rd = "", attendance4th = ""; DeptMapQuery.GetInfo(ref deptid, ref cname, ref attendance, ref attendance3rd, ref attendance4th); ConnDB conn = new ConnDB(); string sql = "update cost_dept_map set DEPT2 = '" + textEdit2nd.Text.ToString().Trim() + "',dept_id =" + comboBoxDept.SelectedValue.ToString() + ",DEPT3 = '" + textEdit3rd.Text.ToString().Trim() + "',DEPT4 = '" + textEdit4th.Text.ToString().Trim() + "'"; sql = sql + " where dept_id = " + deptid + " and isnull(DEPT2,'') = '" + attendance + "' and isnull(DEPT3,'') = '" + attendance3rd + "' and isnull(DEPT4,'') = '" + attendance4th + "'"; string sql2 = "select * from cost_dept_map where isnull(DEPT2,'') = '" + textEdit2nd.Text.ToString().Trim() + "' and dept_id = " + comboBoxDept.SelectedValue.ToString() + " and isnull(DEPT3,'') = '" + textEdit3rd.Text.ToString().Trim() + "' and isnull(DEPT4,'') = '" + textEdit4th.Text.ToString().Trim() + "'"; if (textEdit4th.Text.ToString().Trim() != "" && comboBoxDept.SelectedValue.ToString() != "0") { int rows = conn.ReturnRecordCount(sql2); if (rows > 0) { MessageBox.Show("该记录已经存在!"); } else { bool isok = conn.EditDatabase(sql); if (isok) { MessageBox.Show("修改成功!"); DeptMapQuery.RefreshEX(); this.Close(); } else { MessageBox.Show("失败!"); } } } else { MessageBox.Show("不能为空值!"); } conn.Close(); }
private void simpleButtonOK_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string strsql, strsql2; int rows; strsql = "insert into cost_dept_map(dept_id,DEPT1,DEPT2,DEPT3,DEPT4) values(" + comboBoxDept.SelectedValue.ToString() + ",'制造中心','" + textEdit2nd.Text.ToString().Trim() + "','" + textEdit3rd.Text.ToString().Trim() + "','" + textEdit4th.Text.ToString().Trim() + "')"; strsql2 = "select * from cost_dept_map where isnull(DEPT2,'') = '" + textEdit2nd.Text.ToString().Trim() + "' and isnull(DEPT3,'') = '" + textEdit3rd.Text.ToString().Trim() + "' and isnull(DEPT4,'') = '" + textEdit4th.Text.ToString().Trim() + "'"; if (textEdit4th.Text.ToString().Trim() != "" && comboBoxDept.SelectedValue.ToString() != "0") { rows = conn.ReturnRecordCount(strsql2); if (rows > 0) { MessageBox.Show("该考勤部门已经存在!"); } else { bool isok = conn.EditDatabase(strsql); if (isok) { MessageBox.Show("添加成功!"); DeptMapQuery.RefreshEX(); this.Close(); } else { MessageBox.Show("失败!"); } } } else { MessageBox.Show("不能为空!"); } conn.Close(); }
private void barButtonItem删除_ItemClick(object sender, ItemClickEventArgs e) { DeptMapQuery.Delete(); DeptMapQuery.RefreshEX(); }