public BusinessMessageResponse SaveAttributeValue(SaveRequest<FernBusinessBase.AttributeValue> request) { var response = new BusinessMessageResponse(); try { AttributeValue attributeValue = ConvertToBusinessAttributeValue(request.Item); BaseEntity.ValidateThrow(attributeValue); object[] properties = new object[] { attributeValue.ID, attributeValue.AttributeID, attributeValue.EntityID, //& gs-351 attributeValue.Value, attributeValue.DateModified = DateTime.UtcNow, attributeValue.PrevValue, BusinessBase.ReadyDateForStorage(attributeValue.PrevDateModified), attributeValue.Deleted, }; response = GenericSaveEntity<AttributeValue>("AttributeValue", properties); } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
/// <summary> /// Saves the given Application to the database /// </summary> /// <param name="request"></param> /// <returns></returns> public BusinessMessageResponse SaveApplication(SaveApplicationRequest request) { BusinessMessageResponse response = new BusinessMessageResponse(); try { var db = ImardaDatabase.CreateDatabase(Util.GetConnName<SecurityEntity>()); using (IDataReader dr = db.ExecuteDataReader("SPGetApplication", request.Application.ID)) { Application app = request.Application; if (dr.Read()) { db.ExecuteNonQuery("SPSaveApplication", app.ID, app.Name, app.Active, app.Deleted); } else { db.ExecuteNonQuery("SPAddApplication", app.ID, app.Name); } return response; } } catch (Exception e) { response.Status = false; response.StatusMessage = "Couldn't save Application: " + e.Message + e.StackTrace; return response; } }
public BusinessMessageResponse SaveCompany(SaveRequest<Company> request) { var response = new BusinessMessageResponse(); try { Company entity = request.Item; BaseEntity.ValidateThrow(entity); object[] properties = new object[]{ entity.ID, entity.CompanyID, entity.Path, entity.Active, entity.Deleted, entity.DateCreated, entity.DateModified = DateTime.UtcNow, entity.UserID, entity.Name, entity.StreetAddress, entity.Suburb, entity.City, entity.State, entity.PostCode, entity.DisplayName, entity.Phone, entity.Fax, entity.Mobile, entity.Email, entity.ServiceEmail, entity.RunPrograms, entity.AccountManagerID, entity.AutoLogoffPeriod, entity.GracePeriod, entity.MinorBreak, entity.MajorBreak, entity.WorkPeriod, entity.MapLocationID, entity.MasterPassword, entity.Country ?? "XX", entity.FatigueRuleDefault ,entity.UnlockCode ,entity.LinkID ,entity.ClientType ,entity.TimeZone #if EntityProperty_NoDate ,entity.`field` #endif #if EntityProperty_Date ,BusinessBase.ReadyDateForStorage(entity.`field`) #endif }; response = GenericSaveEntity<Company>(entity.CompanyID, entity.Attributes, properties); //Review IM-3747 } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
BusinessMessageResponse SendSMS(GenericRequest req) { try { var response = new BusinessMessageResponse(); return response; } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
private BusinessMessageResponse ChangeReportTypeOwner(SaveRequest<ReportType> request) { BusinessMessageResponse response = new BusinessMessageResponse(); try { var db = ImardaDatabase.CreateDatabase(Util.GetConnName<ReportType>()); object[] args = new object[] { request.Item.ID, request.Item.OwnerID }; db.ExecuteNonQuery("SPChangeReportTypeOwner", args); } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse SendPlan(GenericRequest req) { try { var response = new BusinessMessageResponse(); //separate delivery method from request //call SendEmail(req1); //call SendSMS(req2); //call other methods; return response;// always return successful response } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
/// <summary> /// Marks the Application with the given ID as Deleted /// </summary> /// <param name="request"></param> /// <returns></returns> public BusinessMessageResponse DeleteApplication(DeleteApplicationRequest request) { BusinessMessageResponse response = new BusinessMessageResponse(); try { var db = ImardaDatabase.CreateDatabase(Util.GetConnName<SecurityEntity>()); db.ExecuteNonQuery("SPDeleteApplication", request.ID); } catch (Exception e) { response.Status = false; response.StatusMessage = "Couldn't delete Application: " + e.Message + e.StackTrace; } return response; }
BusinessMessageResponse SendEmail(GenericRequest req) { try { var response = new BusinessMessageResponse(); //for each recipient in req //build a new Email object //SaveToPending(); //SendSingleEmail(Email e); return response; } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public BusinessMessageResponse DeleteAttributeDefinition(IDRequest request) { var response = new BusinessMessageResponse(); try { var entityName = request.GetString("EntityName"); var attribName = request.GetString("AttributeName"); return GenericDeleteEntity<AttributeDefinition>("AttributeDefinition", request.ID, entityName, attribName); } catch (Exception ex) { response.Status = false; response.ErrorCode = ex.StackTrace + ", " + ex.Message; response.StatusMessage = ex.StackTrace + ", " + ex.Message; return response; } }
public BusinessMessageResponse SaveSolutionList(SaveListRequest<Solution> request) { var response = new BusinessMessageResponse(); try { foreach (Solution item in request.List) { response = GenericSaveEntity<Solution>("Solution", new object[] { item.ID, item.SolutionName }); } } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
//List<WidgetDef> widgets) public BusinessMessageResponse SaveWidgetDefList(SaveListRequest<WidgetDef> request) { var response = new BusinessMessageResponse(); try { var service = ImardaProxyManager.Instance.IImardaCRMProxy; ChannelInvoker.Invoke(delegate(out IClientChannel channel) { channel = service as IClientChannel; response = service.SaveWidgetDefList(request); }); } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse SaveSecurityEntityParentList(SaveListRequest<SecurityEntityParent> request) { var response = new BusinessMessageResponse(); try { BusinessMessageResponse itemRespnse = new BusinessMessageResponse(); foreach (SecurityEntityParent it in request.List) { itemRespnse = GenericSaveEntity<SecurityEntityParent>("SecurityEntityParent", it.RelationId, it.EntityId, it.ParentId, it.Active, it.Deleted); } response.Status = true; } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse DeleteNotificationItem(IDRequest request) { try { var response = new BusinessMessageResponse(); var service = ImardaProxyManager.Instance.IImardaCRMProxy; ChannelInvoker.Invoke(delegate(out IClientChannel channel) { channel = service as IClientChannel; response = service.DeleteNotificationItem(request); }); return response; } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public BusinessMessageResponse AddSecurityObjectList(SaveListRequest<SecurityObjectInfo> SecurityObjectInfo) { var response = new BusinessMessageResponse(); try { List<SecurityObject> allSecurityObjects = GetAllSecurityObjectList(true).List; SaveListRequest<SecurityObject> saveRq = new SaveListRequest<SecurityObject>(); saveRq.List = new List<SecurityObject>(); foreach (SecurityObjectInfo pti in SecurityObjectInfo.List) { Predicate<SecurityObject> find = new Predicate<SecurityObject>( delegate(SecurityObject match) { return match.DisplayName == pti.Name; }); SecurityObject found = allSecurityObjects.Find(find); if (found == null) { // this Security Object doesn't exist, add it SecurityObject newObject = new SecurityObject(); newObject.DisplayName = pti.Name; newObject.ParentID = findSecurityObjectParentId(pti.Parent, ref allSecurityObjects); saveRq.List.Add(newObject); } else { // this Security Object does exist } } response = SaveSecurityObjectList(saveRq); } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse SaveWidgetDefList(SaveListRequest<WidgetDef> request) { //save to storage var response = new BusinessMessageResponse(); try { foreach (WidgetDef entity in request.List) { BaseEntity.ValidateThrow(entity); object[] properties = new object[] { entity.ID, entity.Active, entity.Deleted, entity.DateCreated, entity.DateModified = DateTime.UtcNow, entity.CompanyID, entity.UserID, entity.Title, entity.Type, entity.Row, entity.Column, entity.RowSpan, entity.ColumnSpan #if EntityProperty_NoDate ,entity.`field` #endif #if EntityProperty_Date ,BusinessBase.ReadyDateForStorage(entity.`field`) #endif }; response = GenericSaveEntity<WidgetDef>(entity.CompanyID, entity.Attributes, properties); //Review IM-3747 } } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse DeleteContactMapByContactNPerson(IDRequest request) { try { const string spName = "SPDeleteContactMapByContactNPerson"; var response = new BusinessMessageResponse(); var db = ImardaDatabase.CreateDatabase(Util.GetConnName<ContactMap>()); var contactId = request["ContactId"]; var contactPersonId = request["ContactPersonId"]; var args = new object[] { new Guid(contactId), new Guid(contactPersonId), request.CompanyID }; if (db.ExecuteNonQuery(spName, args) > 0) { response.Status = true; } return response; } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<ContactMap>>(ex); } }
public BusinessMessageResponse SaveAccessLog(SaveRequest<AccessLog> request) { var response = new BusinessMessageResponse(); try { AccessLog log = request.Item; if (log != null) { response = GenericSaveEntity<AccessLog>(request.CompanyID, log.Attributes, null); //Review IM-3747 if (!response.Status) throw new ApplicationException(response.StatusMessage); } response.Status = true; } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse SaveRouteWayPointList(SaveListRequest<RouteWaypoint> request) { var response = new BusinessMessageResponse(); try { foreach (RouteWaypoint entity in request.List) { var properties = new object[] { entity.ID, entity.CompanyID, entity.UserID, entity.DateCreated, entity.DateModified = DateTime.UtcNow, entity.Active, entity.Deleted, entity.RouteId, entity.WayPointId #if EntityProperty_NoDate ,entity.`field` #endif #if EntityProperty_Date ,BusinessBase.ReadyDateForStorage(entity.`field`) #endif }; response = GenericSaveEntity<RouteWaypoint>(entity.CompanyID, entity.Attributes, properties); //Review IM-3747 } return response; } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public BusinessMessageResponse ChangeReportTypeListOwner(SaveListRequest<ReportType> request) { Initialize(); BusinessMessageResponse response = new BusinessMessageResponse(); string sNewOwnerID = request["NewOwnerID"].ToLower(); Guid newOwnerID = new Guid(sNewOwnerID); string pathFrom = null; string pathTo = null; bool moved = false; try { foreach (ReportType reportType in request.List) { SaveRequest<ReportType> req = new SaveRequest<ReportType>(); moved = false; string ownerPath = InstancesFolder + '/' + sNewOwnerID.ToLower(); CreateFolder(sNewOwnerID.ToLower(), InstancesFolder); pathFrom = InstancesFolder + '/' + reportType.OwnerID.ToString().ToLower() + '/' + reportType.Name; pathTo = ownerPath + '/' + reportType.Name; _Rs2005.MoveItem(pathFrom, pathTo); moved = true; reportType.OwnerID = newOwnerID; req.Item = reportType; ChangeReportTypeOwner(req); } } catch (Exception ex) { if (moved) _Rs2005.MoveItem(pathTo, pathFrom); // reverse the move return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse SaveReport(SaveRequest<Report> request) { var response = new BusinessMessageResponse(); try { Report report = request.Item; object[] properties = new object[]{ report.ID, report.ReportTypeID, report.ReportNumber, report.SnapshotName, report.ScheduledTaskID, report.Expiry, report.Notes, report.Status, report.CompanyID, report.UserID, report.DateCreated, report.DateModified, report.Deleted, report.Active }; response = GenericSaveEntity<Report>(report.CompanyID, report.Attributes, properties); //Review IM-3747 } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse SaveSMSPendingList(SaveListRequest<SMSPending> request) { var response = new BusinessMessageResponse(); try { foreach (SMSPending entity in request.List) { BaseEntity.ValidateThrow(entity); object[] properties = new object[] { entity.ID, entity.CompanyID, entity.UserID, entity.SMSDraftID, entity.Subject, entity.Message, entity.NotificationID, entity.RecipientName, entity.ToPhoneNumber, entity.Retry, entity.TimeToSend, entity.Status, entity.DateCreated, entity.DateModified = DateTime.UtcNow, entity.LastRetryAt, entity.Active, entity.Deleted #if EntityProperty_NoDate ,entity.`field` #endif #if EntityProperty_Date ,BusinessBase.ReadyDateForStorage(entity.`field`) #endif }; response = GenericSaveEntity<SMSPending>(entity.CompanyID, entity.Attributes, properties); //Review IM-3747 } return response; } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public BusinessMessageResponse SaveNotificationList(SaveListRequest<Notification> request) { var response = new BusinessMessageResponse(); try { foreach (Notification entity in request.List) { BaseEntity.ValidateThrow(entity); object[] properties = new object[] { entity.ID, entity.CompanyID, entity.UserID, entity.NotificationPlanID, entity.Description, entity.Status, entity.DateCreated, entity.DateModified = DateTime.UtcNow, entity.Active, entity.Deleted #if EntityProperty_NoDate ,entity.`field` #endif #if EntityProperty_Date ,BusinessBase.ReadyDateForStorage(entity.`field`) #endif }; response = GenericSaveEntity<Notification>(entity.CompanyID, entity.Attributes, properties); //Review IM-3747 } return response; } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public BusinessMessageResponse SaveUsageLogList(SaveListRequest<UsageLog> request) { var response = new BusinessMessageResponse(); try { foreach (UsageLog entity in request.List) { var properties = new object[] { entity.ID, entity.CompanyID, entity.UserID, entity.DateCreated, entity.DateModified = DateTime.UtcNow, entity.Active, entity.Deleted ,entity.ApiID ,entity.ApiVersion ,entity.Method ,entity.ExecutionTime #if EntityProperty_NoDate ,entity.`field` #endif #if EntityProperty_Date ,BusinessBase.ReadyDateForStorage(entity.`field`) #endif }; response = GenericSaveEntity<UsageLog>(entity.CompanyID, entity.Attributes, properties); //Review IM-3747 } return response; } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public BusinessMessageResponse SaveRole(SaveRequest<Role> request) { var response = new BusinessMessageResponse(); try { Role entity = request.Item; BaseEntity.ValidateThrow(entity); object [] properties=new object[]{ entity.ID, entity.Active, entity.Deleted, entity.DateCreated, entity.DateModified = DateTime.UtcNow, entity.CompanyID, entity.UserID, entity.PersonID, entity.RoleTypeID #if EntityProperty_NoDate ,entity.`field` #endif #if EntityProperty_Date ,BusinessBase.ReadyDateForStorage(entity.`field`) #endif }; response = GenericSaveEntity<Role>(entity.CompanyID, entity.Attributes, properties); //Review IM-3747 } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse SaveApplicationFeatureOwnerList(SaveListRequest<ApplicationFeatureOwner> request) { try { var response = new BusinessMessageResponse(); var service = ImardaProxyManager.Instance.IImardaSecurityProxy; ChannelInvoker.Invoke(delegate(out IClientChannel channel) { channel = service as IClientChannel; response = service.SaveApplicationFeatureOwnerList(request); }); return response; } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public BusinessMessageResponse SaveProfileList(SaveListRequest<Profile> request) { var response = new BusinessMessageResponse(); try { foreach (Profile entity in request.List) { var properties = new object[] { entity.ID, entity.CompanyID, entity.UserID, entity.DateCreated, entity.DateModified = DateTime.UtcNow, entity.Active, entity.Deleted ,entity.Name ,entity.Description ,BusinessBase.ReadyDateForStorage(entity.StartDate) ,BusinessBase.ReadyDateForStorage(entity.ExpiryDate) ,entity.AreaType ,entity.ProfileType ,entity.SettingsLinkID ,entity.Settings #if EntityProperty_NoDate ,entity.`field` #endif #if EntityProperty_Date ,BusinessBase.ReadyDateForStorage(entity.`field`) #endif }; response = GenericSaveEntity<Profile>(entity.CompanyID, entity.Attributes, properties); //Review IM-3747 } return response; } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public BusinessMessageResponse SaveTaskParameter(SaveRequest<TaskParameter> request) { var response = new BusinessMessageResponse(); try { TaskParameter entity = request.Item; BaseEntity.ValidateThrow(entity); object [] properties=new object[]{ entity.ID, entity.TaskID, entity.Output, entity.Fixed, entity.Ord, entity.Name, entity.DataType, entity.DisplayName, entity.Value, entity.CompanyID, entity.UserID, entity.DateCreated, entity.DateModified = DateTime.UtcNow, entity.Deleted, entity.Active #if EntityProperty_NoDate ,entity.`field` #endif #if EntityProperty_Date ,BusinessBase.ReadyDateForStorage(entity.`field`) #endif }; response = GenericSaveEntity<TaskParameter>(entity.Attributes, properties); } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse SaveSecurityObjectList(SaveListRequest<SecurityObject> request) { try { BusinessMessageResponse bmr = new BusinessMessageResponse(); foreach (SecurityObject it in request.List) { bmr = GenericSaveEntity<SecurityObject>("SecurityObject", it.ID, it.SolutionID, it.ApplicationID, it.DisplayName, it.ParentID, it.ObjectGroupID, it.Description, it.PermissionsConfigurable, it.ObjectType, it.UserID , it.Active, it.Deleted, it.FeatureID); } return bmr; } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public BusinessMessageResponse SaveSecurityEntryList(SaveListRequest<SecurityEntry> request) { var response = new BusinessMessageResponse(); try { foreach (SecurityEntry it in request.List) { object[] properties = new object[] { it.ID, it.ApplicationID, it.EntityID, it.SecurityObjectID, it.PermissionsGranted, it.PermissionsDenied, it.EntryType, it.Active, it.Deleted }; response = GenericSaveEntity<SecurityEntry>(properties); } } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }
public BusinessMessageResponse SaveEmailGroup(SaveRequest<EmailGroup> request) { var response = new BusinessMessageResponse(); try { EmailGroup entity = request.Item; BaseEntity.ValidateThrow(entity); object [] properties=new object[]{ entity.ID, entity.Active, entity.Deleted, entity.DateCreated, entity.DateModified = DateTime.UtcNow, entity.CompanyID, entity.UserID, entity.GroupName, entity.GroupDescription, entity.GroupEmailRecipients, entity.GroupEmailAddresses #if EntityProperty_NoDate ,entity.`field` #endif #if EntityProperty_Date ,BusinessBase.ReadyDateForStorage(entity.`field`) #endif }; response = GenericSaveEntity<EmailGroup>(entity.CompanyID, entity.Attributes, properties); //Review IM-3747 } catch (Exception ex) { return ErrorHandler.Handle(ex); } return response; }