Exemplo n.º 1
0
        //List

        public List <eSunSpeedDomain.BillofMaterialModel> GetAllBillofMaterial()
        {
            List <eSunSpeedDomain.BillofMaterialModel> lstBom = new List <BillofMaterialModel>();

            eSunSpeedDomain.BillofMaterialModel objBom;

            string Query = "SELECT * FROM BillsofMaterial";

            System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());

            while (dr.Read())
            {
                objBom = new BillofMaterialModel();

                objBom.BOMName            = dr["BOMName"].ToString();
                objBom.ItemProduct        = dr["ItemProduct"].ToString();
                objBom.Quantity           = Convert.ToDecimal(dr["Quantity"]);
                objBom.ItemUnit           = dr["ItemUnit"].ToString();
                objBom.Expenses           = Convert.ToDecimal(dr["Expenses"]);
                objBom.SpecifyMCGenerated = Convert.ToBoolean(dr["SpecifyMcGenerated"]);
                objBom.SourceMC           = dr["SourceMC"].ToString();
                objBom.SpecifyDefaultMCforItemConsumed = Convert.ToBoolean(dr["SpecifyDefaultMCforItemConsumed"]);
                objBom.AppMc    = dr["AppMc"].ToString();
                objBom.SNo      = Convert.ToInt32(dr["SNo"]);
                objBom.ItemName = dr["ItemName"].ToString();
                objBom.Qty      = Convert.ToDecimal(dr["Qty"]);
                objBom.Unit     = Convert.ToDecimal(dr["Unit"]);
                objBom.TotalofConsumedqtyUnit = Convert.ToDecimal(dr["TotalofConsumedqtyUnit"]);


                lstBom.Add(objBom);
            }

            return(lstBom);
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            BillofMaterialModel objBMmodl = new BillofMaterialModel();

            objBMmodl.BOMName            = tbxBomName.Text.Trim();
            objBMmodl.ItemProduct        = cbxItemproduce.Text.Trim();
            objBMmodl.Quantity           = Convert.ToInt32(tbxQuanty.Text.Trim());
            objBMmodl.ItemUnit           = cbxUnit.SelectedItem.ToString();
            objBMmodl.Expenses           = Convert.ToDecimal(tbxExpensespcs.Text.Trim());
            objBMmodl.SpecifyMCGenerated = Convert.ToBoolean(cbxItemgenerated.SelectedItem.ToString().Equals("Yes") ? true : false);
            objBMmodl.SourceMC           = string.Empty;
            objBMmodl.SpecifyDefaultMCforItemConsumed = Convert.ToBoolean(cbxItemconsumed.SelectedItem.ToString().Equals("Yes") ? true : false);
            objBMmodl.AppMc = string.Empty;
            //objBMmodl.ItemName = cbxRawItemName.Text.Trim();
            //objBMmodl.Qty = Convert.ToInt32(tbxRawQty.Text.Trim());
            //objBMmodl.Unit = Convert.ToDecimal(tbxRawUnit.Text.Trim());

            bool isSuccess = objbal.SaveBOM(objBMmodl);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
                //List<BillofMaterialModel> lstBillMat = objBillmat.GetAllBillofMaterial();
                //dgvList.DataSource = lstBillMat;
                //Dialogs.PopUPDialog d = new Dialogs.PopUPDialog("Saved Successfully!");
                //d.ShowDialog();
            }
        }
Exemplo n.º 3
0
        private void FillBOMInfo()
        {
            BillofMaterialModel objBom = objbal.GetAllBillofMaterialById(BMId);

            if (BMId == 0)
            {
                tbxBomName.Focus();
                lblSave.Visibility   = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                lblUpdate.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
                lblDelete.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
                return;
            }
            tbxBomName.Text               = objBom.BOMName;
            cbxItemproduce.Text           = objBom.Itemtoproduce.ToString();
            tbxQuanty.Text                = Convert.ToString(objBom.Quantity);
            cbxUnit.Text                  = objBom.ItemUnit;
            tbxExpensespcs.Text           = Convert.ToString(objBom.Expenses);
            cbxItemgenerated.SelectedItem = objBom.SpecifyMCGenerated?"Y":"N";
            cbxItemconsumed.SelectedItem  = objBom.SpecifyDefaultMCforItemConsumed?"Y":"N";

            dtconsumed.Rows.Clear();
            DataRow dr;

            foreach (BillsofMaterialDetailsModel objmod in objBom.MaterialConsumed)
            {
                dr = dtconsumed.NewRow();

                dr["ItemName"] = objmod.ItemName;
                dr["Qty"]      = objmod.Qty;
                dr["Unit"]     = objmod.Unit;
                dr["id"]       = objmod.id;
                dr["ParentId"] = objmod.ParentId;
                dtconsumed.Rows.Add(dr);
            }

            dvgMatConsumed.DataSource = dtconsumed;

            dtgenerate.Rows.Clear();
            DataRow drgen;

            foreach (BillsofMaterialDetailsModel objGen in objBom.MaterialGenerated)
            {
                drgen = dtgenerate.NewRow();

                drgen["ItemName"] = objGen.ItemName;
                drgen["Qty"]      = objGen.Qty;
                drgen["Unit"]     = objGen.Unit;
                drgen["id"]       = objGen.id;
                drgen["ParentId"] = objGen.ParentId;
                dtgenerate.Rows.Add(drgen);
            }

            dvgProductGenerate.DataSource = dtgenerate;
            lblSave.Visibility            = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
            lblUpdate.Visibility          = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
            lblDelete.Visibility          = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
        }
Exemplo n.º 4
0
        //List Of BillofMaterial By Id
        public BillofMaterialModel GetAllBillofMaterialById(int id)
        {
            BillofMaterialModel objBom = new BillofMaterialModel();

            string Query = "SELECT * FROM `BillsofMaterial` WHERE Bom_Id=" + id + "";

            System.Data.IDataReader dr = _dbHelper.ExecuteDataReader(Query, _dbHelper.GetConnObject());

            while (dr.Read())
            {
                objBom.Bom_Id             = Convert.ToInt32(dr["Bom_Id"].ToString());
                objBom.BOMName            = dr["BOMName"].ToString();
                objBom.Itemtoproduce      = dr["Itemtoproduce"].ToString();
                objBom.Quantity           = Convert.ToDecimal(dr["Quantity"]);
                objBom.ItemUnit           = dr["ItemUnit"].ToString();
                objBom.Expenses           = Convert.ToDecimal(dr["Expenses"]);
                objBom.SpecifyMCGenerated = Convert.ToBoolean(dr["SpecifyMCGenerated"]);
                objBom.SpecifyDefaultMCforItemConsumed = Convert.ToBoolean(dr["SpecifyDefaultMCforItemConsumed"]);

                string QueryCon = "SELECT * FROM bom_consumed_details WHERE Bom_Id=" + id;
                System.Data.IDataReader drCon = _dbHelper.ExecuteDataReader(QueryCon, _dbHelper.GetConnObject());

                objBom.MaterialConsumed = new List <BillsofMaterialDetailsModel>();
                BillsofMaterialDetailsModel objMaterial;

                while (drCon.Read())
                {
                    objMaterial          = new BillsofMaterialDetailsModel();
                    objMaterial.id       = Convert.ToInt32(drCon["Consumed_Id"]);
                    objMaterial.ParentId = Convert.ToInt32(drCon["Bom_Id"]);
                    objMaterial.ItemName = drCon["ItemName"].ToString();
                    objMaterial.Qty      = Convert.ToDecimal(drCon["Qty"]);
                    objMaterial.Unit     = drCon["Unit"].ToString();

                    objBom.MaterialConsumed.Add(objMaterial);
                }

                string QueryGen = "SELECT * FROM bom_generate_details WHERE Bom_Id=" + id;
                System.Data.IDataReader drGen = _dbHelper.ExecuteDataReader(QueryGen, _dbHelper.GetConnObject());

                objBom.MaterialGenerated = new List <BillsofMaterialDetailsModel>();
                BillsofMaterialDetailsModel objMatGen;

                while (drGen.Read())
                {
                    objMatGen          = new BillsofMaterialDetailsModel();
                    objMatGen.id       = Convert.ToInt32(drGen["Generate_Id"]);
                    objMatGen.ParentId = Convert.ToInt32(drGen["Bom_Id"]);
                    objMatGen.ItemName = drGen["ItemName"].ToString();
                    objMatGen.Qty      = Convert.ToDecimal(drGen["Qty"]);
                    objMatGen.Unit     = drGen["Unit"].ToString();
                    objBom.MaterialGenerated.Add(objMatGen);
                }
            }
            return(objBom);
        }
Exemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            BillofMaterialModel objBMmodl = new BillofMaterialModel();

            objBMmodl.BOMName            = tbxBomName.Text.Trim();
            objBMmodl.Itemtoproduce      = cbxItemproduce.Text.Trim();
            objBMmodl.Quantity           = Convert.ToDecimal(tbxQuanty.Text.Trim());
            objBMmodl.ItemUnit           = cbxUnit.SelectedItem.ToString();
            objBMmodl.Expenses           = Convert.ToDecimal(tbxExpensespcs.Text.Trim());
            objBMmodl.SpecifyMCGenerated = Convert.ToBoolean(cbxItemgenerated.SelectedItem.ToString() == "Y"? true : false);
            objBMmodl.SpecifyDefaultMCforItemConsumed = Convert.ToBoolean(cbxItemconsumed.SelectedItem.ToString() == "Y"? true : false);
            objBMmodl.AppMc      = string.Empty;
            objBMmodl.ICTotalQty = Convert.ToDecimal(colQty.SummaryItem.SummaryValue);
            objBMmodl.IGTotalQty = Convert.ToDecimal(colIgQty.SummaryItem.SummaryValue);
            //Item consumed
            List <BillsofMaterialDetailsModel> lstItemConsumed = new List <BillsofMaterialDetailsModel>();
            BillsofMaterialDetailsModel        objConsumed;

            for (int i = 0; i < dvgMatConsuDetails.DataRowCount; i++)
            {
                DataRow row = dvgMatConsuDetails.GetDataRow(i);

                objConsumed          = new BillsofMaterialDetailsModel();
                objConsumed.ItemName = row["ItemName"].ToString() == null?string.Empty: row["ItemName"].ToString();
                objConsumed.Qty      = Convert.ToDecimal(row["Qty"].ToString() == string.Empty?"0": row["Qty"].ToString());
                objConsumed.Unit     = row["Unit"].ToString() == string.Empty?string.Empty: row["Unit"].ToString();

                lstItemConsumed.Add(objConsumed);
            }
            objBMmodl.MaterialConsumed = lstItemConsumed;

            //Item generated
            List <BillsofMaterialDetailsModel> lstItemGenerated = new List <BillsofMaterialDetailsModel>();
            BillsofMaterialDetailsModel        objGenerated;

            for (int i = 0; i < dvgProductGeneratedDet.DataRowCount; i++)
            {
                DataRow row = dvgProductGeneratedDet.GetDataRow(i);

                objGenerated          = new BillsofMaterialDetailsModel();
                objGenerated.ItemName = row["ItemName"].ToString() == null ? string.Empty : row["ItemName"].ToString();
                objGenerated.Qty      = Convert.ToDecimal(row["Qty"].ToString() == string.Empty ? "0" : row["Qty"].ToString());
                objGenerated.Unit     = row["Unit"].ToString() == string.Empty ? string.Empty : row["Unit"].ToString();

                lstItemGenerated.Add(objGenerated);
            }
            objBMmodl.MaterialGenerated = lstItemGenerated;
            bool isSuccess = objbal.SaveBOM(objBMmodl);

            if (isSuccess)
            {
                MessageBox.Show("Saved Successfully!");
                ClearControls();
            }
        }
Exemplo n.º 6
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            BillofMaterialModel objBMmodl = new BillofMaterialModel();

            if (BMId == 0)
            {
                tbxBomName.Focus();
                return;
            }

            objBMmodl.BOMName            = tbxBomName.Text.Trim();
            objBMmodl.Itemtoproduce      = cbxItemproduce.Text.Trim();
            objBMmodl.Quantity           = Convert.ToDecimal(tbxQuanty.Text.Trim());
            objBMmodl.ItemUnit           = cbxUnit.SelectedItem.ToString();
            objBMmodl.Expenses           = Convert.ToDecimal(tbxExpensespcs.Text.Trim());
            objBMmodl.SpecifyMCGenerated = Convert.ToBoolean(cbxItemgenerated.SelectedItem.ToString() == "Y"? true : false);

            // objBMmodl.SourceMC = string.Empty;
            objBMmodl.SpecifyDefaultMCforItemConsumed = Convert.ToBoolean(cbxItemconsumed.SelectedItem.ToString() == "Y"? true : false);
            objBMmodl.AppMc      = string.Empty;
            objBMmodl.ICTotalQty = Convert.ToDecimal(colQty.SummaryItem.SummaryValue);
            objBMmodl.IGTotalQty = Convert.ToDecimal(colIgQty.SummaryItem.SummaryValue);
            //Item consumed
            List <BillsofMaterialDetailsModel> lstItemConsumed = new List <BillsofMaterialDetailsModel>();
            BillsofMaterialDetailsModel        objConsumed;

            for (int i = 0; i < dvgMatConsuDetails.DataRowCount; i++)
            {
                DataRow row = dvgMatConsuDetails.GetDataRow(i);

                objConsumed          = new BillsofMaterialDetailsModel();
                objConsumed.ItemName = row["ItemName"].ToString() == string.Empty?string.Empty: row["ItemName"].ToString();
                objConsumed.Qty      = Convert.ToDecimal(row["Qty"].ToString() == string.Empty?string.Empty: row["Qty"].ToString());
                objConsumed.Unit     = row["Unit"].ToString() == string.Empty?string.Empty: row["Unit"].ToString();
                objConsumed.id       = Convert.ToInt32(row["id"].ToString() == string.Empty?"0": row["id"].ToString());
                objConsumed.ParentId = Convert.ToInt32(row["ParentId"].ToString() == string.Empty?"0": row["ParentId"].ToString());
                lstItemConsumed.Add(objConsumed);
            }
            objBMmodl.MaterialConsumed = lstItemConsumed;

            //Item generated
            List <BillsofMaterialDetailsModel> lstItemGenerated = new List <BillsofMaterialDetailsModel>();
            BillsofMaterialDetailsModel        objGenerated;

            for (int i = 0; i < dvgProductGeneratedDet.DataRowCount; i++)
            {
                DataRow row = dvgProductGeneratedDet.GetDataRow(i);

                objGenerated          = new BillsofMaterialDetailsModel();
                objGenerated.ItemName = row["ItemName"].ToString() == string.Empty?string.Empty: row["ItemName"].ToString();
                objGenerated.Qty      = Convert.ToDecimal(row["Qty"].ToString() == string.Empty?string.Empty: row["Qty"].ToString());
                objGenerated.Unit     = row["Unit"].ToString() == string.Empty? string.Empty: row["Unit"].ToString();
                objGenerated.id       = Convert.ToInt32(row["id"].ToString() == string.Empty ? "0" : row["id"].ToString());
                objGenerated.ParentId = Convert.ToInt32(row["ParentId"].ToString() == string.Empty ? "0" : row["ParentId"].ToString());

                lstItemGenerated.Add(objGenerated);
            }
            objBMmodl.MaterialGenerated = lstItemGenerated;
            objBMmodl.id = BMId;
            bool isSuccess = objbal.UpdateBOM(objBMmodl);

            if (isSuccess)
            {
                MessageBox.Show("Update Successfully!");
                BMId = 0;
                ClearControls();
                Administration.List.BillMaterialList frmList = new Administration.List.BillMaterialList();
                frmList.StartPosition = FormStartPosition.CenterScreen;

                frmList.ShowDialog();

                lblSave.Visibility   = DevExpress.XtraLayout.Utils.LayoutVisibility.OnlyInCustomization;
                lblUpdate.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                lblDelete.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                tbxBomName.Focus();

                FillBOMInfo();
            }
        }