示例#1
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);
     }
 }
        /// <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);
        }