Esempio n. 1
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);
                    }
                }
            }
        }