Ejemplo n.º 1
0
        public List <PromotionDetailModels> GetPromotion(byte Etype = 0, bool IsPackage = false)
        {
            List <PromotionDetailModels> lstData = new List <PromotionDetailModels>();

            try
            {
                OurProductRequest paraBody = new OurProductRequest();
                paraBody.EType     = Etype;
                paraBody.IsPackage = IsPackage;

                NSLog.Logger.Info("Get Promotions Request: ", paraBody);

                var     result     = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSideOurProductGetPromo, null, paraBody);
                dynamic data       = result.Data;
                var     lstDataRaw = data["ListPromo"];
                var     lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                lstData = JsonConvert.DeserializeObject <List <PromotionDetailModels> >(lstObject);
                NSLog.Logger.Info("Get Promotions Response", lstData);

                return(lstData);
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("GetListPromotions_Fail", e);
                return(lstData);
            }
        }
Ejemplo n.º 2
0
        /*Trongntn*/
        /// <summary>
        ///  when click button PRICE LIST
        /// </summary>
        /// <param name="ProductType"> Product | Package | Addition </param>
        /// <param name="AdditionType"> Hardwares | Softwares | Locations | Services | Accounts | Functions </param>
        /// <param name="CategoryID"> -> for Type = Product when click Category go to Product List</param>
        /// <returns></returns>
        public PriceListProductModels GetListPrice(int ProductType, int AdditionType, string CategoryID)
        {
            PriceListProductModels item = new PriceListProductModels();

            List <PeriodModels>        ListPeriod  = new List <PeriodModels>();
            List <ProductPeriodModels> ListProduct = new List <ProductPeriodModels>();

            try
            {
                OurProductRequest paraBody = new OurProductRequest();
                paraBody.ProductType  = ProductType;
                paraBody.AdditionType = AdditionType;
                paraBody.CategoryID   = CategoryID;

                NSLog.Logger.Info("GetListPrice Request: ", paraBody);

                var     result = (NSApiResponse)ApiResponse.Post <NSApiResponse>(Commons.ClientSiteOurProductGetPriceList, null, paraBody);
                dynamic data   = result.Data;

                var lstDataRaw = data["ListPeriod"];
                var lstObject  = JsonConvert.SerializeObject(lstDataRaw);
                ListPeriod = JsonConvert.DeserializeObject <List <PeriodModels> >(lstObject);

                lstDataRaw  = data["ListProduct"];
                lstObject   = JsonConvert.SerializeObject(lstDataRaw);
                ListProduct = JsonConvert.DeserializeObject <List <ProductPeriodModels> >(lstObject);

                NSLog.Logger.Info("GetListPrice", item);
                item.ListPeriod  = ListPeriod;
                item.ListProduct = ListProduct;

                return(item);
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("GetListPrice_Fail", e);
                return(item);
            }
        }