protected void uiButtonSearch_Click(object sender, EventArgs e)
 {
     BLL.VedioCategories objData = new VedioCategories();
     objData.SearchVedioCat(uiTextBoxSearch.Text);
     uiGridViewCategories.DataSource = objData.DefaultView;
     uiGridViewCategories.DataBind();
 }
 protected void uiGridViewCategories_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditCategory")
     {
         VedioCategories objData = new VedioCategories();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         uiTextBoxEnName.Text = objData.EnName;
         uiTextBoxArName.Text = objData.ArName;
         uiTextBoxEnDesc.Text = objData.EnDescription;
         uiTextBoxArDesc.Text = objData.ArDescription;
         uiPanelViewCategories.Visible = false;
         uiPanelEdit.Visible = true;
         CurrentCategory = objData;
     }
     else if (e.CommandName == "DeleteCategory")
     {
         VedioCategories objData = new VedioCategories();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         CurrentCategory = null;
         BindData();
     }
 }
 private void BindData()
 {
     BLL.VedioCategories objData = new VedioCategories();
     objData.LoadAll();
     uiGridViewCategories.DataSource = objData.DefaultView;
     uiGridViewCategories.DataBind();
 }
 private void AddNewRecord()
 {
     VedioCategories objData = new VedioCategories();
     objData.AddNew();
     objData.EnName = uiTextBoxEnName.Text;
     objData.ArName = uiTextBoxArName.Text;
     objData.EnDescription = uiTextBoxEnDesc.Text;
     objData.ArDescription = uiTextBoxArDesc.Text;
     string filepath = "";
     if (uiFileUploadLogoPath.HasFile)
     {
         uiFileUploadLogoPath.SaveAs(Server.MapPath("~/FileUploads/VedioCategories" + "/" + uiFileUploadLogoPath.FileName));
         filepath = "/Fileuploads/VedioCategories" + "/" + uiFileUploadLogoPath.FileName;
     }
     if (!string.IsNullOrEmpty(filepath))
     {
         objData.IconPath = filepath;
     }
     objData.Save();
 }
 private void LoadDDLs()
 {
     VedioCategories objData = new VedioCategories();
     objData.LoadAll();
     uiDropDownListAllCategories.DataSource = objData.DefaultView;
     uiDropDownListAllCategories.DataTextField = "ArName";
     uiDropDownListAllCategories.DataValueField = "CategoryID";
     uiDropDownListAllCategories.DataBind();
     uiDropDownListAllCategories.SelectedIndex = 0;
 }
 protected void uiGridViewSubCategories_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DataRowView row = (DataRowView)e.Row.DataItem;
         VedioCategories objData = new VedioCategories();
         objData.LoadByPrimaryKey(Convert.ToInt32(row["CategoryID"].ToString()));
         Label l = (Label)e.Row.FindControl("uiLabelCategoryName");
         l.Text = objData.ArName;
     }
 }