예제 #1
0
        public static void cEnable()
        {
            string sql;
            bool   isdone = true;
            ConnDB conn   = new ConnDB();

            if (dlqform == null || dlqform.IsDisposed)
            {
                MessageBox.Show("没有选中要反禁用的记录!");
            }
            else if (dlqform.gridView1.SelectedRowsCount == 0)
            {
                MessageBox.Show("没有选中要反禁用的记录!");
            }

            else
            {
                MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
                DialogResult      dr         = MessageBox.Show("确定要反禁用吗?", "直接人工反禁用", messButton);
                if (dr == DialogResult.OK)
                {
                    for (int i = 0; i < dlqform.gridView1.SelectedRowsCount; i++)
                    {
                        sql    = "update i set i.forbidden = 'false' from COST_DIRECT_LABOUR i where cid = '" + dlqform.gridView1.GetDataRow(dlqform.gridView1.GetSelectedRows()[i]).ItemArray[5].ToString() + "'";
                        isdone = conn.EditDatabase(sql);
                        if (!isdone)
                        {
                            break;
                        }
                    }
                    if (isdone)
                    {
                        DirectLabour.ForbiddenEnable();
                        DirectLabour.UnforbiddenDisable();
                        MessageBox.Show("反禁用成功!");
                    }
                }
            }
            conn.Close();
        }
예제 #2
0
        private void IsForbidden()
        {
            if (dlqform == null || dlqform.IsDisposed)
            {
            }
            else if (dlqform.gridView1.SelectedRowsCount == 0)
            {
            }

            else
            {
                if (dlqform.gridView1.GetDataRow(dlqform.gridView1.GetSelectedRows()[0]).ItemArray[9].ToString() == "True")
                {
                    DirectLabour.ForbiddenDisable();
                    DirectLabour.UnforbiddenEnable();
                }
                else
                {
                    DirectLabour.ForbiddenEnable();
                    DirectLabour.UnforbiddenDisable();
                }
            }
        }