Ejemplo n.º 1
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtCategoryname.Text) || string.IsNullOrEmpty(cboCategoryFrom.Text))
     {
         MessageBox.Show("Information Required", "Warning");
         txtCategoryname.Focus();
     }
     else
     {
         try
         {
             Category category = new Category
             {
                 CategoryId          = categoryId,
                 CategoryName        = txtCategoryname.Text,
                 CategoryDescription = txtDescription.Text,
                 ProductFromId       = int.Parse(cboCategoryFrom.SelectedValue.ToString())
             };
             CategoyBLL.InsertCategory(category);
             MessageBox.Show("Add Successful", "Warning");
         }
         catch (Exception ex)
         {
             MessageBox.Show("Add Fail", "Warning");
         }
         LoadCategory();
         txtCategoryname.Text = string.Empty;
         txtDescription.Text  = string.Empty;
     }
 }
Ejemplo n.º 2
0
    protected void lnkBtnSave_Click(object sender, EventArgs e)
    {
        string name = CategoryName.Text.Trim();

        if (BLLCategory.checkCategoryExistName(name) != 0)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Notify", "alert('!!!Category Name existed. Please try again');", true);
        }
        else
        {
            Category cat = new Category();
            cat.CategoryName = name;
            cat.Status       = true;
            BLLCategory.InsertCategory(cat);
            Response.Redirect("CategoryList.aspx");
        }
    }