/// <summary> /// Function to Update values in ServiceCategory Table /// </summary> /// <param name="servicecategoryinfo"></param> public void ServiceCategoryEdit(ServiceCategoryInfo servicecategoryinfo) { try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ServiceCategoryEdit", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@servicecategoryId", SqlDbType.Decimal); sprmparam.Value = servicecategoryinfo.ServicecategoryId; sprmparam = sccmd.Parameters.Add("@categoryName", SqlDbType.VarChar); sprmparam.Value = servicecategoryinfo.CategoryName; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = servicecategoryinfo.Narration; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = servicecategoryinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = servicecategoryinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } }
/// <summary> /// Function to save service category /// </summary> public void SaveFunction() { try { ServiceCategoryInfo infoServiceCategory = new ServiceCategoryInfo(); ServiceCategorySP spServiceCategory = new ServiceCategorySP(); infoServiceCategory.CategoryName = txtServiceCategory.Text.Trim(); infoServiceCategory.Narration = txtNarration.Text.Trim(); infoServiceCategory.Extra1 = string.Empty; infoServiceCategory.Extra2 = string.Empty; if (spServiceCategory.ServiceCategoryCheckIfExist(txtServiceCategory.Text.Trim().ToString(), 0) == false) { decId = spServiceCategory.ServiceCategoryAddSpecificFields1(infoServiceCategory); Messages.SavedMessage(); Clear(); } else { Messages.InformationMessage("Service category name already exist"); txtServiceCategory.Focus(); } } catch (Exception ex) { MessageBox.Show("SC3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to view details based on parameter /// </summary> /// <param name="decServiceCategoryId"></param> /// <returns></returns> public ServiceCategoryInfo ServiceCategoryWithNarrationView(decimal decServiceCategoryId) { ServiceCategoryInfo ServiceCategoryinfo = new ServiceCategoryInfo(); SqlDataReader sdrreader = null; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ServiceCategoryWithNarrationView", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@serviceCategoryId", SqlDbType.Decimal); sprmparam.Value = decServiceCategoryId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { ServiceCategoryinfo.ServicecategoryId = Convert.ToDecimal(sdrreader[0].ToString()); ServiceCategoryinfo.CategoryName = sdrreader[1].ToString(); ServiceCategoryinfo.Narration = sdrreader[2].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); sqlcon.Close(); } return(ServiceCategoryinfo); }
/// <summary> /// Function to add values to ServiceCategory Table /// </summary> /// <param name="servicecategoryinfo"></param> /// <returns></returns> public decimal ServiceCategoryAddSpecificFields1(ServiceCategoryInfo servicecategoryinfo) { decimal decId = 0; try { if (sqlcon.State == ConnectionState.Closed) { sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ServiceCategoryAddSpecificFields", sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam = new SqlParameter(); sprmparam = sccmd.Parameters.Add("@categoryName", SqlDbType.VarChar); sprmparam.Value = servicecategoryinfo.CategoryName; sprmparam = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam.Value = servicecategoryinfo.Narration; sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam.Value = servicecategoryinfo.Extra1; sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam.Value = servicecategoryinfo.Extra2; decId = Convert.ToInt32(sccmd.ExecuteScalar()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sqlcon.Close(); } return(decId); }
public bool ServiceCategoryAddSpecificFields(ServiceCategoryInfo servicecategoryinfo) { bool isSave = false; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ServiceCategoryAddSpecificFields", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam5 = new SqlParameter(); sprmparam5 = sccmd.Parameters.Add("@categoryName", SqlDbType.VarChar); sprmparam5.Value = servicecategoryinfo.CategoryName; sprmparam5 = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam5.Value = servicecategoryinfo.Narration; sprmparam5 = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam5.Value = servicecategoryinfo.Extra1; sprmparam5 = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam5.Value = servicecategoryinfo.Extra2; int inWork = sccmd.ExecuteNonQuery(); isSave = (inWork > 0 && true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { base.sqlcon.Close(); } return(isSave); }
public bool ServiceCategoryEditParticularFeilds(ServiceCategoryInfo servicecategoryinfo) { bool isEdit = false; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ServiceCategoryEditParticularFeilds", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam4 = new SqlParameter(); sprmparam4 = sccmd.Parameters.Add("@serviceCategoryId", SqlDbType.Decimal); sprmparam4.Value = servicecategoryinfo.ServicecategoryId; sprmparam4 = sccmd.Parameters.Add("@categoryName", SqlDbType.VarChar); sprmparam4.Value = servicecategoryinfo.CategoryName; sprmparam4 = sccmd.Parameters.Add("@narration", SqlDbType.VarChar); sprmparam4.Value = servicecategoryinfo.Narration; int inAffectedRows = sccmd.ExecuteNonQuery(); isEdit = (inAffectedRows > 0 && true); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { base.sqlcon.Close(); } return(isEdit); }
/// <summary> /// Function to check status for Update /// </summary> /// <param name="servicecategoryinfo"></param> /// <returns></returns> public bool ServiceCategoryEditParticularFeilds(ServiceCategoryInfo servicecategoryinfo) { bool isEdit = false; try { isEdit = spServiceCatogory.ServiceCategoryEditParticularFeilds(servicecategoryinfo); } catch (Exception ex) { MessageBox.Show("SC4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isEdit); }
/// <summary> /// Function to add values to ServiceCategory Table /// </summary> /// <param name="servicecategoryinfo"></param> /// <returns></returns> public decimal ServiceCategoryAddSpecificFields1(ServiceCategoryInfo servicecategoryinfo) { decimal decId = 0; try { decId = spServiceCatogory.ServiceCategoryAddSpecificFields1(servicecategoryinfo); } catch (Exception ex) { MessageBox.Show("SC3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(decId); }
/// <summary> /// Function to view details based on parameter /// </summary> /// <param name="decServiceCategoryId"></param> /// <returns></returns> public ServiceCategoryInfo ServiceCategoryWithNarrationView(decimal decServiceCategoryId) { ServiceCategoryInfo ServiceCategoryinfo = new ServiceCategoryInfo(); try { ServiceCategoryinfo = spServiceCatogory.ServiceCategoryWithNarrationView(decServiceCategoryId); } catch (Exception ex) { MessageBox.Show("SC7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(ServiceCategoryinfo); }
/// <summary> /// Function to fill controlls to edit or delete /// </summary> public void FillControls() { try { ServiceCategoryInfo infoServiceCategory = new ServiceCategoryInfo(); ServiceCategorySP spServiceCategory = new ServiceCategorySP(); infoServiceCategory = spServiceCategory.ServiceCategoryWithNarrationView(Convert.ToDecimal(dgvServiceCategory.CurrentRow.Cells[1].Value.ToString())); txtServiceCategory.Text = infoServiceCategory.CategoryName; txtNarration.Text = infoServiceCategory.Narration; btnSave.Text = "Update"; btnDelete.Enabled = true; strCategoryName = infoServiceCategory.CategoryName; decCategoryName = infoServiceCategory.ServicecategoryId; } catch (Exception ex) { MessageBox.Show("SC8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to edit a service category /// </summary> public void EditFunction() { try { ServiceCategoryInfo infoServiceCategory = new ServiceCategoryInfo(); ServiceCategorySP spServiceCategory = new ServiceCategorySP(); infoServiceCategory.CategoryName = txtServiceCategory.Text.Trim(); infoServiceCategory.Narration = txtNarration.Text.Trim(); infoServiceCategory.Extra1 = string.Empty; infoServiceCategory.Extra2 = string.Empty; infoServiceCategory.ServicecategoryId = Convert.ToDecimal(dgvServiceCategory.CurrentRow.Cells["dgvtxtservicecategoryId"].Value.ToString()); if (txtServiceCategory.Text.ToString() != strCategoryName) { if (spServiceCategory.ServiceCategoryCheckIfExist(txtServiceCategory.Text.Trim().ToString(), 0) == false) { if (spServiceCategory.ServiceCategoryEditParticularFeilds(infoServiceCategory)) { Messages.UpdatedMessage(); Clear(); } } else { Messages.InformationMessage("Service category name already exist"); txtServiceCategory.Focus(); } } else { spServiceCategory.ServiceCategoryEditParticularFeilds(infoServiceCategory); Messages.UpdatedMessage(); Clear(); } } catch (Exception ex) { MessageBox.Show("SC4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ServiceCategoryInfo ServiceCategoryView(decimal servicecategoryId) { ServiceCategoryInfo servicecategoryinfo = new ServiceCategoryInfo(); SqlDataReader sdrreader = null; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("ServiceCategoryView", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam2 = new SqlParameter(); sprmparam2 = sccmd.Parameters.Add("@servicecategoryId", SqlDbType.Decimal); sprmparam2.Value = servicecategoryId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { servicecategoryinfo.ServicecategoryId = Convert.ToDecimal(((DbDataReader)sdrreader)[0].ToString()); servicecategoryinfo.CategoryName = ((DbDataReader)sdrreader)[1].ToString(); servicecategoryinfo.Narration = ((DbDataReader)sdrreader)[2].ToString(); servicecategoryinfo.ExtraDate = Convert.ToDateTime(((DbDataReader)sdrreader)[3].ToString()); servicecategoryinfo.Extra1 = ((DbDataReader)sdrreader)[4].ToString(); servicecategoryinfo.Extra2 = ((DbDataReader)sdrreader)[5].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); base.sqlcon.Close(); } return(servicecategoryinfo); }
/// <summary> /// Function to save service category /// </summary> public void SaveFunction() { try { ServiceCategoryInfo infoServiceCategory = new ServiceCategoryInfo(); ServiceCategoryBll BllServiceCatogory = new ServiceCategoryBll(); infoServiceCategory.CategoryName = txtServiceCategory.Text.Trim(); infoServiceCategory.Narration = txtNarration.Text.Trim(); infoServiceCategory.Extra1 = string.Empty; infoServiceCategory.Extra2 = string.Empty; if (BllServiceCatogory.ServiceCategoryCheckIfExist(txtServiceCategory.Text.Trim().ToString(), 0) == false) { decId = BllServiceCatogory.ServiceCategoryAddSpecificFields1(infoServiceCategory); Messages.SavedMessage(); Clear(); } else { Messages.InformationMessage("Service category name already exist"); txtServiceCategory.Focus(); } } catch (Exception ex) { MessageBox.Show("SC3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill controlls to edit or delete /// </summary> public void FillControls() { try { ServiceCategoryInfo infoServiceCategory = new ServiceCategoryInfo(); ServiceCategoryBll BllServiceCatogory = new ServiceCategoryBll(); infoServiceCategory = BllServiceCatogory.ServiceCategoryWithNarrationView(Convert.ToDecimal(dgvServiceCategory.CurrentRow.Cells[1].Value.ToString())); txtServiceCategory.Text = infoServiceCategory.CategoryName; txtNarration.Text = infoServiceCategory.Narration; btnSave.Text = "Update"; btnDelete.Enabled = true; strCategoryName = infoServiceCategory.CategoryName; decCategoryName = infoServiceCategory.ServicecategoryId; } catch (Exception ex) { MessageBox.Show("SC8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to edit a service category /// </summary> public void EditFunction() { try { ServiceCategoryInfo infoServiceCategory = new ServiceCategoryInfo(); ServiceCategoryBll BllServiceCatogry = new ServiceCategoryBll(); infoServiceCategory.CategoryName = txtServiceCategory.Text.Trim(); infoServiceCategory.Narration = txtNarration.Text.Trim(); infoServiceCategory.Extra1 = string.Empty; infoServiceCategory.Extra2 = string.Empty; infoServiceCategory.ServicecategoryId = Convert.ToDecimal(dgvServiceCategory.CurrentRow.Cells["dgvtxtservicecategoryId"].Value.ToString()); if (txtServiceCategory.Text.ToString() != strCategoryName) { if (BllServiceCatogry.ServiceCategoryCheckIfExist(txtServiceCategory.Text.Trim().ToString(), 0) == false) { if (BllServiceCatogry.ServiceCategoryEditParticularFeilds(infoServiceCategory)) { Messages.UpdatedMessage(); Clear(); } } else { Messages.InformationMessage("Service category name already exist"); txtServiceCategory.Focus(); } } else { BllServiceCatogry.ServiceCategoryEditParticularFeilds(infoServiceCategory); Messages.UpdatedMessage(); Clear(); } } catch (Exception ex) { MessageBox.Show("SC4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }