private void barButtonItem修改_ItemClick(object sender, ItemClickEventArgs e) { string cno = "", cname = "", positionname = "", linetypename = "", deptname = ""; int id = 0, positionid = 0, linetypeid = 0, deptid = 0; DirectLabourQuery.GetInfo(ref id, ref cno, ref cname, ref deptid, ref deptname, ref positionid, ref positionname, ref linetypeid, ref linetypename); if (cno != "") { DirectLabourUpdate Frm = new DirectLabourUpdate(); Frm.TopLevel = false; Frm.Parent = this; Frm.Show(); Frm.BringToFront(); } }
private void DirectLabourUpdate_Load(object sender, EventArgs e) { string cno = "", cname = "", positionname = "", linetypename = "", deptname = ""; int id = 0, positionid = 0, linetypeid = 0, deptid = 0; DirectLabourQuery.GetInfo(ref id, ref cno, ref cname, ref deptid, ref deptname, ref positionid, ref positionname, ref linetypeid, ref linetypename); PositionBind(); Common.BasicDataBind("cost_dept", comboBoxDept); ConnDB conn = new ConnDB(); string sql = "select * from cost_dept where cid = " + deptid + " and isnull(forbidden,'false') = 'true'"; int rows = conn.ReturnRecordCount(sql); string sql2 = "select * from cost_position where cid = " + positionid + " and isnull(forbidden,'false') = 'true'"; int rows2 = conn.ReturnRecordCount(sql); string sql3 = "select * from COST_LINETYPE where cid = " + linetypeid + " and isnull(forbidden,'false') = 'true'"; int rows3 = conn.ReturnRecordCount(sql); if (cno != "") { textEditNo.Text = cno; textEditName.Text = cname; if (rows == 0) { comboBoxDept.SelectedIndex = -1; comboBoxDept.SelectedValue = deptid; } if (rows2 == 0) { comboBoxPosition.SelectedIndex = -1; comboBoxPosition.SelectedValue = positionid; } LineTypeBind(); if (rows3 == 0) { comboBoxLineType.SelectedIndex = -1; comboBoxLineType.SelectedValue = linetypeid; } textEditID.Text = id.ToString(); } }