public void Save(string comment) { if (Any(p => p.Id == this.Id)) { Update(this); } else { Add(this); } var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { //SavedComment.Status = ProjectCommentStatus.Submit; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Submit, comment, this.Id, this.TableName, FlowCode.TempClosure, null, ProjectCommentStatus.Save ); } }
public void Approve(string comment, string SerialNumber) { K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Approve", comment); var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { SavedComment.Status = ProjectCommentStatus.Submit; SavedComment.Action = ProjectCommentAction.Approve; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Approve, comment, this.Id, this.TableName, FlowCode.TempClosure, this.ProcInstId, ProjectCommentStatus.Submit ); } }
public override void Recall(string comment) { using (TransactionScope tranScope = new TransactionScope()) { ProjectInfo.Reset(this.ProjectId, this.WorkflowCode, ProjectStatus.Recalled); ProjectComment.AddComment( ProjectCommentAction.Recall, comment, this.Id, this.TableName, FlowCode.TempClosure, this.ProcInstId, ProjectCommentStatus.Submit ); var actor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == this.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor); var legal = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == this.ProjectId && pu.RoleCode == ProjectUserRoleCode.Legal); var oldUnfinishTasks = TaskWork.Search(t => t.RefID == this.ProjectId && t.TypeCode == FlowCode.TempClosure_LegalReview && t.Status == TaskWorkStatus.UnFinish).ToList(); oldUnfinishTasks.ForEach(t => { t.Status = TaskWorkStatus.Cancel; }); TaskWork.Update(oldUnfinishTasks.ToArray()); tranScope.Complete(); } string comments = ClientCookie.UserNameZHCN + "进行了流程撤回操作"; K2FxContext.Current.GoToActivityAndRecord( this.ProcInstId.Value, this.WorkflowActOriginator, ClientCookie.UserCode, ProjectAction.Recall, comments ); //ProjectInfo.Reset(this.ProjectId, WorkflowCode); }
private void SaveComment() { var projectComment = new ProjectComment() { RefTableId = Id, RefTableName = _refTableName, CreateTime = CreateTime, CreateUserAccount = CreateUserAccount, CreateUserNameZHCN = CreateUser.NameZHCN, UserAccount = CreateUserAccount, UserNameENUS = CreateUser.NameENUS, Id = Guid.NewGuid(), Action = ProjectCommentAction.Submit, Status = ProjectCommentStatus.Submit, ProcInstID = ProcInstId, SourceCode = FlowCode.Reimage, SourceNameENUS = FlowCode.Reimage, SourceNameZHCN = "" }; if (!string.IsNullOrEmpty(Comment)) { projectComment.Content = Comment.Trim(); } var userInfo = ProjectUsers.Get(CreateUserAccount, ProjectId); if (userInfo != null) { projectComment.TitleCode = userInfo.RoleCode; projectComment.TitleNameENUS = userInfo.RoleNameENUS; projectComment.TitleNameZHCN = userInfo.RoleNameZHCN; } projectComment.Add(); }
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 static RenewalPackageDTO InitPage(string projectId, string id = null) { RenewalPackageDTO dto = new RenewalPackageDTO(); var entity = RenewalPackage.Get(projectId, id); var project = ProjectInfo.Get(projectId, FlowCode.Renewal_Package); var info = RenewalInfo.Get(projectId); entity.IsProjectFreezed = entity.CheckIfFreezeProject(projectId); entity.GenerateCover(); var haveTask = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Package && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode); var projectComment = ProjectComment.GetSavedComment(entity.Id, "RenewalPackage", ClientCookie.UserCode); var projectNode = NodeInfo.GetNodeInfo(project.NodeCode); dto.Info = info; dto.Entity = entity; dto.Analysis = RenewalAnalysis.Get(entity.AnalysisId.Value); dto.FinMeasureOutput = RenewalToolFinMeasureOutput.GetByToolId(entity.ToolId.Value); dto.Uploadable = projectNode.Sequence >= 4 && ClientCookie.UserCode == dto.Info.AssetActorAccount; var editStatuses = new[] { ProjectStatus.Finished, ProjectStatus.Rejected }; dto.ProjectComment = projectComment != null ? projectComment.Content : ""; dto.Editable = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Package); dto.Recallable = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Package); dto.Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Package) && string.IsNullOrEmpty(id); if (entity.ProcInstId.HasValue) { var currentActivityName = K2FxContext.Current.GetCurrentActivityName(entity.ProcInstId.Value); dto.Rejectable = !entity.WorkflowNormalActors.Contains(currentActivityName); } dto.IsLindaLu = string.Compare(ClientCookie.UserCode, ConfigurationManager.AppSettings["AssetMgrCode"], true) == 0; return(dto); }
public void Save(string comment, Action onExecuting = null) { using (TransactionScope tranScope = new TransactionScope()) { var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { SavedComment.Status = ProjectCommentStatus.Save; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Submit, comment, this.Id, this.TableName, FlowCode.Renewal, null, ProjectCommentStatus.Save ); } this.Update(); if (onExecuting != null) { onExecuting(); } tranScope.Complete(); } }
public void Resubmit(string comment, string SerialNumber, Action onExecuting = null) { var task = TaskWork.FirstOrDefault(t => t.RefID == this.ProjectId && t.TypeCode == this.WorkflowCode && t.ReceiverAccount == ClientCookie.UserCode); var dataFields = SetWorkflowDataFields(task); K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Resubmit", comment, dataFields); using (TransactionScope tranScope = new TransactionScope()) { task.Finish(); this.CreateUserAccount = ClientCookie.UserCode; this.Update(); ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_Tool_Input); ProjectComment.AddComment( ProjectCommentAction.ReSubmit, comment, this.Id, this.TableName, FlowCode.Renewal, this.ProcInstId, ProjectCommentStatus.Submit ); if (onExecuting != null) { onExecuting(); } tranScope.Complete(); } }
public void Resubmit(string comment, string SerialNumber) { K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Resubmit", comment); using (TransactionScope tranScope = new TransactionScope()) { this.CreateUserAccount = ClientCookie.UserCode; this.Update(); var approveDialogUser = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString()); approveDialogUser.LegalCode = AppUsers.Legal.Code; //approveDialogUser.GeneralCounselCode = AppUsers.GeneralCounsel.Code; approveDialogUser.LastUpdateDate = DateTime.Now; approveDialogUser.LastUpdateUserAccount = ClientCookie.UserCode; approveDialogUser.Update(); ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_LegalApproval_Input); ProjectComment.AddComment( ProjectCommentAction.ReSubmit, comment, this.Id, this.TableName, FlowCode.Renewal, this.ProcInstId, ProjectCommentStatus.Submit ); tranScope.Complete(); } }
public void Reject(string comment, string SerialNumber) { K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, ProjectAction.Decline, comment); using (TransactionScope tranScope = new TransactionScope()) { ProjectInfo.Reject(this.ProjectId, this.WorkflowCode); var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { SavedComment.Status = ProjectCommentStatus.Submit; SavedComment.Action = ProjectCommentAction.Decline; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Decline, comment, this.Id, this.TableName, FlowCode.TempClosure, this.ProcInstId, ProjectCommentStatus.Submit ); } tranScope.Complete(); } }
public override List <ProjectComment> GetEntityProjectComment() { var souceCode = WorkflowCode.Split('_')[0]; return(ProjectComment.Search(e => e.RefTableName == TableName && e.SourceCode == souceCode && e.RefTableId == Id && e.Status == ProjectCommentStatus.Submit) .OrderBy(e => e.CreateTime).ToList()); }
public void Submit(string comment, Action onExecuting = null) { var legal = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == this.ProjectId && pu.RoleCode == ProjectUserRoleCode.Legal); var task = TaskWork.GetTaskWork(this.ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish, FlowCode.TempClosure, this.WorkflowCode); task.Status = TaskWorkStatus.Finished; task.FinishTime = DateTime.Now; List <ProcessDataField> dataFields = new List <ProcessDataField> { new ProcessDataField("dest_Creator", this.CreateUserAccount), new ProcessDataField("dest_Legal", legal.UserAccount), new ProcessDataField("ProcessCode", this.WorkflowProcessCode), new ProcessDataField("ProjectTaskInfo", JsonConvert.SerializeObject(task)) }; var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields); if (procInstId > 0) { using (TransactionScope tranScope = new TransactionScope()) { TaskWork.Update(task); this.ProcInstId = procInstId; this.CreateTime = DateTime.Now; this.CreateUserAccount = ClientCookie.UserCode; this.Update(); var project = ProjectInfo.Get(this.ProjectId, this.WorkflowCode); project.CreateUserAccount = ClientCookie.UserCode; project.Update(); var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { SavedComment.Status = ProjectCommentStatus.Submit; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Submit, comment, this.Id, this.TableName, FlowCode.TempClosure, procInstId, ProjectCommentStatus.Submit ); } ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.TempClosure_LegalReview_Input); if (onExecuting != null) { onExecuting(); } tranScope.Complete(); } } }
public void Submit(string comment, Action onExecuting = null) { try { RenewalInfo info = RenewalInfo.Get(this.ProjectId); var task = TaskWork.GetTaskWork(ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish, FlowCode.Renewal, WorkflowCode); var dataFields = SetWorkflowDataFields(task); var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields); if (procInstId > 0) { using (var tranScope = new TransactionScope()) { task.Finish(); this.ProcInstId = procInstId; this.CreateTime = DateTime.Now; this.CreateUserAccount = ClientCookie.UserCode; this.Update(); var project = ProjectInfo.Get(this.ProjectId, this.WorkflowCode); project.CreateUserAccount = ClientCookie.UserCode; project.Update(); var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { SavedComment.Status = ProjectCommentStatus.Submit; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Submit, comment, this.Id, this.TableName, FlowCode.Renewal, procInstId, ProjectCommentStatus.Submit ); } ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_Tool_Input); if (onExecuting != null) { onExecuting(); } tranScope.Complete(); } } } catch (Exception ex) { Log4netHelper.WriteInfo("[[Renewal Too]]:" + JsonConvert.SerializeObject(ex)); throw ex; } }
public void Submit(string comment, Action onExecuting = null) { var actor = ProjectUsers.GetProjectUser(this.ProjectId, ProjectUserRoleCode.AssetActor); var task = TaskWork.GetTaskWork(ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish, FlowCode.Renewal, WorkflowCode); var dataFields = SetWorkflowDataFields(task); var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields); if (procInstId > 0) { using (TransactionScope tranScope = new TransactionScope()) { this.ProcInstId = procInstId; this.CreateTime = DateTime.Now; this.CreateUserAccount = ClientCookie.UserCode; this.Update(); var approveDialogUser = new ApproveDialogUser(); approveDialogUser.Id = Guid.NewGuid(); approveDialogUser.LegalCode = AppUsers.Legal.Code; approveDialogUser.ProjectId = this.ProjectId; approveDialogUser.FlowCode = this.WorkflowCode; approveDialogUser.RefTableID = this.Id.ToString(); approveDialogUser.Add(); var project = ProjectInfo.Get(this.ProjectId, this.WorkflowCode); project.CreateUserAccount = ClientCookie.UserCode; project.Update(); var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { SavedComment.Status = ProjectCommentStatus.Submit; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Submit, comment, this.Id, this.TableName, FlowCode.Renewal, procInstId, ProjectCommentStatus.Submit ); } ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_LegalApproval_Input); if (onExecuting != null) { onExecuting(); } tranScope.Complete(); } } }
public void Submit(string comment, Action onExecuting = null) { var task = TaskWork.GetTaskWork(ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish, FlowCode.Renewal, WorkflowCode); var dataFields = SetWorkflowDataFields(task); var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields); if (procInstId > 0) { using (TransactionScope tranScope = new TransactionScope()) { task.Finish(); this.ProcInstId = procInstId; this.CreateTime = DateTime.Now; this.CreateUserAccount = ClientCookie.UserCode; this.Update(); if (this.HasReinvenstment) { SaveApprovers(); } var project = ProjectInfo.Get(this.ProjectId, this.WorkflowCode); project.CreateUserAccount = ClientCookie.UserCode; project.Update(); var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { SavedComment.Status = ProjectCommentStatus.Submit; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Submit, comment, this.Id, this.TableName, FlowCode.Renewal, procInstId, ProjectCommentStatus.Submit ); } if (HasReinvenstment) { ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_ConsInfo_Input); } if (onExecuting != null) { onExecuting(); } tranScope.Complete(); } } }
public static bool EnableRecall(string tableName, Guid id) { bool enableRecall = false; var list = ProjectComment.Search(e => e.RefTableName == tableName.Trim() && e.RefTableId == id) .OrderByDescending(e => e.CreateTime).AsNoTracking().ToList(); if (list.Count > 0 && list[0].Action != ProjectAction.Recall) { enableRecall = true; } return(enableRecall); }
public void Approve(string comment, string SerialNumber) { K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Approve", comment); ProjectComment.AddComment( ProjectCommentAction.Approve, comment, this.Id, this.TableName, FlowCode.Renewal, this.ProcInstId, ProjectCommentStatus.Submit ); }
public void Approve(string comment, string SerialNumber) { K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Approve", comment); using (var tranScope = new TransactionScope()) { ProjectComment.AddComment( ProjectCommentAction.Approve, comment, this.Id, this.TableName, FlowCode.Renewal, this.ProcInstId, ProjectCommentStatus.Submit ); tranScope.Complete(); } }
public void Reject(string comment, string SerialNumber) { K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Reject", comment); using (TransactionScope tranScope = new TransactionScope()) { ProjectInfo.Reject(this.ProjectId, this.WorkflowCode); ProjectComment.AddComment( ProjectCommentAction.Decline, comment, this.Id, this.TableName, FlowCode.Renewal, this.ProcInstId, ProjectCommentStatus.Submit ); tranScope.Complete(); } }
public void Return(string comment, string SerialNumber) { K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Return", comment); using (TransactionScope tranScope = new TransactionScope()) { //TaskWork.Finish(t => t.ReceiverAccount == ClientCookie.UserCode && t.Status == TaskWorkStatus.UnFinish && t.TypeCode == this.WorkflowCode && t.RefID == this.ProjectId); ProjectInfo.Reset(this.ProjectId, this.WorkflowCode); ProjectComment.AddComment( ProjectCommentAction.Return, comment, this.Id, this.TableName, FlowCode.Renewal, this.ProcInstId, ProjectCommentStatus.Submit ); tranScope.Complete(); } }
public void GetFullInfo(ClosureWOCheckList entity) { if (entity != null) { ProjectCommentCondition condition = new ProjectCommentCondition(); condition.RefTableId = entity.Id; condition.RefTableName = ClosureWOCheckList.TableName; condition.UserAccount = ClientCookie.UserCode; condition.Status = ProjectCommentStatus.Save; var commentList = ProjectComment.SearchList(condition); if (commentList != null && commentList.Count > 0) { entity.Comments = commentList[0].Content; } var closureEntity = ClosureInfo.GetByProjectId(entity.ProjectId); entity.USCode = closureEntity.USCode; entity.UserAccount = ClientCookie.UserCode; } }
public void Resubmit(string comment, string SerialNumber) { K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Resubmit", comment); using (TransactionScope tranScope = new TransactionScope()) { this.CreateUserAccount = ClientCookie.UserCode; this.Update(); ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.TempClosure_LegalReview_Input); ProjectComment.AddComment( ProjectCommentAction.ReSubmit, comment, this.Id, this.TableName, FlowCode.TempClosure, this.ProcInstId, ProjectCommentStatus.Submit ); tranScope.Complete(); } }
private void SaveComments(string action) { if (action == "Edit") { return; } var comment = ProjectComment.GetSavedComment(Id, TableName, LastUpdateUserAccount); if (comment != null) { comment.Content = Comments; comment.Action = string.IsNullOrEmpty(action) ? "Save" : action; comment.Status = string.IsNullOrEmpty(action) ? ProjectCommentStatus.Save : ProjectCommentStatus.Submit; comment.Update(); } else { comment = new ProjectComment(); comment.Action = string.IsNullOrEmpty(action) ? "Save" : action; comment.ActivityName = ""; comment.Content = Comments; comment.CreateTime = DateTime.Now; comment.CreateUserAccount = LastUpdateUserAccount; comment.CreateUserNameENUS = LastUpdateUserNameENUS; comment.CreateUserNameZHCN = LastUpdateUserNameZHCN; comment.UserAccount = LastUpdateUserAccount; comment.UserNameENUS = LastUpdateUserNameENUS; comment.UserNameZHCN = LastUpdateUserNameZHCN; comment.RefTableId = Id; comment.Id = Guid.NewGuid(); comment.RefTableName = TableName; comment.SourceCode = FlowCode.Renewal; comment.SourceNameZHCN = FlowCode.Renewal; comment.SourceNameENUS = FlowCode.Renewal; comment.TitleNameENUS = ClientCookie.TitleENUS; comment.TitleNameZHCN = ClientCookie.TitleENUS; comment.Status = string.IsNullOrEmpty(action) ? ProjectCommentStatus.Save : ProjectCommentStatus.Submit; comment.ProcInstID = ProcInstID; comment.Add(); } }
public void Resubmit(string serialNumber) { var comment = ""; var task = TaskWork.FirstOrDefault(t => t.RefID == this.ProjectId && t.TypeCode == this.WorkflowCode && t.ReceiverAccount == ClientCookie.UserCode && t.Status == TaskWorkStatus.UnFinish); var dataFields = SetWorkflowDataFields(task); K2FxContext.Current.ApprovalProcess(serialNumber, ClientCookie.UserCode, "Resubmit", comment, dataFields); using (TransactionScope tranScope = new TransactionScope()) { Save(); ProjectComment.AddComment( ProjectCommentAction.ReSubmit, comment, this.Id, this.TableName, FlowCode.Renewal, this.ProcInstId, ProjectCommentStatus.Submit ); tranScope.Complete(); } }
private void SaveComments(string action) { var comment = ProjectComment.GetSavedComment(Id, "MajorLeaseLegalReview", ClientCookie.UserCode); if (comment != null) { comment.Content = Comments; comment.Action = string.IsNullOrEmpty(action) ? "Save" : action; comment.Status = string.IsNullOrEmpty(action) ? ProjectCommentStatus.Save : ProjectCommentStatus.Submit; comment.Update(); } else { comment = new ProjectComment(); comment.Action = string.IsNullOrEmpty(action) ? "Save" : action; comment.ActionDesc = comment.ActivityName = ""; comment.Content = Comments; comment.CreateTime = DateTime.Now; comment.CreateUserAccount = ClientCookie.UserCode; comment.CreateUserNameENUS = ClientCookie.UserNameENUS; comment.CreateUserNameZHCN = ClientCookie.UserNameZHCN; comment.UserAccount = ClientCookie.UserCode; comment.UserNameENUS = ClientCookie.UserNameENUS; comment.UserNameZHCN = ClientCookie.UserNameZHCN; comment.RefTableId = Id; comment.Id = Guid.NewGuid(); comment.RefTableName = "MajorLeaseLegalReview"; comment.SourceCode = FlowCode.MajorLease; comment.SourceNameZHCN = FlowCode.MajorLease; comment.SourceNameENUS = FlowCode.MajorLease; comment.TitleNameENUS = ClientCookie.TitleENUS; comment.TitleNameZHCN = ClientCookie.TitleENUS; comment.Status = string.IsNullOrEmpty(action) ? ProjectCommentStatus.Save : ProjectCommentStatus.Submit; comment.ProcInstID = ProcInstID; comment.Add(); } }
public static RenewalLegalApprovalDTO InitPage(string projectId, string id = null) { RenewalLegalApprovalDTO dto = new RenewalLegalApprovalDTO(); var entity = Get(projectId, id); var info = RenewalInfo.Get(projectId); var isActor = ClientCookie.UserCode == info.AssetActorAccount; entity.IsProjectFreezed = entity.CheckIfFreezeProject(projectId); var nextRefTableId = new Guid(FlowInfo.GetRefTableId(entity.TableName, projectId)); var nextFlowStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Package); var haveTask = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_LegalApproval && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode); var projectComment = ProjectComment.GetSavedComment(entity.Id, entity.TableName, ClientCookie.UserCode); var appUser = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString()); dto.Info = info; dto.Entity = entity; dto.ProjectComment = projectComment != null ? projectComment.Content : ""; dto.IsGeneralCounsel = appUser != null && appUser.GeneralCounselCode == ClientCookie.UserCode; dto.Editable = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_LegalApproval); dto.Recallable = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_LegalApproval); dto.Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_LegalApproval) && string.IsNullOrEmpty(id); return(dto); }
public void Approve(string comment, string SerialNumber, bool isGeneralCouncel) { if (isGeneralCouncel) { K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Approve", comment); } else { K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Approve", comment, SetWorkflowDataFieldsByLegal()); } using (TransactionScope tranScope = new TransactionScope()) { if (!isGeneralCouncel) { var approveDialogUser = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString()); approveDialogUser.GeneralCounselCode = AppUsers.GeneralCounsel.Code; approveDialogUser.Update(); } this.LastUpdateTime = DateTime.Now; this.LastUpdateUserAccount = ClientCookie.UserCode; this.Update(); ProjectComment.AddComment( ProjectCommentAction.Approve, comment, this.Id, this.TableName, FlowCode.Renewal, this.ProcInstId, ProjectCommentStatus.Submit ); if (!isGeneralCouncel) { ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_LegalApproval_LegalReview); } tranScope.Complete(); } }
public void Return(string comment, string SerialNumber) { TaskWork.Finish(e => e.RefID == ProjectId && e.TypeCode == WorkflowCode && e.Status == TaskWorkStatus.UnFinish); //&& e.K2SN != SerialNumber); K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Return", comment); using (TransactionScope tranScope = new TransactionScope()) { ProjectInfo.Reset(this.ProjectId, this.WorkflowCode, ProjectStatus.UnFinish); var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { SavedComment.Status = ProjectCommentStatus.Submit; SavedComment.Action = ProjectCommentAction.Return; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Return, comment, this.Id, this.TableName, FlowCode.TempClosure, this.ProcInstId, ProjectCommentStatus.Submit ); } tranScope.Complete(); } }
public override void Recall(string comment) { K2FxContext.Current.GoToActivityAndRecord( this.ProcInstId.Value, this.WorkflowActOriginator, ClientCookie.UserCode, ProjectAction.Recall, comment ); using (TransactionScope tranScope = new TransactionScope()) { ProjectComment.AddComment( ProjectCommentAction.Recall, comment, this.Id, this.TableName, FlowCode.Renewal, this.ProcInstId, ProjectCommentStatus.Submit ); ProjectInfo.Reset(this.ProjectId, this.WorkflowCode, ProjectStatus.Recalled); tranScope.Complete(); } }
public void Save(string comment) { var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode); if (SavedComment != null) { SavedComment.Status = ProjectCommentStatus.Save; SavedComment.Content = comment; SavedComment.CreateTime = DateTime.Now; SavedComment.Update(); } else { ProjectComment.AddComment( ProjectCommentAction.Submit, comment, this.Id, this.TableName, FlowCode.Renewal, null, ProjectCommentStatus.Save ); } }