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)); }
private void GetQuotationServiceProperties(HttpContext context) { bool onlyActive = true; int quotationId = 0; byte billingModeId = 1; 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["QuotationId"] != null && !int.TryParse(context.Request["QuotationId"].ToString(), out quotationId)) { GenerateErrorResponse(400, string.Format("QuotationId value ({0}) is not a valid integer value", context.Request["QuotationId"].ToString())); } if (context.Request["BillingModeId"] != null && !byte.TryParse(context.Request["BillingModeId"].ToString(), out billingModeId)) { GenerateErrorResponse(400, string.Format("QuotationId value ({0}) is not a valid integer value", context.Request["BillingModeId"].ToString())); } TablePreferences quotationServicePropertiesTablePreferences = new TablePreferences("", "", true, false); Dictionary <string, TablePreferences> quotationServicePropertiesDictionary = new Dictionary <string, TablePreferences>(); quotationServicePropertiesDictionary.Add("QuotationServiceProperties", quotationServicePropertiesTablePreferences); OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON); context.Response.Write(client.GetQuotationServiceProperties(quotationId: quotationId, billingModeId: billingModeId, onlyActive: onlyActive, tablePreferences: quotationServicePropertiesDictionary)); }
public void GetCountries(HttpContext context) { OrdersManagement.Core.Client countriesObj = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON); TablePreferences countriesTablePreferences = new TablePreferences("", "", true, false); Dictionary <string, TablePreferences> countriesDictionary = new Dictionary <string, TablePreferences>(); countriesDictionary.Add(Label.COUNTRIES, countriesTablePreferences); context.Response.Write(countriesObj.GetCountries(tablePreferences: countriesDictionary)); }
private void Search(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())); } TablePreferences productsTablePreferences = new TablePreferences("", "", true, false); Dictionary <string, TablePreferences> productsDictionary = new Dictionary <string, TablePreferences>(); productsDictionary.Add("Products", productsTablePreferences); OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON); context.Response.Write(client.GetProducts(onlyActive: onlyActive, tablePreferences: productsDictionary)); }
public void GetAccountOwnersAndPlans(HttpContext context) { byte isProductId = 0; if (context.Request["ProductId"] == null || !byte.TryParse(context.Request["ProductId"].ToString(), out isProductId)) { GenerateErrorResponse(400, string.Format("ProductId must be a boolean value")); } Orders.BussinessLogicLayer.Accounts accountsObj = new BussinessLogicLayer.Accounts(); TablePreferences statesTablePreferences = new TablePreferences("", "", true, false); Dictionary <string, TablePreferences> statesDictionary = new Dictionary <string, TablePreferences>(); statesDictionary.Add(Label.STATES, statesTablePreferences); context.Response.Write(accountsObj.GetAccountOwnersAndPlans(MyConf.MyConnectionString, isProductId)); }
public void GetStates(HttpContext context) { bool isActive; if (context.Request["IsActive"] == null || !bool.TryParse(context.Request["IsActive"].ToString(), out isActive)) { GenerateErrorResponse(400, string.Format("IsActive must be a boolean value")); } OrdersManagement.Core.Client statesObj = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON); TablePreferences statesTablePreferences = new TablePreferences("", "", true, false); Dictionary <string, TablePreferences> statesDictionary = new Dictionary <string, TablePreferences>(); statesDictionary.Add(Label.STATES, statesTablePreferences); context.Response.Write(statesObj.GetStates(true, tablePreferences: statesDictionary)); }
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)); }
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)); }
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)); }
private void Search(HttpContext context) { byte productId = 0; int quotationId = 0; string quotationNumber = string.Empty; string accountName = string.Empty; string mobile = string.Empty; string email = string.Empty; int accountId = 0; int employeeId = Convert.ToInt32(context.Session["AdminId"]); int ownerShipId = 0; byte statusId = 0; sbyte channelId = 0; string ipAddress = string.Empty; byte billingModeId = 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("QuotationId") != null && !int.TryParse(searchData.SelectToken("QuotationId").ToString(), out quotationId)) { 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 quotationTablePreferences = new TablePreferences("", "", true, false); Dictionary <string, TablePreferences> quotationsDictionary = new Dictionary <string, TablePreferences>(); quotationsDictionary.Add("Quotations", quotationTablePreferences); OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON); context.Response.Write(client.GetQuotations(productId: productId, quotationId: quotationId, 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: quotationsDictionary, isdownload: false)); }
private void downloadQuotations(HttpContext context) { byte productId = 0; int quotationId = 0; string quotationNumber = string.Empty; string accountName = string.Empty; string mobile = string.Empty; string email = string.Empty; int accountId = 0; int employeeId = Convert.ToInt32(context.Session["AdminId"]); int ownerShipId = 0; byte statusId = 0; sbyte channelId = 0; string ipAddress = string.Empty; byte billingModeId = 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["QuotationNumber"] != null) { quotationNumber = context.Request["QuotationNumber"].ToString(); } if (context.Request["AccountName"] != null) { accountName = context.Request["AccountName"].ToString(); } 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["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 quotationTablePreferences = new TablePreferences("", "", true, false); Dictionary <string, TablePreferences> quotationsDictionary = new Dictionary <string, TablePreferences>(); quotationsDictionary.Add("Quotations", quotationTablePreferences); OrdersManagement.Core.Client client = new OrdersManagement.Core.Client(responseFormat: OrdersManagement.ResponseFormat.JSON); context.Response.Write(client.GetQuotations(productId: productId, quotationId: quotationId, 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: quotationsDictionary, isdownload: true)); }
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); }