Esempio n. 1
0
        public HttpResponseMessage GetServiceTypeById(String username_ad, String password_ad, int id)
        {
            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 TSService = AsmRepository.GetServiceProxyCachedOrDefault <IWorkforceConfigurationService>(ah);

            BaseQueryRequest request = new BaseQueryRequest();

            request.FilterCriteria = new CriteriaCollection();
            request.FilterCriteria.Add(new Criteria("Id", id));

            ServiceTypeCollection servicetype = TSService.GetServiceTypeList(request);

            if (servicetype != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, servicetype));
            }
            else
            {
                var       message = string.Format("error");
                HttpError err     = new HttpError(message);
                return(Request.CreateResponse(HttpStatusCode.OK, message));
            }
        }
Esempio n. 2
0
        public HttpResponseMessage GetAgreementByTypeId(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);

            IViewFacadeService viewFacadeService = AsmRepository.GetServiceProxyCachedOrDefault <IViewFacadeService>(ah);

            BaseQueryRequest request = new BaseQueryRequest();

            request.FilterCriteria = new CriteriaCollection();

            //Agreement type is a user-configured property. The value in
            //this key-value pair is the agreement type ID. You can get this
            //value from the Configuration Module or from a call to
            //the AgreementManagementConfigurationService.
            request.FilterCriteria.Add(new Criteria("TypeId", id));
            AgreementViewCollection coll = viewFacadeService.GetAgreementView(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));
            }
        }
Esempio n. 3
0
        public QuoteInvoiceCollection GetQuoteByCustomerId(String username_ad, String password_ad, int id)
        {
            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 billingService             = AsmRepository.GetServiceProxyCachedOrDefault <IBillingEngineService>(ah);
            var financeService             = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceService>(ah);
            var agreementManagementService = AsmRepository.GetServiceProxyCachedOrDefault <IAgreementManagementService>(ah);

            #region Step 1
            //First, get Pending quotes to check their QuoteDates.
            //Instantiate a class for the request.
            BaseQueryRequest req = new BaseQueryRequest();
            req.FilterCriteria = new CriteriaCollection();
            //Define the selection criteria.
            //Replace 73948 with the CustomerId of the customer you want.
            req.FilterCriteria.Add("CustomerId", id);
            //Get the customer's QuoteInvoices.
            QuoteInvoiceCollection qts = billingService.FindQuoteInvoices(req);
            if (qts != null && qts.Items.Count > 0)
            {
                return(qts);
                //foreach (var q in qts)
                //{
                //    Console.WriteLine("Customer ID {0}: QuoteDate = {1} QuoteInvoice ID = {2}",
                //    q.CustomerId, q.QuoteDate, q.Id);
                //    Console.WriteLine("Quote amount = {0} Quote type = {1}",
                //    q.TotalAmount, q.QuoteType);
                //    //If the QuoteDate < Today, then regenerate the quote.
                //    if (q.QuoteDate < System.DateTime.Today)
                //    {
                //        QuoteInvoiceRequest request = new QuoteInvoiceRequest();
                //        request.QuoteId = q.Id;
                //        //If Save = True, ICC saves the QuoteInvoice.
                //        //To get the quote info but not commit it to the database,
                //        //set the flag to False. This is useful when
                //        //you only want to know what the customer would pay next
                //        //period, but you don't want to create the quote.
                //        request.Save = true;
                //        //Regenerate the quote to save Today's quote info.
                //        QuoteInvoiceResponse response = billingService.RegenerateQuoteInvoice(request);
                //        Console.WriteLine("New quote generated. ID = {0}; Amount = {1}",
                //        response.NewQuoteInvoice.Id, response.NewQuoteInvoice.TotalAmount);
                //    }
                //    else
                //    {
                //        Console.WriteLine("Customer's quotes are up-to-date.");
                //    }
                //}
            }
            else
            {
                return(null);
            }
            #endregion step 1
        }
Esempio n. 4
0
        public static void Enqueue(BaseQueryRequest request, Action <object> onResult, Action @finally)
        {
            lock (tuples)
            {
                tuples.GetOrCreate(Dispatcher.CurrentDispatcher).Add(new RequestTuple
                {
                    Request  = request,
                    OnResult = onResult,
                    Finally  = @finally,
                });

                Dispatcher.CurrentDispatcher.Hooks.DispatcherInactive -= new EventHandler(Hooks_DispatcherInactive);
                Dispatcher.CurrentDispatcher.Hooks.DispatcherInactive += new EventHandler(Hooks_DispatcherInactive);
            }
        }
Esempio n. 5
0
        async Task <T> ExecuteAsync <T>(ExecuteType executeType, object queryName, BaseQueryRequest request, Func <DynamicQueryBucket, Task <T> > executor)
        {
            using (ExecutionMode.UserInterface())
                using (HeavyProfiler.Log(executeType.ToString(), () => QueryUtils.GetKey(queryName)))
                {
                    try
                    {
                        var qb = GetQuery(queryName);

                        using (Disposable.Combine(QueryExecuted, f => f(executeType, queryName, request)))
                        {
                            return(await executor(qb));
                        }
                    }
                    catch (Exception e)
                    {
                        e.Data["QueryName"] = queryName;
                        throw;
                    }
                }
        }
Esempio n. 6
0
        public void getValidAddress()
        {
            Authentication_class var_auth   = new Authentication_class();
            AuthenticationHeader authHeader = var_auth.getAuthentication_header();

            AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc");

            var customersService      = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersService>(authHeader);
            var valid_address_Service = AsmRepository.GetServiceProxyCachedOrDefault <ICustomersConfigurationService>(authHeader);

            #region Find customer by phone number
            //Instantiate a BaseQueryRequest for your filter criteria.
            BaseQueryRequest request = new BaseQueryRequest();


            request.FilterCriteria = Op.Like("CountryId", "1");
            //request.FilterCriteria = Op.Like("ProvinceId", "1");
            request.FilterCriteria = Op.Like("PostalCode", "24410000");


            ValidAddressCollection val_address = valid_address_Service.GetValidAddresses(request);

            if (val_address != null)
            {
                foreach (ValidAddress c in val_address)
                {
                    Console.WriteLine("Found valid address ID {0}, countryId = {1} - provinceId = {2} -  bigcity = {3} -  smallcity = {4} - postalcode = {5} - street = {6}", c.Id, c.CountryId, c.ProvinceId, c.BigCity, c.SmallCity, c.PostalCode, c.Street);
                }
            }
            else
            {
                Console.WriteLine("Cannot find a customer with that phone number.");
            }
            Console.WriteLine("total customer = {0} ----", val_address.Count());
            //You will need to enter some error handling in case there is more than
            //one matching customer.
            Console.ReadLine();
            #endregion
        }
Esempio n. 7
0
        public StockHandlerCollection GetStockHandlerByActiveStatus(String username_ad, String password_ad, int id)
        {
            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 TSService = AsmRepository.GetServiceProxyCachedOrDefault <ILogisticsService>(ah);

            BaseQueryRequest request = new BaseQueryRequest();

            request.FilterCriteria = new CriteriaCollection();
            request.FilterCriteria.Add(new Criteria("Active", id));

            var servicetype = TSService.GetStockHandlers(request);

            if (servicetype != null)
            {
                return(servicetype);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 8
0
        public void GetAddressEntityViewCollection(int cust_id)
        {
            Authentication_class var_auth = new Authentication_class();
            AuthenticationHeader ah       = var_auth.getAuthentication_header();

            AsmRepository.SetServiceLocationUrl("http://mncsvasm.mskydev1.local/asm/all/servicelocation.svc");
            var TSService = AsmRepository.GetServiceProxyCachedOrDefault <IViewFacadeService>(ah);

            BaseQueryRequest request = new BaseQueryRequest();

            request.FilterCriteria = new CriteriaCollection();
            request.FilterCriteria.Add(new Criteria("CustomerId", cust_id));

            var servicetype = TSService.GetAddressEntityViewCollection(request);

            if (servicetype != null)
            {
                Console.WriteLine(servicetype.Items[0].Id);
            }
            else
            {
                Console.WriteLine("kosong");
            }
        }
        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. 11
0
        static IDisposable Current_QueryExecuted(DynamicQueryManager.ExecuteType type, object queryName, BaseQueryRequest request)
        {
            if (request == null || !LogQuery(request, type))
            {
                return(null);
            }

            var old = Connector.CurrentLogger;

            StringWriter sw = new StringWriter();

            Connector.CurrentLogger = old == null ? (TextWriter)sw : new DuplicateTextWriter(sw, old);

            var viewLog = new ViewLogEntity
            {
                Target     = QueryLogic.GetQueryEntity(queryName).ToLite(),
                User       = UserHolder.Current?.ToLite(),
                ViewAction = type.ToString(),
            };

            return(new Disposable(() =>
            {
                try
                {
                    using (Transaction tr = Transaction.ForceNew())
                    {
                        viewLog.EndDate = TimeZoneManager.Now;
                        viewLog.Data = GetData(request, sw);
                        using (ExecutionMode.Global())
                            viewLog.Save();
                        tr.Commit();
                    }
                }
                finally
                {
                    Connector.CurrentLogger = old;
                }
            }));
        }
Esempio n. 12
0
        public HttpResponseMessage GetFinancialAccountByCustomerId(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 financeService = AsmRepository.GetServiceProxyCachedOrDefault <IFinanceService>(ah);
            //As of MR29, these are the properties you can use to filter
            //the response. Check the API Reference Library (CHM) file for the
            //latest properties.
            //FinancialAccount f = new FinancialAccount();
            //f.AmountInDispute;
            //f.AnniversaryMonth;
            //f.Balance;
            //f.BankAccountId;
            //f.BankAccountType;
            //f.BankBranchId;
            //f.BankCodeId;
            //f.BankName;
            //f.CreatedDate;
            //f.CreditCard;
            //f.CurrencyId;
            //f.CustomerId;
            //f.CustomFields;
            //f.DailyBalance;
            //f.DueIn;
            //f.DunningLevel;
            //f.ExternalTaxExemptionCertificate;
            //f.FinalInvoice;
            //f.FirstNextBillDate;
            //f.HasBeenApplied;
            //f.IBANAccountId;
            //f.Id;
            //f.InvoiceDeliveryMethodId;
            //f.InvoicingMethod;
            //f.InvoicingProfileId;
            //f.IsDefault;
            //f.LastInvoiced;
            //f.MethodOfPaymentId;
            //f.MopId;
            //f.Name;
            //f.NextInvoiceText;
            //f.NotYetApplied;
            //f.ParentFinancialAccountId;
            //f.PrepaidBalance;
            //f.PrepaidBalanceAsOf;
            //f.PrepaidDisconnectDate;
            //f.PrepaidEndDate;
            //f.PrepaidManualDisconnectDate;
            //f.ProxyCode;
            //f.ProxyCodeId;
            //f.ReferenceNumber;
            //f.Status;
            //f.StatusId;
            //f.SuspendInvoicing;
            //f.SuspendInvoicingDueDate;
            //f.SWIFTCode;
            //f.Type;
            //f.TypeId;
            //Instantiate a BaseQueryRequest object for the input parameter and
            //pass in the criteria as a key-value pair.
            //For details, see the BaseQueryRequest code sample in the
            //ICC API Developer's Guide.
            BaseQueryRequest request = new BaseQueryRequest();

            request.FilterCriteria = new CriteriaCollection();
            //In the UI, the label for the Status property is
            //"External Reference ID."
            request.FilterCriteria.Add(new Criteria("CustomerId", id));
            //Call the method and display the results.
            FinancialAccountCollection faColl = financeService.GetFinancialAccounts(request);

            if (faColl != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, faColl));
            }
            else
            {
                var       message = string.Format("error");
                HttpError err     = new HttpError(message);
                return(Request.CreateResponse(HttpStatusCode.OK, message));
            }
        }
        public void getFinancialTransactionView(int FA_id)
        {
            Authentication_class var_auth   = new Authentication_class();
            AuthenticationHeader authHeader = var_auth.getAuthentication_header();

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


            #region BaseQueryRequest FilterCriteria
            //As of MR24, these are the properties you can use in the
            //BaseQueryRequest filter. Use Visual Studio's Intellisense to get the
            //list of properties that are valid in your version of ICC.
            //FinancialTransactionView f = new FinancialTransactionView
            //f.AmtExclTax;
            //f.AmtInclTax;
            //f.AppearedOnInvoiceNumber;
            //f.ApprdOnInvoiceId;
            //f.BankDatetime;
            //f.BaseAmount;
            //f.BusinessUnitDescription;
            //f.BusinessUnitId;
            //f.CreateDatetime;
            //f.CreatedByEvent;
            //f.CreatedByUserId;
            //f.CreatedByUserName;
            //f.CurrencyId;
            //f.CurrencyMnemonic;
            //f.CustomerId;
            //f.DebitOrCredit;
            //f.EntityId;
            //f.EntityType;
            //f.ExternalAgentId;
            //f.ExternalAgentName;
            //f.ExternalTaxAreaId;
            //f.ExternalTransactionId;
            //f.ExtraPaymentInfo;
            //f.FinanceBatchId;
            //f.FinancialAccountId;
            //f.HistoryId;
            //f.Id;
            //f.InternalComment;
            //f.InvoiceLineText;
            //f.InvoiceRunId;
            //f.IsPending;
            //f.LedgerAccountDescription;
            //f.LedgerAccountId;
            //f.ListPriceAmount;
            //f.ListPriceConditionId;
            //f.ListPriceTypeName;
            //f.MarketSegmentId;
            //f.MarketSegmentName;
            //f.ModelId;
            //f.NumberOfUnits;
            //f.OriginalAmount;
            //f.OriginalCurrencyId;
            //f.PaidForAccountId;
            //f.PaidForCustomerName;
            //f.PaidForInformation;
            //f.PaidForInvoiceId;
            //f.PaymentRefNum;
            //f.PeriodFrom;
            //f.PeriodizationRunId;
            //f.PeriodTo;
            //f.PriceAdjustDefId;
            //f.ProductId;
            //f.ReceiptNumber;
            //f.ReversedTransId;
            //f.TaxAmt1;
            //f.TaxAmt2;
            //f.TaxAmt3;
            //f.TaxType1;
            //f.TaxType2;
            //f.TaxType3;
            //f.TransactionSubType;
            //f.TransactionType;
            //f.TransferAccountId;
            //f.UserKey;
            //f.UserLocationName;
            #endregion

            //Instantiate a request object.
            BaseQueryRequest request = new BaseQueryRequest();
            //Page 0 returns ALL matching records. Page 0 can have a major
            //performance impact. Use it only when you know that
            //the number of matching records is small.
            request.PageCriteria = new PageCriteria {
                Page = 0
            };
            //Instantiate the CollectionCriteria.
            request.FilterCriteria = new CriteriaCollection();
            //In this example, we have only one criteria:
            //FinancialAccountId is 401.
            //To learn how to set selection criteria in a BaseQueryRequest,
            //see the code sample called Code_BaseQuery_Request.pdf.
            request.FilterCriteria.Add(new Criteria("FinancialAccountId", FA_id));
            //Call the method.
            var ftViewCollection = viewFacade.GetFinancialTransactionView(request);
            //Display the results, one screenful at a time.
            if (ftViewCollection != null && ftViewCollection.Items.Count > 0)
            {
                foreach (FinancialTransactionView f in ftViewCollection.Items)
                {
                    #region Pause after a screenful of records
                    //This snippet pauses when the screen is full. When the user presses
                    //Enter, the screen clears and another screenful of records is loaded.
                    //if (Console.WindowHeight == Console.CursorTop)
                    //{
                    //    Console.WriteLine("Press Enter for another screen of records.");
                    //    Console.ReadLine();
                    //    Console.Clear();
                    //}
                    #endregion
                    Console.WriteLine("Found FT {0}, total amount = {1}", f.Id, f.AmtInclTax);
                }
            }
            else
            {
                Console.WriteLine("I found nothing.");
            }
            Console.ReadLine();
        }
Esempio n. 14
0
        public HttpResponseMessage GetWorkOrderByWorkOrderId(int Id_param, String username_ad, String password_ad)
        {
            #region Authenticate and create proxies
            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 viewFacade = AsmRepository.GetServiceProxyCachedOrDefault <IViewFacadeService>(ah);
            #endregion

            #region BaseQueryRequest FilterCriteria
            //As of MR24, these are the properties you can use in the
            //BaseQueryRequest filter. Use Visual Studio's Intellisense to get the
            //list of properties that are valid in your version of ICC.
            //FinancialTransactionView f = new FinancialTransactionView
            //f.AmtExclTax;
            //f.AmtInclTax;
            //f.AppearedOnInvoiceNumber;
            //f.ApprdOnInvoiceId;
            //f.BankDatetime;
            //f.BaseAmount;
            //f.BusinessUnitDescription;
            //f.BusinessUnitId;
            //f.CreateDatetime;
            //f.CreatedByEvent;
            //f.CreatedByUserId;
            //f.CreatedByUserName;
            //f.CurrencyId;
            //f.CurrencyMnemonic;
            //f.CustomerId;
            //f.DebitOrCredit;
            //f.EntityId;
            //f.EntityType;
            //f.ExternalAgentId;
            //f.ExternalAgentName;
            //f.ExternalTaxAreaId;
            //f.ExternalTransactionId;
            //f.ExtraPaymentInfo;
            //f.FinanceBatchId;
            //f.FinancialAccountId;
            //f.HistoryId;
            //f.Id;
            //f.InternalComment;
            //f.InvoiceLineText;
            //f.InvoiceRunId;
            //f.IsPending;
            //f.LedgerAccountDescription;
            //f.LedgerAccountId;
            //f.ListPriceAmount;
            //f.ListPriceConditionId;
            //f.ListPriceTypeName;
            //f.MarketSegmentId;
            //f.MarketSegmentName;
            //f.ModelId;
            //f.NumberOfUnits;
            //f.OriginalAmount;
            //f.OriginalCurrencyId;
            //f.PaidForAccountId;
            //f.PaidForCustomerName;
            //f.PaidForInformation;
            //f.PaidForInvoiceId;
            //f.PaymentRefNum;
            //f.PeriodFrom;
            //f.PeriodizationRunId;
            //f.PeriodTo;
            //f.PriceAdjustDefId;
            //f.ProductId;
            //f.ReceiptNumber;
            //f.ReversedTransId;
            //f.TaxAmt1;
            //f.TaxAmt2;
            //f.TaxAmt3;
            //f.TaxType1;
            //f.TaxType2;
            //f.TaxType3;
            //f.TransactionSubType;
            //f.TransactionType;
            //f.TransferAccountId;
            //f.UserKey;
            //f.UserLocationName;
            #endregion

            //Instantiate a request object.
            BaseQueryRequest request = new BaseQueryRequest();
            //Page 0 returns ALL matching records. Page 0 can have a major
            //performance impact. Use it only when you know that
            //the number of matching records is small.
            request.PageCriteria = new PageCriteria {
                Page = 0
            };
            //Instantiate the CollectionCriteria.
            request.FilterCriteria = new CriteriaCollection();
            //In this example, we have only one criteria:
            //FinancialAccountId is 401.
            //To learn how to set selection criteria in a BaseQueryRequest,
            //see the code sample called Code_BaseQuery_Request.pdf.
            request.FilterCriteria.Add(new Criteria("CustomerId", Id_param));
            //Call the method.
            var ftViewCollection = viewFacade.GetFinancialTransactionView(request);
            //Display the results, one screenful at a time.

            if (ftViewCollection != null && ftViewCollection.Items.Count > 0)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, ftViewCollection));
            }
            else
            {
                var       message = string.Format("error");
                HttpError err     = new HttpError(message);
                return(Request.CreateResponse(HttpStatusCode.OK, message));
            }
        }
Esempio n. 15
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();
        }