/// <summary> /// GridFill Function /// </summary> public void GridFill() { try { List<DataTable> listObj = new List<DataTable>(); ProductGroupBll BllProductGroup = new ProductGroupBll(); listObj = BllProductGroup.ProductAndUnitViewAllForGridFill(Convert.ToDecimal(cmbProductGroup.SelectedValue.ToString()), txtProductCode.Text.Trim(), txtProductName.Text.Trim()); dgvStandardRate.DataSource = listObj[0]; } catch (Exception ex) { MessageBox.Show("SR3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill ProductGroup combobox /// </summary> public void GroupComboFill() { try { List<DataTable> listObj = new List<DataTable>(); ProductGroupBll BllProductGroup = new ProductGroupBll(); listObj = BllProductGroup.ProductGroupViewAll(); DataRow dr = listObj[0].NewRow(); dr["groupName"] = "All"; dr["groupId"] = 0; listObj[0].Rows.InsertAt(dr, 0); cmbGroup.DataSource = listObj[0]; cmbGroup.DisplayMember = "groupName"; cmbGroup.ValueMember = "groupId"; } catch (Exception ex) { MessageBox.Show("ST:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Product group combofill Function /// </summary> public void ProductGroupComboFill() { try { ProductGroupBll BllProductGroup = new ProductGroupBll(); List<DataTable> listObjProductGroup = new List<DataTable>(); listObjProductGroup = BllProductGroup.ProductGroupViewForComboFill(); cmbProductGroup.DataSource = listObjProductGroup[0]; cmbProductGroup.ValueMember = "groupId"; cmbProductGroup.DisplayMember = "groupName"; } catch (Exception ex) { MessageBox.Show("SR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the grid to view all the product groups /// </summary> private void GridFill() { try { List<DataTable> listObj = new List<DataTable>(); ProductGroupBll BllProductGroup = new ProductGroupBll(); ProductGroupInfo info = new ProductGroupInfo(); if (cmbUnderSearch.Text == "") { cmbUnderSearch.Text = "All"; } listObj = BllProductGroup.ProductGroupViewForGridFill(txtProductGroupSearch.Text, cmbUnderSearch.Text); dgvProductGroup.DataSource = listObj[0]; } catch (Exception ex) { MessageBox.Show("PG9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save new productgroup /// </summary> private void SaveFunction() { try { ProductGroupInfo infoProductGroup = new ProductGroupInfo(); ProductGroupBll BllProductGroup = new ProductGroupBll(); infoProductGroup.GroupName = txtProductGroupName.Text.Trim(); infoProductGroup.GroupUnder = Convert.ToDecimal(cmbUnder.SelectedValue.ToString()); infoProductGroup.Narration = txtNarration.Text.Trim(); infoProductGroup.Extra1 = string.Empty; infoProductGroup.Extra2 = string.Empty; if (BllProductGroup.ProductGroupCheckExistence(txtProductGroupName.Text.Trim(), 0) == false) { decIdForOtherForms = BllProductGroup.ProductGroupAdd(infoProductGroup); Messages.SavedMessage(); ProductGroupUnderComboFill(); ProductGroupUnderComboFillForSearch(); GridFill(); Clear(); txtProductGroupName.Focus(); } else { Messages.InformationMessage("Product group already exists"); txtProductGroupName.Focus(); } } catch (Exception ex) { MessageBox.Show("PG4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the fields to edit or delete /// </summary> private void FillControls() { try { ProductGroupInfo infoProductGroup = new ProductGroupInfo(); ProductGroupBll BllProductgroup = new ProductGroupBll(); infoProductGroup = BllProductgroup.ProductGroupView(decId); txtProductGroupName.Text = infoProductGroup.GroupName; List<DataTable> listObj = new List<DataTable>(); listObj = BllProductgroup.ProductGroupViewForComboFillForProductGroup(); cmbUnder.DataSource = listObj[0]; foreach (DataRow dr in listObj[0].Rows) { if (dr["GroupName"].ToString() == txtProductGroupName.Text) dr.Delete(); } cmbUnder.ValueMember = "GroupId"; cmbUnder.DisplayMember = "GroupName"; cmbUnder.SelectedValue = infoProductGroup.GroupUnder; if (BllProductgroup.ProductGroupCheckExistenceOfUnderGroup(decId) == false) { cmbUnder.Enabled = false; } else { cmbUnder.Enabled = true; } txtNarration.Text = infoProductGroup.Narration; } catch (Exception ex) { MessageBox.Show("PG10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function To edit existing productgroup /// </summary> private void EditFunction() { try { ProductGroupInfo infoProductGroup = new ProductGroupInfo(); ProductGroupBll BllProductGroup = new ProductGroupBll(); infoProductGroup.GroupId = Convert.ToDecimal(dgvProductGroup.CurrentRow.Cells["dgvtxtgroupId"].Value); infoProductGroup.GroupName = txtProductGroupName.Text.Trim(); infoProductGroup.GroupUnder = Convert.ToDecimal(cmbUnder.SelectedValue.ToString()); infoProductGroup.Narration = txtNarration.Text.Trim(); infoProductGroup.Extra1 = string.Empty; infoProductGroup.Extra2 = string.Empty; if (BllProductGroup.ProductGroupCheckExistence(txtProductGroupName.Text.Trim().ToString(), decId) == false) { BllProductGroup.ProductGroupEdit(infoProductGroup); Messages.UpdatedMessage(); ProductGroupUnderComboFill(); ProductGroupUnderComboFillForSearch(); GridFill(); Clear(); txtProductGroupName.Focus(); } else { Messages.InformationMessage(" Product group already exists"); txtProductGroupName.Focus(); } } catch (Exception ex) { MessageBox.Show("PG5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to delete productgroup /// </summary> private void Delete() { try { if (PublicVariables.isMessageDelete) { if (Messages.DeleteMessage() == true) { ProductGroupInfo InfoProductGroup = new ProductGroupInfo(); ProductGroupBll BllProductGroup = new ProductGroupBll(); if ((BllProductGroup.ProductGroupReferenceDelete(decId) == -1)) { Messages.ReferenceExistsMessage(); } else { Messages.DeletedMessage(); btnSave.Text = "Save"; btnDelete.Enabled = false; ProductGroupUnderComboFillForSearch(); Clear(); } } } else { ProductGroupInfo InfoProductGroup = new ProductGroupInfo(); ProductGroupBll BllProductGroup = new ProductGroupBll(); if ((BllProductGroup.ProductGroupReferenceDelete(decId) == -1)) { Messages.ReferenceExistsMessage(); } else { Messages.DeletedMessage(); btnSave.Text = "Save"; btnDelete.Enabled = false; Clear(); } } } catch (Exception ex) { MessageBox.Show("PG6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to check whether the groupname exist or not while save or edit group /// </summary> /// <returns></returns> public bool CheckExistanceOfGroupName() { bool isExist = false; try { ProductGroupBll BllProductGroup = new ProductGroupBll(); isExist = BllProductGroup.ProductGroupCheckExistence(txtProductGroupName.Text.Trim(), 0); if (isExist) { if (txtProductGroupName.Text.ToLower() == strProductGroupName.ToLower()) { isExist = false; } } } catch (Exception ex) { MessageBox.Show("PG11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return isExist; }
/// <summary> /// Function to Fill product group or tax according to search by combo box selection in Product Group/Tax combo box /// </summary> public void ProductGroupTaxComboFill() { try { if (cmbSearchBy.SelectedIndex == 0) { ProductGroupBll BllProductgroup = new ProductGroupBll(); List<DataTable> listObjProductGroup = new List<DataTable>(); listObjProductGroup = BllProductgroup.ProductGroupViewAll(); cmbProductGroupTax.DataSource = listObjProductGroup[0]; cmbProductGroupTax.ValueMember = "groupId"; cmbProductGroupTax.DisplayMember = "groupName"; } else { TaxBll bllTax = new TaxBll(); List<DataTable> ListObj = new List<DataTable>(); ListObj = bllTax.TaxViewAll(); cmbProductGroupTax.DataSource = ListObj[0]; cmbProductGroupTax.ValueMember = "taxId"; cmbProductGroupTax.DisplayMember = "taxName"; } } catch (Exception ex) { MessageBox.Show("CPT 5 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }