Esempio n. 1
0
        public QueryTemplate(QueryType type)
        {
            _queryType = type;

            _insertValues = new InsertValueCollection();
            _updateValues = new UpdateValueCollection();
            _joinList = new JoinCollection();
            _criteriaList = new CriteriaCollection();
            _orderList = new OrderCollection();
        }
Esempio n. 2
0
        public CpPackageInfo[] GetByFilter(String tvcdb, List <DTO.Criteria> filters, ref string logMsg, int indexPage = 0, int itemPerPage = 0)
        {
            CpPackageInfo[] res = _objDAO.GetByFilter(tvcdb, filters, ref logMsg, indexPage, itemPerPage);
            //get details

            BUS.CpPackageAllocControl ctr = new CpPackageAllocControl(this);

            foreach (var i in res)
            {
                DTO.CriteriaCollection fs = new CriteriaCollection();
                fs.Add("packagecode", i.packagecode);
                i.allocs = ctr.GetByCPK(tvcdb, i.packagecode, ref logMsg);
            }
            return(res);
        }
        public HttpResponseMessage GetCommercialProduct(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 productCatalogConfigurationService = AsmRepository.GetServiceProxyCachedOrDefault <IProductCatalogConfigurationService>(ah);
            //As of MR26, these are the properties you can use in the BaseQueryRequest.
            //Use Visual Studio's Intellisense function or see the API Reference Library
            //for the latest properties and descriptions.
            //CommercialProduct c = new CommercialProduct();
            //c.AgreementDetailSpearId;
            //c.AllowedBusinessUnits;
            //c.AllowedDisconnectSettings;
            //c.AllowedEventsId;
            //c.AllowedForPurchasedOfferDefinition;
            //c.AllowedMarketSegmentIds;
            //c.AllowedModels;
            //c.AllowedPaymentType;
            //c.AllowIndefiniteSleep;
            //c.AllowQtyToBeUpdated;
            //c.AllowRedistributeFunds;
            //c.AllowSleep;
            //c.ApplyRemainingFunds;
            //c.AreDevicesPresent;
            //c.Availability;
            //c.AvailableDate;
            //c.BusinessUnitId;
            //c.CAEntitlements;
            //c.CaptureRuleId;
            //c.CategoryId;
            //c.CategoryWeight;
            //c.ChargeForUnderlyingTP;
            //c.CommercialProductIds;
            //c.ContractPeriodIdToOverrideOnAD;
            //c.DefaultChargePeriod;
            //c.DefaultDisconnectionSetting;
            //c.DefaultFinanceOptionId;
            //c.DefaultPaymentType;
            //c.Description;
            //c.EditRulesId;
            //c.EPCMappings;
            //c.ExcludedCommercialProducts;
            //c.ExternalId;
            //c.ExternalProductCodeId;
            //c.Hyperlink;
            //c.IconId;
            //c.Id;
            //c.InvoiceLineTexts;
            //c.IsServiceContract;
            //c.IsShippingOrderProduct;
            //c.IsStockHandlerOrderProduct;
            //c.IsUnitOfMeasurementRequired;
            //c.MatchQuantity;
            //c.MaxSleepDays;
            //c.MinSleepDays;
            //c.Name;
            //c.Notes;
            //c.OverrideCAEntitlements;
            //c.PrepaidRequiredBalance;
            //c.PrepaidRequiredBalanceReconnect;
            //c.RequiredCommercialProducts;
            //c.SellFrom;
            //c.SellTo;
            //c.TaxExternalProductCodeId;
            //c.TechnicalProductIds;
            //c.TechnicalProducts;
            //c.Terms;
            //c.UnitOfMeasurementId;
            //c.UsersRoles;
            //Instantiate and initialize the filter criteria (key-value pairs)
            //for the BaseQueryRequest object.
            BaseQueryRequest   request  = new BaseQueryRequest();
            CriteriaCollection criteria = new CriteriaCollection();

            //request.FilterCriteria.Add(new Criteria("ExternalId", 92591));
            request.FilterCriteria.Add(new Criteria("IconId", ""));
            //Call the method and display the results.
            CommercialProductCollection coll = productCatalogConfigurationService.GetCommercialProducts(request);

            if (coll != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, coll));
            }
            else
            {
                var       message = string.Format("error");
                HttpError err     = new HttpError(message);
                return(Request.CreateResponse(HttpStatusCode.OK, message));
            }
        }
        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);
        }
Esempio n. 5
0
 public EntityQueryValues()
 {
     _criteriaList = new CriteriaCollection();
     _orderList = new OrderCollection();
 }
 public CriteriaExpressionVisitor()
 {
     _criteriaList = new CriteriaCollection();
     _criteriaTypeQueue = new Queue<CriteriaType>();
     _nameBuilder = new StringBuilder();
 }
Esempio n. 7
0
 public DataTable GetPKTByFilter(string db, string itemId, string project, CriteriaCollection filters, ref string sErr)
 {
     return(_objDAO.GetPKTByFilter(db, itemId, project, filters, ref sErr));
 }
Esempio n. 8
0
        public void GetShippingOrderByCustomerId(int cust_id)
        {
            //Create the authentication header, initialize with credentials, and
            //create the service proxy. For details, see the API Developer's
            //Guide and the Reference Library CHM.
            Authentication_class var_auth   = new Authentication_class();
            AuthenticationHeader authHeader = var_auth.getAuthentication_header();

            AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc");
            IOrderManagementService orderManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IOrderManagementService>(authHeader);

            BaseQueryRequest request = new BaseQueryRequest();

            //Page = 0 returns a maximum of 20 records. If you want all reecords, you must
            //iterate through the pages.
            request.PageCriteria = new PageCriteria {
                Page = 0
            };
            CriteriaCollection criteria = new CriteriaCollection();

            //Here is a list of properties you can search on. This list is valid as of MR22.
            //For property descriptions, see the API Reference Library (CHM file).
            //Use Intellisense for the current list of properties.
            //ShippingOrder so = new ShippingOrder();
            //so.AgreementId;
            //so.Comment;
            //so.CreateDateTime;
            //so.CustomerId;
            //so.CustomFields.Add;
            //so.Destination;
            //so.FinancialAccountId;
            //so.FullyReceiveReturnedOrder;
            //so.Id;
            //so.IgnoreAgreementId;
            //so.OldStatusId;
            //so.ParentOrderId;
            //so.ReceivedQuantity;
            //so.Reference;
            //so.ReturnedQuantity;
            //so.SandboxId;
            //so.SandboxSkipValidation;
            //so.ShipByDate;
            //so.ShipFromStockHandlerId;
            //so.ShippedDate;
            //so.ShippedQuantity;
            //so.ShippingMethodId;
            //so.ShippingOrderLines.Add;
            //so.ShipToAddressId;
            //so.ShipToPartyId;
            //so.ShipToPostalCode;
            //so.StatusId;
            //so.TotalQuantity;
            //so.TrackingNumbers;
            //so.TypeId;
            //By default, the search uses a logical AND between search criteria.
            //Use || to perform a logical OR.
            criteria.Add("CustomerId", cust_id);
            request.FilterCriteria = criteria;


            ShippingOrderCollection soc = orderManagementService.GetShippingOrders(request);

            if (soc != null && soc.Items.Count > 0)
            {
                foreach (ShippingOrder shippingOrder in soc.Items)
                {
                    Console.WriteLine("Found Shipping Order ID: {0}", shippingOrder.Id);
                }
            }
            else
            {
                Console.WriteLine("No records found.");
            }
            Console.ReadLine();
        }