Пример #1
0
        /// <summary>
        /// 插入记录
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public string InsertRemark(ItemDamageCount.Class.Item item)
        {
            string result;
            string sql;

            try
            {
                sql  = "Insert into ItemDamage values";
                sql += "('" + item.Drugcode + "'";
                sql += ",'" + item.Drugname + "'";
                sql += ",'" + item.Spec + "'";
                sql += ",'" + item.Count + "'";
                sql += ",'" + item.Money + "'";
                sql += ",'" + item.Reason + "'";
                sql += ",'" + item.Responsibilityid + "'";
                sql += ",'" + item.Responsibilityer + "'";
                sql += ",'" + item.Reportid + "'";
                sql += ",'" + item.Reporter + "'";
                sql += ",'" + item.Damagetime + "'";
                sql += ",'" + item.Date + "')";

                result = DB.SetPIVAsDB(sql) != 0 ? "插入成功" : "插入失败";
            }
            catch (Exception ex)
            {
                result = "插入出错";
                throw ex;
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// 重审方法
        /// </summary>
        private void MethodReCheck()
        {
            try
            {
                if (PrescriptionID == "")
                {
                    MessageBox.Show("请选处方!");
                    return;
                }

                if (Mes.ShowDialog("提示", "重审会覆盖之前的结果,确定要重审吗?") == DialogResult.Cancel)
                {
                    return;
                }
                string str = "EXEC [bl_Remonitor] '" + PrescriptionID + "'";
                dbHelp.SetPIVAsDB(str);
                dbHelp.SetPIVAsDB("DELETE FROM BPRecord WHERE PrescriptionID =  '" + PrescriptionID + "' ");
                CheckPre.PREID = PrescriptionID;
                CheckPre cp = (CheckPre)this.Parent.Parent.Parent.Parent;
                cp.GetSelPrescriptions();
                if (cp.dgvResult.Rows.Count > 0)
                {
                    //不需要刷新病区
                }
                else
                {
                    cp.getWards();//刷新病区
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #3
0
        public bool Update(string syncode, int LogSave)
        {
            string LogName = string.Empty;
            int    i       = 0;

            if (LogSave == 1)
            {
                if (Label_Day.Text.Trim().Length == 0)
                {
                    Label_Day.Text = "10";
                }
                if (Pic_LogSave.Visible)
                {
                    LogSave = 1;
                    LogName = Label_LogName.Text;
                }
                else
                {
                    LogSave = 0;
                }
                i = db.SetPIVAsDB(update.Get_SynSet(syncode, LogName, LogSave, Convert.ToInt32(Label_Day.Text)));
            }
            else
            {
                i = db.SetPIVAsDB(update.Get_SynSet(syncode, LogSave));
            }
            //if (Label_LogName.Text != "")
            //{
            //    LogName = Label_LogName.Text;
            //}
            return(i > 0);
        }
Пример #4
0
        private void Dgv_Druglist_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (this.Dgv_Druglist.CurrentCell.ColumnIndex == 0)
            {
                //获取DataGridView中CheckBox的Cell
                DataGridViewCheckBoxCell dgvCheck = (DataGridViewCheckBoxCell)(this.Dgv_Druglist.Rows[this.Dgv_Druglist.CurrentCell.RowIndex].Cells[0]);
                DrugCode = DrugCode = Dgv_Druglist.Rows[Dgv_Druglist.CurrentRow.Index].Cells["药品编码"].Value.ToString();
                //根据单击时,Cell的值进行处理。EditedFormattedValue和Value均可以

                //若单击时,CheckBox没有被勾上
                if (Convert.ToBoolean(dgvCheck.EditedFormattedValue) == false)
                {
                    int i = db.SetPIVAsDB(update.DDurg(1, DrugCode));
                    //通过程序完成CheckBox是否勾上的控制
                    dgvCheck.Value = true;
                    //show();
                }
                //若单击时,CheckBox已经被勾上
                else
                {
                    int i = db.SetPIVAsDB(update.DDurg(0, DrugCode));
                    //通过程序完成CheckBox是否勾上的控制
                    dgvCheck.Value = false;
                    //this.Dgv_Druglist.Rows[this.Dgv_Druglist.CurrentCell.RowIndex].Cells[0]);
                    if (Cb_IsVaildCheck.Checked == true)
                    {
                        Dgv_Druglist.Rows.Remove(Dgv_Druglist.Rows[this.Dgv_Druglist.CurrentCell.RowIndex]);
                        //show();
                    }
                }
            }
        }
Пример #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            ds = DB.GetPIVAsDB(sql.SelectNewCode(this.groupBox1.Text));
            if (ds == null || ds.Tables[0].Rows.Count == 0 || ds.Tables[0].Rows[0][0].ToString() == "")
            {
                label1.Text = "DW" + this.listBox1.SelectedValue.ToString() + "000001";
            }
            else
            {
                int num = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
                num++;
                label1.Text = "DW" + this.listBox1.SelectedValue.ToString() + num.ToString().PadLeft(6, '0');
            }
            if (textBox2.Text != "")
            {
                DataSet ds1 = new DataSet();
                ds1 = DB.GetPIVAsDB(sql.SelDWName(textBox2.Text));
                if (ds1 != null && ds1.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("新病区名重复!");
                    textBox2.Clear();
                }
                else
                {
                    DB.SetPIVAsDB(sql.AddNewDward(listBox1.SelectedValue.ToString(), groupBox1.Text, label1.Text, textBox2.Text));
                }
            }
            ShowGroup1();
            textBox2.Clear();
        }
Пример #6
0
        //退药
        public void update(string Rid, DateTime Rtime)
        {
            string str = string.Empty;

            foreach (LabelNo i in panel1.Controls) //退今天
            {
                if (i.checkBox1.Checked == true)
                {
                    if (IsCheck == "0")
                    {
                        str = sqlstr.CancelDrug(i.checkBox1.Text, Rid, Rtime);
                    }
                    else
                    {
                        str = sqlstr.CancelInsert(i.checkBox1.Text, Rid, Rtime, 1);
                    }
                    db.SetPIVAsDB(str);
                }
            }
            foreach (LabelNo i in panel2.Controls)//退明天
            {
                if (i.checkBox1.Checked == true)
                {
                    if (IsCheck == "0")
                    {
                        str = sqlstr.CancelDrug(i.checkBox1.Text, Rid, Rtime);
                    }
                    else
                    {
                        str = sqlstr.CancelInsert(i.checkBox1.Text, Rid, Rtime, 1);
                    }
                    db.SetPIVAsDB(str);
                }
            }
        }
Пример #7
0
 private void txtLow_KeyPress(object sender, KeyPressEventArgs e)
 {
     try
     {
         if (e.KeyChar == 13)
         {
             if (Convert.ToDouble(txtLow.Text) < Convert.ToDouble(lblUp.Text))
             {
                 string str = "update OrderMCPRule2 set LowMetric = " + Convert.ToDouble(txtLow.Text) +
                              " where MPRule2ID = " + lblID.Text;
                 DB.SetPIVAsDB(str);
                 txtLow.Visible = false;
                 lblLow.Text    = txtLow.Text;
                 lblLow.Visible = true;
             }
             else
             {
                 MessageBox.Show("下限不可以大于上限!");
                 return;
             }
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #8
0
        public void GetYTJDrug()
        {
            try
            {
                //清除英特吉药品表(Drug_YTJ)全部数据
                string firstSql = " truncate table Drug_YTJ ";
                DB.SetPIVAsDB(firstSql);

                //插入查询的数据到英特吉药品表(Drug_YTJ)
                string         secondSQL = " select distinct drugcode from v_druginmachine ";
                DataTable      dt        = new DataTable();
                SqlDataAdapter da        = new SqlDataAdapter(secondSQL, sc);
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow r in dt.Rows)
                    {
                        string thirdSQL = " insert into Drug_YTJ values ('" + r["drugcode"].ToString().Trim() + "')";
                        DB.SetPIVAsDB(thirdSQL);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Пример #9
0
        private void panel1_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (Control c in this.Parent.Controls)
                {
                    if (c.Tag != null)
                    {
                        USynMin us = c as USynMin;
                        us.pictureBox2.Visible = false;
                        us.label1.ForeColor    = Color.Silver;
                        us.label2.ForeColor    = Color.Silver;
                    }
                }
                pictureBox2.Visible = true;
                label1.ForeColor    = Color.Black;
                label2.ForeColor    = Color.Black;
                db.SetPIVAsDB(string.Format("UPDATE [dbo].[SynSet] SET [SynTimeCode] = '{0}' WHERE [SynCode]='{1}'", Tag.ToString(), USynMinSet.SynCode).ToString());
                USynMinSet.SynTimeCode = Tag.ToString();
                switch (Tag.ToString())
                {
                case "1":
                {
                    label1.Text = "一次";
                    label2.Text = "每天定时执行一次同步";
                    label3.Text = "在" + (USynMinSet.begin.Contains(",") ? USynMinSet.begin.Split(',')[0] : USynMinSet.begin) + "点执行";
                    break;
                }

                case "2":
                {
                    label1.Text = "时段";
                    label2.Text = "每天的一个时间段内间隔执行同步";
                    label3.Text = "间隔" + USynMinSet.space + "分钟执行";
                    break;
                }

                case "3":
                {
                    label1.Text = "全天";
                    label2.Text = "全天间隔执行同步";
                    label3.Text = "间隔" + USynMinSet.space + "分钟执行";
                    break;
                }

                case "4":
                {
                    label1.Text         = "手动";
                    pictureBox1.Visible = false;
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #10
0
        public void updateCheckFormSet(bool isopen, string checkname)
        {
            DataSet       ds  = new DataSet();
            StringBuilder str = new StringBuilder();

            str.Append("update  PivasCheckFormSet set IsOpen='" + isopen + "'");
            str.Append(" where CheckName='" + checkname + "'");
            db.SetPIVAsDB(str.ToString());
        }
Пример #11
0
        private void save_Click(object sender, EventArgs e)//保存更新
        {
            string V, pasword;

            try
            {
                if (Pas.Text != "")
                {
                    //pasword = db.Encrypt(Pas.Text);
                    pasword = Pas.Text;
                }
                else
                {
                    pasword = "";
                }

                if (IsValid.Checked)
                {
                    V = "1";
                }
                else
                {
                    V = "0";
                }

                utype = comboBox1.SelectedIndex.ToString();
                updateE(Account.Text, pasword, Position.Text, EName.Text, ECode.Text, V, FormEmployee.ID, utype);


                string str = "Delete from ManageLimit where DEmployeeID = " + FormEmployee.ID;
                db.GetPIVAsDB(str);

                if (LimitShow)
                {
                    Limitstr = f.getLimitStr();
                    f.Dispose();
                }
                if (Limitstr != "")
                {
                    string[] l = Limitstr.Split(',');
                    for (int i = 0; i < l.Length; i++)
                    {
                        str = "insert into ManageLimit values(" + FormEmployee.ID + ",'" + l[i] + "')";
                        db.SetPIVAsDB(str);
                    }
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #12
0
 private void run(int Schedule)
 {
     if (Schedule < 500)
     {
         DB.SetPIVAsDB(string.Format("UPDATE [dbo].[SynLog] SET [Schedule] = '{0}' WHERE [SynCode]='{1}'and [RandomID] ='{2}'", Schedule + 2, SynCode, ds.Tables[0].Rows[0]["RandomID"].ToString()));
     }
     else
     {
         DB.SetPIVAsDB(string.Format("UPDATE [dbo].[SynLog] SET [EndTime] = GETDATE(),[Success] = 1 WHERE [SynCode]='{0}'and [RandomID] ='{1}'", SynCode, ds.Tables[0].Rows[0]["RandomID"].ToString()));
     }
 }
Пример #13
0
        private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count <= 0)
            {
                return;
            }
            string sql = "delete CPResultRGDict where ID=" + listView1.SelectedItems[0].Text;

            sql += " delete CPResultRGDictDetail where [DictID]=" + listView1.SelectedItems[0].Text;
            db.SetPIVAsDB(sql);
            ShowDict();
        }
Пример #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            if (treeView1.Nodes[0].ForeColor != Color.Silver)
            {
                sb.Append(string.Format("UPDATE [dbo].[BatchToOrder] SET [OrderBY] = '{0}' WHERE [Batch]='{1}'; ", treeView1.Nodes[0].Checked ? comboBox6.SelectedItem.ToString() : string.Empty, treeView1.Nodes[0].Text));
            }
            foreach (TreeNode tn in treeView1.Nodes[0].Nodes)
            {
                if (tn.ForeColor != Color.Silver)
                {
                    sb.Append(string.Format("UPDATE [dbo].[BatchToOrder] SET [OrderBY] = '{0}' WHERE [Batch]='{1}'; ", tn.Checked ? comboBox6.SelectedItem.ToString() : string.Empty, tn.Text));
                }
            }
            foreach (TreeNode tn in treeView1.Nodes[0].Nodes[0].Nodes)
            {
                if (tn.ForeColor != Color.Silver)
                {
                    sb.Append(string.Format("UPDATE [dbo].[BatchToOrder] SET [OrderBY] = '{0}' WHERE [Batch]='{1}'; ", tn.Checked ? comboBox6.SelectedItem.ToString() : string.Empty, tn.Text));
                }
            }
            foreach (TreeNode tn in treeView1.Nodes[0].Nodes[1].Nodes)
            {
                if (tn.ForeColor != Color.Silver)
                {
                    sb.Append(string.Format("UPDATE [dbo].[BatchToOrder] SET [OrderBY] = '{0}' WHERE [Batch]='{1}'; ", tn.Checked ? comboBox6.SelectedItem.ToString() : string.Empty, tn.Text));
                }
            }
            foreach (TreeNode tn in treeView1.Nodes[0].Nodes[2].Nodes)
            {
                if (tn.ForeColor != Color.Silver)
                {
                    sb.Append(string.Format("UPDATE [dbo].[BatchToOrder] SET [OrderBY] = '{0}' WHERE [Batch]='{1}'; ", tn.Checked ? comboBox6.SelectedItem.ToString() : string.Empty, tn.Text));
                }
            }
            if (!string.IsNullOrEmpty(sb.ToString()))
            {
                if (db.SetPIVAsDB(sb.ToString()) > 0)
                {
                    MessageBox.Show("保存成功");
                }
                else
                {
                    MessageBox.Show("保存失败");
                }
            }
            else
            {
                MessageBox.Show("无需保存");
            }
        }
Пример #15
0
        /// <summary>
        /// 更改仓位号,并记录
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (label6.Text != label4.Text)
            {
                StringBuilder str = new StringBuilder();
                str.Append("update IVRecord set DeskNo='");
                str.Append(label6.Text);
                str.Append("' where LabelNo='");
                str.Append(labelNo);
                str.Append("'");

                int a = db.SetPIVAsDB(str.ToString());
                if (a == 1)
                {
                    date = label6.Text;
                    StringBuilder str1 = new StringBuilder();
                    str1.Append(" insert into DeskNoUpdateLog([DEmployeeID],[InsertDT],[LabelNo],[oldDeskNo],[newDeskNo]) ");
                    str1.Append("values('");
                    str1.Append(UserId);
                    str1.Append("',GETDATE(),'");
                    str1.Append(labelNo);
                    str1.Append("','");
                    str1.Append(label4.Text);
                    str1.Append("','");
                    str1.Append(label6.Text);
                    str1.Append("')");
                    int b = db.SetPIVAsDB(str1.ToString());
                    if (b == 1)
                    {
                        this.DialogResult = DialogResult.OK;
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("插入记录表出错");
                        this.DialogResult = DialogResult.No;
                        this.Dispose();
                    }
                }
                else
                {
                    MessageBox.Show("修改仓位出错");
                    this.DialogResult = DialogResult.No;
                    this.Dispose();
                }
            }
            else
            {
                MessageBox.Show("未修改仓位");
            }
        }
Пример #16
0
 private void updateDB(DataSet ds)
 {
     try
     {
         foreach (DataRow r in ds.Tables[0].Rows)
         {
             string ustr = " insert into IVRecordToTY(LabelNo,TYDT) values('" + r["labelno"].ToString().Trim() + "', GETDATE()) ";
             DB.SetPIVAsDB(ustr);
         }
     }
     catch (Exception ex)
     {
     }
 }
Пример #17
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dtOrder1 = new DataTable();
                DataTable dtOrder2 = new DataTable();

                string s, str1, strcode;
                int    a;
                string str = "select OrderID from DOrder ORDER BY OrderID";
                dtOrder1 = DB.GetPIVAsDB(str).Tables[0];


                pBar.Maximum = DT.Rows.Count;
                pBar.Visible = true;
                for (int j = 0; j < DT.Rows.Count; j++)
                {
                    strcode  = DT.Rows[j]["WardCode"].ToString();
                    str1     = "select OrderID from OrderMCPRule2 where WardCode ='" + strcode + "' ORDER BY OrderID";
                    dtOrder2 = DB.GetPIVAsDB(str1).Tables[0];

                    for (int i = 0; i < dtOrder1.Rows.Count; i++)
                    {
                        a = Convert.ToInt32(dtOrder1.Rows[i]["OrderID"].ToString());
                        DataRow[] R = dtOrder2.Select("OrderID = " + dtOrder1.Rows[i]["OrderID"].ToString() + "");
                        if (R.Length == 0)
                        {
                            s = "insert into OrderMCPRule2 values('" + Convert.ToString(a) + "',500,1000,'" + Convert.ToString(a + 1) + "','" + strcode + "')";
                            DB.SetPIVAsDB(s);
                        }
                    }
                    for (int i = 0; i < dtOrder2.Rows.Count; i++)
                    {
                        DataRow[] R = dtOrder1.Select("OrderID = " + dtOrder2.Rows[i]["OrderID"].ToString() + "");
                        if (R.Length == 0)
                        {
                            s = "delete from OrderMCPRule2 where WardCode = '" + strcode + "' and OrderID = " + dtOrder2.Rows[i]["OrderID"].ToString();
                            DB.SetPIVAsDB(s);
                        }
                    }
                    pBar.Value = j;
                }
                ShowLimit(code);
                pBar.Visible = false;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #18
0
 /// <summary>
 /// 清空IVRecordToYTJ表定时,一个小时间隔
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void timerClearTable_Tick(object sender, EventArgs e)
 {
     try
     {
         //每天在夜里2点清IVRecordToYTJ表(只保留最近四天的数据)
         if (DateTime.Now.Hour == 2)
         {
             DB.SetPIVAsDB("delete from IVRecordToYTJ where DATEDIFF(DD,RQ,GETDATE()) > 3");
         }
     }
     catch (Exception ex)
     {
         DB.PreserveLog("eRROR", "清IVRecordToYTJ表出错" + ex.Message);
     }
 }
Пример #19
0
 private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (tabControl1.SelectedIndex == 0)
     {
         string sql = " delete from ConsumablesRule where RuleId=" + dgv.CurrentRow.Cells["RuleId"].Value.ToString();
         db.SetPIVAsDB(sql);
         GetPeiZhi1();
     }
     else
     {
         string sql = "delete from ConsumablesRule_Spec where RuleId=" + dgv2.CurrentRow.Cells["RuleId1"].Value.ToString();
         db.SetPIVAsDB(sql);
         GetSpecialPZ();
     }
 }
Пример #20
0
 private void dgv_DoubleClick(object sender, EventArgs e)
 {
     if (dgv != null)
     {
         DataSet ds = db.GetPIVAsDB(sql.IsFriend(DEmployId, dgv.CurrentRow.Cells["DEmployeeID"].Value.ToString()));
         if (ds == null || ds.Tables[0].Rows.Count == 0)
         {
             db.SetPIVAsDB(sql.AddFriend(DEmployId, dgv.CurrentRow.Cells["DEmployeeID"].Value.ToString(), 0));
             MessageBox.Show("添加成功!");
         }
         else if (ds.Tables[0].Rows.Count > 0)
         {
             MessageBox.Show("已经是你的好友!!", "提示", MessageBoxButtons.OK);
         }
     }
 }
Пример #21
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         string        dat = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
         string        PW  = PermitHelper.EncrypOrDecryp(dat, dat, true);
         StringBuilder sb  = new StringBuilder(4096);
         #region 其他加密,暂时没用
         //sb.Append("IF OBJECT_ID('PivasDesPassWord') IS NULL ");
         //sb.Append(" begin ");
         //sb.Append(" Create table [PivasDesPassWord](ID INT identity(1,1) PRIMARY key,MacSSID VARCHAR(250),PivasWord text,Dat datetime) ");
         //sb.Append(" end ");
         //sb.Append(" else ");
         //sb.Append(" begin ");
         //sb.Append(string.Format(" UPDATE [PivasDesPassWord] SET [MacSSID] = '{0}' WHERE ID=(SELECT MAX(ID) FROM [PivasDesPassWord]) ", HDssid));
         //sb.Append(" end ");
         #endregion
         sb.Append("IF OBJECT_ID('PivasDesSoftTAB') IS NULL ");
         sb.Append(" begin ");
         sb.Append(" Create table [PivasDesSoftTAB](ID INT identity(1,1) PRIMARY key,SoftPW VARCHAR(512),Dat datetime) ");
         sb.Append(string.Format(" insert into [PivasDesSoftTAB] values('{0}','{1}') ", PW, dat));
         sb.Append(" end ");
         sb.Append(" else ");
         sb.Append(" begin ");
         sb.Append(" truncate table [PivasDesSoftTAB] ");
         sb.Append(string.Format(" insert into [PivasDesSoftTAB] values('{0}','{1}') ", PW, dat));
         sb.Append(" end ");
         dbHelp.SetPIVAsDB(sb.ToString());
     }
     catch (Exception ex)
     {
         ShowMsgHelper.ShowError("设置同步程序最新出错" + ex.Message);
     }
 }
Пример #22
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (dgv.Rows.Count > 0)
     {
         string sql = "insert into OrderWcodeDrugK(WardCode,DrugCode) values('" + wardCode + "','" + dgv.CurrentRow.Cells["DrugCode"].Value.ToString() + "')";
         int    a   = DB.SetPIVAsDB(sql);
         if (a <= 0)
         {
             MessageBox.Show("添加药品失败!");
         }
         else
         {
             this.DialogResult = DialogResult.Yes;
         }
     }
 }
Пример #23
0
        private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string sql = string.Format(" delete from Consumables where ConsumablesCode='{0}'", dgv.CurrentRow.Cells["ConsumablesCode"].Value.ToString());

            db.SetPIVAsDB(sql);
            getConsumable();
        }
Пример #24
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text.Trim()))
            {
                MessageBox.Show("耗材编号不能为空");
                return;
            }
            if (string.IsNullOrEmpty(textBox2.Text.Trim()))
            {
                MessageBox.Show("耗材名称不能为空");
                return;
            }
            if (string.IsNullOrEmpty(textBox4.Text.Trim()))
            {
                MessageBox.Show("耗材单位不能为空");
                return;
            }
            string sql = string.Format("if not exists(select 1 from Consumables where ConsumablesCode='{0}' ) "
                                       + "insert into Consumables([ConsumablesCode],[ConsumablesName],[Spec],[ItemUnit])values('{0}','{1}','{2}','{3}')"
                                       , textBox1.Text.Trim(), textBox2.Text.Trim(), textBox3.Text.Trim(), textBox4.Text.Trim());
            int a = db.SetPIVAsDB(sql);

            if (a == 1)
            {
                MessageBox.Show("添加成功!");
            }
            else
            {
                MessageBox.Show("添加失败!提示:可能是数据库该数据已存在或数据格式不对");
            }
            this.DialogResult = DialogResult.OK;
        }
Пример #25
0
        private void NurseFormSet()
        {
            string    SqlSet = "Select * from PivasNurseFormSet where WardCode='" + txt_word.Tag + "'";
            DataTable dt     = new DataTable();

            dt = db.GetPIVAsDB(SqlSet).Tables[0];
            if (dt.Rows.Count == 0)
            {
                string  sql = "Select * from PivasNurseFormSet where DateFrom='1'";
                DataSet ds  = db.GetPIVAsDB(sql);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    StringBuilder str = new StringBuilder();
                    str.Append("insert into PivasNurseFormSet([DateFrom],[WardCode] ,[LabelOverFor],[PackOverFor],[LabelPack] ,[LabelPackAir]) ");
                    str.Append("values('0','");
                    str.Append(txt_word.Tag);
                    str.Append("','" + ds.Tables[0].Rows[0]["LabelOverFor"].ToString());
                    str.Append("','" + ds.Tables[0].Rows[0]["PackOverFor"].ToString());
                    str.Append("','" + ds.Tables[0].Rows[0]["LabelPack"].ToString());
                    str.Append("','" + ds.Tables[0].Rows[0]["LabelPackAir"].ToString());
                    str.Append("') ");

                    db.SetPIVAsDB(str.ToString());
                }
                else
                {
                    MessageBox.Show("病区操作条件未设置,请重新登录进行设置");
                    return;
                }
            }
        }
Пример #26
0
        private void GetCtl()
        {
            foreach (Control msg in panel1.Controls)
            {
                if (msg is CancelMessage)
                {
                    if (((CancelMessage)msg).checkBox1.Checked)
                    {
                        string        l   = ((CancelMessage)msg).lb_name.Text.Substring(0, ((CancelMessage)msg).lb_name.Text.LastIndexOf(":"));
                        StringBuilder str = new StringBuilder();
                        str.Append("  select case LEN(statuscode) when 1 then '0'+convert(varchar,statuscode) else convert(varchar,statuscode) end as statuscode");
                        str.Append(",case LEN(TypeCode) when 1 then '0'+convert(varchar,TypeCode) else convert(varchar,TypeCode) end as Typecode ");
                        str.Append("from ErrorRule where statusname ='" + l + "'and typename='" + ((CancelMessage)msg).comboBox1.Text + "'");
                        DataTable dt   = DB.GetPIVAsDB(str.ToString()).Tables[0];
                        string    str1 = "  select isnull(MAX(substring (ErrorCode,14,6)),'000000') from ErrorRecord where DATEDIFF(DD,findtime,'" + DateTime.Now.Date.ToString() + "')=0";
                        DataSet   ds   = DB.GetPIVAsDB(str1);
                        string    s    = ds.Tables[0].Rows[0][0].ToString();
                        int       num  = Convert.ToInt32(s);
                        num++;
                        s = 'E' + DateTime.Now.Date.ToString("yyyyMMdd") + dt.Rows[0][0].ToString() + dt.Rows[0][1].ToString() + num.ToString().PadLeft(6, '0');

                        string stradd = "insert into ErrorRecord values ('" + s + "','" + textBox1.Text + "','" + ((CancelMessage)msg).textBox1.Text + "','" + dt.Rows[0][0].ToString() + "','" + comboFind.SelectedValue + "','" + ((CancelMessage)msg).label2.Text + "','" + UserID + "','" + ((CancelMessage)msg).lb_time.Text + "','" + DateTime.Now.ToString() + "','" + ((CancelMessage)msg).comboBox1.SelectedValue + "')";
                        DB.SetPIVAsDB(stradd);
                    }
                }
            }
            MessageBox.Show("成功保存" + c + "个记录!");
        }
Пример #27
0
 private void button2_Click(object sender, EventArgs e)
 {
     // string labels = "(";
     // string sql = "select LabelNo from IVRecord where DeskNo is null";
     //DataSet ds = db.GetPIVAsDB(sql);
     //if (ds != null && ds.Tables[0].Rows.Count > 0)
     //{
     //    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
     //    {
     //        labels += "'" + ds.Tables[0].Rows[i]["LabelNo"].ToString()+"',";
     //    }
     //}
     //labels = labels.TrimEnd(',');
     //labels += ")";
     db.SetPIVAsDB("exec bl_AutoIVDeskNo '','" + UserID + "'");
 }
Пример #28
0
        /// <summary>
        /// 保存每个用户欢迎页面的信息到数据库表PivasMateFormSet
        /// </summary>
        /// <param name="StartForm">功能模块编号</param>
        protected void SubForm(int StartForm)
        {
            //chbox_check选中时,不显示欢迎页面,
            int noShowWelcome = chbox_check.Checked ? 1 : 0;

            db.SetPIVAsDB("EXEC bl_synformset " + DEmployeeID + "," + noShowWelcome + "," + StartForm + "");
        }
Пример #29
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != null && textBox1.Text != "")
     {
         StringBuilder str = new StringBuilder();
         str.Append("if not exists(select *from IVRecordDeskSet where DeskNo='");
         str.Append(textBox1.Text);
         str.Append("')  ");
         str.Append("insert into IVRecordDeskSet ([DeskNo],[IsPTY],[IsKSS],[IsHLY],[IsYYY],[IsOpen]) values('");
         str.Append(textBox1.Text);
         str.Append("',1,1,1,1,1)");
         int a = db.SetPIVAsDB(str.ToString());
         if (a == 1)
         {
             MessageBox.Show("插入成功");
         }
         else
         {
             MessageBox.Show("更新失败");
         }
         this.Close();
     }
     else
     {
         this.Close();
     }
 }
Пример #30
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (checkBox1.CheckState == CheckState.Unchecked)
     {
         MessageBox.Show("未选择任何表");
     }
     else
     {
         if (treeView1.Nodes["Prescription"].Checked)
         {
             if (MessageBox.Show("选中处方表将默认删除处方明细,瓶签,瓶签明细表", "确认删除", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 treeView1.Nodes["PrescriptionDetail"].Checked = true;
                 treeView1.Nodes["IVRecord"].Checked           = true;
                 treeView1.Nodes["IVRecordDetail"].Checked     = true;
             }
             else
             {
                 treeView1.Nodes["Prescription"].Checked = false;
             }
         }
         if (!treeView1.Nodes["PrescriptionDetail"].Checked || !treeView1.Nodes["IVRecord"].Checked || !treeView1.Nodes["IVRecordDetail"].Checked)
         {
             treeView1.Nodes["Prescription"].Checked = false;
         }
         if (MessageBox.Show("确认删除选中表的信息?", "确认删除", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             foreach (TreeNode tn in treeView1.Nodes)
             {
                 if (tn.Checked)
                 {
                     if (treeView1.Nodes.ContainsKey(tn.Text + "Detail"))
                     {
                         db.SetPIVAsDB(string.Format("delete from {0}", tn.Text + "Detail"));
                     }
                     if (Equals(tn.Text, "Prescription"))
                     {
                         db.SetPIVAsDB(string.Format("delete from IVRecordDetail"));
                         db.SetPIVAsDB(string.Format("delete from IVRecord"));
                     }
                     db.SetPIVAsDB(string.Format("delete from {0}", tn.Text));
                 }
             }
             MessageBox.Show("删除成功");
         }
     }
 }