Exemple #1
0
        public static void Delete()
        {
            string sql;
            bool   isdone = true;
            ConnDB conn   = new ConnDB();

            if (dlpqform == null || dlpqform.IsDisposed)
            {
                MessageBox.Show("没有要删除的数据!");
            }
            else if (dlpqform.gridView1.SelectedRowsCount == 0)
            {
                MessageBox.Show("没有要删除的数据!");
            }

            else
            {
                MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
                string            ms         = "确定要删除月份" + dlpqform.dateTimePicker1.Text.ToString() + "数据吗?";
                DialogResult      dr         = MessageBox.Show(ms, "直接人工费率删除", messButton);
                if (dr == DialogResult.OK)
                {
                    sql    = "delete from cost_direct_labour_price where YYYYMM = '" + dlpqform.dateTimePicker1.Text.ToString() + "'";
                    isdone = conn.DeleteDatabase(sql);
                    if (isdone)
                    {
                        MessageBox.Show("删除成功!");
                    }
                }
            }
            conn.Close();
        }
        public static void Delete()
        {
            string sql;
            bool   isdone = true;
            ConnDB conn   = new ConnDB();

            if (dlpqform == null || dlpqform.IsDisposed)
            {
                MessageBox.Show("没有要删除的数据!");
            }
            else if (dlpqform.gridView1.SelectedRowsCount == 0)
            {
                MessageBox.Show("没有要删除的数据!");
            }

            else
            {
                MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
                string            ms         = "确定要删除对应月份和员工等级的数据吗?";
                DialogResult      dr         = MessageBox.Show(ms, "间接人工费率删除", messButton);
                if (dr == DialogResult.OK)
                {
                    sql    = "delete from cost_indirect_labour_level_price where YYYYMM = '" + dlpqform.dateTimePicker1.Text.ToString() + "' and level_begin = " + dlpqform.gridView1.GetDataRow(dlpqform.gridView1.GetSelectedRows()[0]).ItemArray[2].ToString() + " and level_end = " + dlpqform.gridView1.GetDataRow(dlpqform.gridView1.GetSelectedRows()[0]).ItemArray[3].ToString();
                    isdone = conn.DeleteDatabase(sql);
                    if (isdone)
                    {
                        MessageBox.Show("删除成功!");
                    }
                }
            }
            conn.Close();
        }
Exemple #3
0
        public static void Delete()
        {
            string sql;
            bool   isdone = true;
            ConnDB conn   = new ConnDB();

            if (ilpqform == null || ilpqform.IsDisposed)
            {
                MessageBox.Show("没有要删除的数据!");
            }
            else if (ilpqform.gridView1.SelectedRowsCount == 0)
            {
                MessageBox.Show("没有要删除的数据!");
            }

            else
            {
                MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
                string            ms         = "确定要删除查询出来的所有数据吗?";
                DialogResult      dr         = MessageBox.Show(ms, "间接人工费率删除", messButton);
                if (dr == DialogResult.OK)
                {
                    if (ilpqform.comboBoxDept.SelectedValue.ToString() == "0")
                    {
                        sql = "delete from cost_indirect_labour_price where YYYYMM = '" + ilpqform.dateTimePicker1.Text.ToString() + "'";
                    }
                    else if (ilpqform.comboBoxIndirectLabour.SelectedValue.ToString() == "0")
                    {
                        sql = "delete i from cost_indirect_labour_price i left join cost_direct_labour j on i.indirect_labour_id = j.cid where YYYYMM = '" + ilpqform.dateTimePicker1.Text.ToString() + "' and j.dept_id = " + ilpqform.comboBoxDept.SelectedValue.ToString();
                    }
                    else
                    {
                        sql = "delete i from cost_indirect_labour_price i where YYYYMM = '" + ilpqform.dateTimePicker1.Text.ToString() + "' and i.indirect_labour_id = " + ilpqform.comboBoxIndirectLabour.SelectedValue.ToString();
                    }
                    isdone = conn.DeleteDatabase(sql);
                    if (isdone)
                    {
                        MessageBox.Show("删除成功!");
                    }
                }
            }
            conn.Close();
        }
        public static void Delete()
        {
            string sql;
            bool   isdone = true;
            ConnDB conn   = new ConnDB();

            if (wtqform == null || wtqform.IsDisposed)
            {
                MessageBox.Show("没有选中要删除的记录!");
            }
            else if (wtqform.gridView1.SelectedRowsCount == 0)
            {
                MessageBox.Show("没有选中要删除的记录!");
            }

            else
            {
                MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
                DialogResult      dr         = MessageBox.Show("确定要删除吗?", "上班类型删除", messButton);
                if (dr == DialogResult.OK)
                {
                    for (int i = 0; i < wtqform.gridView1.SelectedRowsCount; i++)
                    {
                        sql    = "delete from cost_work_type where cid   = '" + wtqform.gridView1.GetDataRow(wtqform.gridView1.GetSelectedRows()[i]).ItemArray[0].ToString() + "'";
                        isdone = conn.DeleteDatabase(sql);
                        if (!isdone)
                        {
                            break;
                        }
                    }

                    if (isdone)
                    {
                        MessageBox.Show("删除成功!");
                    }
                }
            }
            conn.Close();
        }
        public static void Delete()
        {
            string sql;
            bool   isdone = true;
            ConnDB conn   = new ConnDB();

            if (dqform == null || dqform.IsDisposed)
            {
                MessageBox.Show("没有选中要删除的用户!");
            }
            else if (dqform.gridView1.SelectedRowsCount == 0)
            {
                MessageBox.Show("没有选中要删除的用户!");
            }

            else
            {
                MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
                DialogResult      dr         = MessageBox.Show("确定要删除吗?", "用户删除", messButton);
                if (dr == DialogResult.OK)
                {
                    for (int i = 0; i < dqform.gridView1.SelectedRowsCount; i++)
                    {
                        sql    = "delete from cost_check_dept where log_name = '" + dqform.gridView1.GetDataRow(dqform.gridView1.GetSelectedRows()[i]).ItemArray[0].ToString() + "' and dept1 = '" + dqform.gridView1.GetDataRow(dqform.gridView1.GetSelectedRows()[i]).ItemArray[2].ToString() + "' and dept2= '" + dqform.gridView1.GetDataRow(dqform.gridView1.GetSelectedRows()[i]).ItemArray[3].ToString() + "' and dept3 = '" + dqform.gridView1.GetDataRow(dqform.gridView1.GetSelectedRows()[i]).ItemArray[4].ToString() + "'";
                        isdone = conn.DeleteDatabase(sql);
                        if (!isdone)
                        {
                            break;
                        }
                    }
                    if (isdone)
                    {
                        MessageBox.Show("删除成功!");
                    }
                }
            }
            conn.Close();
        }