public HttpResponseMessage getDeviceinAgreementDetailByCustId(int id, String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah); var viewService = AsmRepository.GetServiceProxy <IViewFacadeService>(ah); var viewD = viewService.GetCustomerDeviceView(new BaseQueryRequest() { FilterCriteria = Op.Eq("CustomerId", id), PageCriteria = new PageCriteria() { Page = 0, PageSize = 100 }, DeepLoad = true }); if (viewD != null) { return(Request.CreateResponse(HttpStatusCode.OK, viewD)); } else { var message = string.Format("error"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.OK, message)); } }
public HttpResponseMessage GetTotalAmountQuoteByCustomerId(String username_ad, String password_ad, int id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var billService = AsmRepository.GetServiceProxy <IBillingEngineService>(authHeader); var finService = AsmRepository.AllServices.GetFinanceService(authHeader); decimal totalamount = 0; var fa = finService.GetFinancialAccountsForCustomer(id, new CriteriaCollection() { new Criteria() { Key = "TypeId", Operator = Operator.Equal, Value = "1" } }, 0).Items[0]; //Console.WriteLine("Financial Account Id : " + fa.Id.Value); var quoteinvoice = billService.FindQuoteInvoices(new BaseQueryRequest() { FilterCriteria = Op.Eq("FinancialAccountId", fa.Id.Value) & Op.Eq("QuoteStatusId", "1") }); foreach (var quote in quoteinvoice) { string quote_type = ""; //Console.WriteLine("Find quote Id : " + quote.Id.Value); if (quote.QuoteGenerationMethod == QuoteGenerationMethod.EventBased) { quote_type = "Immediate Quote"; } else if (quote.QuoteGenerationMethod == QuoteGenerationMethod.ServiceRetention) { quote_type = "Regular Quote"; } //Console.WriteLine("Quote Type" + quote_type); totalamount = quote.TotalAmount.Value + totalamount; } return(Request.CreateResponse(HttpStatusCode.OK, "TotalAmount = " + totalamount)); }
public string linkdocument([FromBody] DocumentRequest req) { IDocumentManagementService docmService = null; Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(req.username_ad, req.password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); docmService = AsmRepository.GetServiceProxy <IDocumentManagementService>(authHeader); var var_uri = new System.Uri(req.file_uri); Document doc = new Document { Name = req.file_name, Uri = req.file_uri, // File Path , must be correct. And it must be ICC configured file server CreatedDate = DateTime.Now, CreatedByUserId = 45, // ICC User ID HostId = 23, // Fixed Value 23 FileSize = req.file_size // must be the exact file size in Bytes }; var newDoc = docmService.CreateDocument(doc); var docLink = new DocumentLink { DocumentId = newDoc.Id, CustomerId = req.cust_id, //DocumentType = 1 }; var linkReason = 0; DocumentLink newDocLink = docmService.CreateDocumentLink(docLink, linkReason); return(req.file_uri); }
public void getAgreementDetail() { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); var m_IAgreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(authHeader); var viewService = AsmRepository.GetServiceProxy <IViewFacadeService>(authHeader); AgreementDetailCollection adc = m_IAgreementManagementService.GetAgreementDetailsForCustomer(500016733, 1); if (adc != null && adc.Items.Count > 0) { foreach (AgreementDetail a in adc.Items) { Console.WriteLine("Found product ID {0}: Status ID = {1}", a.CommercialProductId, a.Status); } } else { Console.WriteLine("I found nothing."); } var viewD = viewService.GetCustomerDeviceView(new BaseQueryRequest() { FilterCriteria = Op.Eq("CustomerId", 500016733), PageCriteria = new PageCriteria() { Page = 0, PageSize = 100 }, DeepLoad = true }); foreach (var device in viewD.Items) { // here you can call GetDeviceView to get more info, parameters are the same like above GetCustomerDeviceView , just change Op.Eq("CustomerId", customer_id) to Op,Eq("Id",device.Id.Value) Console.WriteLine("Device ID : " + device.DeviceId.Value + " Serial Number : " + device.SerialNumber + " Status : " + device.DeviceStatusName + " Model:" + device.ModelDescription); } var viewAg = viewService.GetAgreementDetailView(new BaseQueryRequest() { FilterCriteria = Op.Eq("CustomerId", 500016733), PageCriteria = new PageCriteria() { Page = 0, PageSize = 100 } }); foreach (var product in viewAg.Items) { Console.WriteLine("Agreement Detail ID : " + product.Id.Value + " Product Name :" + product.CommercialProductName + " Charge Until Date : " + product.ChargeUntilDate + " Charge Period : " + product.ChargePeriodName + " Finance Option : " + product.FinanceOptionName + " Recurring Price : " + product.RecurringListPrice + " Status :" + product.StatusName); } Console.ReadLine(); }
public List <QuoteInvoiceCollection> GetPendingQuote(String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var billService = AsmRepository.GetServiceProxy <IBillingEngineService>(ah); var finService = AsmRepository.AllServices.GetFinanceService(ah); QuoteInvoiceCollection quotes = null; decimal total_amount = 0; ArrayList falist = new ArrayList(); long new_max_quote_id = 1; int total_record = 0; List <QuoteInvoiceCollection> the_items = new List <QuoteInvoiceCollection>(); for (int i = 1; i < 10000; i++) { quotes = billService.FindQuoteInvoices(new BaseQueryRequest() { FilterCriteria = Op.Eq("QuoteStatusId", "1") & Op.Gt("Id", 1), PageCriteria = new PageCriteria() { Page = i, PageSize = 300 }, SortCriteria = new SortCriteriaCollection() { new SortCriteria() { SortDirection = SortDirections.Ascending, Key = "Id" } }, DeepLoad = true }); //Console.WriteLine("Loop " + i + " Times!"); if (quotes.TotalCount == 0) { //Console.WriteLine("End Loop ...... "); break; } // set the new max quote id for next run int count = quotes.TotalCount - 1; new_max_quote_id = quotes.Items[count].Id.Value; foreach (var quote in quotes.Items) { // Avoid duplicate records if (falist.Contains(quote.FinancialAccountId)) { continue; } else { falist.Add(quote.FinancialAccountId); } total_amount = 0; total_amount = quote.TotalAmount.Value; var fa = finService.GetFinancialAccount(quote.FinancialAccountId.Value); // search all pending quote for same financial account and count total // Why : Customer may have multiple pending quote if he request more products or upgrade in different time, so you need count all of them. foreach (var quotet in quotes.Items) { if (quotet.FinancialAccountId == quote.FinancialAccountId && quote.Id != quotet.Id) { total_amount = total_amount + quotet.TotalAmount.Value; total_record++; //Console.WriteLine("quotet.TotalAmount.Value " + quotet.TotalAmount.Value); } } // Add the account debit like payment fee, downgrade fee...etc. so you need to add account balance total_amount = total_amount + fa.Balance.Value; //Console.WriteLine("Customer Id : " + quote.CustomerId.Value + " FA ID : " + fa.Id.Value + " , unpaid quote amount : " + total_amount); //if (quote.LineItems.TotalCount > 0) //{ // Console.WriteLine("From " + quote.LineItems.Items[0].StartDate + " To " + quote.LineItems.Items[0].EndDate); //} total_record++; } the_items.Add(new QuoteInvoiceCollection(quotes)); quotes = null; } //Console.WriteLine("Total " + total_record + " pending quotes"); //Console.Read(); //return new_max_quote_id; return(the_items); }