Пример #1
0
        public ProductMaster Add(ProductMaster data)
        {
            ILog logger = LogManager.GetLogger("AppFrame");
            //string deptId = string.Format("{0:000}", CurrentDepartment.Get().DepartmentId);
            // always insert goods at main stock
            string deptId = "000";
            //var criteria = new ObjectCriteria();
            //criteria.AddBetweenCriteria("ProductMasterId", "0000000000", deptId + "9999999999" );
            object maxId = ProductMasterDAO.SelectSpecificType(null, Projections.Max("ProductMasterId"));
            if (maxId != null)
            {
                data.ProductMasterId = string.Format("{0:0000000000000}" ,Int64.Parse(maxId.ToString()) + 1);
            }
            else
            {
                data.ProductMasterId = deptId + "0000000001";
            }
            data.Barcode = data.ProductMasterId;
            /*            if (data.ProductType != null)
            {
                data.Barcode = string.Format("{0:000}", data.ProductType.TypeId) + data.ProductMasterId;
            } else
            {
                data.Barcode = "000" + data.ProductMasterId;
            }*/
            ProductMasterDAO.Add(data);

            return data;
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (dgvProductMasters.CurrentCell == null) return;
            DataGridViewSelectedRowCollection dgvRows = dgvProductMasters.SelectedRows;

            foreach (DataGridViewRow row in dgvRows)
            {
                ProductMaster master = new ProductMaster
                                           {
                                               ProductName = row.Cells[0].Value.ToString()
                                           };
                if(!ExistInList(pmSelectedList,master))
                {
                    pmSelectedList.Add(master);
                }
            }
            bdsProductMaster.ResetBindings(false);
            dgvSelectedProductMaster.Refresh();
            dgvSelectedProductMaster.Invalidate();
        }
 private bool ExistInList(ProductMasterCollection collection, ProductMaster master)
 {
     foreach (ProductMaster productMaster in collection)
     {
         if(productMaster.ProductName.Equals(master.ProductName))
         {
             return true;
         }
     }
     return false;
 }
 private bool NotInList(ProductMaster master, IList list)
 {
     foreach (ProductMaster productMaster in list)
     {
         if (productMaster.ProductName.Equals(master.ProductName))
         {
             return false;
         }
     }
     return true;
 }
Пример #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var productMaster = new ProductMaster
                                    {
                                        ProductMasterId = ProductMasterId,
                                        ProductName = productMasterControl.txtProductName.Text,
                                        Description = productMasterControl.txtDescription.Text,
                                        ImagePath = productMasterControl.txtImagePath.Text,
                                        Packager = productMasterControl.cbbPackager.SelectedIndex > 0 ? ((Packager)productMasterControl.cbbPackager.SelectedItem) : null,
                                        ProductSize = productMasterControl.cbbProductSize.SelectedIndex > 0 ? ((ProductSize)productMasterControl.cbbProductSize.SelectedItem) : null,
                                        ProductType = productMasterControl.cbbProductType.SelectedIndex > 0 ? ((ProductType)productMasterControl.cbbProductType.SelectedItem) : null,
                                        ProductColor = productMasterControl.cbbProductColor.SelectedIndex > 0 ?
                                            ((ProductColor)productMasterControl.cbbProductColor.SelectedItem) : null,
                                        Country = productMasterControl.cbbCountry.SelectedIndex > 0 ? ((Country)productMasterControl.cbbCountry.SelectedItem) : null,
                                        Manufacturer = productMasterControl.cbbManufacturer.SelectedIndex > 0 ? ((Manufacturer)productMasterControl.cbbManufacturer.SelectedItem) : null,
                                        Distributor = productMasterControl.cbbDistributor.SelectedIndex > 0 ? ((Distributor)productMasterControl.cbbDistributor.SelectedItem) : null
                                    };

            var eventArgs = new ProductMasterEventArgs {ProductMaster = productMaster};
            EventUtility.fireEvent(SaveProductMasterEvent, sender, eventArgs);
            productMaster.ProductMasterId = eventArgs.ProductMaster.ProductMasterId;
            productMasterControl.txtProductMasterId.Text = productMaster.ProductMasterId;
            //DrawBarcode(productMaster.Barcode);
            if (isNeedClosing)
            {
                this.Close();
            }
            if (ClientInfo.getInstance().LoggedUser.Name.Equals("admin"))
            {
                btnDelete.Visible = true;
            }
        }
Пример #6
0
 /// <summary>
 /// Update ProductMaster to database.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public void Update(ProductMaster data)
 {
     HibernateTemplate.Update(data);
 }
Пример #7
0
        public IList FindAllInDepartment(ProductMaster master, bool allDepartment)
        {
            return (IList)HibernateTemplate.Execute(
                               delegate(ISession session)
                               {
                                   try
                                   {

                                       string queryString =
                                           "SELECT DISTINCT p.ProductMaster FROM ProductMaster pm, Product p ";
                                       if(!allDepartment)
                                       {
                                           //queryString += ",DepartmentStockIn dsi,DepartmentStockInDetail dsid ";
                                           queryString += ",DepartmentStock ds ";
                                       }
                                       queryString += " WHERE pm.ProductMasterId = p.ProductMaster.ProductMasterId " +
                                           " AND p.ProductMaster.ProductName LIKE '%" + (string)master.ProductName + "%' " +
                                                            " AND pm.DelFlg = 0 AND p.DelFlg = 0 ";

                                       if (master.ProductType != null && master.ProductType.TypeId > 0)
                                       {
                                           queryString += " AND pm.ProductType.TypeId = " + master.ProductType.TypeId;
                                       }

                                       if (master.ProductSize != null && master.ProductSize.SizeId > 0)
                                       {
                                           queryString += " AND pm.ProductSize.SizeId = " + master.ProductSize.SizeId;
                                       }

                                       if (master.ProductColor != null && master.ProductColor.ColorId > 0)
                                       {
                                           queryString += " AND pm.ProductColor.ColorId = " + master.ProductColor.ColorId;
                                       }

                                       if (master.Country != null && master.Country.CountryId > 0)
                                       {
                                           queryString += " AND pm.Country.CountryId = " + master.Country.CountryId;
                                       }

                                       if (!allDepartment) // if not search all so search by current department
                                       {
                                           //queryString += " AND pm.ProductMasterId = dsi.DepartmentStockInPK.DepartmentId ";
                                           //queryString += " AND dsid.DepartmentStockInDetailPK.DepartmentId = " + CurrentDepartment.Get().DepartmentId;
                                           //queryString += " AND dsid.DepartmentStockInDetailPK.StockInId = dsi.DepartmentStockInPK.StockInId ";
                                           //queryString += " AND dsid.DepartmentStockInDetailPK.DepartmentId = dsi.DepartmentStockInPK.DepartmentId ";
                                           //queryString += " AND p.ProductId = dsid.DepartmentStockInDetailPK.ProductId ";
                                           queryString += " AND ds.DepartmentStockPK.DepartmentId=" + CurrentDepartment.Get().DepartmentId;
                                           queryString += " AND p.ProductId = ds.DepartmentStockPK.ProductId";
                                           //queryString += " AND ds.GoodQuantity > 0 ";
                                       }

                                       // ORDER BY ProductName
                                       /*queryString +=
                                           " ORDER BY pm.ProductMasterName,pm.ProductColor.ColorId,pm.ProductSize.SizeId ";*/
                                       IList productMasters = session.CreateQuery(queryString)
                                           .SetMaxResults(100)
                                           .List();
                                       return productMasters;
                                   }
                                   catch (Exception e)
                                   {
                                       return null;
                                   }
                               }
                               );
        }
Пример #8
0
        public void Update(ProductMaster data)
        {
            var originalProMaster = ProductMasterDAO.FindById(data.ProductMasterId);

            var criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            criteria.AddNotEqualsCriteria("ProductMasterId", data.ProductMasterId);
            criteria.AddEqCriteria("ProductType", originalProMaster.ProductType);
            criteria.AddEqCriteria("Country", originalProMaster.Country);
            criteria.AddEqCriteria("Manufacturer", originalProMaster.Manufacturer);
            criteria.AddEqCriteria("Distributor", originalProMaster.Distributor);
            criteria.AddEqCriteria("Packager", originalProMaster.Packager);
            criteria.AddEqCriteria("ProductName", originalProMaster.ProductName);

            IList list = ProductMasterDAO.FindAll(criteria);
            foreach (ProductMaster master in list)
            {
                master.ProductName = data.ProductName;
                master.ProductType = data.ProductType;
                master.ProductFullName = data.ProductFullName;
                master.Manufacturer = data.Manufacturer;
                master.Packager = data.Packager;
                master.Distributor = data.Distributor;
                master.Packager = data.Packager;
                master.Country = data.Country;
                master.UpdateDate = DateTime.Now;
                master.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                ProductMasterDAO.Update(master);
            }
            ProductMasterDAO.Update(data);
        }
Пример #9
0
        public void Delete(ProductMaster data)
        {
            long deptId = CurrentDepartment.Get().DepartmentId;
            // delete product master
            ProductMaster master = ProductMasterDAO.FindById(data.ProductMasterId);
            if (master != null)
            {
                master.UpdateDate = DateTime.Now;
                master.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                master.DelFlg = 1;
                ProductMasterDAO.Update(master);
            }

            // delete product
            var criteria = new ObjectCriteria();
            criteria.AddEqCriteria("ProductMaster.ProductMasterId", data.ProductMasterId);
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            IList products = ProductDAO.FindAll(criteria);
            IList productIds = new ArrayList();
            foreach (Product product in products)
            {
                product.UpdateDate = DateTime.Now;
                product.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                product.DelFlg = 1;
                ProductDAO.Update(product);
                productIds.Add(product.ProductId);
            }

            if (productIds.Count > 0)
            {
                // delete stock in detail
                criteria = new ObjectCriteria();
                criteria.AddEqCriteria("DepartmentStockInDetailPK.DepartmentId", deptId);
                criteria.AddSearchInCriteria("DepartmentStockInDetailPK.ProductId", productIds);
                IList stockInDetails = DepartmentStockInDetailDAO.FindAll(criteria);
                IList stockInIds = new ArrayList();
                foreach (DepartmentStockInDetail detail in stockInDetails)
                {
                    detail.UpdateDate = DateTime.Now;
                    detail.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                    detail.DelFlg = 1;
                    DepartmentStockInDetailDAO.Update(detail);
                    stockInIds.Add(detail.DepartmentStockInDetailPK.StockInId);
                }

                // delete stock in
                if (stockInIds.Count > 0)
                {
                    criteria = new ObjectCriteria();
                    criteria.AddEqCriteria("DepartmentStockInPK.DepartmentId", deptId);
                    criteria.AddSearchInCriteria("DepartmentStockInPK.StockInId", stockInIds);
                    IList stockIns = DepartmentStockInDAO.FindAll(criteria);
                    foreach (DepartmentStockIn stockIn in stockIns)
                    {
                        stockIn.UpdateDate = DateTime.Now;
                        stockIn.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                        stockIn.DelFlg = 1;
                        DepartmentStockInDAO.Update(stockIn);
                    }
                }

                // delete stock
                criteria = new ObjectCriteria();
                criteria.AddEqCriteria("DepartmentStockPK.DepartmentId", deptId);
                criteria.AddSearchInCriteria("DepartmentStockPK.ProductId", productIds);
                IList stocks = DepartmentStockDAO.FindAll(criteria);
                foreach (DepartmentStock stock in stocks)
                {
                    stock.UpdateDate = DateTime.Now;
                    stock.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                    stock.DelFlg = 1;
                    DepartmentStockDAO.Update(stock);
                }

                // delete purchase order detail
                criteria = new ObjectCriteria();
                criteria.AddEqCriteria("PurchaseOrderDetailPK.DepartmentId", deptId);
                criteria.AddEqCriteria("ProductMaster.ProductMasterId", data.ProductMasterId);
                IList purchaseOrderDetails = PurchaseOrderDetailDAO.FindAll(criteria);
                IList purchaseOrderIds = new ArrayList();
                foreach (PurchaseOrderDetail detail in purchaseOrderDetails)
                {
                    detail.UpdateDate = DateTime.Now;
                    detail.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                    detail.DelFlg = 1;
                    PurchaseOrderDetailDAO.Update(detail);
                    purchaseOrderIds.Add(detail.PurchaseOrderDetailPK.PurchaseOrderId);
                }

                // delete purchase order
                if (purchaseOrderIds.Count > 0)
                {
                    criteria = new ObjectCriteria();
                    criteria.AddEqCriteria("PurchaseOrderPK.DepartmentId", deptId);
                    criteria.AddSearchInCriteria("PurchaseOrderPK.PurchaseOrderId", purchaseOrderIds);
                    IList purchaseOrders = PurchaseOrderDAO.FindAll(criteria);
                    foreach (PurchaseOrder po in purchaseOrders)
                    {
                        po.UpdateDate = DateTime.Now;
                        po.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                        po.DelFlg = 1;
                        PurchaseOrderDAO.Update(po);
                    }
                }
            }

            // delete price
            var pricePk = new DepartmentPricePK{DepartmentId = deptId, ProductMasterId = data.ProductMasterId};
            var deptPrice = DepartmentPriceDAO.FindById(pricePk);
            if (deptPrice != null)
            {
                deptPrice.UpdateDate = DateTime.Now;
                deptPrice.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                deptPrice.DelFlg = 1;
                DepartmentPriceDAO.Update(deptPrice);
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            var productMaster = new ProductMaster
                                    {
                                        ProductMasterId = ProductMasterId,
                                        ProductName = productMasterControl.txtProductName.Text,
                                        Barcode = string.IsNullOrEmpty(txtBarcode.Text) ? ProductMasterId : txtBarcode.Text,
                                        Packager = productMasterControl.cbbPackager.SelectedIndex > 0 ? ((Packager)productMasterControl.cbbPackager.SelectedItem) : null,
                                        ProductSize = productMasterControl.cbbProductSize.SelectedIndex > 0 ? ((ProductSize)productMasterControl.cbbProductSize.SelectedItem) : null,
                                        ProductType = productMasterControl.cbbProductType.SelectedIndex > 0 ? ((ProductType)productMasterControl.cbbProductType.SelectedItem) : null,
                                        ProductColor = productMasterControl.cbbProductColor.SelectedIndex > 0 ?
                                            ((ProductColor)productMasterControl.cbbProductColor.SelectedItem) : null,
                                        Country = productMasterControl.cbbCountry.SelectedIndex > 0 ? ((Country)productMasterControl.cbbCountry.SelectedItem) : null,
                                        Manufacturer = productMasterControl.cbbManufacturer.SelectedIndex > 0 ? ((Manufacturer)productMasterControl.cbbManufacturer.SelectedItem) : null,
                                        Distributor = productMasterControl.cbbDistributor.SelectedIndex > 0 ? ((Distributor)productMasterControl.cbbDistributor.SelectedItem) : null
                                    };

            var eventArgs = new ProductMasterEventArgs {ProductMaster = productMaster};
            EventUtility.fireEvent(SaveProductMasterEvent, sender, eventArgs);
            productMaster.ProductMasterId = eventArgs.ProductMaster.ProductMasterId;
            productMasterControl.txtProductMasterId.Text = productMaster.ProductMasterId;
            txtBarcode.Text = productMaster.Barcode;
            DrawBarcode(productMaster.Barcode);
            if (isNeedClosing)
            {
                this.Close();
            }
            btnPrint.Visible = true;
            numericUpDown.Visible = true;
            btnPreview.Visible = true;
            lblMaVach.Visible = true;
            if (ClientInfo.getInstance().LoggedUser.Name.Equals("admin"))
            {
                btnDelete.Visible = true;
            }
        }
        public IList FindByProductMasterName(ProductMaster master)
        {
            return (IList)HibernateTemplate.Execute(
                 delegate(ISession session)
                 {
                     try
                     {
                         string queryString =
                                      " SELECT st FROM ProductMaster pm,DepartmentStockDefect st " +
                                      " WHERE pm.ProductMasterId = st.ProductMaster.ProductMasterId AND st.ErrorCount > 0 " +
                                      " AND st.DepartmentStockDefectPK.DepartmentId = " + CurrentDepartment.Get().DepartmentId + " " +
                                      " AND pm.ProductName = '" + master.ProductName + "'";
                         return session.CreateQuery(queryString).List();
                     }
                     catch (Exception exp)
                     {

                         return null;
                     }

                 }
               );
        }
Пример #12
0
 private bool ExistInList(IList OldProductMasterList, ProductMaster master)
 {
     foreach (ProductMaster productMaster in OldProductMasterList)
     {
         if (productMaster.ProductMasterId.Equals(master.ProductMasterId))
         {
             return true;
         }
     }
     return false;
 }
 // get product master if in list and get in database if new
 private ProductMaster GetProductMaster(ProductMaster productMaster, IList list)
 {
     ProductMaster foundMaster = null;
     foreach (ProductMaster master in list)
     {
         if(master.ProductMasterId.Equals(productMaster.ProductMasterId))
         {
             foundMaster = master;
             break;
         }
     }
     if(foundMaster== null)
     {
         foundMaster = ProductMasterDAO.FindById(productMaster.ProductMasterId);
         if(foundMaster!=null)
         {
             list.Add(foundMaster);
         }
         else
         {
             list.Add(productMaster);
         }
         return foundMaster;
     }
     else
     {
         return foundMaster;
     }
 }
 private void AddNonDuplicateItem(IList list, ProductMaster master)
 {
     bool found = false;
     foreach (ProductMaster productMaster in list)
     {
        if(productMaster.ProductName.Equals(master.ProductName))
        {
            found = true;
        }
     }
     if(!found)
     {
         list.Add(master);
     }
 }
Пример #15
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            IList pmList = new ArrayList();
            MasterDBTableAdapters.product_master_idsTableAdapter adp = new MasterDBTableAdapters.product_master_idsTableAdapter();

            foreach (DataGridViewRow row in dgvSelectedProductMaster.Rows)
            {

                string productName = row.Cells[0].Value.ToString();
                adp.Fill(masterDB.product_master_ids, productName);
                foreach (MasterDB.product_master_idsRow masterRow in masterDB.product_master_ids)
                {
                    ProductMaster pm = new ProductMaster
                                           {
                                               ProductMasterId = masterRow.product_master_id.ToString(),
                                               ProductName = productName
                                           };
                    pmList.Add(pm);
                }
            }
            SelectedProductMasterList = pmList;
            Close();
        }
 private void dgvProductMaster_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (ProductMasterList != null && e.RowIndex <= ProductMasterList.Count && e.RowIndex >= 0)
     {
         string productMasterId = dgvProductMaster[0, e.RowIndex].Value.ToString();
         foreach (ProductMaster productMaster in ProductMasterList)
         {
             if (productMaster.ProductMasterId.Equals(productMasterId))
             {
                 SelectedProductMaster = productMaster;
             }
         }
         if (!IsCallFromMenu)
         {
             Close();
         }
     }
 }
        private void ProductMasterSearchOrCreateForm_Load(object sender, EventArgs e)
        {
            var eventArgs = new ProductMasterSearchOrCreateEventArgs();
            EventUtility.fireEvent(InitProductMasterSearchOrCreateEvent, sender, eventArgs);

            AddListItemToCombo(productMasterControl.cbbProductType,
                productMasterSearchControl.cbbProductType,
                eventArgs.ProductTypeList,
                "TypeName",
                productMasterControl.cbbProductType.Text,
                productMasterSearchControl.cbbProductType.Text);

            AddListItemToCombo(productMasterControl.cbbProductSize,
                productMasterSearchControl.cbbProductSize,
                eventArgs.ProductSizeList,
                "SizeName",
                productMasterControl.cbbProductSize.Text,
                productMasterSearchControl.cbbProductSize.Text);

            AddListItemToCombo(productMasterControl.cbbProductColor,
                productMasterSearchControl.cbbProductColor,
                eventArgs.ProductColorList,
                "ColorName",
                productMasterControl.cbbProductColor.Text,
                productMasterSearchControl.cbbProductColor.Text);

            AddListItemToCombo(productMasterControl.cbbCountry,
                productMasterSearchControl.cbbCountry,
                eventArgs.CountryList,
                "CountryName",
                productMasterControl.cbbCountry.Text,
                productMasterSearchControl.cbbCountry.Text);

            AddListItemToCombo(productMasterControl.cbbManufacturer,
                productMasterSearchControl.cbbManufacturer,
                eventArgs.ManufacturerList,
                "ManufacturerName",
                productMasterControl.cbbManufacturer.Text,
                productMasterSearchControl.cbbManufacturer.Text);

            AddListItemToCombo(productMasterControl.cbbDistributor,
                productMasterSearchControl.cbbDistributor,
                eventArgs.DistributorList,
                "DistributorName",
                productMasterControl.cbbDistributor.Text,
                productMasterSearchControl.cbbDistributor.Text);

            AddListItemToCombo(productMasterControl.cbbPackager,
                productMasterSearchControl.cbbPackager,
                eventArgs.PackagerList,
                "PackagerName",
                productMasterControl.cbbPackager.Text,
                productMasterSearchControl.cbbPackager.Text);

            SelectedProductMaster = null;
            dgvProductMaster.DataSource = null;
            if (ProductMasterList != null && ProductMasterList.Count > 0)
            {
                dgvProductMaster.DataSource = ProductMasterList;
                for (int i = 0; i < ProductMasterList.Count; i++)
                {
                    dgvProductMaster[0, i].Value = i;
                }
            }
        }
Пример #18
0
        private void LoadGoodsByName(ProductMaster master)
        {
            if (!DepartmentReturnForm)
            {
                stockDefectList.Clear();
                BaseStockOutEventArgs eventArgs = new BaseStockOutEventArgs();
                eventArgs.RequestProductMaster = master;
                EventUtility.fireEvent(LoadGoodsByNameEvent, this, eventArgs);

                foreach (Stock stockDefect in eventArgs.ReturnStockDefectList)
                {
                    stockDefectList.Add(stockDefect);
                }
            }
            else
            {
                deptStockDefectList.Clear();
                BaseStockOutEventArgs eventArgs = new BaseStockOutEventArgs();
                eventArgs.RequestProductMaster = master;
                EventUtility.fireEvent(LoadDeptGoodsByNameEvent, this, eventArgs);

                foreach (DepartmentStockHistory stockDefect in eventArgs.ReturnDeptStockDefectList)
                {
                    deptStockDefectList.Add(stockDefect);
                }

            }
            bdsStockDefect.EndEdit();
            bdsStockDefect.ResetBindings(true);
            dgvStockDefect.Refresh();
            dgvStockDefect.Invalidate();
        }
Пример #19
0
 public IList FindAllInDepartment(ProductMaster master, bool allDepartment)
 {
     return ProductMasterDAO.FindAllInDepartment(master, allDepartment);
 }
        void productMasterSearchDepartmentView_SearchProductMasterEvent(object sender, ProductMasterSearchDepartmentEventArgs e)
        {
            ProductMaster searchProductMaster = new ProductMaster();

            if (!string.IsNullOrEmpty(e.ProductMasterId))
            {
                /*long value = 0;
                Int64.TryParse(e.ProductMasterId, out value);*/
                searchProductMaster.ProductMasterId= e.ProductMasterId;
            }
            searchProductMaster.DelFlg = CommonConstants.DEL_FLG_NO;
            searchProductMaster.ProductName= e.ProductMasterName;

            searchProductMaster.ProductType = new ProductType();
            if (e.ProductType != null && e.ProductType.TypeId > 0)
            {

                searchProductMaster.ProductType.TypeId= e.ProductType.TypeId;
            }

            searchProductMaster.ProductSize = new ProductSize();
            if (e.ProductSize != null && e.ProductSize.SizeId > 0)
            {

                searchProductMaster.ProductSize.SizeId= e.ProductSize.SizeId;
            }

            searchProductMaster.ProductColor = new ProductColor();
            if (e.ProductColor != null && e.ProductColor.ColorId > 0)
            {

                searchProductMaster.ProductColor.ColorId= e.ProductColor.ColorId;
            }

            searchProductMaster.Country = new Country();
            if (e.Country != null && e.Country.CountryId > 0)
            {

                searchProductMaster.Country.CountryId= e.Country.CountryId;
            }

            bool allDepartment = false;
            e.ProductMasterList = ProductMasterLogic.FindAllInDepartment(searchProductMaster,allDepartment);
        }
Пример #21
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            PurchaseOrderDetail orderDetail = pODList.AddNew();
            orderDetail.CreateId = ClientInfo.getInstance().LoggedUser.Name;
            orderDetail.CreateDate = DateTime.Now;
            orderDetail.UpdateDate = DateTime.Now;
            orderDetail.UpdateId = orderDetail.CreateId;
            orderDetail.DelFlg = 0;
            orderDetail.DepartmentId = CurrentDepartment.Get().DepartmentId;
            orderDetail.Quantity = 1;
            if (GoodsSaleController.PurchaseOrder == null)
            {
                PurchaseOrder order = new PurchaseOrder();
                GoodsSaleController.PurchaseOrder = order;
            }
            orderDetail.PurchaseOrder = GoodsSaleController.PurchaseOrder;
            PurchaseOrderDetailPK purchaseOrderDetailPK = new PurchaseOrderDetailPK();
            purchaseOrderDetailPK.DepartmentId = CurrentDepartment.Get().DepartmentId;
            orderDetail.PurchaseOrderDetailPK = purchaseOrderDetailPK;

            // new product to test
            ProductMaster productMaster = new ProductMaster();
            orderDetail.ProductMaster = productMaster;
            Product product = new Product();
            product.ProductMaster = orderDetail.ProductMaster;
            orderDetail.Product = product;

            GoodsSaleController.PurchaseOrder.PurchaseOrderDetails =
                ObjectConverter.ConvertToNonGenericList<PurchaseOrderDetail>(pODList);
            bdsBill.EndEdit();
            //bdsBill.EndEdit();
        }
Пример #22
0
        public IList FindByProductMasterName(ProductMaster master)
        {
            return (IList)HibernateTemplate.Execute(
                 delegate(ISession session)
                 {
                     try
                     {
                         string queryString =
                                      " SELECT st FROM ProductMaster pm,Stock st " +
                                      " WHERE pm.ProductMasterId = st.ProductMaster.ProductMasterId AND st.ErrorQuantity > 0 " +
                                      " AND pm.ProductName = '" + master.ProductName + "'";
                         return session.CreateQuery(queryString).List();
                     }
                     catch (Exception exp)
                     {

                         return null;
                     }

                 }
               );
        }
Пример #23
0
 /// <summary>
 /// Add ProductMaster to database.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public ProductMaster Add(ProductMaster data)
 {
     HibernateTemplate.Save(data);
     return data;
 }
Пример #24
0
        private void CopyAndCreateImage(ProductMaster productMaster, string realImagePath)
        {
            if (!Directory.Exists(Application.StartupPath + "\\ProductImages\\"))
            {
                Directory.CreateDirectory(Application.StartupPath + "\\ProductImages\\");
            }

            // copy image
            if (File.Exists(realImagePath))
            {
                string existPath = Application.StartupPath + "\\ProductImages\\"
                                   + StringUtility.ConvertUniStringToHexChar(productMaster.ProductName)
                                   + ".jpg";
                if(File.Exists(existPath))
                {
                   File.Delete(existPath);
                }
                File.Copy(realImagePath, Application.StartupPath + "\\ProductImages\\"
                    + StringUtility.ConvertUniStringToHexChar(productMaster.ProductName)
                    + ".jpg");
            }
        }
Пример #25
0
 /// <summary>
 /// Delete ProductMaster from database.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public void Delete(ProductMaster data)
 {
     HibernateTemplate.Delete(data);
 }
        private void btnCreate_Click(object sender, EventArgs e)
        {
            var productMaster = new ProductMaster
                                    {
                                        ProductName = productMasterControl.txtProductName.Text,
                                        Packager = productMasterControl.cbbPackager.SelectedIndex > 0 ? ((Packager) productMasterControl.cbbPackager.SelectedItem) : null,
                                        ProductSize = productMasterControl.cbbProductSize.SelectedIndex > 0 ? ((ProductSize) productMasterControl.cbbProductSize.SelectedItem) : null,
                                        ProductType = productMasterControl.cbbProductType.SelectedIndex > 0 ? ((ProductType) productMasterControl.cbbProductType.SelectedItem) : null,
                                        ProductColor = productMasterControl.cbbProductColor.SelectedIndex > 0 ?
                                            ((ProductColor) productMasterControl.cbbProductColor.SelectedItem) : null,
                                        Country = productMasterControl.cbbCountry.SelectedIndex > 0 ? ((Country) productMasterControl.cbbCountry.SelectedItem) : null,
                                        Manufacturer = productMasterControl.cbbManufacturer.SelectedIndex > 0 ? ((Manufacturer)productMasterControl.cbbManufacturer.SelectedItem) : null,
                                        Distributor = productMasterControl.cbbDistributor.SelectedIndex > 0 ? ((Distributor)productMasterControl.cbbDistributor.SelectedItem) : null
                                    };

            var eventArgs = new ProductMasterSearchOrCreateEventArgs { ProductMaster = productMaster };
            EventUtility.fireEvent(SaveProductMasterEvent, sender, eventArgs);
            SelectedProductMaster = productMaster;
            Close();
        }
 public IList FindAllProductMaster(ProductMaster searchProductMaster)
 {
     return DepartmentStockInDetailDAO.FindAllProductMaster(searchProductMaster);
 }
        private void btnSelect_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = dgvProductMaster.SelectedRows;

            if(rows.Count>0)
            {
                var rowIndex = rows[0].Index;
                string productMasterId = dgvProductMaster[0, rowIndex].Value.ToString();
                foreach (ProductMaster productMaster in ProductMasterList)
                {
                    if (productMaster.ProductMasterId.Equals(productMasterId))
                    {
                        SelectedProductMaster = productMaster;
                        break;
                    }
                }
                if (!IsCallFromMenu)
                {
                    Close();
                }
            }

            /*if (ProductMasterList != null && dgvProductMaster.SelectedCells.Count > 0
                && dgvProductMaster.SelectedCells[0].RowIndex <= ProductMasterList.Count
                && dgvProductMaster.SelectedCells[0].RowIndex >= 0)
            {
                var rowIndex = dgvProductMaster.SelectedCells[0].RowIndex;
                string productMasterId = dgvProductMaster[0, rowIndex].Value.ToString();
                foreach (ProductMaster productMaster in ProductMasterList)
                {
                    if (productMaster.ProductMasterId.Equals(productMasterId))
                    {
                        SelectedProductMaster = productMaster;
                        break;
                    }
                }
                if (!IsCallFromMenu)
                {
                    Close();
                }
            }*/
        }
Пример #29
0
 public IList FindByProductMasterName(ProductMaster master)
 {
     return StockHistoryDAO.FindByProductMasterName(master);
 }
Пример #30
0
 public IList FindByProductMasterName(ProductMaster master)
 {
     return SubStockDAO.FindByProductMasterName(master);
 }