public void ProductLoad() { try { bindCategory.DataSource = objProductCategoryDL.GetDataView(); cmbCategory.DataSource = bindCategory; bindSubCategory.DataSource = objProductSubCategory_DL.GetDataView(); cmbProductSubCategory.DataSource = bindSubCategory; bindUnits.DataSource = objUnitDL.GetDataView(); cmbUnit.DataSource = bindUnits; bindForm.DataSource = objFormDL.GetDataView(); cmbForm.DataSource = bindForm; bindDepartment.DataSource = objDepartment_DL.GetDataView(); cmbDepartment.DataSource = bindDepartment; bindSections.DataSource = objSection_DL.GetDataView(); cmbSections.DataSource = bindSections; } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { } }
private void frmMTN_Load(object sender, EventArgs e) { try { cmbMTNType.SelectedIndex = 0; cmbDepartmentFrom.DataSource = objDepartmentDL.GetDataView(CurrentUser.EmployeeID); cmbDepartmentTo.DataSource = objDepartmentDL.GetDataView(); dt.Columns.Add("ItemCode"); dt.Columns.Add("Item"); dt.Columns.Add("Remarks"); dt.Columns.Add("Qty"); dt.Columns.Add("Unit"); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmMRT_Load(object sender, EventArgs e) { try { cmbDepartment.DataSource = objDepDL.GetDataView(CurrentUser.EmployeeID); cmbStore.DataSource = objStoreDL.Get(); cmbMRType.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cmbDivision_SelectedIndexChanged(object sender, EventArgs e) { try { if (cmbDivision.Items.Count > 0) { bindDepartments.DataSource = objDepDL.GetDataView(Convert.ToInt64(cmbDivision.SelectedValue)); cmbDepartment.DataSource = bindDepartments; } } catch (Exception ex) { MessageBox.Show(this, "Error occured while loading", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void frmAddStock_Load(object sender, EventArgs e) { try { cmbGRNType.SelectedIndex = 0; cmbDepartment.DataSource = objDepartmentDL.GetDataView(); LoadDirect(); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadDeparment() { bsDepList.DataSource = objDepartment_DL.GetDataView(); cmbDepartment.DataSource = bsDepList; }
private void btnSave_Click(object sender, EventArgs e) { if (cmbDivision.SelectedValue != null) { if (txtDepartmentDescription.Text.Equals("") || txtDepartmentName.Text.Equals("")) { MessageBox.Show(this, "Please Fill all Fields", "Blank Fields", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { try { long ID = 0; if (!txtID.Text.Equals("[Auto]")) { ID = Convert.ToInt64(txtID.Text); } objDepartment.DepID = ID; objDepartment.DepDescription = txtDepartmentDescription.Text; objDepartment.DepHead = objEmpDL.Get(cmbDepHead.SelectedValue.ToString()); objDepartment.DepName = txtDepartmentName.Text; long DivisionID = Convert.ToInt64(cmbDivision.SelectedValue); objDepartment.DivisionID = DivisionID; if (rbOther.Checked) { objDepartment.DepType = "OTHER"; } if (rbSales.Checked) { objDepartment.DepType = "LAB"; } if (rbStores.Checked) { objDepartment.DepType = Department.Type.STORE.ToString(); } if (rbPRPD.Checked) { objDepartment.DepType = Department.Type.PRPD.ToString(); } if (rbRPD.Checked) { objDepartment.DepType = Department.Type.RPD.ToString(); } if (rbAgri.Checked) { objDepartment.DepType = Department.Type.AGRI.ToString(); } if (rbSupply.Checked) { objDepartment.DepType = Department.Type.SUPPLY.ToString(); } if (rbProduction.Checked) { objDepartment.DepType = Department.Type.PRODUCTION.ToString(); } long NewID = objDepDL.Add_New(objDepartment); if (NewID > 0) { ClearDepartment(); bindDep.DataSource = objDepDL.GetDataView(DivisionID); MessageBox.Show(this, "Succesfully Added to Database", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information); } //int x = 0; //if (this.DepSelect) //{ // // x = objDepDL.Update(objDepartment); // if (x > 0) // { // ClearDepartment(); // bindDep.DataSource = objDepDL.GetDataView(); // MessageBox.Show(this, "Succesfully Updated the Database", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information); // } //} //else //{ // x = objDepDL.Add(objDepartment); // if (x > 0) // { // ClearDepartment(); // bindDep.DataSource = objDepDL.GetDataView(); // MessageBox.Show(this, "Succesfully Added to Database", "Succesfull", 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); } finally { } } } }