Exemplo n.º 1
0
 private void catagorySaveButton_Click(object sender, EventArgs e)
 {
     if (!Ch.IsMatch(catagoryTextBox.Text.Trim()))
     {
         cMessageBox.Warning("Invaild Input Detected");
     }
     else
     {
         CatagoryModel catagoryModel = new CatagoryModel();
         catagoryModel.Name = catagoryTextBox.Text.Trim();
         SetupGateway catagoryGateway = new SetupGateway();
         bool         isExist         = catagoryGateway.IsExists(catagoryModel);
         if (isExist == true)
         {
             cMessageBox.Information("Category Already Exist");
         }
         else
         {
             int rowAffect = catagoryGateway.SaveCatagory(catagoryModel);
             if (rowAffect > 0)
             {
                 cMessageBox.Success("Category Successfully Saved");
                 CatagorySetup_Load(sender, e);
             }
             else
             {
                 cMessageBox.Failed("Failed To Save Category, Try Again");
                 CatagorySetup_Load(sender, e);
             }
         }
     }
 }
Exemplo n.º 2
0
        private void CatagoryUpdateButton_Click(object sender, EventArgs e)
        {
            SetupGateway setupGateway = new SetupGateway();

            if (idhiddenLabel.Text.Trim() != String.Empty && Ch.IsMatch(catagoryTextBox.Text.Trim()))
            {
                CatagoryModel catagory = new CatagoryModel();
                catagory.Name = catagoryTextBox.Text.Trim();
                catagory.Id   = Convert.ToInt32(idhiddenLabel.Text);
                bool isExist = setupGateway.IsExists(catagory);
                if (isExist == true)
                {
                    cMessageBox.Information("Category Already Exist");
                }
                else
                {
                    int rowAffect = setupGateway.UpdateCatagory(catagory);
                    if (rowAffect > 0)
                    {
                        cMessageBox.Success("Category Updated");
                        CatagorySetup_Load(sender, e);
                    }
                    else
                    {
                        cMessageBox.Failed("Faild to Updated Category");
                        CatagorySetup_Load(sender, e);
                    }
                }
            }
        }