public void Run(MasterPriceSearchParameters mpsp, GridState gs, Currency currency, PriceBaseStatus status)
        {
#if !DEBUG
            // Indicates which method to execute
            string      id          = Guid.NewGuid().ToString();
            ProcessItem processItem = new ProcessItem(id);
            processItem.AssemblyName          = typeof(PriceCalculator).Assembly.FullName;
            processItem.ClassName             = typeof(PriceCalculator).FullName;
            processItem.ConstructorParameters = new object[] { true, MembershipHelper.GetUser().UserId };
            processItem.MethodName            = "Run";
            processItem.MethodParameters      = new object[] { mpsp, gs, currency, status };

            // Add the task for processing whenever possible
            DynamicProcessorRemoting processor = (DynamicProcessorRemoting)Activator.GetObject(typeof(DynamicProcessorRemoting), Config.RemotingProcessor);
            processor.AddTask(processItem);
#else
            new PriceCalculator(true, MembershipHelper.GetUser().UserId).Run(mpsp, gs, currency, status);
#endif
        }
示例#2
0
        public void Run(MasterPriceSearchParameters mpsp, GridState gs, Currency currency, PriceBaseStatus priceBaseStatus)
        {
            if (mpsp.ProductStatus == null)
            {
                mpsp.ProductStatus = ProductStatus.Active;
            }

            IQuery           q             = ControllerManager.PriceBase.GetProductListQuery("DISTINCT PB", mpsp.Description, mpsp.Categories, mpsp.CtrRange, mpsp.Selection, mpsp.Frequency, currency, 0, 0, string.Empty, string.Empty, gs.MarkedAll, gs.Items, false, null, null, mpsp.PriceGroup, mpsp.Provider, mpsp.SearchDate, priceBaseStatus, mpsp.ProductStatus, mpsp.IndexPrice, mpsp.SearchDateTo, mpsp.PriceImport, mpsp.PriceList, mpsp.WorkListItemStatus, mpsp.PublishList, mpsp.Distributor);
            List <PriceBase> pricebaselist = q.List <PriceBase>() as List <PriceBase>;

            if (pricebaselist.Count > 0)
            {
                priceBases = pricebaselist;
                Execute();
            }
        }
示例#3
0
        public ProductListView(int id, int workListItemStatus, decimal pCR, int priceBaseId, int productID, string code, string providerCode, string model, string description, int type, decimal pricePurchase, decimal priceSuggest, decimal priceSell, decimal price, decimal cTM, decimal cTR, decimal index, string provider, PriceBaseStatus priceBaseStatus, decimal?lastPrice, decimal discount, int providerID, int priceCurrencyId, int pricePurchaseCurrencyId, int priceSuggestCurrencyId, int lastPriceCurrencyId, string alternativeModel, string alternativeDescription)
        {
            this.id = id;
            if (string.IsNullOrEmpty(code))
            {
                this.code = providerCode;
            }
            else
            {
                this.code           = code;
                this.isGrundfosCode = true;
            }
            this.productID               = productID;
            this.description             = description;
            this.model                   = model;
            this.priceSuggestCurrencyId  = priceSuggestCurrencyId;
            this.priceSuggest            = priceSuggest;
            this.pricePurchaseCurrencyId = pricePurchaseCurrencyId;
            this.pricePurchase           = pricePurchase;
            this.priceCurrencyId         = priceCurrencyId;
            this.priceSell               = priceSell;
            this.price                   = price;
            this.lastPriceCurrencyId     = lastPriceCurrencyId;
            this.lastPrice               = lastPrice;
            this.cTM                    = cTM;
            this.cTR                    = cTR.ToString("#0.##") + "%";
            this.type                   = Resource.Business.GetString(((Frequency)type).ToString());
            this.index                  = index.ToString("0.0");
            this.provider               = provider;
            this.alternativeModel       = alternativeModel;
            this.alternativeDescription = alternativeDescription;
            switch (priceBaseStatus)
            {
            case PriceBaseStatus.Disable:
                this.status = Resource.Business.GetString("PriceBaseDisable");
                break;

            case PriceBaseStatus.Verified:
                this.status = Resource.Business.GetString("PriceBaseVerified");
                break;

            case PriceBaseStatus.NotVerified:
                this.status = Resource.Business.GetString("PriceBaseNotVerified");
                break;
            }
            if (workListItemStatus > 0)
            {
                switch (workListItemStatus)
                {
                case (int)WorkListItemStatus.Approved:
                    this.status = Resource.Business.GetString("WorkListItemApproved");
                    break;

                case (int)WorkListItemStatus.Modified:
                    this.status = Resource.Business.GetString("WorkListItemModified");
                    break;

                case (int)WorkListItemStatus.Published:
                    this.status = Resource.Business.GetString("WorkListItemPublished");
                    break;

                case (int)WorkListItemStatus.Added:
                    this.status = Resource.Business.GetString("WorkListItemAdded");
                    break;

                case (int)WorkListItemStatus.AddedMod:
                    this.status = Resource.Business.GetString("WorkListItemAddedMod");
                    break;
                }
            }
            this.pCR                     = pCR.ToString("#0.##") + "%";
            this.discount                = discount.ToString("#0.##") + "%";
            this.providerID              = providerID;
            this.priceBaseId             = priceBaseId;
            this.priceCurrencyId         = priceCurrencyId;
            this.pricePurchaseCurrencyId = pricePurchaseCurrencyId;
            this.priceSuggestCurrencyId  = priceSuggestCurrencyId;

            if (cTR <= 0)
            {
                if (pricePurchase != 0)
                {
                    cTRColor = "textred";
                }
            }
            else if (cTR < 10)
            {
                cTRColor = "textyellow";
            }
            else if (cTR < 50)
            {
                cTRColor = "textgreen";
            }
            else
            {
                cTRColor = "textpurple";
            }
        }