Пример #1
0
        private void openFileDialog2_FileOk(object sender, CancelEventArgs e)
        {
            if (openFileDialog2.OpenFile().Length > 31460000)
            {
                MessageBox.Show("视频大小限制30M");
                return;
            }
            try
            {
                string name = db.DatebasePIVAsInfo().Split(';')[0].Split('=')[1];
                name = Dns.GetHostEntry(name).HostName;
                //MessageBox.Show(name);
                string source = openFileDialog2.FileName;
                string dest   = @"\\" + name + "\\Media\\" + DrugCode + ".mp4";
                if (File.Exists(dest))
                {
                    DialogResult dr = MessageBox.Show("文件" + dest + "已存在,是否覆盖?", "提示", MessageBoxButtons.OKCancel);
                    if (dr == DialogResult.OK)
                    {
                        File.Delete(dest);
                    }
                    else
                    {
                        return;
                    }
                }

                File.Copy(source, dest);// Dialog2.FileName, "\\ADMIN-PC\\zhangmuyun");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
 private void ShowMain(string str)
 {
     try
     {
         string WhereStr = string.Empty;
         if (str != string.Empty)
         {
             WhereStr = " WHERE Pro LIKE '%" + str.Trim() + "%'   ";
         }
         Sql = "SELECT ID,Pro,Value,Remark,[Caption],Value2,Value3 FROM [PivasAllSet] " + WhereStr + " order by OrdBy,Pro   ";
         // dt = db.GetPIVAsDB(Sql).Tables[0];
         myDataAdapter = new SqlDataAdapter(Sql, new SqlConnection(db.DatebasePIVAsInfo()));//where Pro!='PassWord'
         using (DataTable dt = new DataTable())
         {
             myDataAdapter.Fill(dt);
             dataGridView1.DataSource = dt;
             dataGridView1.Invalidate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "____" + Sql);
     }
 }
Пример #3
0
        /// <summary>
        /// 画面初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void PivasDWard_Load(object sender, EventArgs e)
        {
            Pic_Min.Parent     = this.panel3;
            Panel_Close.Parent = this.panel3;
            if (UserID == null || UserID == "")
            {
                UserID = "00000000000000000000000000000000000000";
            }
            if (GetPivasLimit.Instance.Limit(UserID, "PivasDWard"))
            {
                DataSet nm = new DataSet();
                label9.Text = "";
                DataSet dss = db.GetPIVAsDB("SELECT * FROM [DWard]");
                if (dss != null && dss.Tables.Count > 0 && dss.Tables[0].Rows.Count > 0)
                {
                    if (dss.Tables[0].Columns.Contains("Spellcode"))
                    {
                        SqlDataAdapter    adapter = new SqlDataAdapter("SELECT * FROM [DWard] where Spellcode is null or Spellcode =''", db.DatebasePIVAsInfo());
                        SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
                        DataSet           ds      = new DataSet();
                        adapter.Fill(ds);
                        if (ds != null && ds.Tables.Count > 0)
                        {
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                dr["Spellcode"] = GetChineseSpell(dr["WardName"].ToString());
                            }
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                DataTable dt = ds.Tables[0].GetChanges(DataRowState.Modified);
                                adapter.Update(dt);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("本数据库中没有病区简拼字段");
                    }
                }

                isalter = true;
                addcontrols();
                Load_panel4();
            }
            else
            {
                MessageBox.Show("您没有操作权限,请与管理员联系!");
                this.Dispose();
            }
        }
Пример #4
0
        /// <summary>
        /// 调用药品控量画面
        /// 根据医生或病区设置某药的用药限量,在打印界面进行判断是否达到要求,能否进行打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DrugLimitForPrint_Load(object sender, System.EventArgs e)
        {
            try
            {   //设置各控件的默认值://药品编码 //医生:限药时间间隔//病区:限药时间间隔//医生:确认生效//病区:确认生效//医生:数量//病区:数量//医生:天数//病区:天数
                label3.Text             = Drugcode;
                comboBox1.SelectedIndex = 0;
                comboBox2.SelectedIndex = 0;
                checkBox1.Checked       = false;
                checkBox2.Checked       = false;
                textBox1.Text           = "1000";
                textBox2.Text           = "10000";
                textBox3.Text           = "30";
                textBox4.Text           = "30";

                sda = new SqlDataAdapter(string.Format("SELECT * FROM DrugLimitForPrint where DrugCode='{0}'", Drugcode), db.DatebasePIVAsInfo()); //连接数据库、连接表、执行sql语句

                sda.Fill(ds);                                                                                                                      //执行sql语句得到的结果

                //表中是否读取到数据
                if (ds != null && ds.Tables.Count > 0)
                {
                    ds.Tables[0].PrimaryKey = new DataColumn[] { ds.Tables[0].Columns[0] };//第一张表的第一列设为主键

                    //第一张表的行没有值时,赋予默认值
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        DataRow dr = ds.Tables[0].NewRow();
                        dr["DrugCode"] = Drugcode;
                        ds.Tables[0].Rows.Add(dr);
                    }
                    else//将输入的值更新到表中
                    {
                        DataRow dr = ds.Tables[0].Rows[0];
                        int     a  = 0;

                        checkBox1.Checked = true.Equals(dr["LimitForDoctor"]);
                        int.TryParse(dr["IntervalDateForDoctor"].ToString(), out a);
                        comboBox1.SelectedIndex = a < 3 ? a : 3;//   如果符合a<3,返回值为a,否则返回值为3
                        textBox1.Text           = dr["LimitDgNoForDoctor"].ToString();
                        textBox3.Text           = dr["IntervalDateForDoctor"].ToString();

                        checkBox2.Checked = true.Equals(dr["LimitForWard"]);
                        int.TryParse(dr["IntervalDateForWard"].ToString(), out a);
                        comboBox2.SelectedIndex = a < 3 ? a : 3;
                        textBox2.Text           = dr["LimitDgNoForWard"].ToString();
                        textBox4.Text           = dr["IntervalDateForWard"].ToString();
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }