public static List <WsModel> UpdateWs(WsUpdateModel wsUpdateModel, UpdateProfileFrom updateProfileFrom) { var wsModelIn = wsUpdateModel.WsModel; IManWorkspace imWs = null; //--V469-583-S var wsModel = Workspace.GetWs(wsModelIn.ObjectID, out imWs, WsLoadType.ALL, isAdmin: true); //var wsModel = Workspace.GetWs_Admin(wsModelIn.ObjectID, out imWs, WsLoadType.ALL); //--V469-583-E if (wsModelIn.WsProfile.IsUnderPreservation != wsModel.WsProfile.IsUnderPreservation) { if (wsModelIn.WsProfile.IsUnderPreservation) { if (wsModel.WsProfile.Status.StartsWith("closed", StringComparison.OrdinalIgnoreCase)) { imWs.SetAttributeByID(imProfileAttributeID.imProfileCustom11, "CLOSED - UNDER PRESERVATION"); } else { imWs.SetAttributeByID(imProfileAttributeID.imProfileCustom11, "OPEN - UNDER PRESERVATION"); } } else { imWs.SetAttributeByID(imProfileAttributeID.imProfileCustom11, wsModel.WsProfile.Status.Replace(" - UNDER PRESERVATION", "")); } var wsGLog = new WsGenericLog(); wsGLog.ActionBy = AmUtil.GetCurrentUser; wsGLog.Id = null; wsGLog.Name = null; wsGLog.ActionInfo = wsModelIn.WsProfile.IsUnderPreservation ? "ON" : "OFF"; wsGLog.AdditionalInfo = null; wsGLog.Comment = wsUpdateModel.PreservationComment; wsGLog.OldValue = wsModel.WsProfile.IsUnderPreservation.ToString(); wsGLog.NewValue = wsModelIn.WsProfile.IsUnderPreservation.ToString(); wsGLog.WsLogActivityType = WsLogActivityType.Preservation; WsUtility.CreateWsLog(wsModelIn.ObjectID, wsGLog); //Mail var wsAdmin = WsUtility.GetEmailRecepients(wsModel, EmailRecepientType.ADMIN); var recepients = WsUtility.GetEmailRecepients(wsModel, EmailRecepientType.MEMBERS); var mailBody = AmUtil.SendMail_Preservation(wsModelIn.WsProfile.IsUnderPreservation ? WsActivityType.WSPROFILE_PRESERVATION_ON.ToString() : WsActivityType.WSPROFILE_PRESERVATION_OFF.ToString(), wsModel.WsProfile.EngNum, wsModel.Name, wsModel.WsProfile.ClientDesc, recepients, wsAdmin, wsModelIn.WsProfile.IsUnderPreservation ? "Workspace Flagged for Preservation" : "Workspace Preservation Removed"); wsGLog.WsLogActivityType = wsModelIn.WsProfile.IsUnderPreservation ? WsLogActivityType.PreservationONEmail : WsLogActivityType.PreservationOFFEmail; WsUtility.CreateEmailLog(wsModelIn.ObjectID, mailBody, wsGLog); // } if (wsModelIn.WsProfile.EventTrgDate != wsModel.WsProfile.EventTrgDate) { imWs.SetAttributeByID(imProfileAttributeID.imProfileCustom23, wsModelIn.WsProfile.EventTrgDate); var wsGLog = new WsGenericLog(); wsGLog.ActionBy = AmUtil.GetCurrentUser; wsGLog.Id = null; wsGLog.Name = null; wsGLog.ActionInfo = null; wsGLog.AdditionalInfo = null; wsGLog.Comment = wsUpdateModel.PreservationComment; wsGLog.OldValue = wsModel.WsProfile.EventTrgDate.ToString(); wsGLog.NewValue = wsModelIn.WsProfile.EventTrgDate.ToString(); wsGLog.WsLogActivityType = WsLogActivityType.EventTrgDate; WsUtility.CreateWsLog(wsModelIn.ObjectID, wsGLog); } if (wsModelIn.WsProfile.IsKDrive != wsModel.WsProfile.IsKDrive) { imWs.SetAttributeByID(imProfileAttributeID.imProfileCustom26, wsModelIn.WsProfile.IsKDrive); var wsGLog = new WsGenericLog(); wsGLog.ActionBy = AmUtil.GetCurrentUser; wsGLog.Id = null; wsGLog.Name = null; wsGLog.ActionInfo = null; wsGLog.AdditionalInfo = null; wsGLog.Comment = wsUpdateModel.PreservationComment; wsGLog.OldValue = wsModel.WsProfile.IsKDrive.ToString(); wsGLog.NewValue = wsModelIn.WsProfile.IsKDrive.ToString(); wsGLog.WsLogActivityType = WsLogActivityType.ChangeStorageLocation; WsUtility.CreateWsLog(wsModelIn.ObjectID, wsGLog); } if (wsModelIn.WsProfile.IsServer2 != wsModel.WsProfile.IsServer2) { imWs.SetAttributeByID(imProfileAttributeID.imProfileCustom12, wsModelIn.WsProfile.IsServer2.ToString()); var wsGLog = new WsGenericLog(); wsGLog.ActionBy = AmUtil.GetCurrentUser; wsGLog.Id = null; wsGLog.Name = null; wsGLog.ActionInfo = null; wsGLog.AdditionalInfo = null; wsGLog.Comment = wsUpdateModel.PreservationComment; wsGLog.OldValue = wsModel.WsProfile.IsServer2.ToString(); wsGLog.NewValue = wsModelIn.WsProfile.IsServer2.ToString(); wsGLog.WsLogActivityType = WsLogActivityType.Server2; WsUtility.CreateWsLog(wsModelIn.ObjectID, wsGLog); } if (wsModelIn.WsProfile.RetPolicy != wsModel.WsProfile.RetPolicy) { imWs.SetAttributeByID(imProfileAttributeID.imProfileCustom7, wsModelIn.WsProfile.RetPolicy.ToString()); var wsGLog = new WsGenericLog(); wsGLog.ActionBy = AmUtil.GetCurrentUser; wsGLog.Id = null; wsGLog.Name = null; wsGLog.ActionInfo = null; wsGLog.AdditionalInfo = null; wsGLog.Comment = wsUpdateModel.RetentionComment; wsGLog.OldValue = wsModel.WsProfile.RetPolicy.ToString(); wsGLog.NewValue = wsModelIn.WsProfile.RetPolicy.ToString(); wsGLog.WsLogActivityType = WsLogActivityType.RetPolicy; WsUtility.CreateWsLog(wsModelIn.ObjectID, wsGLog); } //wsNew.Profile.SetAttributeByID(imProfileAttributeID.imProfileCustom7, "7YEARS"); imWs.Update(); WsUtility.UpdateWsProfile(wsUpdateModel, updateProfileFrom); return(IM.Mgr.Workspace.GetWs(wsModelIn.ObjectID)); }