//[AuthCheck(Module = WebModule.Bim, Right = SystemRight.Modify)] public ActionResult Edit(Epm_Bim model) { ResultView <int> view = new ResultView <int>(); //上传模型 string fileDataJson = Request.Form["fileDataJsonFile"]; //获取上传图片json字符串 List <Base_Files> fileListFile = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJson); //将文件信息json字符 //表单校验 //if (string.IsNullOrEmpty(model.Name)) //{ // view.Flag = false; // view.Message = "名称不能为空"; // return Json(view); //} //if (string.IsNullOrEmpty(model.VersionOrder)) //{ // view.Flag = false; // view.Message = "版本号不能为空"; // return Json(view); //} if (fileListFile != null) { model.BIMState = BIMModelState.BIMLightWeight.ToString(); } Result <int> result = new Result <int>(); using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(Request))) { result = proxy.UpdateBim(model, fileListFile); } return(Json(result.ToResultView())); }
///<summary> ///添加: ///</summary> /// <param name="model">要添加的model</param> /// <returns>受影响的行数</returns> public Result <int> AddBim(Epm_Bim model, List <Base_Files> fileListFile) { Result <int> result = new Result <int>(); try { model = base.SetCurrentUser(model); model.CrtCompanyId = CurrentCompanyID.ToLongReq(); model.CrtCompanyName = CurrentCompanyName; //bool dConfig = DataOperateBusiness<Epm_Bim>.Get().Count(i => i.Name == model.Name) > 0; //if (dConfig) //{ // throw new Exception("该模型名称已经存在"); //} var rows = DataOperateBusiness <Epm_Bim> .Get().Add(model); //上传模型 if (fileListFile != null) { AddFilesByTable(model, fileListFile); } //生成代办消息 if ((ApprovalState)model.State == ApprovalState.WaitAppr) { #region 生成待办 var project = DataOperateBusiness <Epm_Project> .Get().GetModel(model.ProjectId.Value); List <Epm_Approver> list = new List <Epm_Approver>(); Epm_Approver app = new Epm_Approver(); app.Title = CurrentUserName + "上传了BIM模型,待审核"; app.Content = CurrentUserName + "上传了BIM模型,待审核"; app.SendUserId = CurrentUserID.ToLongReq(); app.SendUserName = CurrentUserName; app.SendTime = DateTime.Now; app.LinkURL = string.Empty; app.BusinessTypeNo = BusinessType.Model.ToString(); app.Action = SystemRight.Add.ToString(); app.BusinessTypeName = BusinessType.Model.GetText(); app.BusinessState = (int)(ApprovalState.WaitAppr); app.BusinessId = model.Id; app.ApproverId = project.ContactUserId; app.ApproverName = project.ContactUserName; app.ProjectId = model.ProjectId; app.ProjectName = project.Name; list.Add(app); AddApproverBatch(list); WriteLog(BusinessType.Model.GetText(), SystemRight.Add.GetText(), "提交模型生成待办: " + model.Id); #endregion #region 消息 var waitSend = GetWaitSendMessageList(model.ProjectId.Value); foreach (var send in waitSend) { Epm_Massage modelMsg = new Epm_Massage(); modelMsg.ReadTime = null; modelMsg.RecId = send.Key; modelMsg.RecName = send.Value; modelMsg.RecTime = DateTime.Now; modelMsg.SendId = CurrentUserID.ToLongReq(); modelMsg.SendName = CurrentUserName; modelMsg.SendTime = DateTime.Now; modelMsg.Title = CurrentUserName + "上传了BIM模型,待审核"; modelMsg.Content = CurrentUserName + "上传了BIM模型,待审核"; modelMsg.Type = 2; modelMsg.IsRead = false; modelMsg.BussinessId = model.Id; modelMsg.BussinesType = BusinessType.Model.ToString(); modelMsg.ProjectId = model.ProjectId.Value; modelMsg.ProjectName = model.ProjectName; modelMsg = base.SetCurrentUser(modelMsg); modelMsg = base.SetCreateUser(modelMsg); DataOperateBusiness <Epm_Massage> .Get().Add(modelMsg); } #endregion #region 发送短信 //Dictionary<string, string> parameterSms = new Dictionary<string, string>(); //parameterSms.Add("UserName", CurrentUserName); //WriteSMS(project.ContactUserId.Value, project.CompanyId, MessageStep.ModelAdd, parameterSms); #endregion } result.Data = rows; result.Flag = EResultFlag.Success; WriteLog(BusinessType.Model.GetText(), SystemRight.Add.GetText(), "新增: " + model.Id); } catch (Exception ex) { result.Data = -1; result.Flag = EResultFlag.Failure; result.Exception = new ExceptionEx(ex, "AddBim"); } return(result); }