public static bool DeLinkMAF(Post_WsS2GuidModel post_WsS2GuidModel) { using (var db = new S2DbContext()) { var original = db.MasterAuditFile.Find(post_WsS2GuidModel.MasterAuditFileId); original.IsActive = false; original.UpdateDate = DateTime.Now; original.UpdatedBy = AmUtil.GetCurrentUser; //original.EngagementNumber = null;//DBNull.Value; db.SaveChanges(); } WsActivity.CallEmailActivities("UnlinkingRequest", "UnlinkingRequest_10", "0", post_WsS2GuidModel.MasterAuditFileId, string.Format("{0}#%1#{1}#%1#{2}", post_WsS2GuidModel.Comment, post_WsS2GuidModel.EngNum, post_WsS2GuidModel.EngName)); var isEngS2 = ValidateIsEngS2(post_WsS2GuidModel.EngNum); if (!isEngS2) { UpdateWs(post_WsS2GuidModel.WsId, false); } IM.Mgr.WsUtility.SaveGuidInfo_DeLink(post_WsS2GuidModel.MafGuid, post_WsS2GuidModel.EngNum, post_WsS2GuidModel.Comment, post_WsS2GuidModel.MasterAuditFileId); return(isEngS2); }
public static string UpdateFileActivity(FileActivity_UpdateModel activityUpdateModel) { string returnStatus = null; if (activityUpdateModel.FileIn == FileIn.S2) { using (var db = new S2DbContext()) { if (activityUpdateModel.WsActivityType == WsActivityType.Activity_Reprocess) { WsActivity.CallEmailActivities("RepreocessServer2RETFile", "ReprocessRequested_14", activityUpdateModel.FileUniqueId, 0, activityUpdateModel.Comment); } if (activityUpdateModel.WsActivityType == WsActivityType.Activity_Acknowledge && activityUpdateModel.NonAuditFlag.HasValue ? activityUpdateModel.NonAuditFlag.Value : false) { var relatedEngFiles = WsOperation.GetRelated_S2_YrEnd_Audit_EngDoc_Num(activityUpdateModel.FileNum); relatedEngFiles.ForEach(x => Workspace.Move_YrEnd_Audit_RET_N_ENG_To_ElecWp(activityUpdateModel.FileNum, x, activityUpdateModel.EngNum)); } SqlParameter p1 = new SqlParameter("@WorkbookReviewId", activityUpdateModel.FileUniqueId); SqlParameter p2 = new SqlParameter("@Status", (activityUpdateModel.WsActivityType == WsActivityType.Activity_Acknowledge) ? "Acknowledged" : "Removed"); SqlParameter p3 = new SqlParameter("@UpdatedBy", string.IsNullOrWhiteSpace(activityUpdateModel.logAs) ? AmUtil.GetCurrentUser : activityUpdateModel.logAs); SqlParameter p4; if (activityUpdateModel.NonAuditFlag.HasValue) { p4 = new SqlParameter("@NonAuditFlag", activityUpdateModel.NonAuditFlag.Value); } else { p4 = new SqlParameter("@NonAuditFlag", DBNull.Value); } SqlParameter p5 = new SqlParameter("@docNum", activityUpdateModel.FileNum); db.Database.ExecuteSqlCommand("EXEC [S2CLR].spUpdateReviewStatus @WorkbookReviewId, @Status, @UpdatedBy, @NonAuditFlag, @docNum", p1, p2, p3, p4, p5); } var docStatus = AuditManager.Rep.Workspace.GetFileStatus_S2(new List <int> { (int)activityUpdateModel.FileNum }); returnStatus = docStatus.FirstOrDefault().Status; } else if (activityUpdateModel.FileIn == FileIn.SSC) { if (activityUpdateModel.WsActivityType == WsActivityType.Activity_Acknowledge || activityUpdateModel.WsActivityType == WsActivityType.Activity_Reprocess) { using (var db = new SSCDbContext()) { SqlParameter p1 = new SqlParameter("@FAId", activityUpdateModel.FileUniqueId); SqlParameter p2 = new SqlParameter("@success", (activityUpdateModel.WsActivityType == WsActivityType.Activity_Acknowledge)); SqlParameter p3; if (string.IsNullOrWhiteSpace(activityUpdateModel.Comment)) { p3 = new SqlParameter("@comments", DBNull.Value); } else { p3 = new SqlParameter("@comments", activityUpdateModel.Comment); } SqlParameter p4 = new SqlParameter("@activityEndDate", DateTime.Now.ToUniversalTime()); SqlParameter p5 = new SqlParameter("@userId", string.IsNullOrWhiteSpace(activityUpdateModel.logAs) ? AmUtil.GetCurrentUser : activityUpdateModel.logAs); SqlParameter p6 = new SqlParameter("@docNum", activityUpdateModel.FileNum); db.Database.ExecuteSqlCommand("spCloseActivity @FAId, @success, @comments, @activityEndDate, @userId", p1, p2, p3, p4, p5); } } else if (activityUpdateModel.WsActivityType == WsActivityType.Activity_Remove) { using (var db = new SSCDbContext()) { SqlParameter p1 = new SqlParameter("@FAId", activityUpdateModel.FileUniqueId); SqlParameter p2; if (string.IsNullOrWhiteSpace(activityUpdateModel.Comment)) { p2 = new SqlParameter("@comments", DBNull.Value); } else { p2 = new SqlParameter("@comments", activityUpdateModel.Comment); } SqlParameter p3 = new SqlParameter("@userId", string.IsNullOrWhiteSpace(activityUpdateModel.logAs) ? AmUtil.GetCurrentUser : activityUpdateModel.logAs); SqlParameter p4 = new SqlParameter("@docNum", activityUpdateModel.FileNum); db.Database.ExecuteSqlCommand("spRemoveActivity @FAId, @comments, @userId", p1, p2, p3); } } var docStatus = AuditManager.Rep.Workspace.GetFileStatus_SSC(new List <int> { (int)activityUpdateModel.FileNum }); returnStatus = docStatus.FirstOrDefault().Status; } IM.Mgr.WsUtility.SaveActivityInfo(activityUpdateModel, returnStatus); return(returnStatus); }