//Get Todays Message sent Count by client id
 public TodaysMessageCountDTO GetTodaysMessageSentByClientId(string accessId, int ClientId)
 {
     try
     {
         TodaysMessageCountDTO TodaysMessageCountDTO = new TodaysMessageCountDTO();
         TodaysMessageCountDTO.TodaysTotalCampaignMessageSent = CampaignService.GetTodaysCampaignMsssageSentCount(ClientId);
         TodaysMessageCountDTO.TodaysTotalCouponMessageSent   = EcouponCampaignService.GetTodaysCouponMsssageSentCount(ClientId);
         TodaysMessageCountDTO.TodaysTotalMessageSent         = TodaysMessageCountDTO.TodaysTotalCampaignMessageSent + TodaysMessageCountDTO.TodaysTotalCouponMessageSent;
         TodaysMessageCountDTO.TotalPendingCreditRequest      = CreditRequestService.GetPendingCreditRequestCount(ClientId);
         return(TodaysMessageCountDTO);
     }
     catch (TimeoutException)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.RequestTimeout)
         {
             Content      = new StringContent("An error occurred, please try again or contact the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
     catch (Exception)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
         {
             Content      = new StringContent("An error occurred, please try again or contact the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
 }
Beispiel #2
0
 public bool EditCreditRequestForOnlinePayment(CreditRequestDTO creditRequestDTO, bool IsSuccess)
 {
     try
     {
         if (creditRequestDTO.PaymentId == null)
         {
             return(false);
         }
         return(CreditRequestService.EditCreditRequestForOnlinePayment(creditRequestDTO, IsSuccess));
     }
     catch (TimeoutException)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.RequestTimeout)
         {
             Content      = new StringContent("An error occurred, please try again or CreditRequest the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
     catch (Exception)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
         {
             Content      = new StringContent("An error occurred, please try again or CreditRequest the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
 }
 //Get refilled credit request list by client id
 public List <CreditRequestDTO> GetCreditRequestRefilledListByClientId(string accessId, int ClientId, int Top)
 {
     try
     {
         return(CreditRequestService.GetCreditRequestRefilledListByClientId(ClientId, Top));
     }
     catch (TimeoutException)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.RequestTimeout)
         {
             Content      = new StringContent("An error occurred, please try again or contact the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
     catch (Exception)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
         {
             Content      = new StringContent("An error occurred, please try again or contact the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
 }
Beispiel #4
0
 public PageData <CreditRequestDTO> GetCreditRequestPagedListbyPartnerIdWithProvidedflag(PagingInfo pagingInfo, int PartnerId, bool IsProvided)
 {
     try
     {
         return(CreditRequestService.GetCreditRequestPagedListbyPartnerIdWithProvidedflag(pagingInfo, PartnerId, IsProvided));
     }
     catch (TimeoutException)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.RequestTimeout)
         {
             Content      = new StringContent("An error occurred, please try again or CreditRequest the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
     catch (Exception)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
         {
             Content      = new StringContent("An error occurred, please try again or CreditRequest the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
 }
Beispiel #5
0
 public CreditRequestDTO GenerateBill(CreditRequestDTO CreditRequestDTO)
 {
     try
     {
         return(CreditRequestService.GenerateBill(CreditRequestDTO));
     }
     catch (TimeoutException)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.RequestTimeout)
         {
             Content      = new StringContent("An error occurred, please try again or CreditRequest the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
     catch (Exception)
     {
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
         {
             Content      = new StringContent("An error occurred, please try again or CreditRequest the administrator."),
             ReasonPhrase = "Critical Exception"
         });
     }
 }
        public PaymentDTO GetPaymentDetailsURLByPaimentId(string paymentId)
        {
            try
            {
                payment OnlinePaymentDTO = new payment();  //OnlinePaymentDTO

                var    queryString      = HttpContext.Current.Request.QueryString;
                string payment_id       = paymentId;
                string PaymentDetailUrl = ConfigurationManager.AppSettings["PaymentDetailsUrl"].ToString();//  "https://test.instamojo.com/api/1.1/payments/[payment_id]?api_key=4709c5655f99d3799ccc22d8da23a137&auth_token=820cb88637df64e703782970c729a5fb";
                PaymentDetailUrl = PaymentDetailUrl.Replace("%26", "&");
                PaymentDetailUrl = PaymentDetailUrl.Replace("[payment_id]", payment_id);

                WebRequest   request      = HttpWebRequest.Create(PaymentDetailUrl);
                WebResponse  response     = request.GetResponse();
                StreamReader reader       = new StreamReader(response.GetResponseStream());
                string       responseText = reader.ReadToEnd();
                //responseText = responseText.Replace("\n","");


                PaymentDTO PaymentDTO = JsonConvert.DeserializeObject <PaymentDTO>(responseText);
                if (PaymentDTO != null)
                {
                    if (PaymentDTO.payment.custom_fields != null)
                    {
                        int CreditRequestId = Convert.ToInt32(PaymentDTO.payment.custom_fields.Field_52722.value);
                        CreditRequestDTO CreditRequestDTO = new CreditRequestDTO();
                        CreditRequestDTO = CreditRequestService.GetById(CreditRequestId);
                        if (PaymentDTO.success == true)
                        {
                            if (CreditRequestDTO.IsPaid != true)
                            {
                                CreditRequestDTO.PaymentId      = PaymentDTO.payment.payment_id;
                                CreditRequestDTO.ProvidedCredit = CreditRequestDTO.RequestedCredit;
                                CreditRequestService.EditCreditRequestForOnlinePayment(CreditRequestDTO, true);
                            }
                        }
                        else
                        {
                            CreditRequestDTO.PaymentId = PaymentDTO.payment.payment_id;
                            CreditRequestDTO.IsPaid    = false;
                            CreditRequestService.EditCreditRequestForOnlinePayment(CreditRequestDTO, false);
                        }
                    }
                }
                // PaymentInfoDTO PaymentInfoDTO = JsonConvert.DeserializeObject<PaymentInfoDTO>(responseText);

                // OnlinePaymentDTO = urlpaymentId;
                //return PaymentDetailUrl;
                return(PaymentDTO);// OnlinePaymentDTO;
            }
            catch (TimeoutException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.RequestTimeout)
                {
                    Content      = new StringContent("An error occurred, please try again or CreditRequest the administrator."),
                    ReasonPhrase = "Critical Exception"
                });
            }
            catch (Exception)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = new StringContent("An error occurred, please try again or CreditRequest the administrator."),
                    ReasonPhrase = "Critical Exception"
                });
            }
        }