public void duplicationCheck() { ICustomersService custService = null; ICustomersConfigurationService custcService = null; Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthentication_header(); AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc"); custService = AsmRepository.AllServices.GetCustomersService(authHeader); custcService = AsmRepository.AllServices.GetCustomersConfigurationService(authHeader); var ads = custcService.GetValidAddresses(new BaseQueryRequest() { FilterCriteria = new CriteriaCollection() { new Criteria() { Key = "PostalCode", Operator = Operator.Equal, Value = "11140000" } } }); //var ads = custcService.GetCountries(new BaseQueryRequest() //{ // FilterCriteria = new CriteriaCollection() // { // new Criteria() // { // Key = "Id", // Operator = Operator.Equal, // Value = "1" // } // } //}); var findCustomers = custService.GetDuplicateCustomers(new DuplicateCustomerCriteria() { ValidAddressId = ads.Items[0].Id.Value, CustomerCaptureCategory = CustomerCaptureCategory.ResidentialCustomers, FirstName = "TEST NANA", Surname = "UAT LIVE", //HouseNumberAlpha = "123", //Extra = "chongqing", // Address Line 1 //ExtraExtra = "yuzhongqu", // Address Line 2 HomePhone = "02192554175", WorkPhone = "6281808843210", Fax1 = "045465888452", // emergency Number Fax2 = "02192554175", // Mobile Phone //CustomField1 = "aaaaa", //CustomField2 = "bbbbb", ReferenceTypeKey = 1, // ReferenceNumber = "RN123", }); foreach (var cust in findCustomers) { //Console.WriteLine("ID : "); Console.WriteLine("ID : " + cust.Id); Console.WriteLine("ID : " + cust.Id.Value + " Name% : " + cust.SimilarityOfCustomerName + " Address% : " + cust.SimilarityOfAddress + " Phone% : " + cust.SimilarityOfPhone + " RefNum% : " + cust.SimilarityOfReference); } //Console.WriteLine("ID : " ); Console.Read(); }
public YangProductPriceResponse YangProductPriceByProductId(String username_ad, String password_ad, int id) { YangProductPriceResponse db = new YangProductPriceResponse(); var cc = new List <YangProductPriceItems>(); List <int> CustomerClassIds_local = null; List <int> CountryIds_local = null; List <int> CustomerTypeIds_local = null; List <int> FinanceOptionIds_local = null; List <int> FinancialAccountTypeIds_local = null; List <string> PostalCodes_local = null; List <int> ProvinceIds_local = null; List <ListPriceCondition> ListPriceCondition_local = null; IAgreementManagementService agService = null; IAgreementManagementConfigurationService agcService = null; IProductCatalogService productService = null; IProductCatalogConfigurationService productcService = null; ICustomersConfigurationService custcService = null; IFinanceConfigurationService fincService = null; Authentication_class var_auth = new Authentication_class(); AuthenticationHeader ah = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); agService = AsmRepository.AllServices.GetAgreementManagementService(ah); agcService = AsmRepository.AllServices.GetAgreementManagementConfigurationService(ah); productService = AsmRepository.AllServices.GetProductCatalogService(ah); productcService = AsmRepository.AllServices.GetProductCatalogConfigurationService(ah); custcService = AsmRepository.AllServices.GetCustomersConfigurationService(ah); fincService = AsmRepository.AllServices.GetFinanceConfigurationService(ah); BaseQueryRequest request = new BaseQueryRequest(); CriteriaCollection criteria = new CriteriaCollection(); //request.FilterCriteria.Add(new Criteria("ExternalId", 92591)); request.FilterCriteria.Add(new Criteria("Id", id)); //Call the method and display the results. CommercialProductCollection pl = productcService.GetCommercialProducts(request); //CommercialProductCollection pl = productcService.GetCommercialProducts(new BaseQueryRequest() //{ // //FilterCriteria = Op.Le("SellFrom", DateTime.Now) && Op.Ge("SellTo", DateTime.Now), // FilterCriteria = Op.Equals("Id", id), // DeepLoad = true, // PageCriteria = new PageCriteria() // { // Page = 0 // } //}); //Console.WriteLine("Total Commercial Product Count : " + pl.TotalCount); db.the_TotalCount = pl.TotalCount; foreach (var pr in pl.Items) { int commercial_product_id = pr.Id.Value; var prices = productcService.GetListPrices(new BaseQueryRequest() { FilterCriteria = Op.Eq("UsedBy", 0) && Op.Eq("Active", true) && Op.Eq("ApplyToId", commercial_product_id), DeepLoad = true, PageCriteria = new PageCriteria() { Page = 0 } }); //Console.WriteLine("Product Name : " + pr.Name + "\n"); foreach (var ccc in pr.CommercialProductIds) { //Console.WriteLine("value = {0}" + ccc.ToString()); } //Console.WriteLine("Start to search all prices for commecial products : " + pr.Name + "\n"); if (prices == null) { continue; } foreach (var listprice in prices.Items) { string msg = ""; if (listprice.PriceConditions == null) { continue; } foreach (var pricecondition in listprice.PriceConditions.Items) { msg = ""; if (pricecondition.Active == false) { continue; } // Type - OnceOff, Recurrence msg = " Price Type : " + pricecondition.Type + "\n"; // Charge Period if (pricecondition.ChargePeriodId != 0) { msg = msg + " Charge Period " + pricecondition.ChargePeriodId + " Month" + "\n"; } // The price amount if (pricecondition.PriceAmounts != null) { string priceamount = ""; foreach (var pa in pricecondition.PriceAmounts) { priceamount += " Amount : " + pa.Amount + " From " + pa.FromDate + ","; } if (priceamount != "") { msg = msg + " " + priceamount + "\n"; } priceamount = ""; } // Allowed Agreement Type conditions if (pricecondition.AgreementTypeIds != null) { string agreement_type_list = ""; foreach (var agtid in pricecondition.AgreementTypeIds) { agreement_type_list += agcService.GetAgreementType(agtid).Description + ","; } if (agreement_type_list != "") { msg = msg + "Allowed Agreement Types : " + agreement_type_list + "\n"; } agreement_type_list = ""; } // Allowed Business Unit Attributes if (pricecondition.BusinessUnitAttributeValues != null) { string business_unit_attribute = ""; foreach (var bu in pricecondition.BusinessUnitAttributeValues) { business_unit_attribute += bu + ","; } if (business_unit_attribute != "") { msg = msg + " Allowed Business Unit Attribute : " + business_unit_attribute + "\n"; } business_unit_attribute = ""; } // Allowed Charge Period if (pricecondition.ChargePeriodId != null) { string charge_period = ""; if (pricecondition.ChargePeriodId == 1) { charge_period = "Monthly"; } if (pricecondition.ChargePeriodId == 3) { charge_period = "Quauterly"; } if (pricecondition.ChargePeriodId == 6) { charge_period = "HalfYearly"; } if (pricecondition.ChargePeriodId == 12) { charge_period = "Yearly"; } if (charge_period != "") { msg = msg + " Allowed Charge Period : " + charge_period + "\n"; } charge_period = ""; } // Allowed Country if (pricecondition.CountryIds != null) { string country_list = ""; foreach (var c in pricecondition.CountryIds) { country_list += custcService.GetCountry(c).Description + ","; } if (country_list != "") { msg = msg + " Allowed Country : " + country_list + "\n"; } country_list = ""; CountryIds_local = pricecondition.CountryIds; } // Allowed Currency if (pricecondition.CurrencyId != null) { string currency = ""; currency = fincService.GetCurrency(pricecondition.CurrencyId.Value).Description; if (currency != "") { msg = msg + " Allowed Currency : " + currency + "\n"; } currency = ""; } // Allowed Customer Class if (pricecondition.CustomerClassIds != null) { string customer_class = ""; foreach (var ci in pricecondition.CustomerClassIds) { customer_class += custcService.GetCustomerClass(ci).Description + ","; } if (customer_class != "") { msg = msg + " Allowed Customer Class : " + customer_class + "\n"; } customer_class = ""; CustomerClassIds_local = pricecondition.CustomerClassIds; } // Allowed Customer Type if (pricecondition.CustomerTypeIds != null) { string customer_type = ""; foreach (var ct in pricecondition.CustomerTypeIds) { customer_type += custcService.GetCustomerType(ct).Name + ","; } if (customer_type != null) { msg = msg + " Allowed Customer Type : " + customer_type + "\n"; } customer_type = ""; CustomerTypeIds_local = pricecondition.CustomerTypeIds; } // Allowed Finance Options if (pricecondition.FinanceOptionIds != null) { string financeoption = ""; foreach (var fo in pricecondition.FinanceOptionIds) { financeoption += productcService.GetFinanceOption(fo).Description + ","; } if (financeoption != "") { msg = msg + " Allowed Finance Options : " + financeoption + "\n"; } FinanceOptionIds_local = pricecondition.FinanceOptionIds; } // Allowed Finance Account Type if (pricecondition.FinancialAccountTypeIds != null) { string fatype = ""; foreach (var fatypeid in pricecondition.FinancialAccountTypeIds) { fatype += fincService.GetFinancialAccountType((fatypeid)).Description + ","; } if (fatype != "") { msg = msg + " Allowed Financial Account Type : " + fatype + "\n"; } } // Allowed Postal Codes if (pricecondition.PostalCodes != null) { string postcode = ""; foreach (var pcode in pricecondition.PostalCodes) { postcode += pcode + ","; } if (postcode != "") { msg = msg + " Allowed Postal Code : " + postcode + "\n"; } PostalCodes_local = pricecondition.PostalCodes; } // Allowed Province if (pricecondition.ProvinceIds != null) { string province = ""; foreach (var pro in pricecondition.ProvinceIds) { province += custcService.GetProvince(pro).Description + ","; } if (province != "") { msg = msg + " Allowed Province : " + province + "\n"; } ProvinceIds_local = pricecondition.ProvinceIds; } ListPriceCondition_local = listprice.PriceConditions.Items; } } cc.Add(new YangProductPriceItems { the_Name = pr.Name, the_CommercialProductIds = pr.CommercialProductIds, the_ListPriceCollection = prices.Items, the_CustomerClassIds = CustomerClassIds_local, the_CountryIds = CountryIds_local, the_CustomerTypeIds = CustomerTypeIds_local, the_ListPriceConditions = ListPriceCondition_local }); } db.the_items = cc; return(db); }
public List <OfferDefinition> YangOfferDefinition(String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); IOfferManagementConfigurationService offercService = null; IOfferManagementService offerService = null; IPriceAdjustmentService priceadService = null; IPriceAdjustmentConfigurationService priceadcService = null; ICustomersConfigurationService custcService = null; IProductCatalogConfigurationService productcService = null; IAgreementManagementService agService = null; offercService = AsmRepository.AllServices.GetOfferManagementConfigurationService(authHeader); offerService = AsmRepository.AllServices.GetOfferManagementService(authHeader); priceadService = AsmRepository.AllServices.GetPriceAdjustmentService(authHeader); priceadcService = AsmRepository.AllServices.GetPriceAdjustmentConfigurationService(authHeader); custcService = AsmRepository.AllServices.GetCustomersConfigurationService(authHeader); productcService = AsmRepository.AllServices.GetProductCatalogConfigurationService(authHeader); agService = AsmRepository.AllServices.GetAgreementManagementService(authHeader); try { var offers = offercService.GetOfferDefinitions(new BaseQueryRequest() { FilterCriteria = Op.Eq("Active", true), DeepLoad = true, PageCriteria = new PageCriteria() { Page = 0, } }); //Console.WriteLine("Find " + offers.TotalCount + " Promo defenitions..."); return(offers.Items); //foreach (var offer in offers.Items) //{ // Console.WriteLine("-----------------------------------------------------------------------"); // Console.WriteLine("Promo Name : " + offer.Description); // var offer_adjustments = priceadcService.GetPriceAdjustmentDefinitionsForOffer(offer.Id.Value, 0); // Console.WriteLine(" Find total price adjustment : " + offer_adjustments.TotalCount); // foreach (var offer_adjust in offer_adjustments.Items) // { // string condition = ""; // //string apply_level = ""; // string price = ""; // string charge_type = ""; // string apply_to_customer_class = ""; // string apply_to_customer_type = ""; // string apply_to_product = ""; // foreach (var cust_class in offer_adjust.ApplicableCustomerClasses) // { // apply_to_customer_class += custcService.GetCustomerClass(cust_class).Description + ","; // } // foreach (var cust_type in offer_adjust.ApplicableCustomerTypes) // { // apply_to_customer_type += custcService.GetCustomerType(cust_type).LongDescription + ","; // } // if (offer_adjust.ApplicableProducts != 0) // { // apply_to_product = productcService.GetCommercialProduct(offer_adjust.ApplicableProducts.Value).Name; // } // if (apply_to_customer_class != "") // { // condition += " apply to customer class : " + apply_to_customer_class; // } // if (apply_to_customer_type != "") // { // condition += " apply to customer type : " + apply_to_customer_type; // } // if (apply_to_product != "") // { // condition += " apply to product : " + apply_to_product; // } // if (offer_adjust.Type == PriceAdjustmentTypes.PercentOff) // { // price = " discount is percent :" + offer_adjust.Value; // } // if (offer_adjust.Type == PriceAdjustmentTypes.FixedPrice) // { // price = " discount is fixed price : " + offer_adjust.Value; // } // if (offer_adjust.Type == PriceAdjustmentTypes.AmountOff) // { // price = " discount is off amount " + offer_adjust.Value; // } // if (offer_adjust.ChargeType == ChargeTypes.OnceOff) // { // charge_type = " charge type is Once-Off"; // } // else if (offer_adjust.ChargeType == ChargeTypes.Recurring) // { // charge_type = " charge type is Recurring"; // } // Console.WriteLine("Apply level : 0 - ListPrice, 1 - Settlement 2 - OrderableEventDiscount 3 - PrepaidFAPayment 4 - QuoteProduct"); // Console.WriteLine("Adjustment " + offer_adjust.Description + " apply level : " + offer_adjust.ApplyToType.ToString() + " | " + condition + " Price : " + price + " " + charge_type); // } // Console.WriteLine("########################################################################"); //} //Console.WriteLine("End"); } catch (Exception ex) { return(null); //Console.WriteLine("Errors : " + ex.Message); //Console.WriteLine("Exception Stack : " + ex.StackTrace); } }