Example #1
0
 /// <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)
     {
         formMDI.infoError.ErrorString = "SC3" + ex.Message;
     }
 }
Example #2
0
 /// <summary>
 /// Function to fill saved servicecategories in the grid
 /// </summary>
 public void Gridfill()
 {
     try
     {
         DataTable         dtblServiceCategory = new DataTable();
         ServiceCategorySP spServiceCategory   = new ServiceCategorySP();
         dtblServiceCategory           = spServiceCategory.ServiceCategoryParticularFieldsViewAll();
         dgvServiceCategory.DataSource = dtblServiceCategory;
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SC2" + ex.Message;
     }
 }
Example #3
0
 /// <summary>
 /// Category ComboFill Function
 /// </summary>
 public void CategoryComboFill()
 {
     try
     {
         ServiceCategorySP spServiceCatogery   = new ServiceCategorySP();
         DataTable         dtblServiceCatogery = new DataTable();
         dtblServiceCatogery       = spServiceCatogery.ServiceCategoryViewAll();
         cmbCategory.DataSource    = dtblServiceCatogery;
         cmbCategory.ValueMember   = "serviceCategoryId";
         cmbCategory.DisplayMember = "categoryName";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "Ser1:" + ex.Message;
     }
 }
Example #4
0
 /// <summary>
 /// Category Search combo fill
 /// </summary>
 public void CategorySearchFill()
 {
     try
     {
         ServiceCategorySP spServiceCatogery   = new ServiceCategorySP();
         DataTable         dtblServiceCatogery = new DataTable();
         dtblServiceCatogery = spServiceCatogery.ServiceCategoryViewAll();
         DataRow dr = dtblServiceCatogery.NewRow();
         dr[1] = "All";
         dtblServiceCatogery.Rows.InsertAt(dr, 0);
         cmbCategorySearch.DataSource    = dtblServiceCatogery;
         cmbCategorySearch.ValueMember   = "serviceCategoryId";
         cmbCategorySearch.DisplayMember = "categoryName";
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "Ser3:" + ex.Message;
     }
 }
Example #5
0
 /// <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)
     {
         formMDI.infoError.ErrorString = "SC8" + ex.Message;
     }
 }
Example #6
0
 /// <summary>
 /// Function to delete a servicecategory
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         ServiceCategorySP spServiceCategory = new ServiceCategorySP();
         if (spServiceCategory.ServiceCategoryCheckReferenceAndDelete(decCategoryName) == -1)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             spServiceCategory.ServiceCategoryDelete(Convert.ToDecimal(dgvServiceCategory.CurrentRow.Cells[1].Value.ToString()));
             Messages.DeletedMessage();
             Clear();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "SC6" + ex.Message;
     }
 }
Example #7
0
 /// <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)
     {
         formMDI.infoError.ErrorString = "SC4" + ex.Message;
     }
 }