Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/whats_new.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oWhatsNew = new WhatsNew(intProfile, dsn);
     if (Request.QueryString["id"] == null)
     {
         panView.Visible = true;
         LoopRepeater();
     }
     else
     {
         panAdd.Visible = true;
         lngID          = Int32.Parse(Request.QueryString["id"]);
         if (!IsPostBack)
         {
             DataSet ds = oWhatsNew.Get(lngID);
             if (ds.Tables[0].Rows.Count > 0)
             {
                 txtTitle.Text       = ds.Tables[0].Rows[0]["title"].ToString();
                 txtDescription.Text = ds.Tables[0].Rows[0]["description"].ToString();
                 txtAttachment.Text  = ds.Tables[0].Rows[0]["attachment"].ToString();
                 txtVersion.Text     = ds.Tables[0].Rows[0]["Version"].ToString();
                 txtCategory.Text    = ds.Tables[0].Rows[0]["Category"].ToString();
                 chkEnabled.Checked  = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                 btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=WHATSNEW" + "',false,400,400);");
                 btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
             }
             else
             {
                 btnOrder.Enabled  = false;
                 btnDelete.Enabled = false;
             }
         }
     }
     btnBrowse.Attributes.Add("onclick", "return OpenWindow('FILEBROWSER','" + txtAttachment.ClientID + "','',false,400,600);");
 }