Exemplo n.º 1
0
 public static DirectLabourQuery GetInstance()
 {
     if (dlqform == null || dlqform.IsDisposed)
     {
         dlqform = new DirectLabourQuery();
     }
     return(dlqform);
 }
Exemplo n.º 2
0
        private void barButtonItem查询_ItemClick(object sender, ItemClickEventArgs e)
        {
            DirectLabourQuery Frm = DirectLabourQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
        }
Exemplo n.º 3
0
        private void LineType_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            DirectLabourQuery Frm = DirectLabourQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
            //Frm.Width = this.Width - 15;
            //Frm.Height = this.Width - 60;
        }
Exemplo n.º 4
0
        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();
            }
        }
Exemplo n.º 5
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_direct_labour set cno = ltrim(rtrim('" + textEditNo.Text.ToString().Trim() + "')),cname = ltrim(rtrim('" + textEditName.Text.ToString().Trim() + "')),position_id = " + Common.IsZero(comboBoxPosition.SelectedValue.ToString()) + ",linetype_id =" + Common.IsZero(comboBoxLineType.SelectedValue.ToString()) + ",dept_id =" + comboBoxDept.SelectedValue.ToString();

            sql = sql + " where cid = " + textEditID.Text.ToString();
            string sql2 = "select cname from cost_direct_labour where cno = '" + textEditNo.Text.ToString().Trim() + "' and cid <> " + textEditID.Text;
            string sql3 = "select * from cost_direct_labour where cno = '" + textEditNo.Text.ToString().Trim() + "' and cname ='" + textEditName.Text.ToString().Trim() + "' and position_id = " + comboBoxPosition.SelectedValue.ToString() + " and linetype_id =" + comboBoxLineType.SelectedValue.ToString() + " and dept_id =" + comboBoxDept.SelectedValue.ToString();

            if (textEditNo.Text.ToString().Trim() != "" && textEditName.Text.ToString().Trim() != "" && comboBoxPosition.SelectedValue.ToString() != "0" && comboBoxDept.SelectedValue.ToString() != "0")
            {
                int rows  = conn.ReturnRecordCount(sql2);
                int rows2 = conn.ReturnRecordCount(sql3);
                if (rows > 0)
                {
                    MessageBox.Show("该工号已经存在!");
                }
                else if (rows2 > 0)
                {
                    MessageBox.Show("该人员已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        DirectLabourQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空值!");
            }
            conn.Close();
        }
Exemplo n.º 6
0
        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();
            }
        }
Exemplo n.º 7
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_direct_labour(CNO,CNAME,DEPT_ID,POSITION_ID,LINETYPE_ID,PERSON_TYPE_ID,FORBIDDEN) values(LTRIM(rtrim('" + textEditNo.Text.ToString() + "')),LTRIM(rtrim('" + textEditName.Text.ToString() + "'))," + comboBoxDept.SelectedValue.ToString() + "," + comboBoxPosition.SelectedValue.ToString() + "," + Common.IsZero(comboBoxLineType.SelectedValue.ToString()) + ",3,0)";
            strsql2 = "select cname from cost_direct_labour where cno = LTRIM(rtrim('" + textEditNo.Text.ToString().Trim() + "'))";
            if (textEditNo.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该人员已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        DirectLabourQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("工号不能为空!");
            }
            conn.Close();
        }
Exemplo n.º 8
0
 private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e)
 {
     DirectLabourQuery.RefreshEX();
 }