private void switchPage(PageType pageType) { try { Dictionary <Label, string> dicOnePage = null; Label showPageLabel = null; string imgName = string.Empty; dicAllPage.TryGetValue(pageType, out dicOnePage); foreach (var item in dicOnePage) { showPageLabel = item.Key; imgName = item.Value; break;//只有一个 } Hover_Leave(showPageLabel, imgName, PageLabelEffect.MouseDown); #region 一定要在画面效果显示后才能保存选中的画面信息(先清理) dicCurrentPage.Clear(); dicCurrentPage.Add(showPageLabel, imgName); #endregion //"d"十进制整数 Control_welcome.SetForm(int.Parse(Enum.Format(pageType.GetType(), pageType, "d"))); showOnePage(pageType); } catch (Exception ex) { ShowMsgHelper.ShowError("画面切换出错:" + ex.Message); } }
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); } }
/// <summary> /// 页面载入 /// </summary> public void load() { try { int all = 0; dsWard = db.GetPIVAsDB(Mysql.GetWard()); if (dsWard.Tables != null && dsWard.Tables.Count > 0) { for (int i = 0; i < dsWard.Tables[0].Rows.Count; i++) { all = all + int.Parse(dsWard.Tables[0].Rows[i]["Count"].ToString()); } DataRow dr = dsWard.Tables[0].NewRow(); dr["check"] = "False"; dr["WardName"] = "<全部>"; dr["WardCode"] = "<全部>"; dr["Count"] = all; dsWard.Tables[0].Rows.InsertAt(dr, 0); dgvWard.DataSource = dsWard.Tables[0]; dgvWard.Rows[0].Selected = true; } } catch (Exception ex) { ShowMsgHelper.ShowError("ChagneData.load" + ex.Message); } }
/// <summary> /// 二次登陆系统判断上一次停留程序路径 /// </summary> /// <param name="DEmpID">登陆账号ID</param> protected void FormPath(string DEmpID) { try { Control_welcome we = new Control_welcome(); Control_welcome.DEmployeeID = Convert.ToInt32(DEmployeeID); Control_welcome.Logname = EmpName; DataSet ds = dbHelp.GetPIVAsDB("select * from PivasMateFormSet where DEmployeeID='" + DEmpID + "'"); bool noShowWelcome = true; //默认显示 PageType pageNo = PageType.Check; //默认是页面 if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { noShowWelcome = bool.Parse(ds.Tables[0].Rows[0]["Welcome"].ToString()); int iStartForm = Convert.ToInt32(ds.Tables[0].Rows[0]["StartForm"].ToString().Trim()); if (iStartForm > 0 && iStartForm < 8)//在PageType枚举范围内 { pageNo = (PageType)iStartForm; } } if (!noShowWelcome)//若显示,则添加 { panelContent.Controls.Add(we); we.Size = panelContent.Size; } switchPage(pageNo); } catch (Exception ex) { ShowMsgHelper.ShowError("登录后设置欢迎页面和上次页面出错:" + ex.Message); } }
private void PIVASMate_Load(object sender, EventArgs e) { try { this.ControlBox = false; this.Text = this.Text + " (" + EmpName + ")"; this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); this.WindowState = FormWindowState.Maximized; NowDate.Text = "PIVAS MATE 3.0 " + DateTime.Now.ToString(); FormPath(DEmployeeID); labelLoginer.Text = EmpName + "(" + EmpCode + ")"; //*****************张建双2014-07-16**********************// try { IniRemTime = Convert.ToInt32(dbHelp.IniReadValuePivas("Remind", "RemindTime")) * 60; keeptime = Convert.ToInt32(dbHelp.IniReadValuePivas("Remind", "KeepTime")); remindtime = IniRemTime; } catch { IniRemTime = 180; remindtime = IniRemTime; keeptime = 5; dbHelp.IniWriteValuePivas("Remind", "RemindTime", "3"); dbHelp.IniWriteValuePivas("Remind", "KeepTime", "5"); } //判断气泡消息框是否可用 if (dbHelp.GetPivasAllSet("主画面_气泡消息框") == "0") { QiPao = true;//执行不可用 } else { QiPao = false; } //判断气泡消息框是否可用 if (dbHelp.GetPivasAllSetValue2("主画面_气泡消息框") == "0") { QiPaoShuangJi = true;//执行不可用 } else { QiPaoShuangJi = false; } ShanShuo(); } catch (Exception ex) { ShowMsgHelper.ShowError("主窗体加载出错:" + ex.Message); } }
private void Refresh_Click(object sender, RoutedEventArgs e) { try { if (null != this.patient) { this.clearOrders(); loadOrders(this.patient.WardCode, this.patient.PatientCode); } } catch (Exception ex) { ShowMsgHelper.ShowError("点击 仅显示在用医嘱 复选框出错:" + ex.Message); } }
private void Form1_Load(object sender, EventArgs e) { try { label11.ForeColor = Color.Blue; label10.ForeColor = Color.Red; panel3.Controls.Clear(); ChangeDate ch = new ChangeDate(); panel3.Controls.Add(ch); label2.Text = "9999"; } catch (Exception ex) { ShowMsgHelper.ShowError("摆药核对主界面加载失败:" + ex.Message); } }
/// <summary> /// 权限 /// </summary> /// <param name="DEmployeeID">用户名</param> /// <param name="LimitName">权限名</param> /// <returns></returns> public bool Limit(string DEmployeeID, string LimitName) { try { bool lt = false;//当前画面是否在该医院可用Check string str = "select * from ManageLimit where DEMployeeID = '" + DEmployeeID + "' and LimitName = '" + LimitName + "' "; str = str + " select DEmployeeName from DEmployee where DEmployeeID = '" + DEmployeeID + "' "; DataSet ds = dbHelp.GetPIVAsDB(str); if (NotInFormLimit(LimitName.Trim()))//检测是否需要 { lt = true; } else if (SynToolIsLatest()) //如果是最新的则进一步判断是否有权限 { lt = GetLimt(LimitName); } if (!lt) { MessageBox.Show("您没有此操作权限,请于系统管理员联系!!!"); ds.Dispose(); return(false); } else if ((ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0 && ds.Tables[1].Rows[0]["DEmployeeName"].ToString().Trim() == "LaennecSystem") || (ds != null && ds.Tables[0].Rows.Count > 0)) { ds.Dispose(); return(true); } else { MessageBox.Show("您没有此操作权限,请于系统管理员联系!!!"); ds.Dispose(); return(false); } } catch (Exception ex) { ShowMsgHelper.ShowError("判断用户权限时出错:" + ex.Message); } return(false); }
/// <summary> /// 初始化画面使用图片名 /// </summary> private void InitLabelText() { try { dicAllPage.Clear(); Dictionary <Label, string> dicSyn = new Dictionary <Label, string>(); dicSyn.Add(Label_Syn, "同步"); dicAllPage.Add(PageType.SynNo, dicSyn); Dictionary <Label, string> dicReview = new Dictionary <Label, string>(); dicReview.Add(Label_Checking, "审方"); dicAllPage.Add(PageType.Review, dicReview); Dictionary <Label, string> dicBatch = new Dictionary <Label, string>(); dicBatch.Add(Label_Batch, "批次"); dicAllPage.Add(PageType.Batch, dicBatch); Dictionary <Label, string> dicCheck = new Dictionary <Label, string>(); dicCheck.Add(Label_Check, "核对"); dicAllPage.Add(PageType.Check, dicCheck); Dictionary <Label, string> dicPrint = new Dictionary <Label, string>(); dicPrint.Add(Label_print, "打印"); dicAllPage.Add(PageType.Print, dicPrint); Dictionary <Label, string> dicTool = new Dictionary <Label, string>(); dicTool.Add(Label_Tool, "工具"); dicAllPage.Add(PageType.Tool, dicTool); Dictionary <Label, string> dicTpnReview = new Dictionary <Label, string>(); dicTpnReview.Add(Label_TPNReview, "TPN审方"); dicAllPage.Add(PageType.TpnReview, dicTpnReview); } catch (Exception ex) { ShowMsgHelper.ShowError("初始化画面使用图片名出错:" + ex.Message); } }
/// <summary> /// 在主窗体加载时,不等待。 /// </summary> /// <param name="bWait">默认等待</param> private void loadPatient(bool bWait = true) { try { waitAutoResetEvent.Reset();//初始化一下 StartLoadPatientThread(); if (bWait) { waitAutoResetEvent.WaitOne(60000);//最大等待时间30秒 } if (cbTodayTPN.IsChecked == true) { loadPatient(dsRecentPatient); } else { loadPatient(dsAllPatient); } } catch (Exception ex) { ShowMsgHelper.ShowError("加载患者时出错:" + ex.Message); } }
void IMenuManager.menuBeforeSelect() { try { this.db = new BLPublic.DBOperate(AppDomain.CurrentDomain.BaseDirectory + "bl_server.lcf", AppConst.SYSTEM_ID); if (!this.db.IsConnected) { BLPublic.Dialogs.Error("连接服务器失败:" + this.db.Error); return; } AppConst.db = this.db; ComClass.getAcountNameList(AppConst.db, ComClass.Acounts); listWard();//初始化患者查询页面中有个病区的下拉列表,耗时80毫秒 loadPatient(false); Page_Click(btnTPNOrders, null); } catch (Exception ex) { ShowMsgHelper.ShowError("TPN画面加载时出错:" + ex.Message); } }
/// <summary> /// 右下角图标双击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void notify_MouseDoubleClick(object sender, MouseEventArgs e) { try { if (QiPaoShuangJi)//若配置双击不可用,直接退出。 { return; } DataSet ds = new DataSet(); ds = dbHelp.GetPIVAsDB(GetSql()); if (CheckFormIsOpen("frmNotify")) { fnotify.Close(); } Screen[] screens = Screen.AllScreens; Screen screen = screens[0]; fnotify = new frmNotify(this.DEmployeeID); fnotify.setMouseOn += new frmNotify.MouseOn(SetMouseOnRemind); fnotify.setRemindTime += new frmNotify.RemindTime(setRemindTime); fnotify.setDelayTime += new frmNotify.DelayTime(setDelayTime); if (ds != null && ds.Tables.Count > 0) { int index1 = 0; int index2 = 0; switch (IniRemTime) { case 60: index1 = 0; break; case 180: index1 = 1; break; case 300: index1 = 2; break; case 600: index1 = 3; break; } switch (keeptime) { case 5: index2 = 0; break; case 10: index2 = 1; break; case 15: index2 = 2; break; case 60: index2 = 3; break; } if (!fnotify.SetRemindForm(ds, index1, index2, DelayIndex)) { fnotify.Dispose(); fnotify = null; remindtime = IniRemTime; return; } } fnotify.Show(); fnotify.Left = screen.WorkingArea.Width - fnotify.Width - 10; fnotify.Top = screen.WorkingArea.Height; while (fnotify.Top > screen.WorkingArea.Height - fnotify.Height) { Application.DoEvents(); fnotify.Top--; } remindtime = IniRemTime; } catch (Exception ex) { ShowMsgHelper.ShowError("右下角图标双击出错:" + ex.Message); } }
/// <summary> /// 显示一个画面,不存在创建,存在直接用 /// </summary> private void showOnePage(PageType pageType) { try { foreach (UserControl item in panelContent.Controls) { item.Visible = false; } UserControl page = null; //需要显示的页面 if (dicAllUserControlPage.ContainsKey(pageType)) //包含 { dicAllUserControlPage.TryGetValue(pageType, out page); page.Visible = true; ((IMenuManager)page).menuBeforeSelect(); } else//不存在,创建并保存到字典中 { switch (pageType) { case PageType.SynNo: page = new Sync(DEmployeeID, EmpCode, EmpName); dicAllUserControlPage.Add(PageType.SynNo, page); break; case PageType.Review: page = new CheckPre(DEmployeeID, EmpCode, EmpName); dicAllUserControlPage.Add(PageType.Review, page); break; case PageType.Batch: page = new UserControlBatch(DEmployeeID, EmpCode, EmpName); dicAllUserControlPage.Add(PageType.Batch, page); break; case PageType.Check: page = new UserControlCheck(DEmployeeID, EmpCode, EmpName); dicAllUserControlPage.Add(PageType.Check, page); break; case PageType.Print: page = new UserControlPrint(DEmployeeID, EmpCode, EmpName); dicAllUserControlPage.Add(PageType.Print, page); break; case PageType.Tool: page = new UMaxControl(DEmployeeID, EmpCode, EmpName); dicAllUserControlPage.Add(PageType.Tool, page); break; case PageType.TpnReview: string empRole = EmpCode.Trim() == "9999" ? "G" : "E"; //csw 只有9999才有管理员权限,tpn审方的设置界面 page = new UCTPNReview(EmpCode, empRole, DEmployeeID); dicAllUserControlPage.Add(PageType.TpnReview, page); break; default: break; } if (page != null) { page.Size = panelContent.Size;//先改变大小,减少加载闪烁 page.Dock = DockStyle.Fill; panelContent.Controls.Add(page); ((IMenuManager)page).menuBeforeSelect(); } } } catch (Exception ex) { ShowMsgHelper.ShowError("显示单个页面时出错:" + ex.Message); } }