/// <summary> /// 根据科室ID找科室名称 /// </summary> /// <param name="id"></param> /// <returns></returns> public DataSet getOfficeNameByOfficeId(string id) { OfficeFacade mOfficeFacade = new OfficeFacade(); DataSet mDataSet = new DataSet(); mDataSet = mOfficeFacade.FindAllNameByOfficeID(id); return(mDataSet); }
private void FrmDoctorChoose_Load(object sender, EventArgs e) { ucTime1.Sec = 60; this.ucDoctorList2.itemClick += ucDoctorList2_itemClick; ucTime1.timer1.Start(); BespeakDataset = new BespeakRegisterData(); officeFacade = new OfficeFacade(); backgroundWorker1.RunWorkerAsync(); }
/// <summary> /// 构造大通合理用药入参 /// </summary> /// <returns></returns> private string PassXmlCreate(string doctorID, string OfficeID) { ETechnicalpostFacade eTechnicalpostFacade = new ETechnicalpostFacade(); DataSet dsRole = eTechnicalpostFacade.GetTeachInfo(doctorID); DataSet dsDoctor = new OperatorFacade().FindOperatorInfobyUserID(doctorID); string office = new OfficeFacade().FindAllNameByOfficeID(OfficeID).Tables[0].Rows[0]["office"].ToString(); string strbase = "<base_xml>" + "<source>HIS</source> " + "<hosp_code>1790</hosp_code> " + "<dept_code>" + OfficeID + "</dept_code> " + "<dept_name>" + office + "</dept_name> " + "<doct>" + "<code>" + dsDoctor.Tables[0].Rows[0]["OPERATORID"].ToString() + "</code> " + "<name>" + dsDoctor.Tables[0].Rows[0]["OPERATORNAME"].ToString() + "</name> " + "<type>" + dsRole.Tables[0].Rows[0]["TECHNICALPOSTID"].ToString() + "</type> " + "<type_name>" + dsRole.Tables[0].Rows[0]["TECHNICALPOST"].ToString() + "</type_name> " + "</doct>" + "</base_xml>"; return(strbase); }
private void lblOk_Click(object sender, EventArgs e) { try { if (Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date == DateTime.Now.Date) //如果预约时间为当天,则调用挂号方法,重新组织数据 { if (registerInfoData.Tables.Count > 0 && registerInfoData.Tables[0].Rows.Count > 0) { registerInfoData.Tables[0].Rows.Clear(); } DataRow rowReg = registerInfoData.Tables[0].NewRow(); int i = registerInfoData.Tables[0].Rows.Count + 1; rowReg[RegisterInfoData.T_REGISTER_INFO_REGISTERID] = "新增" + i.ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_CANCELMARK] = "0"; rowReg[RegisterInfoData.T_REGISTER_INFO_OPERATORID] = SysOperatorInfo.OperatorID; rowReg[RegisterInfoData.T_REGISTER_INFO_OPERATEDATE] = new CommonFacade().GetServerDateTime(); rowReg[RegisterInfoData.T_REGISTER_INFO_CHARGEMARK] = 0; rowReg[RegisterInfoData.T_REGISTER_INFO_PATIENTNAME] = patientData.Tables[0].Rows[0]["PATIENTNAME"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_SEX] = patientData.Tables[0].Rows[0]["SEX"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_REGISTEROFFICEID] = BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_OFFICE] = BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICENAME"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_REGISTERCLASS] = REGISTERCLASS; rowReg[RegisterInfoData.T_REGISTER_INFO_DOCTORID] = BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORID"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_USERNAME] = BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORNAME"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_CASECOST] = Gbf; rowReg[RegisterInfoData.T_REGISTER_INFO_BESPEAKMONEY] = 0;//预约费 rowReg[RegisterInfoData.T_REGISTER_INFO_REGISTERFEE] = Ghf; rowReg[RegisterInfoData.T_REGISTER_INFO_CARDID] = SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["CARDID"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_EXAMINEMONEY] = Zj; rowReg[RegisterInfoData.T_REGISTER_INFO_BESPEAKID] = ""; rowReg[RegisterInfoData.T_REGISTER_INFO_DIAGNOSEID] = SkyComm.DiagnoseID; rowReg[RegisterInfoData.T_REGISTER_INFO_AGE] = patientData.Tables[0].Rows[0]["AGE"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_AGEUNIT] = patientData.Tables[0].Rows[0]["AGEUNIT"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_ADDRESS] = patientData.Tables[0].Rows[0]["ADDRESS"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_TELEPHONE] = patientData.Tables[0].Rows[0]["TELEPHONE"].ToString(); OfficeFacade officeFacade = new OfficeFacade(); DataSet officeSet = officeFacade.QueryByOfficeType(26, ""); DataRow officeRow = officeSet.Tables[0].AsEnumerable().FirstOrDefault(o => o.Field <string>("OFFICEID") == BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString()); rowReg[RegisterInfoData.T_REGISTER_INFO_OFFICEADDRESS] = officeRow["OFFICEADDRESS"].ToString().Trim(); rowReg[RegisterInfoData.T_REGISTER_INFO_DIAGNOSESTATE] = 0; rowReg[RegisterInfoData.T_REGISTER_INFO_CHECKFEE] = jcf; rowReg[RegisterInfoData.T_REGISTER_INFO_WORKTYPE] = BespeakDataset.Tables[0].Rows[0]["WORKTYPE"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_ARRANAGERECORDID] = BespeakDataset.Tables[0].Rows[0]["ARRANAGERECORDID"].ToString(); //if (SystemInfo.SystemConfigs["是否启用分时预约"] != null && SystemInfo.SystemConfigs["是否启用分时预约"].DefaultValue == "1") //{ rowReg[RegisterInfoData.T_REGISTER_INFO_QUEUEID] = BespeakDataset.Tables[0].Rows[0]["QUEUEID"].ToString(); //} rowReg[RegisterInfoData.T_REGISTER_INFO_BIRTHDAY] = patientData.Tables[0].Rows[0]["BIRTHDAY"].ToString(); rowReg[RegisterInfoData.T_REGISTER_INFO_EXECDATE] = new CommonFacade().GetServerDateTime(); rowReg["BESPEAKDATE"] = Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()); rowReg["BESPEAKMODE"] = ""; decimal decMoney = Convert.ToDecimal(Ghf) + Convert.ToDecimal(Zj) + Convert.ToDecimal(Gbf) + Convert.ToDecimal(jcf); rowReg["CASHDEFRAY"] = decMoney; rowReg["ACCOUNTDEFRAY"] = 0; rowReg["DISCOUNTDEFRAY"] = 0; rowReg["BALANCEMARK"] = 2; rowReg["BALANCESTATE"] = 0; rowReg["BALANCESTATE"] = 0; rowReg["BALANCEMODE"] = "预交金";//结算方式 registerInfoData.Tables[0].Rows.Add(rowReg); bespeakFac = new BespeakRegisterFacade(); //ZHOUHU ADD 20180130 CASE:29222 string isRegContr = new OfficeFacade().FindByOfficeID(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString()).Tables[0].Rows[0]["ISREGCONTR"].ToString(); //chenqiang 2017-03-09 add by Case:27423 if ("1" == SystemInfo.SystemConfigs["挂号、预约限制条件"].DefaultValue && isRegContr == "1") { if (registerFacade.FindNowDateRegisterInfo(patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date) > 0) { MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一位患者同天同科室限一个号,系统不允许挂号"); registerInfo.ShowDialog(); return; } if (bespeakFac.FindBespeakPatientInfo(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date, patientData.Tables[0].Rows[0]["IDENTITYCARD"].ToString(), patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString()) > 0) { MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一位患者同天同科室限一个号,当天已有预约信息,系统不允许挂号"); registerInfo.ShowDialog(); return; } } //chenqiang 2017.06.16 add by Case:28088 if (registerFacade.FindNowDateRegisterInfo(registerInfoData.Tables[0].Rows[0]["DOCTORID"].ToString(), registerInfoData.Tables[0].Rows[0]["REGISTEROFFICEID"].ToString(), registerInfoData.Tables[0].Rows[0]["WORKTYPE"].ToString(), registerInfoData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), Convert.ToDateTime(registerInfoData.Tables[0].Rows[0]["OPERATEDATE"].ToString()).Date) > 0) { MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一个患者同一个班次只能挂一个号,系统不允许挂号"); registerInfo.ShowDialog(); return; } if (bespeakFac.FindBespeakPatientInfo(registerInfoData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), registerInfoData.Tables[0].Rows[0]["DOCTORID"].ToString(), registerInfoData.Tables[0].Rows[0]["REGISTEROFFICEID"].ToString(), registerInfoData.Tables[0].Rows[0]["WORKTYPE"].ToString(), Convert.ToDateTime(registerInfoData.Tables[0].Rows[0]["OPERATEDATE"].ToString()).Date) > 0) { MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一个患者同一个班次只能挂一个号,系统不允许挂号"); registerInfo.ShowDialog(); return; } string ss = SystemInfo.SystemConfigs["院内就诊卡模式"].DefaultValue.ToString(); DataSet ds = this.registerFacade.insertEntityForFZBD(this.registerInfoData); MyAlert frmAlter = new MyAlert(AlertTypeenum.信息, "挂号成功!"); frmAlter.ShowDialog(); //输出挂号凭证 if (null == ds.Tables[0].Columns["EXAMINENAME"]) { DataColumn col = new DataColumn("EXAMINENAME", typeof(System.String)); col.Caption = "EXAMINENAME"; ds.Tables[0].Columns.Add(col); } if (!ds.Tables[0].Columns.Contains("EXAMINELOC")) { ds.Tables[0].Columns.Add("EXAMINELOC"); } UsersFacade uf = new UsersFacade(); foreach (DataRow row in ds.Tables[0].Rows) { string keyval = row["DOCTORID"].ToString(); if (keyval != "-1") { row["EXAMINENAME"] = uf.FindByUserInfo(keyval).Tables[0].Rows[0]["EXAMINENAME"].ToString(); } ExamineFacade ef = new ExamineFacade(); string i_EXAMINENAME = uf.FindByPrimaryKeyString(keyval).ToString(); if (i_EXAMINENAME == "") { row["EXAMINELOC"] = ""; } else { DataRow[] rw = ef.FindAllExamine().Tables[0].Select("EXAMINENAME = '" + i_EXAMINENAME + "' AND OFFICEID = '" + row["REGISTEROFFICEID"].ToString() + "'"); if (rw.Length > 0) { row["EXAMINELOC"] = rw[0]["EXAMINELOC"].ToString(); } else { row["EXAMINELOC"] = ""; } } } SkyComm.GetCardBalance(); PrintReport(ds, "自助挂号"); // PrintTriageInfo(ds.Tables[0], theServerTime); } else { DataRow dr = BespeakDataset.Tables[0].Rows[0]; dr["PATIENTNAME"] = patientData.Tables[0].Rows[0]["PATIENTNAME"].ToString(); dr["TELEPHONE"] = patientData.Tables[0].Rows[0]["TELEPHONE"].ToString(); dr["IDENTITYCARD"] = patientData.Tables[0].Rows[0]["IDENTITYCARD"].ToString(); dr["SEX"] = patientData.Tables[0].Rows[0]["SEX"].ToString(); //判断是否已经预约 DataSet dsBespeak = new DataSet(); if (!string.IsNullOrEmpty(patientData.Tables[0].Rows[0]["IDENTITYCARD"].ToString())) { dsBespeak = bespeakFac.FindBespeakInfoByIdentityOrDiagnoseId(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()), BespeakDataset.Tables[0].Rows[0]["WORKTYPE"].ToString(), patientData.Tables[0].Rows[0]["IDENTITYCARD"].ToString(), "", patientData.Tables[0].Rows[0]["PATIENTNAME"].ToString()); } else { dsBespeak = bespeakFac.FindBespeakInfoByIdentityOrDiagnoseId(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()), BespeakDataset.Tables[0].Rows[0]["WORKTYPE"].ToString(), "", patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), ""); } if (Convert.ToInt16(dsBespeak.Tables[0].Rows[0][0]) > 0) { MyAlert frm = new MyAlert(AlertTypeenum.信息, Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).ToShortDateString() + "已有预约信息,不能再次预约!"); frm.ShowDialog(); return; } //ZHOUHU ADD 20180130 CASE:29222 string isRegContr = new OfficeFacade().FindByOfficeID(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString()).Tables[0].Rows[0]["ISREGCONTR"].ToString(); //chenqiang 2017-03-09 add by Case:27423 if ("1" == SystemInfo.SystemConfigs["挂号、预约限制条件"].DefaultValue && isRegContr == "1") { bespeakFac = new BespeakRegisterFacade(); if (registerFacade.FindNowDateRegisterInfo(patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date) > 0) { MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一位患者同天同科室限一个号,系统不允许挂号"); registerInfo.ShowDialog(); return; } if (bespeakFac.FindBespeakPatientInfo(BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date, patientData.Tables[0].Rows[0]["IDENTITYCARD"].ToString(), patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString()) > 0) { MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一位患者同天同科室限一个号,当天已有预约信息,系统不允许挂号"); registerInfo.ShowDialog(); return; } } //chenqiang 2017.06.16 add by Case:28088 if (registerFacade.FindNowDateRegisterInfo(BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["WORKTYPE"].ToString(), patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date) > 0) { MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一个患者同一个班次只能挂一个号,系统不允许挂号"); registerInfo.ShowDialog(); return; } if (bespeakFac.FindBespeakPatientInfo(patientData.Tables[0].Rows[0]["DIAGNOSEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORID"].ToString(), BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICEID"].ToString(), BespeakDataset.Tables[0].Rows[0]["WORKTYPE"].ToString(), Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["OPERATEDATE"].ToString()).Date) > 0) { MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "一个患者同一个班次只能挂一个号,系统不允许挂号"); registerInfo.ShowDialog(); return; } //chenqiang add by case:33511 if (SystemInfo.SystemConfigs["是否启用号源云平台接口"].DefaultValue != "0") { if (BespeakDataset.Tables[0].Rows.Count > 1) { MyAlert registerInfo = new MyAlert(AlertTypeenum.信息, "在启用号源接口时,同一次只能预约一个医生!"); registerInfo.ShowDialog(); return; } } BespeakDataset = (BespeakRegisterData)bespeakFac.insertBespeakEntityReturn(BespeakDataset, patientData, 1); //chenqiang add by case:33511 if (SystemInfo.SystemConfigs["是否启用号源云平台接口"].DefaultValue != "0") { if (arrangeSource == "1" && Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"].ToString()).Date != new CommonFacade().GetServerDateTime().Date) { RegisterClouldInterface theRegisterClouldInterface = new RegisterClouldInterface(); int intResult = theRegisterClouldInterface.BespeakRegisteInfo(BespeakDataset); if (intResult < 0) { bespeakFac.CancelBespeak(BespeakDataset.Tables[0].Rows[0]["BESPEAKID"].ToString()); return; } } } MyAlert frmAlter = new MyAlert(AlertTypeenum.信息, "预约成功!"); frmAlter.ShowDialog(); PrintReport(BespeakDataset, "自助预约"); //预约成功后,发短信 try { Hashtable htPara = new Hashtable(); htPara.Add("@预约时间", Convert.ToDateTime(BespeakDataset.Tables[0].Rows[0]["BESPEAKDATE"]).ToString("MM月dd日HH时mm分")); string OfficeAddress = SysOperatorInfo.OperatorAreaname + BespeakDataset.Tables[0].Rows[0]["OFFICEADDRESS"].ToString(); htPara.Add("@科室位置", OfficeAddress); htPara.Add("@科室", BespeakDataset.Tables[0].Rows[0]["BESPEAKOFFICENAME"].ToString()); htPara.Add("@医生", BespeakDataset.Tables[0].Rows[0]["BESPEAKDOCTORNAME"].ToString()); htPara.Add("@排队号", BespeakDataset.Tables[0].Rows[0]["QUEUEID"].ToString()); htPara.Add("@预约号", BespeakDataset.Tables[0].Rows[0]["BESPEAKID"].ToString()); UMSMsgLib.UMSMsg.Instance.SendMsg(BespeakDataset.Tables[0].Rows[0]["TELEPHONE"].ToString(), "预约挂号", htPara); } catch (Exception ex) { Skynet.LoggingService.LogService.GlobalInfoMessage("预约成功后,发短信失败!" + ex.Message); } } SkyComm.CloseWin(this); } catch (Exception ex) { MyAlert frm = new MyAlert(AlertTypeenum.信息, ex.Message); frm.ShowDialog(); } }
private static bool login() { string HostName = Dns.GetHostName(); IPHostEntry hostEntry = Dns.GetHostByName(HostName); string IpAddress = hostEntry.AddressList[0].ToString(); //通过计算机名和IP地址查询自助机信息表的相关配置 AutoServiceMachineInfoFacade AutoServiceFac = new AutoServiceMachineInfoFacade(); AutoServiceMachineInfoData AutoServiceData = AutoServiceFac.GetByIPAddressHostName(IpAddress, HostName); if (AutoServiceData == null) { SkynetMessage.MsgInfo("该自助机IP地址和计算名没有登记,请与管理员联系!"); return(false); } if (AutoServiceData.Stopflag == 1) { SkynetMessage.MsgInfo("该自助机已被停用,不能正常使用"); return(false); } AutoHostConfig.SendCardType = AutoServiceData.Sendcardtype; AutoHostConfig.SendCardPort = AutoServiceData.Sendcardport; AutoHostConfig.ReadCardType = AutoServiceData.Readcardtype; LogService.GlobalInfoMessage("读卡机类型:" + AutoServiceData.Readcardtype); AutoHostConfig.ReadCardPort = AutoServiceData.Readcardport; AutoHostConfig.CashBoxType = AutoServiceData.Cashboxtype; AutoHostConfig.CashBoxPort = AutoServiceData.Cashboxport; AutoHostConfig.IDCardType = AutoServiceData.Idcardtype; AutoHostConfig.IDCardPort = AutoServiceData.Idcardport; AutoHostConfig.MachineType = AutoServiceData.Machinetype; AutoHostConfig.Machineno = AutoServiceData.Machineno; AutoHostConfig.PosInterfaceType = AutoServiceData.PosInterfaceType; AutoHostConfig.PosNo = AutoServiceData.PosNo; AutoHostConfig.BankName = AutoServiceData.BankName; AutoHostConfig.ClosePassword = AutoServiceData.Closepassword; AutoHostConfig.OpenDoorPassword = AutoServiceData.Opendoorpassword; //登陆HIS操作系统 OperatorFacade operatorFacade = new OperatorFacade(); DataSet opds = operatorFacade.GetLoginOperatorInfo(AutoServiceData.Operatorcodeno); if (opds.Tables[0].Rows.Count == 0) { SkynetMessage.MsgInfo("自助机对应的用户在系统中找不到!"); return(false); } //根据查询的结果给AutoHostConfig中变量赋值,保存操作员的相关信息,以及设备的相关信息 DataRow OperatorRow = opds.Tables[0].Rows[0]; SysOperatorInfo.OperatorID = OperatorRow["OPERATORID"].ToString(); SysOperatorInfo.OperatorCode = AutoServiceData.Operatorcodeno; SysOperatorInfo.OperatorName = OperatorRow["OPERATORNAME"].ToString(); SysOperatorInfo.OperatorWorkkind = OperatorRow["WORKKIND"].ToString(); SysOperatorInfo.UserID = OperatorRow["USERID"].ToString(); SysOperatorInfo.OperatorOfficeID = OperatorRow["OFFICEID"].ToString(); DataSet dsofficeArea = new OfficeFacade().FindHospitalAreaInfoByOfficeID(SysOperatorInfo.OperatorOfficeID); if (dsofficeArea.Tables.Count > 0 && dsofficeArea.Tables[0].Rows.Count > 0) { SysOperatorInfo.OperatorAreaid = dsofficeArea.Tables[0].Rows[0]["AREAID"].ToString(); SysOperatorInfo.OperatorAreaname = dsofficeArea.Tables[0].Rows[0]["AREANAME"].ToString(); } else { SysOperatorInfo.OperatorAreaid = string.Empty; SysOperatorInfo.OperatorAreaname = string.Empty; } OfficeAttachFacade officeAttachFacade = new OfficeAttachFacade(); SysOperatorInfo.CustomerName = officeAttachFacade.GetCustomName(); return(true); }
public static void Main(string[] args) { Console.WriteLine("----------- Strategy Pattern ------------"); var husky = new Husky(); husky.Bark(); husky.Run(); husky.SetBarkBehavior(new BarkElectronical()); husky.Bark(); Console.WriteLine("----------- Singleton ------------"); var bankValues1 = BankValues.GetInstance(); var bankValues2 = BankValues.GetInstance(); Console.WriteLine(bankValues1 == bankValues2 ? "Oh yes, I am the same instance" : "Nope, I am another BankValue instance."); Console.WriteLine("----------- Factory Method ------------"); var shop = new SoftwareShop().GetProgram(OfficeProg.Powerpoint); Console.WriteLine("----------- Facade ------------"); var officeTask = new OfficeFacade(); officeTask.PrintDocument(); Console.WriteLine("----------- State ------------"); var lumpi = new Doggy(); lumpi.Play(); lumpi.Anger(); lumpi.GiveMeal(); lumpi.Stroke(); lumpi.LeaveAlone(); Console.WriteLine("----------- DI with Autofac ------------"); var container = ContainerConfig.Configure(); using (var scope = container.BeginLifetimeScope()) { var app = scope.Resolve <IApplication>(); app.Run(); } Console.WriteLine("----------- Repository ------------"); ArticleRepository artRepo = new ArticleRepository(); List <Article> artList = artRepo.ReadAll(); Console.WriteLine($"Found {artList.Count} articles in the List"); artRepo.Create(new Article { }); var artLatest = artRepo.ReadLatest(); Console.WriteLine($"Title: {artLatest.Title}, ID: {artLatest.Id}"); artList = artRepo.ReadAll(); Console.WriteLine($"Found {artList.Count} articles in the List"); artRepo.Update(new Article { }); Console.WriteLine($"FOUND: {artRepo.ReadById(1).Title}"); artRepo.Delete(new Article { }); artList = artRepo.ReadAll(); Console.WriteLine($"Found {artList.Count} articles in the List"); }