/// <summary> /// 发送台通知 /// </summary> /// <returns></returns> public bool SendDeskNotice(string Content, List <string> IPlist, bool IsBroadCast, string name) { try { GetInstance(); BroadCast_DeskNoticeInfo deskInfo = new BroadCast_DeskNoticeInfo(); if (!IsBroadCast && IPlist != null) { foreach (string ip in IPlist) { deskInfo.OperationName = name; deskInfo.RemoteAddress = IPAddress.Parse(ip.Trim()); deskInfo.DeskNoticeTpyeSign = DeskNoticeTpyeSign.DNTS_AllDesk; deskInfo.Info = Content; Entrance.GetSendInstence().Broadcast_DeskNotice(deskInfo); } } else { deskInfo.DeskNoticeTpyeSign = DeskNoticeTpyeSign.DNTS_AllDesk; deskInfo.OperationName = name; deskInfo.Info = Content; Entrance.GetSendInstence().Broadcast_DeskNotice(deskInfo); } return(true); } catch (Exception ex) { Log4Net.LogError("Notice", ex.ToString()); return(false); } }
/// <summary> /// 删除 /// </summary> /// <returns></returns> public ActionResult OfficeDelete(IList <int> idList) { BLL.Office.Office office = new BLL.Office.Office(); bool delete; try { delete = office.Delete(idList); } catch (Exception ex) { Log4Net.LogError("Office", ex.Message); delete = false; } if (delete) { return(Json(new { IsSuccess = true, Message = "删除成功" })); } else { return(Json(new { IsSuccess = false, Message = "删除失败" })); } }
/// <summary> /// 发送车辆通知 /// </summary> /// <returns></returns> public bool SendAmbNotice(string Content, List <string> Codelist, string OperationCode) { try { GetInstance(); AmbDevice_NoticeInfo ambInfo = new AmbDevice_NoticeInfo(); ambInfo.AmbulanceCodeList = Codelist; ambInfo.Content = Content; ambInfo.TypeId = NoticeTpyeSign.NTS_CheckedAmbs; //发送的车辆范围(所选车辆) ambInfo.SendNoticeAimType = SendNoticeAimType.SNAT_Ambs; //目的地 ambInfo.OperatorCode = OperationCode; Entrance.GetSendInstence().AmbDevice_SendNotice(ambInfo); NoticeList notice = new NoticeList(); return(true); } catch (Exception ex) { Log4Net.LogError("Notice", ex.ToString()); return(false); } }
public static bool Delete(IList <int> idList) { using (MainDataContext dbContext = new MainDataContext()) { try { foreach (int g in idList) { B_Remind model = dbContext.B_Remind.SingleOrDefault(t => t.编码 == g); if (model != null) { dbContext.B_Remind.DeleteOnSubmit(model); } } dbContext.SubmitChanges(); return(true); } catch (Exception ex) { Log4Net.LogError("定时短信删除", ex.ToString()); return(false); } } }
public static bool DelWorkerRole(int id) { using (MainDataContext dbContext = new MainDataContext()) { using (MainDataContext dsContext = new MainDataContext(AppConfig.ConnectionStringDispatch)) { try { B_WORKER_ROLE wr = dbContext.B_WORKER_ROLE.SingleOrDefault(t => t.ID == id); dbContext.B_WORKER_ROLE.DeleteOnSubmit(wr); //同步Tperson if (!string.IsNullOrEmpty(wr.TPerson编码)) { TPerson tp = dsContext.TPerson.SingleOrDefault(t => t.编码 == wr.TPerson编码); dsContext.TPerson.DeleteOnSubmit(tp); } dbContext.SubmitChanges(); dsContext.SubmitChanges(); return(true); } catch (Exception ex) { Log4Net.LogError("DelWorkerRole", ex.ToString()); return(false); } } } }
/// <summary> /// 更新反馈 /// </summary> public static string UpdateRec(int BGCode, string userCode) { using (MainDataContext dbContext = new MainDataContext()) { string result = null; try { var oldQuery = from t in dbContext.TOfficeReceive where t.办公编码 == BGCode && t.接收人编码 == userCode select t; if (oldQuery.Any()) { var old = oldQuery.First(); if (!old.是否已阅) { old.是否已阅 = true; old.查阅时间 = DateTime.Now; dbContext.SubmitChanges(); } } } catch (Exception ex) { Log4Net.LogError("Office UpdateRec", ex.ToString()); result = ex.ToString(); } return(result); } }
public static bool Delete(IList <string> listId) { using (MainDataContext dbContext = new MainDataContext()) { using (MainDataContext dsContext = new MainDataContext(AppConfig.ConnectionStringDispatch)) { try { //删除Tperson foreach (string id in listId) { int workerId = int.Parse(id); List <B_WORKER_ROLE> listWorkerRole = dbContext.B_WORKER_ROLE.Where(t => t.WorkerID == workerId && t.TPerson编码 != null && t.TPerson编码 != "").ToList(); foreach (B_WORKER_ROLE workerRole in listWorkerRole) { TPerson person = dsContext.TPerson.FirstOrDefault(t => t.编码 == workerRole.TPerson编码); dsContext.TPerson.DeleteOnSubmit(person); } } dsContext.SubmitChanges(); //删除人员 StringBuilder sb = new StringBuilder(); sb.Append("SET XACT_ABORT ON "); sb.AppendLine(" BEGIN TRAN "); foreach (string id in listId) { int workerId = int.Parse(id); //删除人员 sb.AppendFormat(" delete B_WORKER where id={0}", workerId); //删除人员组织 sb.AppendFormat(" delete B_WORKER_ORGANIZATION where WorkerID={0}", workerId); //删除人员角色 sb.AppendFormat(" delete B_WORKER_ROLE where WorkerID={0}", workerId); } sb.AppendLine(" COMMIT TRAN "); dbContext.ExecuteCommand(sb.ToString()); return(true); } catch (Exception ex) { Log4Net.LogError("删除人员", ex.Message); return(false); } } } }
/// <summary> /// 打印命令单 /// 2012.1.6 刘爱青 /// </summary> /// <param name="TaskCode"></param> /// <returns></returns> public static StationCommandInfo PrintCommand(string TaskCode) { try { StringBuilder sb = new StringBuilder(); sb.Append(" select 事件编码=tt.事件编码,收单时刻=tace.发送指令时刻,调度员=tp.工号,台号=right(tt.事件编码,2),现场地址=tace.现场地址,等车地址=tace.等车地址,送往地址=tace.送往地点,"); sb.Append("呼救电话=tace.呼救电话,联系电话=tace.联系电话+tace.分机,联系人=tace.联系人,车辆='['+ta.实际标识+']'+'['+ta.车牌号码+']',"); sb.Append("随车人员=tt.司机+' '+tt.医生+' '+tt.护士+' '+tt.担架工+' '+tt.抢救员,特殊要求=tace.特殊要求,"); sb.Append("患者姓名=tace.患者姓名,性别=tace.性别,年龄=tace.年龄,民族=tace.民族,国籍=tace.国籍,患者人数=tace.患者人数,"); sb.Append("初步判断=tace.主诉,备注=tace.备注,"); sb.Append(" 分站=ts.名称 "); sb.Append("from TTask tt "); sb.Append(" left join TAcceptEvent tace on tace.事件编码=tt.事件编码 and tt.受理序号=tace.受理序号"); sb.Append(" left join TAlarmEvent tae on tae.事件编码=tt.事件编码"); sb.Append(" left join TAmbulance ta on ta.车辆编码=tt.车辆编码 "); sb.Append(" left join TStation ts on ts.编码=tt.分站编码 "); sb.Append(" left join TPerson tp on tp.编码=tt.责任调度人编码 "); sb.Append(" where tt.任务编码='").Append(TaskCode).Append("'"); using (DataSet ds = SQLHelper.ExecuteDataSet(AppConfig.ConnectionStringReport, CommandType.Text, sb.ToString(), null)) { DataRow dr = ds.Tables[0].Rows[0]; StationCommandInfo info = new StationCommandInfo(); info.EventCode = DBConvert.ConvertStringToString(dr["事件编码"]); info.ReceiveRecordCommandTime = DBConvert.ConvertStringToString(dr["收单时刻"]); info.DispatcherWorkid = DBConvert.ConvertStringToString(dr["调度员"]); info.DeskID = DBConvert.ConvertStringToString(dr["台号"]); info.LocalAddr = DBConvert.ConvertStringToString(dr["现场地址"]); info.WaitAddr = DBConvert.ConvertStringToString(dr["等车地址"]); info.SendAddr = DBConvert.ConvertStringToString(dr["送往地址"]); info.AlarmTel = DBConvert.ConvertStringToString(dr["呼救电话"]); info.LinkTel = DBConvert.ConvertStringToString(dr["联系电话"]); info.LinkPerson = DBConvert.ConvertStringToString(dr["联系人"]); info.RealSignbunch = DBConvert.ConvertStringToString(dr["车辆"]); info.AmbPersons = DBConvert.ConvertStringToString(dr["随车人员"]); info.SpecialNeed = DBConvert.ConvertStringToString(dr["特殊要求"]); info.PatientName = DBConvert.ConvertStringToString(dr["患者姓名"]); info.Sex = DBConvert.ConvertStringToString(dr["性别"]); info.Age = DBConvert.ConvertStringToString(dr["年龄"]); info.Nationality = DBConvert.ConvertStringToString(dr["国籍"]); info.Folk = DBConvert.ConvertStringToString(dr["民族"]); info.PatientCount = DBConvert.ConvertStringToString(dr["患者人数"]); info.Judge = DBConvert.ConvertStringToString(dr["初步判断"]); info.Remark = DBConvert.ConvertStringToString(dr["备注"]); info.StationName = DBConvert.ConvertStringToString(dr["分站"]); return(info); } } catch (Exception ex) { Log4Net.LogError("StatisticsDAL/PrintCommand()", ex.ToString()); return(null); } }
/// <summary> /// 存储通知单和短信 /// </summary> /// <param name="Content"></param> /// <param name="SendTime"></param> /// <param name="OperationCode"></param> /// <param name="TypeId"></param> /// <param name="Code"></param> /// <param name="Name"></param> public void InsertNoticeMsg(string Content, DateTime SendTime, string OperationCode, int TypeId, List <string> Code, List <string> Name) { try { CoreService.GetService().SaveNoticeMessage(Content, SendTime, OperationCode, TypeId, Code.ToArray(), Name.ToArray()); } catch (Exception ex) { Log4Net.LogError("NoticeBLL/InsertNoticeMsg", ex.Message); } }
/// <summary> /// 车辆人员下班 /// </summary> public string AmbulancePersonCheckOut(string personCode, string ambCode, int operationOrigin, string operatorCode, DateTime operateTime) { try { CoreService.AmbulancePersonCheckOut(personCode, ambCode, operationOrigin, operatorCode, operateTime); return(""); } catch (Exception ex) { Log4Net.LogError("AmbulanceBLL/UnlockPerson", ex.Message); return(ex.Message); } }
/// <summary> /// 发送&&存草稿 /// </summary> /// <param name="entity">邮件实体</param> /// <param name="mailWorker">邮件相关人</param> /// <returns></returns> public static bool SendMail(E_Mail entity, List <E_Mail_Worker> mailWorker) { using (MainDataContext dbContext = new MainDataContext()) { try { var email = dbContext.E_Mail.FirstOrDefault(m => m.ID == entity.ID); if (email == null) //新建信件 { //邮件主表 dbContext.E_Mail.InsertOnSubmit(entity); } else //从草稿箱进入 { //邮件主表 email.Title = entity.Title; email.SendDate = entity.SendDate; email.From = entity.From; email.Body = entity.Body; email.CC = entity.CC; email.CreateTime = entity.CreateTime; email.SC = entity.SC; email.To = entity.To; var list = dbContext.E_Mail_Worker.Where(m => m.MailId == entity.ID).ToList(); foreach (E_Mail_Worker m in list) { dbContext.E_Mail_Worker.DeleteOnSubmit(m); } } //存入数据库 foreach (E_Mail_Worker w in mailWorker) { dbContext.E_Mail_Worker.InsertOnSubmit(w); } dbContext.SubmitChanges(); return(true); } catch (Exception ex) { Log4Net.LogError("SendMail", ex.ToString()); return(false); } } }
public static void LoginLog(B_LOGIN_LOG log) { using (MainDataContext dbContext = new MainDataContext()) { try { dbContext.B_LOGIN_LOG.InsertOnSubmit(log); dbContext.SubmitChanges(); } catch (Exception e) { Log4Net.LogError("Anchor.FA.DAL.Organize/LoginLog()", e.Message); } } }
public static int Create(UserPreferenceDataModel data, RequestProfile requestProfile) { var sql = String.Empty; try { sql = Save(data, requestProfile, "Create"); var id = DBDML.RunScalarSQL("UserPreference.Insert", sql, DataStoreKey); return(Convert.ToInt32(id)); } catch (Exception ex) { Log4Net.LogError(sql, MethodBase.GetCurrentMethod().DeclaringType.ToString(), requestProfile.ApplicationId, ex); throw ex; } }
public static bool Save(B_ROLE entity) { using (MainDataContext dbContext = new MainDataContext()) { using (MainDataContext dsContext = new MainDataContext(AppConfig.ConnectionStringDispatch)) { string sqlB; string sqlT; try { if (dbContext.B_ROLE.Count(t => t.ID == entity.ID) == 0) //添加 { //var list = from a in dbContext.B_ROLE select a.ID; //long total = list.LongCount(); //if (total == 0) //{ // entity.ID = 1; //} //else //{ // entity.ID = dbContext.B_ROLE.Max(a => a.ID) + 1; //} sqlB = string.Format(" INSERT INTO [B_ROLE]([ID],[Name],[Remark]) VALUES ({0},'{1}','{2}')", entity.ID, entity.Name, entity.Remark); sqlT = string.Format(" insert TRole ([编码],[名称],[顺序号],[是否有效])values ({0},'{1}',{2},{3})", entity.ID, entity.Name, 1, dbContext.TRole.Max(a => a.顺序号) + 1); } else //修改 { sqlB = string.Format(" update B_ROLE set name='{0}',remark='{1}' where id={2}", entity.Name, entity.Remark, entity.ID); sqlT = string.Format(" update TRole set 名称='{0}' where 编码={1}", entity.Name, entity.ID); } dbContext.ExecuteCommand(sqlB); dsContext.ExecuteCommand(sqlT); return(true); } catch (Exception ex) { Log4Net.LogError("Save Role", ex.Message); return(false); } } } }
public static bool Delete(IList <int> idList) { using (MainDataContext dbContext = new MainDataContext()) { using (MainDataContext dsContext = new MainDataContext(AppConfig.ConnectionStringDispatch)) { StringBuilder sbB = new StringBuilder(); StringBuilder sbT = new StringBuilder(); try { sbB.Append("SET XACT_ABORT ON "); sbB.AppendLine(" BEGIN TRAN "); sbT.Append("SET XACT_ABORT ON "); sbT.AppendLine(" BEGIN TRAN "); foreach (int g in idList) { var Rmodel = dbContext.B_ROLE.Single(a => a.ID == g); if (Rmodel != null) { sbB.AppendFormat("delete B_ROLE where id={0}", g); } TRole role = dbContext.TRole.FirstOrDefault(a => a.编码 == g); if (role != null) { sbT.AppendFormat("delete TRole where 编码={0}", g); } } sbB.AppendLine(" COMMIT TRAN "); sbT.AppendLine(" COMMIT TRAN "); dbContext.ExecuteCommand(sbB.ToString()); dsContext.ExecuteCommand(sbT.ToString()); return(true); } catch (Exception ex) { Log4Net.LogError("Save Role", ex.Message); return(false); } } } }
/// <summary> /// 提交表单 /// </summary> /// <returns></returns> public ActionResult Submit() { int flowId = int.Parse(Request.QueryString["flowId"]); int flowNo = int.Parse(Request.QueryString["flowNo"]); Engine engine = new Engine(); Dictionary <string, string> param; string digest = GetFormDigest(); using (TransactionScope scope = new TransactionScope()) { try { engine.ApplyInnerFlow(flowId, ref flowNo, CurrentUser.ID, digest, out param); if (SaveForm(flowNo)) { scope.Complete(); return(Json(new { IsSuccess = true, SplitType = param["SplitType"], ActivtyInstId = param["ActivityInstId"], FlowInstId = param["FlowInstId"] }, "text/html", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { Log4Net.LogError("Submit Form", string.Format("flowId:{0},flowNo:{1},Message:{2}", flowId, flowNo, ex.ToString())); } return(Json(new { IsSuccess = false, Message = "提交失败" }, "text/html", JsonRequestBehavior.AllowGet)); } }