Пример #1
0
        /// <summary>
        /// 根据函数名称实例化窗体
        /// </summary>
        public void InstanceWorkForm()
        {
            if (_functionName == "")
            {
                throw new Exception("引出函数名不能为空!");
            }
            FrmTxYy frm = null;

            string sSql        = "";
            int    nType       = 0;
            Guid   inpatientID = Guid.Empty;

            if (_communicateValue != null)
            {
                sSql  = _communicateValue[0].ToString();
                nType = Convert.ToInt32(_communicateValue[1]);
            }
            switch (_functionName)
            {
            case "Fun_ts_mz_txyy":
                frm = new FrmTxYy();
                if (_mdiParent != null)
                {
                    frm.MdiParent = _mdiParent;
                }
                frm.Show();
                break;

            case "Fun_ts_mz_ChangeGhInfo":
                //FrmChangeGhInfo frmChange = new FrmChangeGhInfo();
                //if (_mdiParent != null)
                //{
                //    frmChange.MdiParent = _mdiParent;
                //}
                //frmChange.Show();
                try
                {
                    string path = @"D:\bsoft\portal\360\360chrome.exe";
                    string url  = @"http://192.168.0.59:7005/RegisterRoomToChangeNumber.aspx";

                    System.Diagnostics.Process[] myProcesses;
                    myProcesses = System.Diagnostics.Process.GetProcessesByName("360chrome");
                    foreach (System.Diagnostics.Process instance in myProcesses)
                    {
                        //instance.CloseMainWindow();
                        instance.Kill();
                    }

                    System.Diagnostics.Process pro = System.Diagnostics.Process.Start(path, url);
                }
                catch
                {
                }
                break;



            case "Fun_ts_mz_ksdz":
                Frm_mz_ksdzwh frmKsdz = new Frm_mz_ksdzwh();
                if (_mdiParent != null)
                {
                    frmKsdz.MdiParent = _mdiParent;
                }
                frmKsdz.WindowState = FormWindowState.Maximized;
                frmKsdz.Show();
                break;

            case "Fun_ts_jc_PersonTel":

                FrmUrgentOrdMsg frmPerTel = new FrmUrgentOrdMsg();
                if (_mdiParent != null)
                {
                    frmPerTel.MdiParent = _mdiParent;
                }
                frmPerTel.Show();
                frmPerTel.WindowState = FormWindowState.Maximized;
                break;

            case "Fun_ts_jc_fzyyzd_ys":

                Frm_yp_fzyywh frmFzYyZd_ys = new Frm_yp_fzyywh("");
                if (_mdiParent != null)
                {
                    frmFzYyZd_ys.MdiParent = _mdiParent;
                }
                frmFzYyZd_ys.Show();
                frmFzYyZd_ys.WindowState = FormWindowState.Maximized;
                break;

            case "Fun_ts_jc_fzyyzd":

                Frm_yp_fzyywh frmFzYyZd = new Frm_yp_fzyywh();
                if (_mdiParent != null)
                {
                    frmFzYyZd.MdiParent = _mdiParent;
                }
                frmFzYyZd.Show();
                frmFzYyZd.WindowState = FormWindowState.Maximized;
                break;

            case "Fun_ts_jc_ksssh":

                Frmksssh _Frmksssh = new Frmksssh();
                if (_mdiParent != null)
                {
                    _Frmksssh.MdiParent = _mdiParent;
                }
                _Frmksssh.Show();
                _Frmksssh.WindowState = FormWindowState.Maximized;
                break;

            case "Fun_ts_jc_ksssh_ys":

                Frmksssh _Frmksssh_ys = new Frmksssh("");
                if (_mdiParent != null)
                {
                    _Frmksssh_ys.MdiParent = _mdiParent;
                }
                _Frmksssh_ys.Show();
                _Frmksssh_ys.WindowState = FormWindowState.Maximized;
                break;

            case "Fun_ts_jc_yygzl":

                yygzltj yygzltj = new yygzltj();
                if (_mdiParent != null)
                {
                    yygzltj.MdiParent = _mdiParent;
                }
                yygzltj.Show();
                yygzltj.WindowState = FormWindowState.Maximized;
                break;

            case "Fun_ts_jc_subks":

                subks subks = new subks();
                if (_mdiParent != null)
                {
                    subks.MdiParent = _mdiParent;
                }
                subks.Show();
                subks.WindowState = FormWindowState.Maximized;
                break;

            case "Fun_ts_jc_syfytj":

                Frmmz_syffjl Frmmz_syffjl = new Frmmz_syffjl();
                if (_mdiParent != null)
                {
                    Frmmz_syffjl.MdiParent = _mdiParent;
                }
                Frmmz_syffjl.Show();
                Frmmz_syffjl.WindowState = FormWindowState.Maximized;
                break;

            case "Fun_ts_jc_OutPatientBackNum":

                OutPatientBackNum OutPatientBackNum = new OutPatientBackNum();
                if (_mdiParent != null)
                {
                    OutPatientBackNum.MdiParent = _mdiParent;
                }
                OutPatientBackNum.Show();
                OutPatientBackNum.WindowState = FormWindowState.Maximized;
                break;

            case "Fun_ts_jc_GrantCard":

                GrantCard GrantCard = new GrantCard();
                if (_mdiParent != null)
                {
                    GrantCard.MdiParent = _mdiParent;
                }
                GrantCard.Show();
                GrantCard.WindowState = FormWindowState.Maximized;
                break;

            default:
                throw new Exception("引出函数名称错误!");
            }
        }
Пример #2
0
        private void btnAddSearch_Click(object sender, EventArgs e)
        {
            DataTable dtGrid = dataGridView1.DataSource as DataTable;
            string    ypid   = label2.Text;


            if (dtGrid == null || dtGrid.Rows.Count <= 0)
            {
                return;
            }

            if (MessageBox.Show("是否新增?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
            {
                return;
            }


            if (!checkItemChecking())
            {
                MessageBox.Show("请勾选要新增的诊断信息");
                return;
            }

            try
            {
                FrmMdiMain.Database.BeginTransaction();
                for (int i = 0; i < dataGridView1.RowCount; i++)
                {
                    string chk_value = dataGridView1.Rows[i].Cells[0].EditedFormattedValue.ToString();
                    if (chk_value == "True")
                    {
                        #region
                        string strSql = string.Empty;
                        string coding = dataGridView1.Rows[i].Cells["CODING"].Value.ToString().Trim();
                        string guid   = Guid.NewGuid().ToString();



                        int iReturn = 0;
                        Convertor.IsNull(dataGridView1.Rows[i].Cells["CODING"].Value, "").ToString().Trim();
                        Convertor.IsNull(dataGridView1.Rows[i].Cells["YBJKLX"].Value, "").ToString().Trim();


                        #endregion

                        strSql = string.Format(@"select count(1) as NUM from  [jc_yp_fzyywh]  where ypid ='{0}' and CODING='{1}'", ypid, coding);
                        DataTable dt = FrmMdiMain.Database.GetDataTable(strSql);
                        if (dt == null || dt.Rows.Count <= 0)
                        {
                            throw new Exception("获取药品对应诊断出错");
                        }

                        if (int.Parse(dt.Rows[0]["NUM"].ToString()) > 0)
                        {
                            _isAdd = false;
                        }
                        else
                        {
                            _isAdd = true;
                        }

                        if (_isAdd == true)//新增
                        {
                            int      deletebit = 0;
                            int      opr_man   = FrmMdiMain.CurrentUser.EmployeeId;
                            DateTime opr_date  = DateManager.ServerDateTimeByDBType(FrmMdiMain.Database);
                            strSql = string.Format(@"insert into [jc_yp_fzyywh](coding,ypid,deletebit,opr_man,opr_date,guidbs) VALUES('{0}','{1}','{2}','{3}','{4}','{5}')",
                                                   coding, ypid, deletebit, opr_man, opr_date, guid);

                            iReturn = FrmMdiMain.Database.DoCommand(strSql);

                            if (iReturn != 1)
                            {
                                throw new Exception("新增失败");
                            }
                        }
                        else
                        {
                            int      mod_man   = FrmMdiMain.CurrentUser.EmployeeId;
                            DateTime mod_date  = DateManager.ServerDateTimeByDBType(FrmMdiMain.Database);
                            int      deletebit = 0;
                            strSql = string.Format(@"update [jc_yp_fzyywh] set [deletebit]='{2}',[mod_man]='{3}',[mod_date]='{4}' where ypid ='{0}' and CODING='{1}' ",
                                                   ypid, coding, deletebit, mod_man, mod_date);

                            iReturn = FrmMdiMain.Database.DoCommand(strSql);

                            if (iReturn != 1)
                            {
                                throw new Exception("新增失败");
                            }
                        }
                    }
                }
                FrmMdiMain.Database.CommitTransaction();
                MessageBox.Show("添加成功 ");
            }
            catch (Exception ex)
            {
                FrmMdiMain.Database.RollbackTransaction();
                MessageBox.Show(ex.Message);
            }
            this.Close();
            Frm_yp_fzyywh frm = new Frm_yp_fzyywh();
            frm.dv2binddata();
        }