Ejemplo n.º 1
0
        private void IndirectLabourUpdate_Load(object sender, EventArgs e)
        {
            string cno = "", cname = "", positionname = "", deptname = "";
            int    id = 0, positionid = 0, deptid = 0, person_level = 0;

            IndirectLabourQuery.GetInfo(ref id, ref cno, ref cname, ref positionid, ref positionname, ref person_level, ref deptid, ref deptname);
            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);

            if (cno != "")
            {
                textEditNo.Text    = cno;
                textEditName.Text  = cname;
                textEditLevel.Text = person_level.ToString();
                if (rows == 0)
                {
                    comboBoxDept.SelectedIndex = -1;
                    comboBoxDept.SelectedValue = deptid;
                }
                if (rows2 == 0)
                {
                    comboBoxPosition.SelectedIndex = -1;
                    comboBoxPosition.SelectedValue = positionid;
                }
                textEditID.Text = id.ToString();
            }
        }
Ejemplo n.º 2
0
 public static IndirectLabourQuery GetInstance()
 {
     if (ilqform == null || ilqform.IsDisposed)
     {
         ilqform = new IndirectLabourQuery();
     }
     return(ilqform);
 }
Ejemplo n.º 3
0
        private void barButtonItem查询_ItemClick(object sender, ItemClickEventArgs e)
        {
            IndirectLabourQuery Frm = IndirectLabourQuery.GetInstance();

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

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
            //Frm.Width = this.Width - 15;
            //Frm.Height = this.Width - 60;
        }
Ejemplo n.º 5
0
        private void barButtonItem修改_ItemClick(object sender, ItemClickEventArgs e)
        {
            string cno = "", cname = "", positionname = "", deptname = "";
            int    id = 0, positionid = 0, deptid = 0, person_level = 0;

            IndirectLabourQuery.GetInfo(ref id, ref cno, ref cname, ref positionid, ref positionname, ref person_level, ref deptid, ref deptname);
            if (cno != "")
            {
                IndirectLabourUpdate Frm = new IndirectLabourUpdate();
                Frm.TopLevel = false;
                Frm.Parent   = this;
                Frm.Show();
                Frm.BringToFront();
            }
        }
Ejemplo n.º 6
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() + "')),cname = ltrim(rtrim('" + textEditName.Text.ToString() + "')),position_id =" + Common.IsZero(comboBoxPosition.SelectedValue.ToString()) + ",person_level = " + textEditLevel.Text.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 dept_id =" + comboBoxDept.SelectedValue.ToString() + " and person_level = " + Common.IsNull(textEditLevel.Text.ToString().Trim());

            if (textEditNo.Text.ToString().Trim() != "" && textEditName.Text.ToString().Trim() != "" && comboBoxPosition.SelectedValue.ToString() != "0" && comboBoxDept.SelectedValue.ToString() != "0" && textEditLevel.Text.ToString().Trim() != "")
            {
                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("修改成功!");
                        IndirectLabourQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空值!");
            }
            conn.Close();
        }
Ejemplo 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,POSITION_ID,DEPT_ID,PERSON_LEVEL,PERSON_TYPE_ID,FORBIDDEN) values(LTRIM(rtrim('" + textEditNo.Text.ToString().Trim() + "')),LTRIM(rtrim('" + textEditName.Text.ToString().Trim() + "'))," + comboBoxPosition.SelectedValue.ToString() + "," + comboBoxDept.SelectedValue.ToString() + "," + textEditLevel.Text.ToString().Trim() + ",4,0)";
            strsql2 = "select cname from cost_direct_labour where cno = LTRIM(rtrim('" + textEditNo.Text.ToString().Trim() + "'))";
            if (textEditLevel.Text.ToString().Trim() == "")
            {
                MessageBox.Show("员工等级不能为空!");
            }
            else if (textEditNo.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该人员已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        IndirectLabourQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("工号不能为空!");
            }
            conn.Close();
        }
Ejemplo n.º 8
0
 private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e)
 {
     IndirectLabourQuery.RefreshEX();
 }