Exemplo n.º 1
0
        public virtual int GetProductPackSize()
        {
            if (_productId != null)
            {
                ProductPrice activeprod = _productId.GetActiveProductPrice(DateTime.Now);

                return(activeprod != null ? activeprod.PackSize : 0);
            }
            return(0);
        }
Exemplo n.º 2
0
        public virtual ProductPrice GetActiveProductPrice(DateTime date)
        {
            ProductPrice activeProductPrice = null;

            foreach (ProductPrice p in ProductPrices)
            {
                if (p.FromDate <= date)
                {
                    if (activeProductPrice == null)
                    {
                        activeProductPrice = p;
                    }
                    else if (p.FromDate > activeProductPrice.FromDate)
                    {
                        activeProductPrice = p;
                    }
                }
                else if (p.FromDate > date)
                {
                    activeProductPrice = p;
                }
            }
            return(activeProductPrice);
        }
Exemplo n.º 3
0
        private void butSave_Click(object sender, EventArgs e)
        {
            int count = 0;
            int error = 0;
            try
            {
                foreach (ImportProductData rd in _rdata)
                {
                    if (!rd.IsExist)
                    {
                        if (!rd.HasError)
                        {
                            MasterProduct pro = new MasterProduct();
                            pro.ProductName = rd.ProductName;
                            pro.SerialNo = rd.Serial;
                            pro.BasicUnit = rd.BasicUnit;
                            pro.ProductType = rd.Category;
                            pro.Specification = rd.Specification;
                            pro.MinimumPackSize = rd.minSize;
                            pro.RapidTestGroup = rd.RapidTest;

                            ProductPrice pp = new ProductPrice();
                            pp.FromDate = rd.PriceDate;
                            pp.PackSize = rd.Packsize;
                            pp.Price = rd.Price;

                            pro.ProductPrices.Add(pp);
                            count++;
                            DataRepository.SaveOrUpdateProduct(pro);
                        }
                        else { error++; }
                    }else { error++; }

                }

                MessageBox.Show(count + " Products are imported and saved successfully." + Environment.NewLine + error + " Products Failed.", "Importing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();

            }
            catch
            {
                MessageBox.Show("Error: Unable to import and save product data.", "Importing", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                DataRepository.CloseSession();
            }
        }
Exemplo n.º 4
0
 public FrmPriceinput(ProductPrice pprice)
 {
     InitializeComponent();
     _proprice = pprice;
     BindPrice();
 }
Exemplo n.º 5
0
 public FrmPriceinput()
 {
     InitializeComponent();
     _proprice = new ProductPrice();
 }