protected void uiLinkButtonAdd_Click(object sender, EventArgs e)
 {
     uiPanelViewAllPages.Visible = false;
     uiPanelEdit.Visible = true;
     Clearfields();
     CurrentRequest = null;
 }
 protected void uiGridViewNews_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditNews")
     {
         UserRequests objData = new UserRequests();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         CurrentRequest = objData;
         uiTextBoxArTitle.Text = objData.RequestTitle;
         uiHyperLinkFile.Visible = true;
         if (!string.IsNullOrEmpty(objData.RequestFile))
             uiHyperLinkFile.NavigateUrl = objData.RequestFile;
         else
             uiHyperLinkFile.Visible = false;
         uiFCKeditorContent.Value = Server.HtmlDecode(objData.RequestDetails);
         uiFckeditorReply.Value = Server.HtmlDecode(objData.AdminResponse);
         uiPanelViewAllPages.Visible = false;
         uiPanelEdit.Visible = true;
     }
     else if (e.CommandName == "DeleteNews")
     {
         UserRequests objData = new UserRequests();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         BindData();
     }
 }
 private void BindData()
 {
     UserRequests objData = new UserRequests();
     SiteUsers user = new SiteUsers();
     user = (SiteUsers)Session["CurrentUser"];
     objData.GetRequesetsByUserID(user.ID);
     uiGridViewNews.DataSource = objData.DefaultView;
     uiGridViewNews.DataBind();
 }
 protected void uiLinkButtonUpdate_Click(object sender, EventArgs e)
 {
     UserRequests objData = new UserRequests();
     if (CurrentRequest != null)
         objData = CurrentRequest;
     else
     {
         objData.AddNew();
     }
     objData.RequestTitle = uiTextBoxArTitle.Text;
     objData.RequestDetails = Server.HtmlEncode(uiFCKeditorContent.Value);
     if (uiFileUploadRequest.HasFile)
     {
         uiFileUploadRequest.SaveAs(Server.MapPath("~/Userfiles/UserRequests/") + uiFileUploadRequest.FileName);
         objData.RequestFile = "/Userfiles/UserRequests/" + uiFileUploadRequest.FileName;
     }
     objData.SiteUserID = CurrentUser.ID;
     objData.Save();
     CurrentRequest = null;
     uiPanelViewAllPages.Visible = true;
     uiPanelEdit.Visible = false;
     BindData();
 }
 protected void uiLinkButtonUpdate_Click(object sender, EventArgs e)
 {
     UserRequests objData = new UserRequests();
     if (CurrentRequest != null)
         objData = CurrentRequest;
     if (!string.IsNullOrEmpty(uiFckeditorReply.Value))
     {
         objData.AdminResponse = Server.HtmlEncode(uiFckeditorReply.Value);
         objData.IsAnswered = true;
     }
     objData.Save();
     CurrentRequest = null;
     uiPanelViewAllPages.Visible = true;
     uiPanelEdit.Visible = false;
     BindData();
 }
 private void BindData()
 {
     UserRequests objData = new UserRequests();
     objData.LoadAll();
     uiGridViewNews.DataSource = objData.DefaultView;
     uiGridViewNews.DataBind();
 }