Esempio n. 1
0
        private void ListMaterial_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Administration.List.BillMaterialList frmList = new Administration.List.BillMaterialList();
            frmList.StartPosition = FormStartPosition.CenterScreen;

            frmList.ShowDialog();
        }
Esempio n. 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool isDelete = objbal.DeleteBillsOfMaterial(BMId);

            if (isDelete)
            {
                MessageBox.Show("Delete Successfully!");
                ClearControls();
                BMId = 0;
                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();
            }
        }
Esempio n. 3
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();
            }
        }