Beispiel #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);
     }
 }
        /// <summary>
        /// Function to check existence of service category based on parameter
        /// </summary>
        /// <param name="strCategoryName"></param>
        /// <param name="decServiceCategoryId"></param>
        /// <returns></returns>
        public bool ServiceCategoryCheckIfExist(String strCategoryName, decimal decServiceCategoryId)
        {
            bool inChek = false;

            try
            {
                inChek = spServiceCatogory.ServiceCategoryCheckIfExist(strCategoryName, decServiceCategoryId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("SC2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(inChek);
        }
Beispiel #3
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);
     }
 }