コード例 #1
0
 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();
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
ファイル: Report.Extra.cs プロジェクト: ashish-antil/Products
 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);
     }
 }
コード例 #5
0
ファイル: Contact.cs プロジェクト: ashish-antil/Products
        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);
            }
        }
コード例 #6
0
ファイル: Report.Extra.cs プロジェクト: ashish-antil/Products
 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);
     }
 }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
ファイル: Contact.cs プロジェクト: ashish-antil/Products
 //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);
     }
 }
コード例 #10
0
        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);
            }
        }
コード例 #11
0
        //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);
            }
        }
コード例 #12
0
ファイル: AppTask.cs プロジェクト: ashish-antil/Products
 /// <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);
     }
 }
コード例 #13
0
        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;
        }
コード例 #14
0
ファイル: SMSPending.cs プロジェクト: ashish-antil/Products
        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);
            }
        }
コード例 #15
0
 public IProfile GetProfile(Guid profileId)
 {
     var request = new IDRequest(profileId);
     var response = _proxy.Invoke(service => service.GetExtensionProfile(request));
     ErrorHandler.Check(response);
     return response.Item;
 }
コード例 #16
0
 public BusinessMessageResponse DeleteSecurityObject(IDRequest request)
 {
     try {
         return GenericDeleteEntity<SecurityObject>("SecurityObject", true, new object[] { request.ID });
     }
     catch (Exception ex) {
         return ErrorHandler.Handle(ex);
     }
 }
コード例 #17
0
 public GetListResponse<SecurityObject> GetSecurityObjectList(IDRequest request)
 {
     try {
         return GenericGetEntityList<SecurityObject>("SecurityObject", true, request.ID);
     }
     catch (Exception ex) {
         return ErrorHandler.Handle<GetListResponse<SecurityObject>>(ex);
     }
 }
コード例 #18
0
 public GetListResponse<RelationShipType> GetRelationShipTypeList(IDRequest request)
 {
     try
     {
         return GenericGetEntityList<RelationShipType>(request);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle<GetListResponse<RelationShipType>>(ex);
     }
 }
コード例 #19
0
 public BusinessMessageResponse DeleteRelationShipType(IDRequest request)
 {
     try
     {
         return GenericDeleteEntity<RelationShipType>("RelationShipType", request.ID);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle(ex);
     }
 }
コード例 #20
0
ファイル: Report.cs プロジェクト: ashish-antil/Products
 public GetItemResponse<Report> GetReport(IDRequest request)
 {
     try
     {
         return GenericGetEntity<Report>(request);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle<GetItemResponse<Report>>(ex);
     }
 }
コード例 #21
0
 public GetListResponse<EmailDraft> GetEmailDraftListByNotificationID(IDRequest request)
 {
     try
     {
         return GenericGetRelated<EmailDraft>("NotificationID", request.ID, false);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle<GetListResponse<EmailDraft>>(ex);
     }
 }
コード例 #22
0
ファイル: Company.cs プロジェクト: ashish-antil/Products
 public GetListResponse<Company> GetCompanyList(IDRequest request)
 {
     try
     {
         return GenericGetEntityList<Company>(request);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle<GetListResponse<Company>>(ex);
     }
 }
コード例 #23
0
ファイル: SMSPending.cs プロジェクト: ashish-antil/Products
 public GetItemResponse<SMSPending> GetSMSPending(IDRequest request)
 {
     try
     {
         return GenericGetEntity<SMSPending>(request);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle<GetItemResponse<SMSPending>>(ex);
     }
 }
コード例 #24
0
ファイル: SMSPending.cs プロジェクト: ashish-antil/Products
 public BusinessMessageResponse DeleteSMSPending(IDRequest request)
 {
     try
     {
         return GenericDeleteEntity<SMSPending>("SMSPending", request.ID);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle(ex);
     }
 }
コード例 #25
0
ファイル: Notification.cs プロジェクト: ashish-antil/Products
 public GetListResponse<Notification> GetNotificationList(IDRequest request)
 {
     try
     {
         return GenericGetEntityList<Notification>(request);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle<GetListResponse<Notification>>(ex);
     }
 }
コード例 #26
0
ファイル: Notification.cs プロジェクト: ashish-antil/Products
 public BusinessMessageResponse DeleteNotification(IDRequest request)
 {
     try
     {
         return GenericDeleteEntity<Notification>("Notification", request.ID);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle(ex);
     }
 }
コード例 #27
0
 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);
     }
 }
コード例 #28
0
ファイル: MessageOwner.cs プロジェクト: ashish-antil/Products
 public GetListResponse<MessageOwner> GetMessageOwnerList(IDRequest request)
 {
     try
     {
         return GenericGetEntityList<MessageOwner>(request);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle<GetListResponse<MessageOwner>>(ex);
     }
 }
コード例 #29
0
 public GetListResponse<SecurityEntry> GetEntriesByEntityID(IDRequest request)
 {
     try
     {
         return base.GenericGetRelated<SecurityEntry>("EntityID", request.ID, false);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle<GetListResponse<SecurityEntry>>(ex);
     }
 }
コード例 #30
0
ファイル: Person.cs プロジェクト: ashish-antil/Products
 public GetItemResponse<Person> GetPerson(IDRequest request)
 {
     try
     {
         return GenericGetEntity<Person>(request);
     }
     catch (Exception ex)
     {
         return ErrorHandler.Handle<GetItemResponse<Person>>(ex);
     }
 }