Exemplo n.º 1
0
        private void cmbMRType_SelectedIndexChanged(object sender, EventArgs e)
        {
            Material      objMat    = new Material();
            BasicProduct  objBasic  = new BasicProduct();
            FinishProduct objFinish = new FinishProduct();

            bindItemList.DataSource = null;
            objMRFinishhProductCollec.Clear();
            objMRMaterialCollec.Clear();
            objMRBasicProductCollec.Clear();

            try
            {
                if (cmbMRType.SelectedItem.Equals("Material"))
                {
                    cmbItem.DataSource    = objMaterialDL.GetDataView();
                    cmbItem.DisplayMember = "Material";
                    cmbItem.ValueMember   = "MaterialCode";



                    objMat = objMaterialDL.Get(cmbItem.SelectedValue.ToString());
                    if (objMat != null)
                    {
                        lblUnit.Text = objMat.MatUnit.UnitCode;
                    }
                }
                else if (cmbMRType.SelectedItem.Equals("Basic Products"))
                {
                    cmbItem.DataSource    = objBasicProductDL.GetDataView(true);
                    cmbItem.DisplayMember = "Code";
                    cmbItem.ValueMember   = "BasicProductCode";



                    objBasic = objBasicProductDL.Get(cmbItem.SelectedValue.ToString());
                    if (objBasic != null)
                    {
                        lblUnit.Text = objBasic.BasicProductUnit.UnitCode;
                    }
                }
                else if (cmbMRType.SelectedItem.Equals("Finish Products"))
                {
                    cmbItem.DataSource    = objFinishProductDL.GetDataView(1);
                    cmbItem.DisplayMember = "Code";
                    cmbItem.ValueMember   = "FinishProductCode";


                    objFinish = objFinishProductDL.Get(cmbItem.SelectedValue.ToString());
                    if (objFinish != null)
                    {
                        lblUnit.Text = objFinish.FinishProductPackingType.PackingTitle;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void frmPrimaryPreperationBatchCreateIndependent_Load(object sender, EventArgs e)
        {
            //cmbStores.DataSource = objStoreDL.Get(objDepDL.GetByDepType("Store").DepID);
            objStore = objStoreDL.Get_Default(objDepDL.GetByDepType("Store").DepID);
            try
            {
                txtStore.Text     = objStore.StoreName;
                dtMaterials       = objMaterial_DL.GetDataView("Raw");
                dtEmployees       = objEmployee_DL.Get_By_RoleType("Staff", true);
                dtActivityMachine = objMachineActivity_DL.GetDataByAct(Convert.ToInt64(cmbActivityID.SelectedValue));

                objSourceMaterial.DataSource = dtMaterials;
                cmbMaterial.DataSource       = objSourceMaterial;

                Department objDep = objDepDL.GetByDepType("PRPD");

                cmbActivityID.DataSource    = objMainActivity_DL.GetByDepID(objDepDL.GetByDepType("PRPD").DepID);
                cmbActivityID.DisplayMember = "MainActivity";
                cmbActivityID.ValueMember   = "MainActID";

                txtInstructedBy.Text = CurrentUser.UserEmp.EmployeeNameID;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
 private void LoadMaterial()
 {
     if (cmbGRNType.SelectedIndex + 1 == Convert.ToInt32(GRN.Type.Material))
     {
         cmbMaterial.DataSource = null;
         cmbMaterial.Items.Clear();
         bsMaterialList.DataSource  = objMaterial_DL.GetDataView();
         cmbMaterial.DataSource     = bsMaterialList;
         cmbMaterial.BindingContext = this.BindingContext;
         cmbMaterial.DisplayMember  = "Material";
         cmbMaterial.ValueMember    = "MaterialCode";
     }
     else if (cmbGRNType.SelectedIndex + 1 == Convert.ToInt32(GRN.Type.BasicProduct))
     {
         cmbMaterial.DataSource = null;
         cmbMaterial.Items.Clear();
         bsMaterialList.DataSource  = objBasicProduct_DL.GetDataView();
         cmbMaterial.DataSource     = bsMaterialList;
         cmbMaterial.BindingContext = this.BindingContext;
         cmbMaterial.DisplayMember  = "BasicProduct";
         cmbMaterial.ValueMember    = "BasicProductCode";
     }
     else if (cmbGRNType.SelectedIndex + 1 == Convert.ToInt32(GRN.Type.FinishProduct))
     {
         cmbMaterial.DataSource = null;
         cmbMaterial.Items.Clear();
         bsMaterialList.DataSource  = objFinishProduct_DL.GetDataView(1);
         cmbMaterial.DataSource     = bsMaterialList;
         cmbMaterial.BindingContext = this.BindingContext;
         cmbMaterial.DisplayMember  = "FinishProduct";
         cmbMaterial.ValueMember    = "FinishProductCode";
     }
 }
Exemplo n.º 4
0
        //--------------- Methods --------------------

        public void LoadDirect()
        {
            try
            {
                if (cmbGRNType.SelectedItem.Equals("Material"))
                {
                    cmbItem.DataSource    = objMaterialDL.GetDataView();
                    cmbItem.DisplayMember = "Material";
                    cmbItem.ValueMember   = "MaterialCode";
                    objGRN.GRNType        = GRN.Type.Material;
                }
                else if (cmbGRNType.SelectedItem.Equals("Basic Product"))
                {
                    cmbItem.DataSource    = objBasicProductDL.GetDataView();
                    cmbItem.DisplayMember = "BasicProduct";
                    cmbItem.ValueMember   = "BasicProductCode";
                    objGRN.GRNType        = GRN.Type.BasicProduct;
                }
                else if (cmbGRNType.SelectedItem.Equals("Finish Product"))
                {
                    cmbItem.DataSource    = objFinishProductDL.GetDataView(1);
                    cmbItem.DisplayMember = "FinishProduct";
                    cmbItem.ValueMember   = "FinishProductCode";
                    objGRN.GRNType        = GRN.Type.FinishProduct;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        private void frmPRPDBatchCreateCAP_Load(object sender, EventArgs e)
        {
            try
            {
                dtMaterials       = objMaterial_DL.GetDataView(Convert.ToInt32(SESD.MRP.REF.Material.Status.Enable));
                dtEmployees       = objEmployee_DL.Get_By_RoleType("Manager", "Staff", "Production", true);
                dtActivityMachine = objMachineActivity_DL.GetDataByAct(Convert.ToInt64(cmbActivityID.SelectedValue));


                cmbInstructedBy.DataSource = dtEmployees;


                //Load Activity
                Department objDep = objDepDL.GetByDepType("PRPD");

                cmbActivityID.DataSource    = objMainActivity_DL.GetByDepID(objDepDL.GetByDepType("PRPD").DepID);
                cmbActivityID.DisplayMember = "MainActivity";
                cmbActivityID.ValueMember   = "MainActID";

                //Load CAPRework

                dtMTN = objMTN_DL.GetDataViewByStateAndType(MTN.Status.Received, MTN.Type.PRPDCAPBatch);


                objSourceMTN.DataSource = dtMTN;
                cmbMTN.DataSource       = objSourceMTN;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 6
0
        private void frmMRT_Load(object sender, EventArgs e)
        {
            try
            {
                Material  objMat = new Material();
                DataTable dt     = new DataTable();

                objDepartment           = objDepDL.GetByDepType("RPD");
                bindItemList.DataSource = null;
                objMRMaterialCollec.Clear();

                cmbStore.DataSource   = objStoreDL.Get();
                cmbBatchID.DataSource = objRPDBatch_DL.GetDataViewByState(RPDBatch.RPDBatchStatus.Approved, RPDBatch.RPDBatchStatus.Started, true);

                dt = objMaterialDL.GetDataView(MaterialCat);
                objSourceMaterial.DataSource = dt;

                cmbItem.DataSource = objSourceMaterial;



                objMat = objMaterialDL.Get(cmbItem.SelectedValue.ToString());
                if (objMat != null)
                {
                    lblUnit.Text = objMat.MatUnit.UnitCode;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 7
0
        private void frmMRT_Load(object sender, EventArgs e)
        {
            try
            {
                Material  objMat = new Material();
                DataTable dt     = new DataTable();

                bindItemList.DataSource = null;
                objMRMaterialCollec.Clear();


                objStore = objStoreDL.Get("Packing");

                txtStore.Text = objStore.StoreName;

                dt = objMaterialDL.GetDataView("Packing");
                objSourceMaterial.DataSource = dt;

                cmbItem.DataSource = objSourceMaterial;



                objMat = objMaterialDL.Get(cmbItem.SelectedValue.ToString());
                if (objMat != null)
                {
                    lblUnit.Text = objMat.MatUnit.UnitCode;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 8
0
        private void Load_Materials()
        {
            DataTable dt = objMaterialDL.GetDataView("Raw");

            objSourceMaterial.DataSource = dt;

            cmbItem.DataSource = objSourceMaterial;
        }
Exemplo n.º 9
0
        //--------------- Methods --------------------

        public void LoadDirect()
        {
            try
            {
                cmbItem.DataSource    = objMaterialDL.GetDataView(MatCat);
                cmbItem.DisplayMember = "Material";
                cmbItem.ValueMember   = "MaterialCode";
                objGRN.GRNType        = GRN.Type.Material;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 10
0
        private void LoadMaterial()
        {
            try
            {
                DataTable dt = objMaterial_DL.GetDataView("Packing");

                objSourceMaterials.DataSource = dt;
                cmMaterial.DataSource         = objSourceMaterials;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Exemplo n.º 11
0
        private void Load_MaterialList()
        {
            try
            {
                dtMaterials = objMaterial_DL.GetDataView("Raw");
                objSourceMaterial.DataSource = dtMaterials;

                cmbMaterial.DataSource = objSourceMaterial;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 12
0
        private void Load_Material()
        {
            try
            {
                dtMaterials = objMaterial_DL.GetDataView(Cat);

                objSourceMaterials.DataSource = dtMaterials;
                cmbMaterial.DataSource        = objSourceMaterials;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);;
            }
        }
Exemplo n.º 13
0
        private void POEntering_Load(object sender, EventArgs e)
        {
            try
            {
                dtSuppliers = objSupplier_DL.GetDataView(POType);

                objSource.DataSource   = dtSuppliers;
                cmbSupplier.DataSource = objSource;

                dtMaterials = objMaterial_DL.GetDataView(POType);
                objSourceMaterials.DataSource = dtMaterials;
                cmbMaterials.DataSource       = objSourceMaterials;
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 14
0
        //------------------ Form Methods ----------------------
        private void LoadMaterials(string Type)
        {
            try
            {
                dtMaterials = objMaterialDL.GetDataView(Type);


                gvMaterialList.AutoGenerateColumns = false;
                bindMaterials.DataSource           = dtMaterials;
                gvMaterialList.DataSource          = bindMaterials;
                bindMaterials.ResetBindings(true);

                objsourceMaterialBasic.DataSource   = dtMaterials;
                cmbMaterialBasicMaterial.DataSource = objsourceMaterialBasic;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 15
0
 private void btnMaterialDelete_Click(object sender, EventArgs e)
 {
     if (this.MaterialSelect)
     {
         DialogResult dr = MessageBox.Show(this, "Are you sure, You want to Delete selected Record?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             Material_DL objMaterialDL = new Material_DL(ConnectionStringClass.GetConnection());
             try
             {
                 int x = objMaterialDL.Delete(objSelectedMaterial.MaterialCode);
                 bindMaterials.DataSource = objMaterialDL.GetDataView(cmbCatergory.SelectedValue.ToString());
                 MaterialClear();
                 if (x > 0)
                 {
                     MessageBox.Show(this, "Succesfully Deleted From Database", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
             catch (SqlException sqlex)
             {
                 if (sqlex.Number == 547)
                 {
                     MessageBox.Show(this, "Selected Material has references to another record or more. System will not allow to delete the record\nPlease contact your System Administrator for further information", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show(this, "Error occured while deleteing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(this, "Error occured while deleteing", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show(this, "Select a Record from the List", "Select a Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 16
0
        private void frmFormula_Load(object sender, EventArgs e)
        {
            try
            {
                cmbMaterials.DataSource    = objMaterialDL.GetDataView();
                cmbMaterials.DisplayMember = "Material";
                cmbMaterials.ValueMember   = "MaterialCode";


                cmbBasicProducts.DataSource    = objBasicProductDL.GetDataView(true);
                cmbBasicProducts.DisplayMember = "BasicProduct";
                cmbBasicProducts.ValueMember   = "BasicProductCode";

                cmbFinishProducts.DataSource    = objFinishProductDL.GetDataView(1);
                cmbFinishProducts.DisplayMember = "FinishProduct";
                cmbFinishProducts.ValueMember   = "FinishProductCode";
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 17
0
        //-------------- Events ----------------------------------------


        private void btnMaterialSave_Click(object sender, EventArgs e)
        {
            if (this.IntermediateMaterialSelect)
            {
                if (txtAcgUnitCost.Text.Equals("") || txtMaterialBasicPartialSize.Text.Equals("") ||
                    txtMaterialCode.Text.Equals("") || txtMaterialQtyPerUnit.Text.Equals("") || txtmaterialName.Text.Equals("")
                    )
                {
                    MessageBox.Show(this, "Please Fill all Fields", "Blank Fields", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                else
                {
                    try
                    {
                        objMaterial.MatBasicMaterial = cmbMaterialBasicMaterial.SelectedValue.ToString();
                        objMaterial.MatBasicQty      = Convert.ToDecimal(txtMaterialQtyPerUnit.Text);
                        objMaterial.MatCost          = Convert.ToDecimal(txtAcgUnitCost.Text);
                        objMaterial.MateialType      = objMaterialTypeDL.Get(cmbMaterialType.SelectedValue.ToString());

                        objMaterial.MaterialMainType    = MainType;
                        objMaterial.MaterialCode        = txtMaterialCode.Text.Replace(" ", "");
                        objMaterial.MaterialDescription = txtmaterialName.Text;
                        objMaterial.MaterialStatus      = Convert.ToInt32(Material.Status.Enable);

                        objMaterial.MatForm         = objFormDL.Get(Convert.ToInt64(cmbMaterialForm.SelectedValue));
                        objMaterial.MatParticleSize = (txtMaterialBasicPartialSize.Text);
                        objMaterial.MatUnit         = objUnitDL.Get(Convert.ToInt64(cmbMaterialUnit.SelectedValue));
                        objMaterial.MatSeasonFrom   = "N/A";
                        objMaterial.MatSeasonTo     = "N/A";


                        int x = 0;
                        if (this.MaterialSelect)
                        {
                            //x = objMaterialDL.Add(objMaterial, objSelectedMaterial.MaterialCode,SubcatL1,SubCatL2);
                            MaterialClear();

                            bindMaterials.DataSource = objMaterialDL.GetDataView(cmbCatergory.SelectedValue.ToString());

                            if (x > 0)
                            {
                                MessageBox.Show(this, "Succesfully Updated the Database", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                int counter = 0;
                                foreach (DataGridViewRow var in gvMaterialList.Rows)
                                {
                                    if (var.Cells["ColMaterialCode"].Value.Equals(objMaterial.MaterialCode))
                                    {
                                        gvMaterialList.CurrentCell = gvMaterialList[1, counter];
                                        gvMaterialList.FirstDisplayedScrollingRowIndex = counter;

                                        break;
                                    }
                                    counter++;
                                }
                            }
                        }
                        else
                        {
                            // x = objMaterialDL.Add(objMaterial,"",SubcatL1,SubCatL2);
                            if (x > 0)
                            {
                                MaterialClear();
                                bindMaterials.DataSource = objMaterialDL.GetDataView(cmbCatergory.SelectedValue.ToString());
                                MessageBox.Show(this, "Succesfully Added to Database", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);


                                int counter = 0;
                                foreach (DataGridViewRow var in gvMaterialList.Rows)
                                {
                                    if (var.Cells["ColMaterialCode"].Value.Equals(objMaterial.MaterialCode))
                                    {
                                        gvMaterialList.CurrentCell = gvMaterialList[1, counter];
                                        gvMaterialList.FirstDisplayedScrollingRowIndex = counter;

                                        break;
                                    }
                                    counter++;
                                }
                            }
                            else if (x == -1)
                            {
                                MessageBox.Show(this, "Material Code already in the Database,Please enter another Material Code", "Problem with Material Code", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        this.MaterialSelect = false;
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show(this, "Please enter valid data", "Input Data Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                if (txtAcgUnitCost.Text.Equals("") || txtmaterialName.Text.Equals("") ||
                    txtMaterialCode.Text.Equals(""))
                {
                    MessageBox.Show(this, "Please fill All Fields", "Blank Fields", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                else
                {
                    try
                    {
                        objMaterial.IsExport            = cbMaterialImport.Checked;
                        objMaterial.IsLocal             = cbMaterialLocal.Checked;
                        objMaterial.IsSeasanal          = cbMaterialSeasonal.Checked;
                        objMaterial.MatBasicMaterial    = objMaterial.MaterialCode;
                        objMaterial.MatBasicQty         = 0;
                        objMaterial.MatCost             = Convert.ToDecimal(txtAcgUnitCost.Text);
                        objMaterial.MateialType         = objMaterialTypeDL.Get(cmbMaterialType.SelectedValue.ToString());
                        objMaterial.MaterialCategory    = Category;
                        objMaterial.MaterialMainType    = MainType;
                        objMaterial.MaterialCode        = txtMaterialCode.Text;
                        objMaterial.MaterialDescription = txtmaterialName.Text;
                        objMaterial.MaterialStatus      = Convert.ToInt32(Material.Status.Enable);
                        objMaterial.MatForm             = objFormDL.Get(Convert.ToInt64(cmbMaterialForm.SelectedValue));
                        objMaterial.MatParticleSize     = "N/A";
                        if (cbMaterialSeasonal.Checked)
                        {
                            objMaterial.MatSeasonFrom = cmbFromMonth.SelectedItem.ToString();
                            objMaterial.MatSeasonTo   = cmbToMonth.SelectedItem.ToString();
                        }
                        else
                        {
                            objMaterial.MatSeasonFrom = "N/A";
                            objMaterial.MatSeasonTo   = "N/A";
                        }


                        objMaterial.MatUnit = objUnitDL.Get(Convert.ToInt64(cmbMaterialUnit.SelectedValue));
                        int x = 0;

                        if (this.MaterialSelect)
                        {
                            // x = objMaterialDL.Add(objMaterial, objSelectedMaterial.MaterialCode,SubcatL1,SubCatL2);
                            MaterialClear();
                            bindMaterials.DataSource = objMaterialDL.GetDataView(cmbCatergory.SelectedValue.ToString());
                            if (x > 0)
                            {
                                MessageBox.Show(this, "Succesfully Updated the Database", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                int counter = 0;
                                foreach (DataGridViewRow var in gvMaterialList.Rows)
                                {
                                    if (var.Cells["ColMaterialCode"].Value.Equals(objMaterial.MaterialCode))
                                    {
                                        gvMaterialList.CurrentCell = gvMaterialList[1, counter];
                                        gvMaterialList.FirstDisplayedScrollingRowIndex = counter;

                                        break;
                                    }
                                    counter++;
                                }
                            }
                        }
                        else
                        {
                            //  x = objMaterialDL.Add(objMaterial,"",SubcatL1,SubCatL2);


                            if (x > 0)
                            {
                                MaterialClear();
                                bindMaterials.DataSource = objMaterialDL.GetDataView(cmbCatergory.SelectedValue.ToString());
                                MessageBox.Show(this, "Succesfully Added to Database", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                int counter = 0;
                                foreach (DataGridViewRow var in gvMaterialList.Rows)
                                {
                                    if (var.Cells["ColMaterialCode"].Value.Equals(objMaterial.MaterialCode))
                                    {
                                        gvMaterialList.CurrentCell = gvMaterialList[1, counter];
                                        gvMaterialList.FirstDisplayedScrollingRowIndex = counter;

                                        break;
                                    }
                                    counter++;
                                }
                            }
                            else if (x == -1)
                            {
                                MessageBox.Show(this, "Material Code already in the Database,Please enter another Material Code", "Problem with Material Code", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                    catch (FormatException)
                    {
                        MessageBox.Show(this, "Please enter valid data", "Input Data Invalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }