public void SendMsg(string codes, string module) { try { Bll_Sys_Map mapInst = new Bll_Sys_Map(); var Map = mapInst.GetModel(string.Format(" AND Map_Module='{0}' AND Map_Source='{0}'", "SmsTemplate")); Bll_Audit auditInst = new Bll_Audit(); var TemlateKey = auditInst.GetTemplateModel(module); string[] code = codes.TrimEnd(',').Split(','); foreach (var c in code) { string content = string.Format(Map.Map_Object, TemlateKey.Template_Name, SessionConfig.UserName()); var model = stuffInstance.GetModelByCode(c); GSMHelper.SendMessage(model.Emp_Mobile, content); } } catch (Exception ex) { QX.Log.PlateLog.WriteError(SessionConfig.UserName(), "", "", "", "发送短信失败!", QX.Log.PlateLog.LogMessageType.Error, ex); } }
/// <summary> /// 写入用户登录日志 /// </summary> public static void LoginLog(string UserName, string Msg) { try { Bll_Sys_LoginLog instance = new Bll_Sys_LoginLog(); Sys_LoginLog model = new Sys_LoginLog() { EL_Date = DateTime.Now, EL_UserCode = UserName, EL_UserName = SessionConfig.UserName(), EL_IP = HttpContext.Current.Request.UserHostAddress, EL_Mac = "", EL_Company = SessionConfig.Company(), EL_Dept = SessionConfig.DeptName(), EL_Success = Msg }; instance.Insert(model); } catch (System.Exception ex) { PlateLog.WriteInFile(SessionConfig.UserId(), SessionConfig.UserName(), HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(), ex.Message, PlateLog.LogMessageType.Error, ex); } }
public ActionResult UploadImg(string code, string path, string module) { var list = cInstance.GetCompHisList(string.Format("AND CH_CompCode='{0}' AND CH_iType='File'", code)); if (list.Count >= 1) { return(new JsonResult { Data = new { result = "fail", Msg = "您已上传图纸图片,不能重复上传!" } }); } string fileName = Path.GetFileName(path); Bse_CompHistory comp = new Bse_CompHistory(); comp.CH_Code = cInstance.GenerateHistoryCode(); comp.CH_Date = DateTime.Now; comp.CH_CompCode = code; comp.CH_Auditor = SessionConfig.UserId(); comp.CH_AuditorName = SessionConfig.UserName(); comp.CH_FilePath = path; comp.CH_iType = "File"; comp.CH_Type = "上传附件"; cInstance.AddHis(comp); return(new JsonResult { Data = new { result = "success", Msg = "数据更新成功!" } }); }
/// <summary> /// 图纸文件上传后回调函数 /// </summary> /// <param name="code"></param> /// <param name="path"></param> /// <param name="module"></param> /// <returns></returns> public ActionResult UploadDocComp(string code, string path, string type, string typename, string node, string nodename, string module) { string fileName = Path.GetFileName(path); Doc_Attachment attachment = new Doc_Attachment(); attachment.Dat_Name = fileName; attachment.Dat_Path = path; attachment.Dat_Module = module; attachment.Dat_RefCode = code; //文件类型(不同的类型不同的处理方式) attachment.Dat_Type = Path.GetExtension(path).Trim('.'); attachment.Dat_Date = DateTime.Now; attachment.Dat_Creator = SessionConfig.UserId(); attachment.Dat_CreatorName = SessionConfig.UserName(); attachment.Dat_Code = diInstance.GenerateAttachmentCode(); //图纸的类型-->全工艺 、工艺节点 attachment.Dat_Udef1 = type; attachment.Dat_Udef2 = typename; attachment.Dat_Udef3 = node; attachment.Dat_Udef4 = nodename; diInstance.AddAttachment(attachment); BLL.Bll_Comm.OpLog("Upload", "Upload", string.Format("上传附件:{0}", attachment.Dat_RefCode)); return(new JsonResult { Data = new { result = "success", Msg = "数据更新成功!" } }); }
public ActionResult Get(string oper, string id) { string Form = Request["form"]; Sys_Bug model = new Sys_Bug(); Sys_BugLog Logmodel = new Sys_BugLog(); if (!string.IsNullOrEmpty(Form)) { model = JsonConvert.DeserializeObject <Sys_Bug>(Form); } Logmodel.SL_Code = model.Sys_Code; Logmodel.SL_OpUser = SessionConfig.UserName(); Logmodel.SL_Date = DateTime.Now; Logmodel.SL_Status = model.Sys_Status; Logmodel.SL_Owner = model.Sys_Owner; if (oper == JqGridEnum.view.ToString()) { List <Sys_Bug> list = bugInstance.GetListByCode(" AND Sys_Code='" + id + "'"); model = new Sys_Bug(); if (list.Count > 0) { model = list[0]; } return(JavaScript(JsonConvert.SerializeObject(model, new JsonDateConverter("yyyy-MM-dd HH:mm")))); } else if (oper == JqGridEnum.edit.ToString()) { model.Sys_ID = bugInstance.GetModel(" AND Sys_Code='" + model.Sys_Code + "' ").Sys_ID; bool result = bugInstance.Update(model); result = buglogInstance.Insert(Logmodel); string strResult = result ? "success" : "fail"; return(Content(strResult)); } else if (oper == JqGridEnum.del.ToString()) { bool result = bugInstance.Delete(" AND WHBM_Code='" + id + "'"); string strResult = result ? "success" : "fail"; return(Content(strResult)); } else if (oper == JqGridEnum.add.ToString()) { string form = Request["form"]; model.Sys_Date = DateTime.Now; bool result = bugInstance.Insert(model); result = buglogInstance.Insert(Logmodel); string strResult = result ? "success" : "fail"; return(Content(strResult)); } else { return(new EmptyResult()); } }
public ActionResult AuditCallback(string code) { var list = cInstance.GetCompHisList(string.Format("AND CH_CompCode='{0}'", code)); Bse_CompHistory model = list.FirstOrDefault(o => o.CH_iType == "File"); List <Bse_CompHistory> auditHis = list.Where(o => o.CH_iType != "File").ToList(); if (model != null) { try { var d = System.IO.Path.GetTempPath(); //var d = @"E:\运营方案"; string filename = Path.GetFileName(model.CH_FilePath); string temp = Server.MapPath(model.CH_FilePath); string srcpath = temp; string despath = Path.Combine(d, filename); ThumNail.AddWaterWord(string.Format("{0} {1}", SessionConfig.UserName(), DateTime.Now.ToString("yy-MM-dd hh:mm")), srcpath, despath, 10, auditHis.Count * 30); //如果存在则表示生成成功 if (System.IO.File.Exists(despath)) { System.IO.File.Copy(despath, srcpath, true); System.IO.File.Delete(despath); } } catch (Exception ex) { return(new JsonResult { Data = new { result = "fail", Msg = ex.Message } }); } Bse_CompHistory newModel = new Bse_CompHistory(); newModel.CH_Code = cInstance.GenerateHistoryCode(); newModel.CH_CompCode = model.CH_CompCode; newModel.CH_FilePath = model.CH_FilePath; newModel.CH_Auditor = SessionConfig.UserId(); newModel.CH_AuditorName = SessionConfig.UserName(); newModel.CH_Date = DateTime.Now; newModel.CH_iType = "His"; newModel.CH_Type = "审核"; cInstance.AddHis(newModel); return(new JsonResult { Data = new { result = "success", Msg = "数据更新成功!" } }); } else { return(new JsonResult { Data = new { result = "fail", Msg = "请上传图纸文件图片!" } }); } }
/// <summary> /// 全局异常处理:Error记录到文本 /// </summary> /// <param name="filterContext"></param> public void OnException(ExceptionContext filterContext) { //写入文本日志 //PlateLog.WriteInFile(SessionConfig.UserId(), SessionConfig.UserName(), // HttpContext.Current.Request.UserHostAddress,HttpContext.Current.Request.Url.ToString(), // filterContext.Exception.Message, PlateLog.LogMessageType.Error, filterContext.Exception); //写入数据库日志 PlateLog.WriteError(SessionConfig.UserId(), SessionConfig.UserName(), HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(), filterContext.Exception.Message, PlateLog.LogMessageType.Error, filterContext.Exception); }
public ActionResult Add() { Bse_Components info = new Bse_Components(); info.Comp_Code = cInstance.GenerateCompCode(); info.Comp_Creator = SessionConfig.UserId(); info.Comp_CreatorName = SessionConfig.UserName(); info.Comp_Date = DateTime.Now; GetbackUrl(); return(View(info)); }
public ActionResult top() { //Bll_System_Menu Menu = new Bll_System_Menu(); //QX.Comm.MenuLocation local = QX.Comm.MenuLocation.TOP; //List<System_Menu> MenuList = Menu.GetMenu(local); //var model = TopInsatance.GetModel(" AND Menu_User='******' "); // ViewData["TopList"] = model != null ? model.Menu_Links : ""; //登录人信息 ViewData["UserName"] = !string.IsNullOrEmpty(SessionConfig.UserName()) ? SessionConfig.UserName() : "1"; ViewData["UserRole"] = !string.IsNullOrEmpty(SessionConfig.Stuff_LoginType()) ? instanceD.GetModel(" and Dict_Code='" + SessionConfig.Stuff_LoginType() + "'").Dict_Name: "2"; ViewData["IP"] = SessionConfig.CurrentIP(); return(View()); }
public ActionResult Add() { Doc_Info info = new Doc_Info(); info.Doc_Code = diInstance.GenerateDocCode(); info.Doc_Creator = SessionConfig.UserId(); info.Doc_CreatorName = SessionConfig.UserName(); info.Doc_DpCode = SessionConfig.DeptCode(); info.Doc_DpName = SessionConfig.DeptName(); info.Doc_Date = DateTime.Now; GetbackUrl(); return(View(info)); }
/// <summary> /// 零件图纸上传(图片上传) /// </summary> /// <param name="qqfile"></param> /// <returns></returns> public ActionResult Upload(string qqfile) { var path = Server.MapPath("~/Upload"); var dpath = Server.MapPath("~/Upload/Temp"); string file = Comm.FileUpload.UploadFile(qqfile, path, System.Web.HttpContext.Current); string dfile = Path.Combine(dpath, Path.GetFileName(file)); //业务处理 已审人数*50作为高度 if (string.IsNullOrEmpty(file)) { return(Json(new { result = "fail", message = "上传失败!" }, "application/json")); } ThumNail.AddWaterWord(SessionConfig.UserName(), file, dfile, 100, 100); return(Json(new { result = "success", path = "/Upload/" + Path.GetFileName(file), message = "成功" }, "application/json")); }
/// <summary> /// 获取当前用户所在的BUG组 /// </summary> /// <returns></returns> private EnumBugUserGroup CurrentUserRole() { EnumBugUserGroup result = new EnumBugUserGroup(); try { var UserName = SessionConfig.UserName(); var CurRole = BugUserGroup().Where(o => o.Dict_Code == UserName).First(); if (CurRole != null) { result = (EnumBugUserGroup)Enum.Parse(typeof(EnumBugUserGroup), CurRole.Dict_UDef1); } } catch (System.Exception ex) { result = EnumBugUserGroup.GDev; } return(result); }
/// <summary> /// 写入操作日志 /// </summary> /// <param name="Module">模块编码 </param> /// <param name="ModuleName">模块名称</param> /// <param name="Message">异常信息</param> public static void OpLog(string Module, string ModuleName, string Message) { var IS_OPEN_PERMISSION = ConfigHelper.GetApp("IS_OPEN_FUNCATIONLOG"); if (!string.IsNullOrEmpty(IS_OPEN_PERMISSION) && IS_OPEN_PERMISSION == "true") { try { PlateLog.WriteOp(SessionConfig.UserId(), SessionConfig.UserName(), HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(), Message, PlateLog.LogMessageType.Info, Module, ModuleName); } catch (System.Exception ex) { PlateLog.WriteInFile(SessionConfig.UserId(), SessionConfig.UserName(), HttpContext.Current.Request.UserHostAddress, HttpContext.Current.Request.Url.ToString(), Message, PlateLog.LogMessageType.Error, ex); } } }
public ActionResult UploadDoc(string code, string path, string module) { string fileName = Path.GetFileName(path); Doc_Attachment attachment = new Doc_Attachment(); attachment.Dat_Name = fileName; attachment.Dat_Path = path; attachment.Dat_Module = module; attachment.Dat_RefCode = code; attachment.Dat_Date = DateTime.Now; attachment.Dat_Creator = SessionConfig.UserId(); attachment.Dat_CreatorName = SessionConfig.UserName(); attachment.Dat_Code = diInstance.GenerateAttachmentCode(); diInstance.AddAttachment(attachment); BLL.Bll_Comm.OpLog("Upload", "Upload", string.Format("上传附件:{0}", attachment.Dat_RefCode)); return(new JsonResult { Data = new { result = "success", Msg = "数据更新成功!" } }); }
public static void InsertRunSql(string Sql, Hashtable Params, string Fun, string Error) { try { StringBuilder strPara = new StringBuilder(); ADOSys_RunLog instance = new ADOSys_RunLog(); Sys_RunLog model = new Sys_RunLog(); model.Log_Date = DateTime.Now; model.Log_Fun = Fun; model.Log_Error = Error; foreach (DictionaryEntry item in Params) { strPara.Append(item.Key + "=" + item.Value); } model.Log_SQLParameter = strPara.ToString(); model.Log_Author = SessionConfig.UserId() + "," + SessionConfig.UserName(); model.Log_SQL = Sql; instance.Add(model); } catch (Exception) { } }
public JsonResult FileOperation(FormCollection formCollect) { var flag = false; Bse_File doc = new Bse_File(); bmHelper.BindFormToModel <Bse_File>(doc, formCollect); string type = formCollect["optype"]; int isback = 0; if (formCollect["formOper"] == "edit") { doc.UpdateTime = DateTime.Now; if (type == "nor") { doc.CF_iType = "Draft"; } else if (type == "submit") { doc.CF_iType = "Normal"; //进入审核流程 doc.AuditStat = "Auditing"; var model = auditInstance.GetVerifyTemplateFirstNode(AuditModuleEnum.ComFileAudit.ToString()); if (model != null) { doc.AuditCurAudit = model.VT_VerifyNode_Code; } } flag = fInstance.UpdateModel(doc); BLL.Bll_Comm.OpLog("Bse_FileModule", "FileOperation", string.Format("更新文件:{0}", doc.CF_Code)); } else { isback = 1; doc.CreateTime = DateTime.Now; doc.UpdateTime = DateTime.Now; if (type == "nor") { doc.CF_iType = "Draft"; } else { doc.CF_iType = "Normal"; //进入审核流程 doc.AuditStat = "Auditing"; var model = auditInstance.GetVerifyTemplateFirstNode(AuditModuleEnum.DocumentAudit.ToString()); if (model != null) { doc.AuditCurAudit = model.VT_VerifyNode_Code; } } doc.CF_Creator = SessionConfig.UserId(); doc.CF_CreatorName = SessionConfig.UserName(); flag = fInstance.AddModel(doc); //日志记录 BLL.Bll_Comm.OpLog("Bse_FileModule", "FileOperation", string.Format("添加文件:{0}", doc.CF_Code)); } if (flag) { return(Json(new { result = "success", isBack = isback, Msg = "数据更新成功!" }, "application/json")); } else { return(Json(new { result = "fail", Msg = "数据更新失败!" }, "application/json")); } }
/// <summary> /// Action操作后处理:日志 /// </summary> /// <param name="filterContext"></param> public void OnActionExecuted(ActionExecutedContext filterContext) { //var f=filterContext.ActionDescriptor.GetParameters(); PlateLog.WriteOp(SessionConfig.UserId(), SessionConfig.UserName(), SessionConfig.CurrentIP(), HttpContext.Current.Request.Url.AbsoluteUri, filterContext.ActionDescriptor.ActionName, PlateLog.LogMessageType.Info, Module, ModuleName); }
/// <summary> /// Bug操作 /// </summary> /// <param name="id"></param> /// <param name="page"></param> /// <param name="rows"></param> /// <param name="search"></param> /// <param name="sidx"></param> /// <param name="sord"></param> /// <returns></returns> public ActionResult GetList(string id, int page, int rows, string search, string sidx, string sord) { //获取当前用户BUG组别 var UserName = SessionConfig.UserName(); var RoleSql = ""; EnumBugUserGroup Role = CurrentUserRole(); switch (Role) { case EnumBugUserGroup.GDev: RoleSql = " AND (Sys_UserName='******' or Sys_Owner='" + UserName + "' ) "; break; case EnumBugUserGroup.GTest: RoleSql = " AND (Sys_UserName='******' or Sys_Owner='" + UserName + "') "; break; case EnumBugUserGroup.GAdmin: break; default: break; } List <Sys_Bug> list = new List <Sys_Bug>(); string filters = Request["filters"]; string filtersSql = string.Empty; if (!string.IsNullOrEmpty(filters)) { filtersSql = " AND " + filters.BuildSearch("Sys_BugModule"); } if (!string.IsNullOrEmpty(id)) { filtersSql += "and Sys_Project='" + id + "'"; } if (!string.IsNullOrEmpty(RoleSql)) { filtersSql += RoleSql; } if (!string.IsNullOrEmpty(filtersSql)) { list = bugInstance.GetListByCode(filtersSql); } else { list = bugInstance.GetAll(); } //字典 if (list.Count() > 0) { foreach (var item in list) { var dictModel = dictInstance.GetModel(" AND Dict_Code='" + item.Sys_Status + "'"); if (dictModel != null) { item.Sys_Status = dictModel.Dict_Name; } } } var model = list.AsQueryable <Sys_Bug>(); var result = JsonConvert.SerializeObject(model.ToJqGridData(page, rows, null, search, null), new JsonDateConverter("yyyy-MM-dd HH:mm")); return(JavaScript(result)); }