protected void ui_save_button_Click(object sender, EventArgs e)
        {
            StationeryController sationeryController = new StationeryController();

            StationeryCategory category = new StationeryCategory();
            int category_id;

            //getting hidden field id
            if (int.TryParse(ui_id_hiddenfield.Value, out category_id))
            {
                category.id = Convert.ToInt32(ui_id_hiddenfield.Value);
            }

            //fields validation
            if (String.IsNullOrEmpty(ui_catname_textbox.Text))
            {
                Response.Cookies.Add(new HttpCookie("flash_message", "Field(s) marked with * can't be empty.") { Path = "/" });
                Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-error") { Path = "/" });
                return;
                //String idstring = (supplier.id > 0) ? ("?id="+supplier.id) : ("");
                //Response.Redirect("~/StoreClerk/SupplierDetail.aspx"+idstring);
            }

            //setting up object
            category.category_name = ui_catname_textbox.Text;

            //updating db;
            Message message;
            if (category.id > 0)
            {
                message = sationeryController.actionUpdateStationeryCategory(category);
            }
            else
            {
                message = sationeryController.actionCreateStationeryCategory(category);
            }

            //redirecting
            if (message.condition)
            {
                Response.Cookies.Add(new HttpCookie("flash_message", "Successfully Saved.") { Path = "/" });
                Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-success") { Path = "/" });
                Response.Redirect("~/StoreClerk/CategoryDetail.aspx?id=" + category.id);
            }
            else
            {
                Response.Cookies.Add(new HttpCookie("flash_message", message.message) { Path = "/" });
                Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-error") { Path = "/" });
                Response.Redirect("~/StoreClerk/CategoryDetail.aspx?id=" + category.id);
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the StationeryCategories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToStationeryCategories(StationeryCategory stationeryCategory)
 {
     base.AddObject("StationeryCategories", stationeryCategory);
 }
 /// <summary>
 /// Create a new StationeryCategory object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="category_name">Initial value of the category_name property.</param>
 public static StationeryCategory CreateStationeryCategory(global::System.Int32 id, global::System.String category_name)
 {
     StationeryCategory stationeryCategory = new StationeryCategory();
     stationeryCategory.id = id;
     stationeryCategory.category_name = category_name;
     return stationeryCategory;
 }