Beispiel #1
0
        private void butsave_Click(object sender, System.EventArgs e)
        {
            if (MessageBox.Show(this, "您 [确定] 要保存参数设置吗?", "确认", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            try
            {
                string str_old = "修改[" + cmbyjks.Text.Trim() + "]参数 ";
                InstanceForm.BDatabase.BeginTransaction();
                DataTable tb = (DataTable)this.myDataGrid1.DataSource;
                for (int i = 0; i <= tb.Rows.Count - 1; i++)
                {
                    int    _values = Convert.ToInt32(Convertor.IsNull(tb.Rows[i]["参数值"], "0"));
                    string _code   = Convertor.IsNull(tb.Rows[i]["参数编码"], "0");
                    string ssql    = "update yk_config set zt=" + _values + " where bh='" + _code + "' and deptid=" + Convertor.IsNull(cmbyjks.SelectedValue, "0") + "";
                    InstanceForm.BDatabase.DoCommand(ssql);

                    str_old = str_old + _code.ToString() + ":" + _values.ToString() + "|";
                }

                SystemLog systemLog = new SystemLog(-1, InstanceForm.BCurrentDept.DeptId, InstanceForm.BCurrentUser.EmployeeId, "修改药品参数", str_old, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase), 0, "主机名:" + System.Environment.MachineName, 8);
                systemLog.Save();
                systemLog = null;

                Yp.InsertLog("修改药品参数", TrasenFrame.Forms.FrmMdiMain.CurrentDept.DeptId, 0, TrasenFrame.Forms.FrmMdiMain.CurrentUser.EmployeeId, DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString(), str_old, InstanceForm.BDatabase);


                InstanceForm.BDatabase.CommitTransaction();

                MessageBox.Show("保存成功");
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                MessageBox.Show(err.Message);
            }
        }
Beispiel #2
0
        private void butsave_Click(object sender, System.EventArgs e)
        {
            if (MessageBox.Show(this, "您的确要更改以下药品的禁用状态吗?", "确认", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            if (this.rdolog.Checked == true)
            {
                return;
            }
            DataTable tb    = (DataTable)this.myDataGrid1.DataSource;
            string    ssql  = "";
            string    sdate = DateManager.ServerDateTimeByDBType(InstanceForm.BDatabase).ToString();



            try
            {
                //this.Cursor=XcjwHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();

                InstanceForm.BDatabase.BeginTransaction();


                this.butsave.Enabled = false;
                for (int i = 0; i <= tb.Rows.Count - 1; i++)
                {
                    if (tb.Rows[i]["药库禁用"].ToString().Trim() == "√")
                    {
                        ssql = "update yf_kcph set ykbdelete=1 where cjid=" + Convert.ToInt32(tb.Rows[i]["cjid"]) + " and deptid=" + Convert.ToInt32(tb.Rows[i]["deptid"]) + "";
                        InstanceForm.BDatabase.DoCommand(ssql);

                        ssql = "update yf_kcmx set bdelete=1 where  cjid=" + Convert.ToInt32(tb.Rows[i]["cjid"]) + " and deptid=" + Convert.ToInt32(tb.Rows[i]["deptid"]) + "";
                        InstanceForm.BDatabase.DoCommand(ssql);

                        Yp.InsertLog("禁用药品", Convert.ToInt32(tb.Rows[i]["deptid"]), Convert.ToInt32(tb.Rows[i]["cjid"]), InstanceForm.BCurrentUser.EmployeeId, sdate, "★药库人员禁用,当时库存为 " + tb.Rows[i]["库存量"].ToString() + tb.Rows[i]["单位"].ToString(), InstanceForm.BDatabase);
                    }
                    else
                    {
                        ssql = "update yf_kcph set  ykbdelete=0 where cjid=" + Convert.ToInt32(tb.Rows[i]["cjid"]) + " and deptid=" + Convert.ToInt32(tb.Rows[i]["deptid"]) + " and ykbdelete=1";
                        int ncount = InstanceForm.BDatabase.DoCommand(ssql);

                        if (ncount > 0)
                        {
                            ssql = "select * from yf_kcph where bdelete=0 and cjid=" + Convert.ToInt32(tb.Rows[i]["cjid"]) + " and deptid=" + Convert.ToInt32(tb.Rows[i]["deptid"]) + "";
                            DataTable tbph = InstanceForm.BDatabase.GetDataTable(ssql);
                            if (tbph.Rows.Count > 0)
                            {
                                ssql = "update yf_kcmx set bdelete=0 where  cjid=" + Convert.ToInt32(tb.Rows[i]["cjid"]) + " and deptid=" + Convert.ToInt32(tb.Rows[i]["deptid"]) + "";
                                InstanceForm.BDatabase.DoCommand(ssql);
                            }
                            Yp.InsertLog("禁用药品", Convert.ToInt32(tb.Rows[i]["deptid"]), Convert.ToInt32(tb.Rows[i]["cjid"]), InstanceForm.BCurrentUser.EmployeeId, sdate, "★药库人员解除禁用,当时库存为 " + tb.Rows[i]["库存量"].ToString() + tb.Rows[i]["单位"].ToString(), InstanceForm.BDatabase);
                        }
                    }
                }

                InstanceForm.BDatabase.CommitTransaction();
                this.butsave.Enabled = true;
                MessageBox.Show("保存成功");
            }
            catch (System.Exception err)
            {
                InstanceForm.BDatabase.RollbackTransaction();
                this.butsave.Enabled = true;
                MessageBox.Show(err.Message);
            }
        }