public List<IProfile> GetProfileListForExtension(Guid companyId, Guid extensionId) { var request = new IDRequest(extensionId) { CompanyID = companyId }; var response = _proxy.Invoke(service => service.GetProfileListForExtension(request)); ErrorHandler.Check(response); return response.List.OfType<IProfile>().ToList(); }
public GetListResponse<NotificationItem> GetNotificationTemplateList(IDRequest request) { try { var response = new GetListResponse<NotificationItem>(); var db = ImardaDatabase.CreateDatabase(Util.GetConnName<NotificationItem>()); bool includeInactive = request.HasSome(RetrievalOptions.IncludeInactive); object[] args = new object[] { includeInactive, request.ID }; using (IDataReader dr = db.ExecuteDataReader("SPGetNotificationTemplateList", args)) { response.List = new List<NotificationItem>(); while (dr.Read()) { response.List.Add(GetFromData<NotificationItem>(dr)); } return response; } } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<NotificationItem>>(ex); } }
public GetListResponse<ApplicationFeature> GetApplicationFeatureListByOwnerID(IDRequest request) { try { var response = new GetListResponse<ApplicationFeature>(); var db = ImardaDatabase.CreateDatabase(Util.GetConnName<ApplicationFeature>()); bool includeInactive = request.HasSome(RetrievalOptions.IncludeInactive); int topn = request.Get<int>("TopN", int.MaxValue); Guid ownerid = Guid.Empty; request.Get<Guid>("OwnerID", out ownerid); using (IDataReader dr = db.ExecuteDataReader("SPGetApplicationFeatureListByOwnerID", includeInactive, topn, request.CompanyID, ownerid)) { response.List = new List<ApplicationFeature>(); while (dr.Read()) { response.List.Add(GetFromData<ApplicationFeature>(dr)); } return response; } } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<ApplicationFeature>>(ex); } }
public GetListResponse<Report> GetReportListByReportTypeID(IDRequest request) { Initialize(); var response = new GetListResponse<Report>(); try { var db = ImardaDatabase.CreateDatabase(Util.GetConnName<Report>()); object[] args = new object[] { request.ID }; using (IDataReader dr = db.ExecuteDataReader("SPGetReportListByReportTypeID", args)) { response.List = new List<Report>(); while (dr.Read()) { var report = GetFromData<Report>(dr); SetAccessInformation(report); response.List.Add(report); } response.Status = true; return response; } } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<Report>>(ex); } }
public BusinessMessageResponse DeleteContact(IDRequest request) { try { BusinessMessageResponse appResponse = null; var service = ImardaProxyManager.Instance.IImardaCRMProxy; ChannelInvoker.Invoke(delegate(out IClientChannel channel) { channel = service as IClientChannel; var response = service.DeleteContact(request); ErrorHandler.Check(response); if (!request.ContainsKey("contactType") || !((int)Contact.ContactType.ContactPerson).ToString().Equals(request["contactType"])) { response = service.DeleteContactRelatedPersons(request); ErrorHandler.Check(response); } appResponse = response; }); return appResponse; } catch (Exception ex) { return ErrorHandler.Handle<BusinessMessageResponse>(ex); } }
public BusinessMessageResponse DeleteLinkedReports(IDRequest request) { try { Initialize(); int countDB = 0; int countRS = 0; var db = ImardaDatabase.CreateDatabase(Util.GetConnName<ReportType>()); IDataReader dr; if (request.ID == Guid.Empty) { string name = request["name"]; dr = db.ExecuteDataReader("GetReportsByNamePattern", name); } else { dr = db.ExecuteDataReader("SPGetReportType", request.ID); } using (dr) { while (dr.Read()) { DeleteOneLinkedReport(db, dr, ref countDB, ref countRS); } return new BusinessMessageResponse { StatusMessage = string.Format("{0}|{1}", countDB, countRS) }; } } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public GetItemResponse<Contact> GetContactByName(IDRequest request) { try { var response = new GetItemResponse<Contact>(); var db = ImardaDatabase.CreateDatabase(Util.GetConnName<Contact>()); string custName = request.GetString("custName"); using (IDataReader dr = db.ExecuteDataReader("SPGetContactByName", request.ID, custName)) { response = new GetItemResponse<Contact>(); if (dr.Read()) { response.Item = (GetFromData<Contact>(dr)); } return response; } } catch (Exception ex) { return ErrorHandler.Handle<GetItemResponse<Contact>>(ex); } }
public GetListResponse<Contact> GetContactListByParentId(IDRequest request) { try { var response = new GetListResponse<Contact>(); var db = ImardaDatabase.CreateDatabase(Util.GetConnName<Contact>()); bool includeInactive = request.HasSome(RetrievalOptions.IncludeInactive); int topn = request.Get<int>("TopN", int.MaxValue); int contactType = request.Get<int>("ContactType", 0); Guid parentId = request.Get("ParentId", Guid.Empty); using (IDataReader dr = db.ExecuteDataReader("SPGetContactListByParentId", includeInactive, request.CompanyID, topn, contactType, parentId)) { response.List = new List<Contact>(); while (dr.Read()) { response.List.Add(GetFromData<Contact>(dr)); } return response; } } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<Contact>>(ex); } }
//get contact list by type public GetListResponse<Contact> GetContactList(IDRequest request) { var response = new GetListResponse<Contact>(); response.List = new List<Contact>(); try { var db = ImardaDatabase.CreateDatabase(Util.GetConnName<Contact>()); string spName = "SPGetContactList"; byte type = 0; if (request.ContainsKey("Type")) type = byte.Parse(request["Type"]); int size = 0; if (request.ContainsKey("TopN")) int.TryParse(request["TopN"], out size); bool includeInactive = request.HasSome(RetrievalOptions.IncludeInactive); Guid id = request.ID; var args = new object[] { includeInactive, id, type }; using (IDataReader dr = db.ExecuteDataReader(spName, args)) { while (dr.Read()) response.List.Add(GetFromData<Contact>(dr)); if (size > 0 && response.List.Count > size) { response.List.RemoveRange(size - 1, response.List.Count - size); } return response; } } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<Contact>>(ex); } }
public GetListResponse<BillableFeature> GetBillableFeaturesByCompanyID(IDRequest request) { try { var response = new GetListResponse<BillableFeature>(); var db = ImardaDatabase.CreateDatabase(Util.GetConnName<BillableFeature>()); object[] args = new object[] { request.ID }; using (IDataReader dr = db.ExecuteDataReader("SPGetBillableFeaturesByCompanyID", args)) { response.List = new List<BillableFeature>(); while (dr.Read()) { response.List.Add(GetFromData<BillableFeature>(dr)); } return response; } } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<BillableFeature>>(ex); } }
//public GetListResponse<FtpFailed> GetFtpFailedListByNotificationID(IDRequest request) //{ // try // { // return GenericGetRelated<FtpFailed>("NotificationID", request.ID, false); // } // catch (Exception ex) // { // return ErrorHandler.Handle<GetListResponse<FtpFailed>>(ex); // } //} public GetListResponse<FtpFailed> GetFtpFailedDueList(IDRequest request) { var result = new GetListResponse<FtpFailed>(); try { var db = ImardaDatabase.CreateDatabase(Util.GetConnName<FtpFailed>()); object[] args = new object[] { DateTime.UtcNow }; using (IDataReader dr = db.ExecuteDataReader("SPGetFtpFailedDueList", args)) { while (dr.Read()) { result.List.Add(GetFromData<FtpFailed>(dr)); } return result; } } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<FtpFailed>>(ex); } }
/// <summary> /// Cancel the scheduled task. /// </summary> /// <param name="request">ID = ScheduledTask.ID, ["QueueID"]=queue where scheduled</param> /// <returns></returns> public SolutionMessageResponse CancelScheduledAppTask(IDRequest request) { try { Guid id = request.ID; ScheduledTask task = null; var service = ImardaTaskProxyManager.Instance.IImardaTaskProxy; ChannelInvoker.Invoke(delegate(out IClientChannel channel) { channel = service as IClientChannel; var resp1 = service.GetScheduledTask(new IDRequest(id)); ErrorHandler.CheckItem(resp1); task = resp1.Item; if (task.Status == (byte)TaskStatus.Queued) { var resp2 = service.SetScheduledTaskStatus(new GenericRequest(id, (byte)AppTaskStatus.Cancelled)); ErrorHandler.Check(resp2); } }); return new SolutionMessageResponse { StatusMessage = task.QueueID }; } catch (Exception ex) { return ErrorHandler.Handle<SolutionMessageResponse>(ex); } }
public GetItemResponse<SecurityEntity> GetSecurityEntity(IDRequest request) { var response = new GetItemResponse<SecurityEntity>(); try { response = GenericGetEntity<SecurityEntity>(request); if (response != null && response.Item != null) { SecurityEntity entity = response.Item; Guid applicationID; request.Get<Guid>("appid", out applicationID); //fill in permission list entity.PermissionList = GetSecurityPermissionList(applicationID, entity); // fill in the parent id list entity.ImmediateParentsIds = GetEntityRelationships(entity.ID); response.Item = entity; } } catch (Exception ex) { return ErrorHandler.Handle<GetItemResponse<SecurityEntity>>(ex); } return response; }
public GetListResponse<SMSPending> GetSMSPendingList(IDRequest request) { var result = new GetListResponse<SMSPending>(); try { var db = ImardaDatabase.CreateDatabase(Util.GetConnName<SMSPending>()); int numRecords = 100; //process 100 SMS at a time if (request.ContainsKey("NumRecords")) //! IM-2342 int.TryParse(request["NumRecords"], out numRecords); object[] args = new object[] { numRecords }; using (IDataReader dr = db.ExecuteDataReader("SPGetSMSPendingList", args)) { while (dr.Read()) { result.List.Add(GetFromData<SMSPending>(dr)); } return result; } } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<SMSPending>>(ex); } }
public IProfile GetProfile(Guid profileId) { var request = new IDRequest(profileId); var response = _proxy.Invoke(service => service.GetExtensionProfile(request)); ErrorHandler.Check(response); return response.Item; }
public BusinessMessageResponse DeleteSecurityObject(IDRequest request) { try { return GenericDeleteEntity<SecurityObject>("SecurityObject", true, new object[] { request.ID }); } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public GetListResponse<SecurityObject> GetSecurityObjectList(IDRequest request) { try { return GenericGetEntityList<SecurityObject>("SecurityObject", true, request.ID); } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<SecurityObject>>(ex); } }
public GetListResponse<RelationShipType> GetRelationShipTypeList(IDRequest request) { try { return GenericGetEntityList<RelationShipType>(request); } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<RelationShipType>>(ex); } }
public BusinessMessageResponse DeleteRelationShipType(IDRequest request) { try { return GenericDeleteEntity<RelationShipType>("RelationShipType", request.ID); } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public GetItemResponse<Report> GetReport(IDRequest request) { try { return GenericGetEntity<Report>(request); } catch (Exception ex) { return ErrorHandler.Handle<GetItemResponse<Report>>(ex); } }
public GetListResponse<EmailDraft> GetEmailDraftListByNotificationID(IDRequest request) { try { return GenericGetRelated<EmailDraft>("NotificationID", request.ID, false); } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<EmailDraft>>(ex); } }
public GetListResponse<Company> GetCompanyList(IDRequest request) { try { return GenericGetEntityList<Company>(request); } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<Company>>(ex); } }
public GetItemResponse<SMSPending> GetSMSPending(IDRequest request) { try { return GenericGetEntity<SMSPending>(request); } catch (Exception ex) { return ErrorHandler.Handle<GetItemResponse<SMSPending>>(ex); } }
public BusinessMessageResponse DeleteSMSPending(IDRequest request) { try { return GenericDeleteEntity<SMSPending>("SMSPending", request.ID); } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public GetListResponse<Notification> GetNotificationList(IDRequest request) { try { return GenericGetEntityList<Notification>(request); } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<Notification>>(ex); } }
public BusinessMessageResponse DeleteNotification(IDRequest request) { try { return GenericDeleteEntity<Notification>("Notification", request.ID); } catch (Exception ex) { return ErrorHandler.Handle(ex); } }
public GetListResponse<MessageItem> GetMessageListByUser(IDRequest request) { try { return ImardaDatabase.GetList<MessageItem>("SPGetMessageListByUser", new Guid(request.GetString("userid")), request.GetString("ViewDate")); } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<MessageItem>>(ex); } }
public GetListResponse<MessageOwner> GetMessageOwnerList(IDRequest request) { try { return GenericGetEntityList<MessageOwner>(request); } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<MessageOwner>>(ex); } }
public GetListResponse<SecurityEntry> GetEntriesByEntityID(IDRequest request) { try { return base.GenericGetRelated<SecurityEntry>("EntityID", request.ID, false); } catch (Exception ex) { return ErrorHandler.Handle<GetListResponse<SecurityEntry>>(ex); } }
public GetItemResponse<Person> GetPerson(IDRequest request) { try { return GenericGetEntity<Person>(request); } catch (Exception ex) { return ErrorHandler.Handle<GetItemResponse<Person>>(ex); } }