Ejemplo n.º 1
0
        public ProductPane(MasterProduct pro, bool enableCtr)
        {
            this._product = pro;
            this._enableCtr = enableCtr;

            InitializeComponent();
            SetControlState();
            PopProductType();
            BindProduct();
        }
Ejemplo n.º 2
0
        public ProductForm(MasterProduct pro, Form mdiparent)
        {
            this._product = pro;
            this._mdiparent = mdiparent;

            InitializeComponent();

            lqtToolStrip1.SaveAndCloseClick += new EventHandler(lqtToolStrip1_SaveAndCloseClick);
            lqtToolStrip1.SaveAndNewClick += new EventHandler(lqtToolStrip1_SaveAndNewClick);

            LoadProductCtr();
        }
Ejemplo n.º 3
0
 public static void DeleteProduct(MasterProduct t)
 {
     DaoFactory.GetDaoFactory().CreateProductDao().Delete(t);
 }
Ejemplo n.º 4
0
 public static void SaveOrUpdateProduct(MasterProduct pro)
 {
     DaoFactory.GetDaoFactory().CreateProductDao().SaveOrUpdate(pro);
 }
Ejemplo n.º 5
0
        public override bool DeleteSelectedItem()
        {
            int delProCount = 0;
            string productName = null;

            if (MessageBox.Show("Are you sure you want to delete selected Product/s ?", "Delete Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                for (int i = 0; i < listView1.SelectedItems.Count; i++)
                {
                    try
                    {
                        DataRepository.DeleteProduct((MasterProduct)listView1.SelectedItems[i].Tag);
                        delProCount++;
                    }
                    catch
                    {
                        if (productName == null)
                            productName = ((MasterProduct)listView1.SelectedItems[i].Tag).ProductName + Environment.NewLine;
                        else
                            productName += ", " + ((MasterProduct)listView1.SelectedItems[i].Tag).ProductName + Environment.NewLine;
                    }
                }

                if (productName != null)
                {
                    MessageBox.Show("Some of Products listed below could not delete. " + Environment.NewLine + productName, "Delete selected Product(s)", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                if (delProCount > 0)
                    MdiParentForm.ShowStatusBarInfo(delProCount + " Product/s deleted successfully.");

                _selectedProId = null;
                //DataRepository.CloseSession();
                PopProduct();
                return true;
            }

            return false;
        }
Ejemplo n.º 6
0
        private void PopProduct()
        {
            _totalNoOfPro =  DataRepository.GetTotalCountOfProducts(_proTypeId);

            _totalPages = Math.Ceiling(_totalNoOfPro / _pageSize);

            if (_pageNo > 0 && _pageNo == _totalPages)
                _pageNo--;
            _selectedProId = null;

            txtPageno.Text = _totalPages == 0 ? "0" : (_pageNo + 1).ToString();
            lblPages.Text = _totalPages.ToString();

            BindProductToListView();
            SetNavButtonState();
        }
Ejemplo n.º 7
0
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         //int id = (int)listView1.SelectedItems[0].Tag;
         MasterProduct mp = listView1.SelectedItems[0].Tag as MasterProduct;
         //if (id != _selectedProId)
         if (_selectedProId == null)
             _selectedProId = mp;
         else if (mp.Id != _selectedProId.Id)
             _selectedProId = mp; // id;
     }
     SelectedItemChanged(listView1);
 }
Ejemplo n.º 8
0
 public void RebindProduct(MasterProduct pro)
 {
     this._product = pro;
     BindProduct();
 }
Ejemplo n.º 9
0
 public ProductPane(MasterProduct pro)
     : this(pro, false)
 {
 }
Ejemplo n.º 10
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();
            }
        }
Ejemplo n.º 11
0
 public ProductForm(MasterProduct pro, Form mdiparent, bool reloadctr)
     : this(pro, mdiparent)
 {
     this._reloadCtr = reloadctr;
 }
Ejemplo n.º 12
0
        void lqtToolStrip1_SaveAndNewClick(object sender, EventArgs e)
        {
            try
            {
                LQTUserMessage msg = SaveOrUpdateObject();
                ((LqtMainWindowForm)_mdiparent).ShowStatusBarInfo(msg.Message,true);
                //DataRepository.CloseSession();

                ProductType pt = _product.ProductType;

                _product = new MasterProduct();
                _product.ProductType = pt;

                LoadProductCtr();
            }
            catch (Exception ex)
            {
                new FrmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
        }
Ejemplo n.º 13
0
 private void InitializeProductForm(MasterProduct pro)
 {
     ProductForm frm = new ProductForm(pro, _mdiparent);
     frm.ShowDialog();
     RebindProductType(_proType);
 }
Ejemplo n.º 14
0
        private void butNewpro_Click(object sender, EventArgs e)
        {
            if (CreateOrEditProduct != null)
            {
                MasterProduct pro = new MasterProduct();
                pro.ProductType = _proType;
                CreateOrUpdateEventArgs eArgs = new CreateOrUpdateEventArgs(pro);
                CreateOrEditProduct(this, eArgs);

                _proType = DataRepository.GetProductTypeById(pro.ProductType.Id);//b
            }

            DisplayProducts();//b
        }
Ejemplo n.º 15
0
 private void butNewpro_Click(object sender, EventArgs e)
 {
     if (CreateOrEditProduct != null)
     {
         MasterProduct pro = new MasterProduct();
         pro.ProductType = _proType;
         CreateOrUpdateEventArgs eArgs = new CreateOrUpdateEventArgs(pro);
         CreateOrEditProduct(this, eArgs);
     }
 }