/// <summary> /// 设置默认公众号 /// </summary> /// <param name="MpID"></param> /// <returns></returns> public JsonResult SetDefaultMp(string MpID) { var mpUserRelationFO = Formula.FormulaHelper.CreateFO <MpUserRelationFO>(); mpUserRelationFO.SetDefaultMp(this.CurrentUserInfo.UserID, MpID); return(Json(JsonAjaxResult.Successful())); }
public JsonAjaxResult _Print(PrintPara para) { JsonAjaxResult jsonR = new JsonAjaxResult(); entities.Set <S_E_PublishInfoDetail>().Where(a => a.ID == para.ID) .Update(a => { a.Count = a.Count + para.Count; a.Printed = true; }); Formula.Exceptions.BusinessException e = null; try { entities.SaveChanges(); } catch (Formula.Exceptions.BusinessException ex) { jsonR.Message = ex.Message; jsonR.StatusCode = 500; } if (e != null) { jsonR.Message = e.Message; jsonR.StatusCode = 500; } else { jsonR.Message = "操作成功"; jsonR.StatusCode = 200; } return(jsonR); }
public JsonResult SaveUserLinkMan(string linkManID) { linkManID = linkManID.Substring(1, linkManID.Length - 2); string userID = Formula.FormulaHelper.GetUserInfo().UserID; SQLHelper sqlHelper = SQLHelper.CreateSqlHelper("Base"); DataTable dt1 = sqlHelper.ExecuteDataTable(string.Format("select ID from S_A_UserLinkMan where UserID='{0}' and LinkManID='{1}' ", userID, linkManID)); if (dt1.Rows.Count > 0) { return(Json(JsonAjaxResult.Successful("联系人已存在!"))); } string newID = FormulaHelper.CreateGuid(); object obj = sqlHelper.ExecuteScalar(string.Format("select Max(SortIndex) as SortIndex from S_A_UserLinkMan where UserID='{0}'", userID)); double maxSort = 0; if (obj is DBNull) { maxSort = 0; } else { maxSort = Convert.ToDouble(obj); } sqlHelper.ExecuteDataTable(string.Format("Insert Into S_A_UserLinkMan (ID,UserID,LinkManID,SortIndex) Values ('{0}','{1}','{2}',{3})", newID, userID, linkManID, Math.Ceiling(maxSort) + 1)); return(Json(JsonAjaxResult.Successful("添加成功!"))); }
/// <summary> /// 设置默认企业号 /// </summary> /// <param name="QyID"></param> /// <returns></returns> public JsonResult SetDefaultQy(string QyID) { var qyUserRelationFO = Formula.FormulaHelper.CreateFO <QyUserRelationFO>(); qyUserRelationFO.SetDefaultQy(this.CurrentUserInfo.UserID, QyID); return(Json(JsonAjaxResult.Successful())); }
public JsonResult DeleteEmployee() { string listIDs = Request["ListIDs"]; string[] idArray = listIDs.Split(','); entities.Set <T_Employee>().Where(c => idArray.Contains(c.ID)).Update(c => { c.IsDeleted = "1"; c.DeleteTime = DateTime.Now; }); entities.SaveChanges(); return(Json(JsonAjaxResult.Successful())); }
public override JsonResult Delete() { #region 假删除 var IDs = (Request["ListIDs"] ?? "").Split(','); var mpid = GetQueryString("MpID"); var etys = entities.Set <MpMessage>().Where(c => IDs.Contains(c.ID) && c.IsDelete == 0).ToList(); var wxFO = Formula.FormulaHelper.CreateFO <WxFO>(); for (int i = 0; i < etys.Count(); i++) { var entity = etys[i]; entity.IsDelete = 1; } entities.SaveChanges(); return(Json(JsonAjaxResult.Successful())); #endregion }
public JsonResult SyncSystemUser() { string Ids = Request["IDs"]; if (string.IsNullOrWhiteSpace(Ids)) { return(Json("")); } BaseEntities baseEntities = FormulaHelper.GetEntities <BaseEntities>(); EmployeeFo fo = new EmployeeFo(); List <S_HR_Employee> employeeList = this.ComprehensiveDbContext.Set <S_HR_Employee>().Where(c => c.IsHaveAccount == "1" && Ids.Contains(c.ID)).ToList(); if (employeeList == null || employeeList.Count == 0) { return(Json("")); } foreach (S_HR_Employee employee in employeeList) { if (string.IsNullOrEmpty(employee.UserID)) { fo.EmployeeAddToUser(employee, FormsAuthentication.HashPasswordForStoringInConfigFile(employee.Code.ToLower(), "SHA1")); } else { var user = baseEntities.Set <S_A_User>().Find(employee.UserID); if (user == null) { fo.EmployeeAddToUser(employee, FormsAuthentication.HashPasswordForStoringInConfigFile(employee.Code.ToLower(), "SHA1")); } else if (employee.IsDeleted == "0") //Update { fo.EmployeeUpdateToUser(employee); } else { fo.EmployeeDeleteToUser(employee);//Delete } } } return(Json(JsonAjaxResult.Successful())); }
public JsonResult AddFile() { var mpid = GetQueryString("MpID"); var filename = GetQueryString("FileName"); var wxFO = Formula.FormulaHelper.CreateFO<WxFO>(); foreach (var fn in filename.Split(',').Where(c => !string.IsNullOrEmpty(c))) { FsFileInfo fileInfo = masterService.GetFileInfo(fn, WeChatConfig.FileServerName); var entity = GetEntity<MpMediaVideo>(""); EntityCreateLogic(entity); entity.IsDelete = 0; entity.MpID = mpid; entity.Title = fileInfo.FileName.Substring(fileInfo.FileName.IndexOf('_') + 1); entity.FileID = fileInfo.FileName; var mediaid = wxFO.AddVideoFile(mpid, fileInfo.FileFullPath, entity.Title, ""); entity.MediaID = mediaid; entities.Set<MpMediaVideo>().Add(entity); } entities.SaveChanges(); return Json(JsonAjaxResult.Successful()); }
public JsonAjaxResult _UpdatePrintConfig(List <UpdatePrintConfigPara> paras) { JsonAjaxResult jsonR = new JsonAjaxResult(); foreach (UpdatePrintConfigPara dic in paras) { entities.Set <S_E_PublishInfoDetail>().Where(a => a.ID == dic.ID) .Update(a => { a.PaperSize = dic.PaperSize; a.IsVertical = dic.IsVertical; }); } Formula.Exceptions.BusinessException e = null; try { entities.SaveChanges(); } catch (Formula.Exceptions.BusinessException ex) { jsonR.Message = ex.Message; jsonR.StatusCode = 500; } if (e != null) { jsonR.Message = e.Message; jsonR.StatusCode = 500; } else { jsonR.Message = "操作成功"; jsonR.StatusCode = 200; } return(jsonR); }
public JsonAjaxResult _GetList(SearchPara para) { SearchResult result = new SearchResult(); JsonAjaxResult jsonR = new JsonAjaxResult() { Data = result }; Expression <Func <S_E_PublishInfoDetail, bool> > predicate = a => true; int pageIndex = 1; int pageSize = 10; if (para != null) { pageIndex = para.CurPage; pageSize = para.PageSize; predicate = And(predicate, a => a.Printed == para.Printed && !string.IsNullOrEmpty(a.PdfFile)); if (!string.IsNullOrEmpty(para.ProjectInfoName)) { predicate = And(predicate, a => a.ProjectInfoName.Contains(para.ProjectInfoName)); } if (!string.IsNullOrEmpty(para.ProjectCode)) { predicate = And(predicate, a => a.ProjectCode.Contains(para.ProjectCode)); } if (!string.IsNullOrEmpty(para.ProjectManager)) { predicate = And(predicate, a => a.S_E_PublishInfo.S_I_ProjectInfo.ChargeUserName.Contains(para.ProjectManager)); } if (!string.IsNullOrEmpty(para.ChargeDeptName)) { predicate = And(predicate, a => a.ChargeDeptName.Contains(para.ChargeDeptName)); } if (!string.IsNullOrEmpty(para.DesignerName)) { predicate = And(predicate, a => a.DesingerName.Contains(para.DesignerName)); } if (para.SubmitDateFrm != null) { predicate = And(predicate, a => a.PublishDate >= para.SubmitDateFrm); } if (para.SubmitDateTo != null) { DateTime to = para.SubmitDateTo.Value.AddDays(1); predicate = And(predicate, a => a.PublishDate < to); } } else { jsonR.Message = "传入的SearchPara参数为空,过滤条件失效,默认显示10条数据"; } if (pageIndex < 1) { pageIndex = 1; } var itemIndex = (pageIndex - 1) * pageSize; Formula.Exceptions.BusinessException e = null; try { result.PageList = entities.Set <S_E_PublishInfoDetail>().Include("S_E_PublishInfo").Include("S_E_PublishInfo.S_I_ProjectInfo") .Where(predicate.Compile()) .OrderBy(a => a.ProductCode) .Skip(itemIndex).Take(pageSize).ToList().Select(a => { var dic = new Dictionary <string, object>(); dic = a.ToDic(); dic.SetValue("ProjectManagerName", a.S_E_PublishInfo.S_I_ProjectInfo.ChargeUserName); dic.SetValue("MajorName", a.S_E_PublishInfo.MajorName); dic.SetValue("StepName", a.S_E_PublishInfo.S_I_ProjectInfo.PhaseName); return(dic); }).ToList(); result.Total = entities.Set <S_E_PublishInfoDetail>().Count(predicate.Compile()); } catch (Formula.Exceptions.BusinessException ex) { e = ex; } if (e != null) { jsonR.Message = e.Message; jsonR.StatusCode = 500; } else { jsonR.Message = "获取成功"; jsonR.StatusCode = 200; } return(jsonR); }