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

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

            else
            {
                MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
                DialogResult      dr         = MessageBox.Show("确定要反禁用吗?", "营业类型反禁用", messButton);
                if (dr == DialogResult.OK)
                {
                    for (int i = 0; i < stqform.gridView1.SelectedRowsCount; i++)
                    {
                        sql    = "update i set i.forbidden = 'false' from cost_saletype i where cname = '" + stqform.gridView1.GetDataRow(stqform.gridView1.GetSelectedRows()[i]).ItemArray[0].ToString() + "'";
                        isdone = conn.EditDatabase(sql);
                        if (!isdone)
                        {
                            break;
                        }
                    }
                    if (isdone)
                    {
                        SaleType.ForbiddenEnable();
                        SaleType.UnforbiddenDisable();
                        MessageBox.Show("反禁用成功!");
                    }
                }
            }
            conn.Close();
        }
Beispiel #2
0
        private void IsForbidden()
        {
            if (stqform == null || stqform.IsDisposed)
            {
            }
            else if (stqform.gridView1.SelectedRowsCount == 0)
            {
            }

            else
            {
                if (stqform.gridView1.GetDataRow(stqform.gridView1.GetSelectedRows()[0]).ItemArray[1].ToString() == "True")
                {
                    SaleType.ForbiddenDisable();
                    SaleType.UnforbiddenEnable();
                }
                else
                {
                    SaleType.ForbiddenEnable();
                    SaleType.UnforbiddenDisable();
                }
            }
        }