Ejemplo n.º 1
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_work_type set cname = ltrim(rtrim('" + textEditNew.Text.ToString() + "')) where cid =" + id;
            string sql2 = "select cname from cost_work_type where cname = LTRIM(rtrim('" + textEditNew.Text.ToString() + "'))";

            if (textEditNew.Text.ToString().Trim() != "")
            {
                int rows = conn.ReturnRecordCount(sql2);
                if (rows > 0)
                {
                    MessageBox.Show("该上班类型已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        WorkTypeQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("新值不能为空!");
            }
            conn.Close();
        }
Ejemplo n.º 2
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_work_type(CNAME,forbidden) values(LTRIM(rtrim('" + textEditName.Text.ToString() + "')),0)";
            strsql2 = "select cname from cost_work_type where cname = LTRIM(rtrim('" + textEditName.Text.ToString() + "'))";
            if (textEditName.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该上班类型已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        WorkTypeQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
Ejemplo n.º 3
0
 private void barButtonItem禁用_ItemClick(object sender, ItemClickEventArgs e)
 {
     WorkTypeQuery.cDisable();
     WorkTypeQuery.RefreshEX();
 }
Ejemplo n.º 4
0
 private void barButtonItem删除_ItemClick(object sender, ItemClickEventArgs e)
 {
     WorkTypeQuery.Delete();
     WorkTypeQuery.RefreshEX();
 }