示例#1
0
 private void Save()
 {
     try
     {
         if (SaveButtonIsEnable == false)
         {
             return;
         }
         if (!CategoryModel.Category.IsNotNullOrEmpty())
         {
             ShowInformationMessage(PDMsg.NotEmpty("Category"));
             FocusButton = true;
             return;
         }
         else if (!categoryBll.CategoryAddDuplicate(CategoryModel))
         {
             ShowInformationMessage(PDMsg.AlreadyExists("Category"));
             FocusButton = true;
             return;
         }
         //else if (!categoryBll.CategoryEditDuplicate(CategoryModel) && EditButtonIsEnable == false)
         //{
         //    ShowInformationMessage(PDMsg.AlreadyExists("Category"));
         //    FocusButton = true;
         //    return;
         //}
         string mode = "";
         CategoryModel.Active = (Active) ? false : true;
         //Progress.Start();
         if (categoryBll.AddEditCategory(CategoryModel, ref mode))
         {
             if (mode == "Add")
             {
                 //Progress.End();
                 ShowInformationMessage(PDMsg.SavedSuccessfully);
                 FocusButton = true;
             }
             else
             {
                 Progress.End();
                 ShowInformationMessage(PDMsg.UpdatedSuccessfully);
                 FocusButton = true;
             }
             CategoryModel.Category = string.Empty;
             ApplicationFocus       = true;
             //Add();
         }
     }
     catch (Exception e)
     {
         throw e.LogException();
     }
 }