protected void btnDeleteImage_Click(object sender, EventArgs e)
        {
            int ID = int.Parse(btnDeleteImage.CommandArgument.ToString());
            BLL.ReferenceCategories obj = new BLL.ReferenceCategories();
            obj.LoadByPrimaryKey(ID);
            obj.RefernceImagePath = "";
            obj.Save();

            pnlAddMode.Visible = true;
            pnlEditMode.Visible = false;
        }
        protected void GrdCtegories_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int ID = int.Parse(e.CommandArgument.ToString());
                BLL.ReferenceCategories obj = new BLL.ReferenceCategories();
                obj.LoadByPrimaryKey(ID);
                obj.MarkAsDeleted();
                obj.Save();

                LoadAllCategories();
            }
            else if (e.CommandName == "Edit")
            {
                Response.Redirect("ReferenceCategories.aspx?CatID=" + e.CommandArgument.ToString() );
            }
        }
        private void UpdateCtegory()
        {
            BLL.ReferenceCategories obj = new BLL.ReferenceCategories();
            obj.LoadByPrimaryKey(int.Parse(Request.QueryString["CatID"].ToString()));

            obj.CatNameEn = TxtName.Text;

            if (UploadImg.HasFile)
            {
                Bitmap UpImg = (Bitmap)Bitmap.FromStream(UploadImg.PostedFile.InputStream);
                string path = "UploadedFiles/ReferenceCategories/" + DateTime.Now.ToString("ddMMyyyyhhmmss") + UploadImg.FileName;
                UpImg.Save(MapPath(path), System.Drawing.Imaging.ImageFormat.Png);
                obj.RefernceImagePath = path;
            }

            obj.Save();
        }
        private void LoadCategoryForEdit(int catID)
        {
            BLL.ReferenceCategories obj = new BLL.ReferenceCategories();
            obj.LoadByPrimaryKey(catID);

            pnlAddMode.Visible = false;
            pnlEditMode.Visible = true;

            TxtName.Text = obj.CatNameEn;
            imgReferenceCategory.ImageUrl = obj.RefernceImagePath;
            btnDeleteImage.CommandArgument = catID.ToString();
        }