public IHttpActionResult Save(ConsInfoDTO <RenewalInfo, RenewalConsInfo> postData) { using (TransactionScope tranScope = new TransactionScope()) { postData.Entity.Save(postData.ProjectComment, () => { var tool = RenewalTool.Get(postData.Entity.ProjectId); postData.Info.NeedProjectCostEst = postData.Entity.HasReinvenstment; postData.Info.Update(); if (postData.ReinBasicInfo != null) { postData.ReinBasicInfo.ConsInfoID = postData.Entity.Id; postData.ReinBasicInfo.Save(); } if (postData.ReinCost != null) { postData.ReinCost.ConsInfoID = postData.Entity.Id; postData.ReinCost.Save(); } if (postData.WriteOff != null) { postData.WriteOff.ConsInfoID = postData.Entity.Id; postData.WriteOff.Save(); } }); tranScope.Complete(); } return(Ok()); }
public IHttpActionResult Submit(ConsInfoDTO <RenewalInfo, RenewalConsInfo> postData) { postData.Entity.Submit(postData.ProjectComment, () => { postData.Info.NeedProjectCostEst = postData.Entity.HasReinvenstment; postData.Info.Update(); if (postData.Info.NeedProjectCostEst) { if (postData.ReinBasicInfo != null) { postData.ReinBasicInfo.ConsInfoID = postData.Entity.Id; postData.ReinBasicInfo.Save(); } if (postData.ReinCost != null) { postData.ReinCost.ConsInfoID = postData.Entity.Id; postData.ReinCost.Save(); } if (postData.WriteOff != null) { postData.WriteOff.ConsInfoID = postData.Entity.Id; postData.WriteOff.Save(); } } }); return(Ok()); }
public static ConsInfoDTO <RenewalInfo, RenewalConsInfo> InitPage(string projectId, string id = "") { RenewalInfo info = RenewalInfo.Get(projectId); var consInfo = RenewalConsInfo.Get(projectId, id); if (consInfo == null) { consInfo = new RenewalConsInfo(); consInfo.ProjectId = projectId; } var isOriginator = ClientCookie.UserCode == info.PMAccount; consInfo.IsProjectFreezed = consInfo.CheckIfFreezeProject(projectId); var nextRefTableId = new Guid(FlowInfo.GetRefTableId("RenewalTool", projectId)); var nextFlowStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Tool); var haveTask = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Tool && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode); var projectComment = ProjectComment.GetSavedComment(consInfo.Id, "RenewalConsInfo", ClientCookie.UserCode); if (string.IsNullOrEmpty(id)) { consInfo.HasReinvenstment = info.NeedProjectCostEst; } ConsInfoDTO <RenewalInfo, RenewalConsInfo> dto = new ConsInfoDTO <RenewalInfo, RenewalConsInfo>(); dto.Entity = consInfo; dto.Info = info; dto.ReinBasicInfo = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id); dto.ReinCost = ReinvestmentCost.GetByConsInfoId(consInfo.Id); dto.WriteOff = WriteOffAmount.GetByConsInfoId(consInfo.Id); dto.ProjectComment = projectComment != null ? projectComment.Content : ""; dto.Editable = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_ConsInfo); dto.Recallable = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_ConsInfo); dto.Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_ConsInfo) && string.IsNullOrEmpty(id); return(dto); }
public IHttpActionResult Return(ConsInfoDTO <RenewalInfo, RenewalConsInfo> postData) { postData.Entity.Return(postData.ProjectComment, postData.SN); return(Ok()); }