Example #1
0
        private void Save()
        {
            Business.Inventory.ProductMaster objProductMaster = new Business.Inventory.ProductMaster();
            Entity.Inventory.ProductMaster   productMaster    = new Entity.Inventory.ProductMaster();

            productMaster.BrandId               = int.Parse(ddlBrand.SelectedValue);
            productMaster.ProductMasterId       = ProductMasterId;
            productMaster.ParentProductMasterId = 0;
            productMaster.ProductCode           = txtProductCode.Text;
            productMaster.ProductName           = txtProductName.Text;
            productMaster.ProductSpecification  = txtProductSpecification.Text;
            productMaster.MachineLife           = int.Parse(txtMachineLife.Text);
            productMaster.MCBF = (txtMCBF.Text == string.Empty) ? 0 : int.Parse(txtMCBF.Text);
            productMaster.MTBF = (txtMTBF.Text == string.Empty) ? 0 : int.Parse(txtMTBF.Text);
            productMaster.ProductCategoryId = int.Parse(ddlProductCategory.SelectedValue);

            productMaster.UserId          = 1;
            productMaster.CompanyMasterId = 1;

            int i = objProductMaster.Save(productMaster);

            if (i > 0)
            {
                ClearControl();
                LoadProductMaster();
                Message.IsSuccess = true;
                Message.Text      = "Product Saved Successfully...";
            }
            else
            {
                Message.IsSuccess = false;
                Message.Text      = "Sorry, can not save product!";
            }
            Message.Show = true;
        }
Example #2
0
 private void LoadProductMaster()
 {
     Business.Inventory.ProductMaster objProductMaster = new Business.Inventory.ProductMaster();
     Entity.Inventory.ProductMaster   productMaster    = new Entity.Inventory.ProductMaster();
     productMaster.CompanyMasterId = 1;
     gvProductMaster.DataSource    = objProductMaster.GetAll(productMaster);
     gvProductMaster.DataBind();
 }
Example #3
0
        private void Inventory_ProductSpareMapping_GetById()
        {
            Business.Inventory.ProductMaster objServiceBook = new Business.Inventory.ProductMaster();
            DataTable dt = objServiceBook.ProductSpareMapping_GetById(Business.Common.Context.ProductId, Entity.Inventory.ItemType.Spare);

            gvSpareList.DataSource = dt;
            gvSpareList.DataBind();
        }
 //protected void LoadCustomer()
 //{
 //    Business.Customer.Customer objCustomer = new Business.Customer.Customer();
 //    Entity.Customer.Customer customer = new Entity.Customer.Customer();
 //    if (HttpContext.Current.User.IsInRole(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL))
 //        customer.AssignEngineer = 0;
 //    else
 //        customer.AssignEngineer = int.Parse(HttpContext.Current.User.Identity.Name);
 //    DataTable dt = objCustomer.Customer_Customer_GetByAssignEngineerId(customer);
 //    ddlCustomer.DataSource = dt;
 //    ddlCustomer.DataTextField = "CustomerName";
 //    ddlCustomer.DataValueField = "CustomerMasterId";
 //    ddlCustomer.DataBind();
 //    ddlCustomer.InsertSelect();
 //}
 private void LoadProduct()
 {
     Business.Inventory.ProductMaster objProductMaster = new Business.Inventory.ProductMaster();
     Entity.Inventory.ProductMaster   productmaster    = new Entity.Inventory.ProductMaster();
     productmaster.CompanyMasterId = 1;
     ddlProduct.DataSource         = objProductMaster.GetAll(productmaster);
     ddlProduct.DataTextField      = "ProductName";
     ddlProduct.DataValueField     = "ProductMasterId";
     ddlProduct.DataBind();
     ddlProduct.InsertSelect();
 }
        protected void btnMap_Click(object sender, EventArgs e)
        {
            try
            {
                Business.Inventory.ProductMaster objProductMaster = new Business.Inventory.ProductMaster();
                Entity.Inventory.ProductMaster   productMaster    = new Entity.Inventory.ProductMaster();

                using (DataTable dt = new DataTable())
                {
                    dt.Columns.Add("SpareId");
                    foreach (GridViewRow gvr in gvSpare.Rows)
                    {
                        CheckBox chkMap = (CheckBox)gvr.FindControl("chkMap");
                        if (chkMap.Checked)
                        {
                            dt.Rows.Add();
                            dt.Rows[dt.Rows.Count - 1]["SpareId"] = gvSpare.DataKeys[gvr.RowIndex].Values[0].ToString();
                            dt.AcceptChanges();
                        }
                    }

                    productMaster.ProductMasterId = int.Parse(ddlProduct.SelectedValue);
                    productMaster.dtMapping       = dt;

                    int i = objProductMaster.ProductSpareMapping_Save(productMaster);

                    if (i > 0)
                    {
                        Message.IsSuccess = true;
                        Message.Text      = "Product Spare Mapping Saved...";
                    }
                    else
                    {
                        Message.IsSuccess = false;
                        Message.Text      = "Mapping can not save!";
                    }
                    Message.Show = true;
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
        }
Example #6
0
        private void PopulateProduct()
        {
            Business.Inventory.ProductMaster objProductMaster = new Business.Inventory.ProductMaster();
            Entity.Inventory.ProductMaster   productMaster    = new Entity.Inventory.ProductMaster();

            productMaster                = objProductMaster.GetById(ProductMasterId);
            ProductMasterId              = productMaster.ProductMasterId;
            ddlBrand.SelectedValue       = Convert.ToString(productMaster.BrandId);
            txtProductCode.Text          = productMaster.ProductCode;
            txtProductName.Text          = productMaster.ProductName;
            txtProductSpecification.Text = productMaster.ProductSpecification;
            txtMachineLife.Text          = Convert.ToString(productMaster.MachineLife);
            txtMCBF.Text = (productMaster.MCBF == 0) ? "" : Convert.ToString(productMaster.MCBF);
            txtMTBF.Text = (productMaster.MTBF == 0) ? "" : Convert.ToString(productMaster.MTBF);
            ddlProductCategory.SelectedValue = Convert.ToString(productMaster.ProductCategoryId);
        }
        private void LoadProduct()
        {
            Business.Inventory.ProductMaster objProductMaster = new Business.Inventory.ProductMaster();
            Entity.Inventory.ProductMaster   productmaster    = new Entity.Inventory.ProductMaster();

            productmaster.CompanyMasterId = 1;
            productmaster.Nature          = 1;
            productmaster.BrandId         = (ddlBrand.SelectedIndex == 0) ? 0 : int.Parse(ddlBrand.SelectedValue);
            DataTable dt = objProductMaster.GetAll(productmaster);

            ddlProduct.DataSource     = dt;
            ddlProduct.DataTextField  = "ProductName";
            ddlProduct.DataValueField = "ProductMasterId";
            ddlProduct.DataBind();
            ddlProduct.InsertSelect();
        }
Example #8
0
        private void LoadProduct()
        {
            Business.Inventory.ProductMaster objProductMaster = new Business.Inventory.ProductMaster();
            Entity.Inventory.ProductMaster   productmaster    = new Entity.Inventory.ProductMaster();

            productmaster.CompanyMasterId = 1;
            DataTable dt = objProductMaster.GetAll(productmaster);

            ddlDocketProduct.DataSource     = dt;
            ddlDocketProduct.DataTextField  = "ProductName";
            ddlDocketProduct.DataValueField = "ProductMasterId";
            ddlDocketProduct.DataBind();
            ListItem li = new ListItem("--SELECT ALL--", "0");

            ddlDocketProduct.Items.Insert(0, li);
        }
Example #9
0
        private void LoadAllItem()
        {
            using (DataTable dtItem = new DataTable())
            {
                dtItem.Columns.Add("ItemIdType");
                dtItem.Columns.Add("ItemName");

                Business.Inventory.ProductMaster objProductMaster = new Business.Inventory.ProductMaster();

                foreach (DataRow drItem in objProductMaster.GetAll(new Entity.Inventory.ProductMaster()
                {
                    CompanyMasterId = 1
                }).Rows)
                {
                    DataRow drNewItem = dtItem.NewRow();
                    drNewItem["ItemIdType"] = drItem["ProductMasterId"].ToString() + "|" + (int)ItemType.Product;
                    drNewItem["ItemName"]   = drItem["ProductName"].ToString() + " (P)";
                    dtItem.Rows.Add(drNewItem);
                    dtItem.AcceptChanges();
                }

                Business.Inventory.SpareMaster objSpareMaster = new Business.Inventory.SpareMaster();

                foreach (DataRow drItem in objSpareMaster.GetAll(new Entity.Inventory.SpareMaster()
                {
                }).Rows)
                {
                    DataRow drNewItem = dtItem.NewRow();
                    drNewItem["ItemIdType"] = drItem["SpareId"].ToString() + "|" + (int)ItemType.Spare;
                    drNewItem["ItemName"]   = drItem["SpareName"].ToString() + " (S)";
                    dtItem.Rows.Add(drNewItem);
                    dtItem.AcceptChanges();
                }

                ddlItem.DataSource     = dtItem;
                ddlItem.DataValueField = "ItemIdType";
                ddlItem.DataTextField  = "ItemName";
                ddlItem.DataBind();
                ddlItem.InsertSelect();
            }
        }
        private void LoadProductSpareMapping()
        {
            LoadSpare();
            Business.Inventory.ProductMaster objProductMaster = new Business.Inventory.ProductMaster();
            DataTable dt = objProductMaster.ProductSpareMapping_GetById(long.Parse(ddlProduct.SelectedValue), Entity.Inventory.ItemType.None);

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    foreach (GridViewRow gvr in gvSpare.Rows)
                    {
                        if (dr["SpareId"].ToString() == gvSpare.DataKeys[gvr.RowIndex].Values[0].ToString())
                        {
                            CheckBox chkMap = (CheckBox)gvr.FindControl("chkMap");
                            chkMap.Checked = true;
                        }
                    }
                }
            }
        }
Example #11
0
        protected void gvProductMaster_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Ed")
                {
                    ProductMasterId = int.Parse(e.CommandArgument.ToString());
                    PopulateProduct();
                }
                else if (e.CommandName == "Del")
                {
                    Business.Inventory.ProductMaster objProductMaster = new Business.Inventory.ProductMaster();

                    int i = objProductMaster.Delete(int.Parse(e.CommandArgument.ToString()));
                    if (i > 0)
                    {
                        ClearControl();
                        LoadProductMaster();
                        Message.IsSuccess = true;
                        Message.Text      = "Product Deleted Successfully...";
                    }
                    else
                    {
                        Message.IsSuccess = false;
                        Message.Text      = "Sorry, can not delete product!";
                    }
                    Message.Show = true;
                }
            }
            catch (Exception ex)
            {
                ex.WriteException();

                Message.IsSuccess = false;
                Message.Text      = ex.Message;
                Message.Show      = true;
            }
        }