예제 #1
0
        private void UpdateService(HttpContext context)
        {
            bool areMultipleEntriesAllowed = false;
            byte serviceId = 0;
            bool isActive  = false;

            if (context.Request["ServiceId"] == null || !byte.TryParse(context.Request["ServiceId"].ToString(), out serviceId))
            {
                GenerateErrorResponse(400, string.Format("Parameter ServiceId is missing or not a valid number"));
            }
            if (context.Request["DisplayName"] == null || context.Request["DisplayName"].ToString().Trim().Length == 0)
            {
                GenerateErrorResponse(400, string.Format("DisplayName Is Mandatory"));
            }
            if (context.Request["MetaDataCode"] == null || context.Request["MetaDataCode"].ToString().Trim().Length == 0)
            {
                GenerateErrorResponse(400, string.Format("MetaDataCode Is Mandatory"));
            }
            if (context.Request["AreMultipleEntriesAllowed"] == null || !bool.TryParse(context.Request["AreMultipleEntriesAllowed"].ToString(), out areMultipleEntriesAllowed))
            {
                GenerateErrorResponse(400, string.Format("Parameter AreMultipleEntriesAllowed is missing or not a valid boolean value"));
            }
            if (context.Request["IsActive"] == null || !bool.TryParse(context.Request["IsActive"].ToString(), out isActive))
            {
                GenerateErrorResponse(400, string.Format("Parameter IsActive is missing or not a valid boolean value"));
            }
            if (serviceId <= 0)
            {
                GenerateErrorResponse(400, string.Format("ServiceId must be greater than 0"));
            }
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.UpdateService(serviceId: serviceId,
                                                        displayName: context.Request["DisplayName"].ToString(), metaDataCode: context.Request["MetaDataCode"].ToString(),
                                                        areMultipleEntriesAllowed: bool.Parse(context.Request["AreMultipleEntriesAllowed"].ToString()), isActive: bool.Parse(context.Request["IsActive"].ToString())));
        }
예제 #2
0
        private void GetServices(HttpContext context)
        {
            short serviceId  = 0;
            bool  onlyActive = true;
            bool  includeServiceProperties = true;
            byte  productId = 0;

            if (context.Request["ProductId"] == null || !byte.TryParse(context.Request["ProductId"].ToString(), out productId))
            {
                GenerateErrorResponse(400, string.Format("ProductId is mandatory", context.Request["ProductId"].ToString()));
            }
            if (context.Request["ServiceId"] != null && !short.TryParse(context.Request["ServiceId"].ToString(), out serviceId))
            {
                GenerateErrorResponse(400, string.Format("ServiceId value ({0}) is not a valid number", context.Request["ServiceId"].ToString()));
            }
            if (context.Request["OnlyActive"] != null && !bool.TryParse(context.Request["OnlyActive"].ToString(), out onlyActive))
            {
                GenerateErrorResponse(400, string.Format("OnlyActive value ({0}) is not a valid boolean value", context.Request["OnlyActive"].ToString()));
            }
            if (context.Request["IncludeServiceProperties"] != null && !bool.TryParse(context.Request["IncludeServiceProperties"].ToString(), out includeServiceProperties))
            {
                GenerateErrorResponse(400, string.Format("IncludeServiceProperties value ({0}) is not a valid boolean value", context.Request["IncludeServiceProperties"].ToString()));
            }

            TablePreferences servicesTablePreferences = new TablePreferences("", "", true, false);
            Dictionary <string, TablePreferences> servicesDictionary = new Dictionary <string, TablePreferences>();

            servicesDictionary.Add("Services", servicesTablePreferences);
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.GetServices(productId: productId, serviceId: serviceId, includeServiceProperties: includeServiceProperties, onlyActive: onlyActive, tablePreferences: servicesDictionary));
        }
예제 #3
0
        private void GetInputDataTypes(HttpContext context)
        {
            bool onlyActive = true;

            if (context.Request["OnlyActive"] != null && !bool.TryParse(context.Request["OnlyActive"].ToString(), out onlyActive))
            {
                GenerateErrorResponse(400, string.Format("OnlyActive value ({0}) is not a valid boolean value", context.Request["OnlyActive"].ToString()));
            }
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.GetInputDataTypes(onlyActive: onlyActive, tablePreferences: null));
        }
예제 #4
0
        private void VerifyPaymentStatuses(HttpContext context)
        {
            long orderId = 0;

            if (context.Request["OrderId"] != null && !Int64.TryParse(context.Request["OrderId"].ToString(), out orderId))
            {
                GenerateErrorResponse(400, "OrderId value must be a number");
            }

            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.VerifyPaymentStatuses(orderId, null));
        }
예제 #5
0
        private void GetInvoiceAccountDetails(HttpContext context)
        {
            int invoiceId = 0;

            if (context.Request["invoiceId"] != null && !int.TryParse(context.Request["invoiceId"].ToString(), out invoiceId))
            {
                GenerateErrorResponse(400, string.Format("InvoiceId Must be a number"));
            }


            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.GetInvoiceAccountDetails(invoiceId: invoiceId));
        }
예제 #6
0
        private void DeleteService(HttpContext context)
        {
            byte serviceId = 0;

            if (context.Request["ServiceId"] == null || !byte.TryParse(context.Request["ServiceId"].ToString(), out serviceId))
            {
                GenerateErrorResponse(400, string.Format("Parameter ServiceId is missing or not a valid number"));
            }
            if (serviceId <= 0)
            {
                GenerateErrorResponse(400, string.Format("ServiceId must be greater than 0"));
            }
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.DeleteService(serviceId));
        }
예제 #7
0
        //cancel Invoice
        private void CancelInvoice(HttpContext context)
        {
            int quotationId = 0;
            int adminId     = 0;

            if (context.Request["QuotationId"] != null && !int.TryParse(context.Request["QuotationId"].ToString(), out quotationId))
            {
                GenerateErrorResponse(400, string.Format("QuotationId Must be a number"));
            }
            if (context.Request["AdminId"] != null && !int.TryParse(context.Request["AdminId"].ToString(), out adminId))
            {
                GenerateErrorResponse(400, string.Format("AdminId Must be a number"));
            }

            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.CancelInvoice(quotationId, adminId));
        }
예제 #8
0
        private void UpdateInvoice(HttpContext context)
        {
            JObject InvoiceDetails = JObject.Parse(context.Request["payload"]);

            string mobile      = string.Empty;
            string email       = string.Empty;
            string address     = string.Empty;
            string GSTIN       = string.Empty;
            string companyName = string.Empty;
            int    stateId     = 0;
            int    invoiceId   = 0;

            if (InvoiceDetails.SelectToken("Mobile") != null)
            {
                mobile = Convert.ToString(InvoiceDetails.SelectToken("Mobile"));
            }
            if (InvoiceDetails.SelectToken("BusinessMailID") != null)
            {
                email = Convert.ToString(InvoiceDetails.SelectToken("BusinessMailID"));
            }
            if (InvoiceDetails.SelectToken("ContactAddress") != null)
            {
                address = Convert.ToString(InvoiceDetails.SelectToken("ContactAddress"));
            }
            if (InvoiceDetails.SelectToken("GSTIN") != null)
            {
                GSTIN = Convert.ToString(InvoiceDetails.SelectToken("GSTIN"));
            }
            if (InvoiceDetails.SelectToken("CompanyName") != null)
            {
                companyName = Convert.ToString(InvoiceDetails.SelectToken("CompanyName"));
            }
            if (InvoiceDetails.SelectToken("States") != null)
            {
                stateId = Convert.ToInt32(InvoiceDetails.SelectToken("States"));
            }
            if (InvoiceDetails.SelectToken("InvoiceId") != null)
            {
                invoiceId = Convert.ToInt32(InvoiceDetails.SelectToken("InvoiceId"));
            }

            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.UpdateInvoice(invoiceId: invoiceId, mobile: mobile, email: email, address: address, GSTIN: GSTIN, companyName: companyName, stateId: stateId));
        }
예제 #9
0
        private void CreateServiceProperties(HttpContext context)
        {
            Int16   serviceId           = 0;
            JObject propertyObject      = null;
            JArray  propertyFieldsArray = null;

            List <ServiceProperty>       servicePropertiesList      = new List <ServiceProperty>();
            List <ServicePropertyFields> servicePropertiesFieldList = new List <ServicePropertyFields>();

            if (context.Request["ServiceId"] == null || !Int16.TryParse(context.Request["ServiceId"].ToString(), out serviceId))
            {
                GenerateErrorResponse(400, string.Format("Parameter ServiceId is missing or not a valid number"));
            }
            try
            {
                propertyObject = JObject.Parse(context.Request["Properties"].ToString());
            }
            catch (Exception e)
            {
                GenerateErrorResponse(400, string.Format("Invalid JSON"));
            }
            //foreach (JObject propertyObject in properiesArray)
            //{
            try
            {
                propertyFieldsArray = JArray.Parse(propertyObject.SelectToken("PropertyFields").ToString());
            }
            catch (Exception ex)
            {
                GenerateErrorResponse(400, string.Format("Invalid JSON"));
            }

            ServiceProperty serviceProperty = ValidateServiceProperties(propertyObject);

            servicePropertiesFieldList = ValidateServicePropertyFields(propertyFieldsArray, serviceProperty);

            //servicePropertiesList.Add(serviceProperty);
            //}


            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.CreateServiceProperties(serviceId, serviceProperty, servicePropertiesFieldList));
        }
예제 #10
0
        private void Download(HttpContext context)
        {
            int  quotationId         = 0;
            bool isPostPaidQuotation = false;

            if (context.Request["QuotationId"] != null && !int.TryParse(context.Request["QuotationId"].ToString(), out quotationId))
            {
                GenerateErrorResponse(400, string.Format("OnlyActive value ({0}) is not a valid boolean value", context.Request["OnlyActive"].ToString()));
            }
            if (quotationId <= 0)
            {
                GenerateErrorResponse(400, string.Format("QuoationId must be greater than 0"));
            }
            if (context.Request["IsPostPaidQuotation"] != null && !bool.TryParse(context.Request["IsPostPaidQuotation"].ToString(), out isPostPaidQuotation))
            {
                GenerateErrorResponse(400, string.Format("IsPostPaidQuotation must be a boolean value"));
            }
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.DownloadInvoice(quotationId, isPostPaidQuotation));
        }
예제 #11
0
        private void CreateInvoice(HttpContext context)
        {
            int  quotationId   = 0;
            byte billingModeId = 0;
            int  employeeId    = 0;

            if (context.Request["QuotationId"] != null && !int.TryParse(context.Request["QuotationId"].ToString(), out quotationId))
            {
                GenerateErrorResponse(400, string.Format("QuotationId Must be a number"));
            }
            if (context.Request["BillingModeId"] != null && !byte.TryParse(context.Request["BillingModeId"].ToString(), out billingModeId))
            {
                GenerateErrorResponse(400, string.Format("BillingModeId Must be a number"));
            }
            //if (context.Request["EmployeeId"] != null && !int.TryParse(context.Request["EmployeeId"].ToString(), out employeeId))
            //    GenerateErrorResponse(400, string.Format("EmployeeId Must be a number"));
            employeeId = Convert.ToInt32(context.Session["AdminId"]);
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.CreateInvoice(quotationId, billingModeId, employeeId));
        }
예제 #12
0
        private void View(HttpContext context)
        {
            int  orderId   = 0;
            byte productId = 0;

            if (context.Request["OrderId"] != null && !int.TryParse(context.Request["OrderId"].ToString(), out orderId))
            {
                GenerateErrorResponse(400, "OrderId value must be a number");
            }
            if (context.Request["ProductId"] != null && !byte.TryParse(context.Request["ProductId"].ToString(), out productId))
            {
                GenerateErrorResponse(400, "ProductId value must be a number");
            }

            TablePreferences PaymentDetailsTablePreferences = new TablePreferences("", "", true, false);
            Dictionary <string, TablePreferences> PaymentDetailsDictionary = new Dictionary <string, TablePreferences>();

            PaymentDetailsDictionary.Add("PaymentDetails", PaymentDetailsTablePreferences);
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.GetPaymentDetails(productId, orderId, PaymentDetailsDictionary));
        }
예제 #13
0
        private void VerifyOrderStatuses(HttpContext context)
        {
            long orderId = 0; float activationAmount = 0; bool isActivated = true;

            if (context.Request["OrderId"] != null && !Int64.TryParse(context.Request["OrderId"].ToString(), out orderId))
            {
                GenerateErrorResponse(400, "OrderId value must be a number");
            }
            if (context.Request["IsActivated"] != null && !bool.TryParse(context.Request["IsActivated"].ToString(), out isActivated))
            {
                GenerateErrorResponse(400, "IsActivated value must be a Boolean");
            }
            if (string.IsNullOrEmpty(context.Request["ActivationAmount"]))
            {
                GenerateErrorResponse(400, string.Format("ActivationAmount is Mandatory"));
            }
            else
            {
                activationAmount = float.Parse(context.Request["ActivationAmount"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
            }
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.VerifyOrderStatuses(orderId, activationAmount, isActivated, null));
        }
예제 #14
0
        private void Search(HttpContext context)
        {
            byte     productId       = 0;
            int      invoiceId       = 0;
            string   quotationNumber = string.Empty;
            string   accountName     = string.Empty;
            string   mobile          = string.Empty;
            string   email           = string.Empty;
            int      accountId       = 0;
            int      employeeId      = 0;
            int      ownerShipId     = 0;
            byte     statusId        = 0;
            sbyte    channelId       = 0;
            string   ipAddress       = string.Empty;
            byte     billingModeId   = 1;
            bool     isdownload      = false;
            DateTime fromDateTime    = DateTime.Now.Date;
            DateTime toDateTime      = DateTime.Now.AddDays(1).AddTicks(-1);
            int      pageNumber      = 1;
            byte     limit           = 20;
            JObject  searchData      = new JObject();

            searchData = JObject.Parse(context.Request["SearchData"]);

            if (searchData.SelectToken("ProductId") != null && !byte.TryParse(searchData.SelectToken("ProductId").ToString(), out productId))
            {
                GenerateErrorResponse(400, string.Format("ProductId must be a number"));
            }
            if (searchData.SelectToken("InvoiceId") != null && !int.TryParse(searchData.SelectToken("InvoiceId").ToString(), out invoiceId))
            {
                GenerateErrorResponse(400, string.Format("QuotationId must be a number"));
            }
            if (searchData.SelectToken("QuotationNumber") != null)
            {
                quotationNumber = searchData.SelectToken("QuotationNumber").ToString();
            }
            if (searchData.SelectToken("AccountName") != null)
            {
                accountName = searchData.SelectToken("AccountName").ToString();
            }
            if (searchData.SelectToken("AccountId") != null && !int.TryParse(searchData.SelectToken("AccountId").ToString(), out accountId))
            {
                GenerateErrorResponse(400, string.Format("AccountId must be a number"));
            }
            if (searchData.SelectToken("EmployeeId") != null && !int.TryParse(searchData.SelectToken("EmployeeId").ToString(), out employeeId))
            {
                GenerateErrorResponse(400, string.Format("EmployeeId must be a number"));
            }
            if (searchData.SelectToken("OwnerShipId") != null && !int.TryParse(searchData.SelectToken("OwnerShipId").ToString(), out ownerShipId))
            {
                GenerateErrorResponse(400, string.Format("OwnerShipId must be a number"));
            }
            if (searchData.SelectToken("StatusId") != null && !byte.TryParse(searchData.SelectToken("StatusId").ToString(), out statusId))
            {
                GenerateErrorResponse(400, string.Format("StatusId must be a number"));
            }
            if (searchData.SelectToken("ChannelId") != null && !sbyte.TryParse(searchData.SelectToken("ChannelId").ToString(), out channelId))
            {
                GenerateErrorResponse(400, string.Format("ChannelId must be a number"));
            }
            if (searchData.SelectToken("BillingModeId") != null && !byte.TryParse(searchData.SelectToken("BillingModeId").ToString(), out billingModeId))
            {
                GenerateErrorResponse(400, string.Format("BillingModeId must be a number"));
            }
            if (searchData.SelectToken("FromDateTime") != null && !DateTime.TryParse(searchData.SelectToken("FromDateTime").ToString(), out fromDateTime))
            {
                GenerateErrorResponse(400, string.Format("FromDateTime is not a valid datetime"));
            }
            if (searchData.SelectToken("ToDateTime") != null && !DateTime.TryParse(searchData.SelectToken("ToDateTime").ToString(), out toDateTime))
            {
                GenerateErrorResponse(400, string.Format("ToDateTime is not a valid datetime"));
            }
            if (searchData.SelectToken("PageNumber") != null && !int.TryParse(searchData.SelectToken("PageNumber").ToString(), out pageNumber))
            {
                GenerateErrorResponse(400, string.Format("PageNumber must be a number"));
            }
            if (searchData.SelectToken("Limit") != null && !byte.TryParse(searchData.SelectToken("Limit").ToString(), out limit))
            {
                GenerateErrorResponse(400, string.Format("Limit must be a number"));
            }
            if (searchData.SelectToken("Mobile") != null)
            {
                mobile = searchData.SelectToken("Mobile").ToString();
            }
            if (searchData.SelectToken("Email") != null)
            {
                email = searchData.SelectToken("Email").ToString();
            }
            TablePreferences invoiceTablePreferences = new TablePreferences("", "", true, false);
            Dictionary <string, TablePreferences> invoiceDictionary = new Dictionary <string, TablePreferences>();

            invoiceDictionary.Add("Invoices", invoiceTablePreferences);
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.GetInvoices(productId: productId, invoiceId: invoiceId, quotationNumber: quotationNumber, accountId: accountId,
                                                      employeeId: employeeId, ownerShipId: ownerShipId, statusId: statusId, channelId: channelId, ipAddress: ipAddress,
                                                      billingModeId: billingModeId, fromDateTime: fromDateTime, toDateTime: toDateTime, pageNumber: pageNumber, limit: limit,
                                                      mobile: mobile, email: email, accountName: accountName, tablePreferences: invoiceDictionary, isdownload: isdownload));
        }
예제 #15
0
        private void downloadOrderActivations(HttpContext context)
        {
            byte     productId    = 0;
            int      accountId    = 0;
            string   accountName  = string.Empty;
            string   mobile       = string.Empty;
            string   email        = string.Empty;
            string   number       = string.Empty;
            byte     orderStatus  = 0;
            byte     billingMode  = 1;
            DateTime fromDateTime = DateTime.Now.Date;
            DateTime toDateTime   = DateTime.Now.AddDays(1).AddTicks(-1);
            int      pageNumber   = 1;
            byte     limit        = 20;

            if (context.Request["ProductId"] != null && !byte.TryParse(context.Request["productId"].ToString(), out productId))
            {
                GenerateErrorResponse(400, string.Format("ProductId must be a number"));
            }
            if (context.Request["Number"] != null)
            {
                number = context.Request["Number"].ToString();
            }
            if (context.Request["AccountName"] != null)
            {
                accountName = context.Request["AccountName"].ToString();
            }
            if (context.Request["OrderStatus"] != null && !byte.TryParse(context.Request["OrderStatus"].ToString(), out orderStatus))
            {
                GenerateErrorResponse(400, string.Format("OrderStatus must be a number"));
            }
            if (context.Request["BillingMode"] != null && !byte.TryParse(context.Request["BillingMode"].ToString(), out billingMode))
            {
                GenerateErrorResponse(400, string.Format("BillingModeId must be a number"));
            }
            if (context.Request["mobile"] != null)
            {
                mobile = Convert.ToString(context.Request["mobile"]);
            }
            if (context.Request["email"] != null)
            {
                email = Convert.ToString(context.Request["email"]);
            }
            if (context.Request["FromDateTime"] != null)
            {
                fromDateTime = Convert.ToDateTime(context.Request["fromDateTime"]);
            }
            if (context.Request["ToDateTime"] != null)
            {
                toDateTime = Convert.ToDateTime(context.Request["ToDateTime"]);
            }

            TablePreferences ordersTablePreferences = new TablePreferences("", "", true, false);
            Dictionary <string, TablePreferences> ordersDictionary = new Dictionary <string, TablePreferences>();

            ordersDictionary.Add("Orders", ordersTablePreferences);

            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.GetOrders(productId: productId, accountId: accountId, mobile: mobile, email: email, orderStatus: orderStatus,
                                                    number: number, billingMode: billingMode, fromDateTime: fromDateTime, toDateTime: toDateTime,
                                                    accountName: accountName, pageNumber: pageNumber, limit: limit, tablePreferences: ordersDictionary, isdownload: true));
        }
예제 #16
0
        private void Activate(HttpContext context)
        {
            string activationUrl       = string.Empty;
            string metaData            = string.Empty;
            int    quotationId         = 0;
            string searchData          = string.Empty;
            byte   billingModeId       = 0;
            bool   isPostPaid          = false;
            byte   activatedPercentage = 0;
            float  activationAmount    = 0;

            if (string.IsNullOrEmpty(context.Request["ActivationUrl"]))
            {
                GenerateErrorResponse(400, string.Format("ActivationUrl is Mandatory"));
            }
            else
            {
                activationUrl = context.Request["ActivationUrl"].ToString();
            }
            //if (string.IsNullOrEmpty(context.Request["SearchData"]))
            //    GenerateErrorResponse(400, string.Format("SearchData is Mandatory"));
            //else
            //    searchData = context.Request["SearchData"].ToString();
            if (string.IsNullOrEmpty(context.Request["QuotationId"]))
            {
                GenerateErrorResponse(400, string.Format("QuotationId is Mandatory"));
            }
            else
            {
                quotationId = Convert.ToInt32(context.Request["QuotationId"].ToString());
            }

            //if (string.IsNullOrEmpty(context.Request["MetaData"]))
            //    GenerateErrorResponse(400, string.Format("MetaData is Mandatory"));
            //else
            //    metaData = context.Request["MetaData"].ToString();

            //if (string.IsNullOrEmpty(context.Request["BillingMode"]))
            //    GenerateErrorResponse(400, string.Format("BillingMode is Mandatory"));
            //else
            //    billingModeId = Convert.ToByte(context.Request["BillingMode"].ToString());

            if (string.IsNullOrEmpty(context.Request["IsPostPaid"]))
            {
                GenerateErrorResponse(400, string.Format("IsPostPaid is Mandatory"));
            }
            else
            {
                isPostPaid = Convert.ToBoolean(context.Request["IsPostPaid"].ToString());
            }
            //if (string.IsNullOrEmpty(context.Request["ActivatedPercentage"]))
            //    GenerateErrorResponse(400, string.Format("ActivatedPercentage is Mandatory"));
            //else
            //    activatedPercentage = Convert.ToByte(context.Request["ActivatedPercentage"].ToString());

            if (string.IsNullOrEmpty(context.Request["ActivationAmount"]))
            {
                GenerateErrorResponse(400, string.Format("ActivationAmount is Mandatory"));
            }
            else
            {
                activationAmount = float.Parse(context.Request["ActivationAmount"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
            }


            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);

            context.Response.Write(client.ActivateOrder(quotationId: quotationId, isPostPaidQuotation: isPostPaid, activationAmount: activationAmount, activationUrl: activationUrl, employeeId: Convert.ToInt32(HttpContext.Current.Session["AdminId"]), tablePreferences: null));
        }
예제 #17
0
        private void Search(HttpContext context)
        {
            byte     productId    = 0;
            int      accountId    = 0;
            string   accountName  = string.Empty;
            string   mobile       = string.Empty;
            string   email        = string.Empty;
            string   number       = string.Empty;
            byte     orderStatus  = 0;
            byte     billingMode  = 1;
            DateTime fromDateTime = DateTime.Now.Date;
            DateTime toDateTime   = DateTime.Now.AddDays(1).AddTicks(-1);
            int      pageNumber   = 1;
            byte     limit        = 20;


            JObject searchData = new JObject();

            searchData = JObject.Parse(context.Request["SearchData"]);
            if (searchData.SelectToken("ProductId") != null && !byte.TryParse(searchData.SelectToken("ProductId").ToString(), out productId))
            {
                GenerateErrorResponse(400, string.Format("ProductId must be a number"));
            }
            if (searchData.SelectToken("Number") != null)
            {
                number = searchData.SelectToken("Number").ToString();
            }
            if (searchData.SelectToken("AccountId") != null && !int.TryParse(searchData.SelectToken("AccountId").ToString(), out accountId))
            {
                GenerateErrorResponse(400, string.Format("AccountId must be a number"));
            }
            if (searchData.SelectToken("Mobile") != null)
            {
                mobile = searchData.SelectToken("Mobile").ToString();
            }
            if (searchData.SelectToken("AccountName") != null)
            {
                accountName = searchData.SelectToken("AccountName").ToString();
            }
            if (searchData.SelectToken("Email") != null)
            {
                email = searchData.SelectToken("Email").ToString();
            }
            if (searchData.SelectToken("OrderStatus") != null && !byte.TryParse(searchData.SelectToken("OrderStatus").ToString(), out orderStatus))
            {
                GenerateErrorResponse(400, string.Format("OrderStatus must be a number"));
            }
            if (searchData.SelectToken("BillingMode") != null && !byte.TryParse(searchData.SelectToken("BillingMode").ToString(), out billingMode))
            {
                GenerateErrorResponse(400, string.Format("BillingMode must be a number"));
            }
            if (searchData.SelectToken("FromDateTime") != null && !DateTime.TryParse(searchData.SelectToken("FromDateTime").ToString(), out fromDateTime))
            {
                GenerateErrorResponse(400, string.Format("FromDateTime is not a valid datetime"));
            }
            if (searchData.SelectToken("ToDateTime") != null && !DateTime.TryParse(searchData.SelectToken("ToDateTime").ToString(), out toDateTime))
            {
                GenerateErrorResponse(400, string.Format("ToDateTime is not a valid datetime"));
            }
            if (searchData.SelectToken("PageNumber") != null && !int.TryParse(searchData.SelectToken("PageNumber").ToString(), out pageNumber))
            {
                GenerateErrorResponse(400, string.Format("PageNumber must be a number"));
            }
            if (searchData.SelectToken("Limit") != null && !byte.TryParse(searchData.SelectToken("Limit").ToString(), out limit))
            {
                GenerateErrorResponse(400, string.Format("Limit must be a number"));
            }
            TablePreferences ordersTablePreferences = new TablePreferences("", "", true, false);
            Dictionary <string, TablePreferences> ordersDictionary = new Dictionary <string, TablePreferences>();

            ordersDictionary.Add("Orders", ordersTablePreferences);

            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.GetOrders(productId: productId, accountId: accountId, mobile: mobile, email: email, orderStatus: orderStatus,
                                                    number: number, billingMode: billingMode, fromDateTime: fromDateTime, toDateTime: toDateTime,
                                                    accountName: accountName, pageNumber: pageNumber, limit: limit, tablePreferences: ordersDictionary, isdownload: false));
        }
예제 #18
0
        private void downloadInvoices(HttpContext context)
        {
            byte     productId       = 0;
            int      invoiceId       = 0;
            string   quotationNumber = string.Empty;
            string   accountName     = string.Empty;
            string   mobile          = string.Empty;
            string   email           = string.Empty;
            string   ipAddress       = string.Empty;
            int      accountId       = 0;
            int      employeeId      = 0;
            int      ownerShipId     = 0;
            byte     statusId        = 0;
            sbyte    channelId       = 0;
            byte     billingModeId   = 1;
            bool     isdownload      = true;
            DateTime fromDateTime    = DateTime.Now.Date;
            DateTime toDateTime      = DateTime.Now.AddDays(1).AddTicks(-1);
            int      pageNumber      = 1;
            byte     limit           = 20;

            if (context.Request["ProductId"] != null && !byte.TryParse(context.Request["productId"].ToString(), out productId))
            {
                GenerateErrorResponse(400, string.Format("ProductId must be a number"));
            }
            //if (context.Request["InvoiceId"] != null && !int.TryParse(context.Request["InvoiceId"].ToString(), out invoiceId))
            //    GenerateErrorResponse(400, string.Format("InvoiceId must be a number"));
            if (context.Request["QuotationNumber"] != null)
            {
                quotationNumber = context.Request["QuotationNumber"].ToString();
            }
            if (context.Request["AccountName"] != null)
            {
                accountName = context.Request["AccountName"].ToString();
            }
            //if (context.Request["AccountId"] != null && !int.TryParse(context.Request["AccountId"].ToString(), out accountId))
            //    GenerateErrorResponse(400, string.Format("AccountId must be a number"));
            //if (context.Request["EmployeeId"] != null && !int.TryParse(context.Request["EmployeeId"].ToString(), out employeeId))
            //    GenerateErrorResponse(400, string.Format("EmployeeId must be a number"));
            //if (context.Request["OwnerShipId"] != null && !int.TryParse(context.Request["OwnerShipId"].ToString(), out ownerShipId))
            //    GenerateErrorResponse(400, string.Format("OwnerShipId must be a number"));
            if (context.Request["StatusId"] != null && !byte.TryParse(context.Request["StatusId"].ToString(), out statusId))
            {
                GenerateErrorResponse(400, string.Format("StatusId must be a number"));
            }
            //if (context.Request["ChannelId"] != null && !sbyte.TryParse(context.Request["ChannelId"].ToString(), out channelId))
            //    GenerateErrorResponse(400, string.Format("ChannelId must be a number"));
            if (context.Request["BillingModeId"] != null && !byte.TryParse(context.Request["BillingModeId"].ToString(), out billingModeId))
            {
                GenerateErrorResponse(400, string.Format("BillingModeId must be a number"));
            }
            if (context.Request["mobile"] != null)
            {
                mobile = Convert.ToString(context.Request["mobile"]);
            }
            if (context.Request["email"] != null)
            {
                email = Convert.ToString(context.Request["email"]);
            }
            if (context.Request["FromDateTime"] != null)
            {
                fromDateTime = Convert.ToDateTime(context.Request["fromDateTime"]);
            }
            if (context.Request["ToDateTime"] != null)
            {
                toDateTime = Convert.ToDateTime(context.Request["ToDateTime"]);
            }

            TablePreferences invoiceTablePreferences = new TablePreferences("", "", true, false);
            Dictionary <string, TablePreferences> invoiceDictionary = new Dictionary <string, TablePreferences>();

            invoiceDictionary.Add("Invoices", invoiceTablePreferences);
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            //JObject jobj = new JObject();
            context.Response.Write(client.GetInvoices(productId: productId, invoiceId: invoiceId, quotationNumber: quotationNumber, accountId: accountId,
                                                      employeeId: employeeId, ownerShipId: ownerShipId, statusId: statusId, channelId: channelId, ipAddress: ipAddress,
                                                      billingModeId: billingModeId, fromDateTime: fromDateTime, toDateTime: toDateTime, pageNumber: pageNumber, limit: limit,
                                                      mobile: mobile, email: email, accountName: accountName, tablePreferences: invoiceDictionary, isdownload: isdownload));
            //string resp = jobj.ToString();
            //if (isdownload == false)
            //  context.Response.Write(jobj);
        }
예제 #19
0
        private void Create(HttpContext context)
        {
            byte     productId                 = 0;
            int      invoiceId                 = 0;
            int      accountId                 = 0;
            int      paymentGatewayId          = 0;
            float    paymentAmount             = 0;
            int      employeeId                = Convert.ToInt32(context.Session["AdminId"]);
            int      bankAccountId             = 0;
            string   comments                  = string.Empty;
            string   ipAddress                 = string.Empty;
            int      activatePercentage        = 0;
            int      activationAmount          = 0;
            int      billingModeId             = 0;
            DateTime depositeDate              = new DateTime();
            DateTime dueDate                   = new DateTime();
            bool     isTDSApplicable           = false;
            int      tdsPercentage             = 0;
            JObject  paymentData               = new JObject();
            string   chequeNumber              = string.Empty;
            string   attachments               = string.Empty;
            string   transactionNumber         = string.Empty;
            string   clientAccountNumber       = string.Empty;
            string   clientAccountName         = string.Empty;
            string   clientBankName            = string.Empty;
            string   clientBankBranch          = string.Empty;
            int      onlinePaymentGatewayId    = 0;
            string   paymentGatewayReferenceId = string.Empty;

            paymentData = JObject.Parse(context.Request["SearchData"]);
            if (paymentData.SelectToken("ProductId") != null && !byte.TryParse(paymentData.SelectToken("ProductId").ToString(), out productId))
            {
                GenerateErrorResponse(400, string.Format("ProductId must be a number"));
            }
            if (paymentData.SelectToken("InvoiceId") != null && !int.TryParse(paymentData.SelectToken("InvoiceId").ToString(), out invoiceId))
            {
                GenerateErrorResponse(400, string.Format("InvoiceId must be a number"));
            }
            if (paymentData.SelectToken("AccountId") != null && !int.TryParse(paymentData.SelectToken("AccountId").ToString(), out accountId))
            {
                GenerateErrorResponse(400, string.Format("AccountId must be a number"));
            }
            if (paymentData.SelectToken("BillingModeId") != null && !int.TryParse(paymentData.SelectToken("BillingModeId").ToString(), out billingModeId))
            {
                GenerateErrorResponse(400, string.Format("BillingModeId must be a number"));
            }
            if (paymentData.SelectToken("PaymentGatewayId") != null && !int.TryParse(paymentData.SelectToken("PaymentGatewayId").ToString(), out paymentGatewayId))
            {
                GenerateErrorResponse(400, string.Format("PaymentGatewayId must be a number"));
            }
            if (paymentData.SelectToken("PaymentAmount") != null && !float.TryParse(paymentData.SelectToken("PaymentAmount").ToString(), out paymentAmount))
            {
                GenerateErrorResponse(400, string.Format("Payment Amount must be a Float"));
            }
            if (paymentData.SelectToken("BankAccountId") != null && !int.TryParse(paymentData.SelectToken("BankAccountId").ToString(), out bankAccountId))
            {
                GenerateErrorResponse(400, string.Format("bankAccountId Amount must be a number"));
            }
            if (paymentData.SelectToken("DepositeDate") != null && !DateTime.TryParse(paymentData.SelectToken("DepositeDate").ToString(), out depositeDate))
            {
                GenerateErrorResponse(400, string.Format("FromDateTime is not a valid datetime"));
            }
            if (paymentData.SelectToken("DueDate") != null && !DateTime.TryParse(paymentData.SelectToken("DueDate").ToString(), out dueDate))
            {
                GenerateErrorResponse(400, string.Format("DueDate is not a valid datetime"));
            }
            //if (paymentData.SelectToken("ActivatePercentage") != null && !int.TryParse(paymentData.SelectToken("ActivatePercentage").ToString(), out activatePercentage))
            //    GenerateErrorResponse(400, string.Format("Activate percentage must be a number"));
            //if (paymentData.SelectToken("ActivationAmount") != null && !int.TryParse(paymentData.SelectToken("ActivationAmount").ToString(), out activationAmount))
            //    GenerateErrorResponse(400, string.Format("Activation Amount must be a number"));
            if (paymentData.SelectToken("IsTDSApplicable") != null && !bool.TryParse(paymentData.SelectToken("IsTDSApplicable").ToString(), out isTDSApplicable))
            {
                GenerateErrorResponse(400, string.Format("IsTDSApplicable percentage must be a boolean"));
            }
            if (isTDSApplicable == true && (paymentData.SelectToken("TDSPercentage") != null && !int.TryParse(paymentData.SelectToken("TDSPercentage").ToString(), out tdsPercentage)))
            {
                GenerateErrorResponse(400, string.Format("TDSPercentage percentage must be a number"));
            }
            if (paymentData.SelectToken("Comments") != null)
            {
                comments = paymentData.SelectToken("Comments").ToString();
            }
            if (paymentData.SelectToken("ChequeNumber") != null)
            {
                chequeNumber = paymentData.SelectToken("ChequeNumber").ToString();
            }
            if (paymentData.SelectToken("Attachments") != null)
            {
                attachments = paymentData.SelectToken("Attachments").ToString();
            }
            if (paymentData.SelectToken("TransactionNumber") != null)
            {
                transactionNumber = paymentData.SelectToken("TransactionNumber").ToString();
            }
            if (paymentData.SelectToken("ClientAccountNumber") != null)
            {
                clientAccountNumber = paymentData.SelectToken("ClientAccountNumber").ToString();
            }
            if (paymentData.SelectToken("ClientAccountName") != null)
            {
                clientAccountName = paymentData.SelectToken("ClientAccountName").ToString();
            }
            if (paymentData.SelectToken("ClientBankName") != null)
            {
                clientBankName = paymentData.SelectToken("ClientBankName").ToString();
            }
            if (paymentData.SelectToken("ClientBankBranch") != null)
            {
                clientBankBranch = paymentData.SelectToken("ClientBankBranch").ToString();
            }
            if (paymentData.SelectToken("OnlinePaymentGatewayId") != null && !int.TryParse(paymentData.SelectToken("OnlinePaymentGatewayId").ToString(), out onlinePaymentGatewayId))
            {
                GenerateErrorResponse(400, string.Format("Online Payment GatewayId must be a number"));
            }
            if (paymentData.SelectToken("PaymentGatewayReferenceId") != null)
            {
                paymentGatewayReferenceId = paymentData.SelectToken("PaymentGatewayReferenceId").ToString();
            }
            OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON);
            context.Response.Write(client.CreatePayment(productId: productId, accountId: accountId, employeeId: employeeId,
                                                        invoiceId: invoiceId, billingModeId: billingModeId, paymentGatewayId: paymentGatewayId, paymentAmount: paymentAmount,
                                                        bankAccountId: bankAccountId, depositeDate: depositeDate, dueDate: dueDate,
                                                        comments: comments, isTDSApplicable: isTDSApplicable, tdsPercentage: tdsPercentage, chequeNumber: chequeNumber, attachments: attachments,
                                                        transactionNumber: transactionNumber, clientAccountNumber: clientAccountNumber, clientAccountName: clientAccountName,
                                                        clientBankName: clientBankName, clientBankBranch: clientBankBranch, onlinePaymentGatewayId: onlinePaymentGatewayId,
                                                        paymentGatewayReferenceId: paymentGatewayReferenceId));
        }