예제 #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)
     {
         MessageBox.Show("SC3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #2
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)
     {
         MessageBox.Show("SC4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }