Ejemplo n.º 1
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_shift(cname,cbegin,cend,rest_hours,overtime_rest_hours,overtime_begin) values('" + textEditName.Text.ToString().Trim() + "','" + dateTimePickerBegin.Text.ToString() + "','" + dateTimePickerEnd.Text.ToString() + "','" + textEditRest.Text.ToString().Trim() + "','" + textEditOverTimeRest.Text.ToString().Trim() + "','" + dateTimePickerOvertimeBegin.Text.ToString() + "')";
            strsql2 = "select cname from cost_shift where cname = '" + textEditName.Text.ToString().Trim() + "'";
            if (textEditName.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该考勤班次已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        ShiftQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
Ejemplo n.º 2
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_shift set cname = '" + textEditName.Text.ToString().Trim() + "',cbegin = '" + dateTimePickerBegin.Text + "',cend = '" + dateTimePickerEnd.Text + "',rest_hours = '" + textEditRest.Text.ToString().Trim() + "',overtime_rest_hours = '" + textEditOvertimeRest.Text.ToString().Trim() + "',overtime_begin = '" + dateTimePickerOvertimeBegin.Text.ToString() + "' where cname ='" + cname + "'";
            string sql2 = "select cname from cost_shift where cname = '" + textEditName.Text.ToString().Trim() + "'";

            if (textEditName.Text.ToString().Trim() != "")
            {
                int rows = conn.ReturnRecordCount(sql2);
                if (rows > 0 && textEditName.Text.ToString().Trim() != cname)
                {
                    MessageBox.Show("该考勤班次已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(sql);
                    if (isok)
                    {
                        MessageBox.Show("修改成功!");
                        ShiftQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("名称不能为空!");
            }
            conn.Close();
        }
Ejemplo n.º 3
0
 private void barButtonItem禁用_ItemClick(object sender, ItemClickEventArgs e)
 {
     ShiftQuery.cDisable();
     ShiftQuery.RefreshEX();
 }
Ejemplo n.º 4
0
 private void barButtonItem删除_ItemClick(object sender, ItemClickEventArgs e)
 {
     ShiftQuery.Delete();
     ShiftQuery.RefreshEX();
 }