public void ProductGroupEdit(ProductGroupInfo productgroupinfo) { try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ProductGroupEdit", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam7 = new SqlParameter(); sprmparam7 = sccmd.Parameters.Add("@groupId", SqlDbType.Decimal); sprmparam7.Value = productgroupinfo.GroupId; sprmparam7 = sccmd.Parameters.Add("@groupName", SqlDbType.VarChar); sprmparam7.Value = productgroupinfo.GroupName; sprmparam7 = sccmd.Parameters.Add("@groupUnder", SqlDbType.Decimal); sprmparam7.Value = productgroupinfo.GroupUnder; sprmparam7 = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam7.Value = productgroupinfo.Narration; sprmparam7 = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam7.Value = productgroupinfo.Extra1; sprmparam7 = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam7.Value = productgroupinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { base.sqlcon.Close(); } }
/// <summary> /// Function To edit existing productgroup /// </summary> private void EditFunction() { try { ProductGroupInfo infoProductGroup = new ProductGroupInfo(); ProductGroupSP spProductGroup = new ProductGroupSP(); 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 (spProductGroup.ProductGroupCheckExistence(txtProductGroupName.Text.Trim().ToString(), decId) == false) { spProductGroup.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 save new productgroup /// </summary> private void SaveFunction() { try { ProductGroupInfo infoProductGroup = new ProductGroupInfo(); ProductGroupSP spProductGroup = new ProductGroupSP(); 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 (spProductGroup.ProductGroupCheckExistence(txtProductGroupName.Text.Trim(), 0) == false) { decIdForOtherForms = spProductGroup.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); } }
public void ProductGroupEdit(ProductGroupInfo productgroupinfo) { try { spProductGroup.ProductGroupEdit(productgroupinfo); } catch (Exception ex) { MessageBox.Show("AL21:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public decimal ProductGroupAdd(ProductGroupInfo productgroupinfo) { decimal decIdForOtherForms = 0; try { decIdForOtherForms = spProductGroup.ProductGroupAdd(productgroupinfo); } catch (Exception ex) { MessageBox.Show("AL18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(decIdForOtherForms); }
public ProductGroupInfo ProductGroupView(decimal groupId) { ProductGroupInfo productgroupinfo = new ProductGroupInfo(); try { productgroupinfo = spProductGroup.ProductGroupView(groupId); } catch (Exception ex) { MessageBox.Show("AL38:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(productgroupinfo); }
/// <summary> /// Function to delete productgroup /// </summary> private void Delete() { try { if (PublicVariables.isMessageDelete) { if (Messages.DeleteMessage() == true) { ProductGroupInfo InfoProductGroup = new ProductGroupInfo(); ProductGroupSP spProductGroup = new ProductGroupSP(); if ((spProductGroup.ProductGroupReferenceDelete(decId) == -1)) { Messages.ReferenceExistsMessage(); } else { Messages.DeletedMessage(); btnSave.Text = "Save"; btnDelete.Enabled = false; ProductGroupUnderComboFillForSearch(); Clear(); } } } else { ProductGroupInfo InfoProductGroup = new ProductGroupInfo(); ProductGroupSP spProductGroup = new ProductGroupSP(); if ((spProductGroup.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 fill the grid to view all the product groups /// </summary> private void GridFill() { try { DataTable dtbl = new DataTable(); ProductGroupSP spProducttGroup = new ProductGroupSP(); ProductGroupInfo info = new ProductGroupInfo(); if (cmbUnderSearch.Text == "") { cmbUnderSearch.Text = "All"; } dtbl = spProducttGroup.ProductGroupViewForGridFill(txtProductGroupSearch.Text, cmbUnderSearch.Text); dgvProductGroup.DataSource = dtbl; } catch (Exception ex) { MessageBox.Show("PG9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to insert values to ProductGroup Table /// </summary> /// <param name="productgroupinfo"></param> /// <returns></returns> public decimal ProductGroupAdd(ProductGroupInfo productgroupinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ProductGroupAdd", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@groupName", SqlDbType.VarChar); sprmparam.Value = productgroupinfo.GroupName; sprmparam = sccmd.Parameters.Add("@groupUnder", SqlDbType.Decimal); sprmparam.Value = productgroupinfo.GroupUnder; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = productgroupinfo.Narration; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = productgroupinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = productgroupinfo.Extra2; decimal decIdForOtherForms = Convert.ToDecimal(sccmd.ExecuteScalar()); if (decIdForOtherForms > 0) { return(decIdForOtherForms); } else { return(0); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); return(0); } finally { sqlcon.Close(); } }
public ProductGroupInfo ProductGroupView(decimal groupId) { ProductGroupInfo productgroupinfo = new ProductGroupInfo(); SqlDataReader sdrreader = null; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ProductGroupView", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam2 = new SqlParameter(); sprmparam2 = sccmd.Parameters.Add("@groupId", SqlDbType.Decimal); sprmparam2.Value = groupId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { productgroupinfo.GroupId = decimal.Parse(((DbDataReader)sdrreader)[0].ToString()); productgroupinfo.GroupName = ((DbDataReader)sdrreader)[1].ToString(); productgroupinfo.GroupUnder = decimal.Parse(((DbDataReader)sdrreader)[2].ToString()); productgroupinfo.Narration = ((DbDataReader)sdrreader)[3].ToString(); productgroupinfo.Extra1 = ((DbDataReader)sdrreader)[4].ToString(); productgroupinfo.Extra2 = ((DbDataReader)sdrreader)[5].ToString(); productgroupinfo.ExtraDate = DateTime.Parse(((DbDataReader)sdrreader)[6].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); base.sqlcon.Close(); } return(productgroupinfo); }
/// <summary> /// Function to fill the fields to edit or delete /// </summary> private void FillControls() { try { ProductGroupInfo infoProductGroup = new ProductGroupInfo(); ProductGroupSP spProductGroup = new ProductGroupSP(); infoProductGroup = spProductGroup.ProductGroupView(decId); txtProductGroupName.Text = infoProductGroup.GroupName; DataTable dtbl = new DataTable(); dtbl = spProductGroup.ProductGroupViewForComboFillForProductGroup(); cmbUnder.DataSource = dtbl; foreach (DataRow dr in dtbl.Rows) { if (dr["GroupName"].ToString() == txtProductGroupName.Text) { dr.Delete(); } } cmbUnder.ValueMember = "GroupId"; cmbUnder.DisplayMember = "GroupName"; cmbUnder.SelectedValue = infoProductGroup.GroupUnder; if (spProductGroup.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 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 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 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); } }