using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class etwuser_IsTop : System.Web.UI.Page
{
    public string id = string.Empty;
    public string state = string.Empty;
    public string username = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie ChatCookie = Request.Cookies["cookChatuser"];
        HttpCookie GetCookie = Request.Cookies["cookEtwuser"];
        if (Request.Cookies["cookChatuser"] == null)
        {
            if (Request.Cookies["cookEtwuser"] == null)
            {
                Response.Redirect("../index.aspx");
            }
            else
            {
                username = GetCookie["username"];
            }
        }
        else
        {
            username = ChatCookie["username"];
        }
        DataSet dss = DbHelperSQL.Query("select * from etw_user where username='" + username + "'");
         if (dss.Tables[0].Rows.Count > 0)
         {
             id = Request.Params["id"];
             state = Request.Params["state"];
             string[] strid = id.Split(new char[] { ',' });
             for (int i = 0; i < strid.Length; i++)
             {
                 if (strid[i] != "")
                 {
                     etw.etw_onlines lead = new etw.etw_onlines();
                     lead.id = Convert.ToInt32(strid[i]);
                     lead.biaoji = Convert.ToInt32(state);
                     lead.UpTop();
                     //DataSet ds = DbHelperSQL.Query("select * from etw_biaoji where online_id=" + strid[i] + "");
                     //etw.etw_biaoji lead = new etw.etw_biaoji();
                     //lead.istop = Convert.ToInt32(state);
                     //if (ds.Tables[0].Rows.Count > 0)
                     //{
                     //    lead.id = Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString());
                     //    lead.online_id = Convert.ToInt32(ds.Tables[0].Rows[0]["online_id"].ToString());
                     //    lead.usernameid = Convert.ToInt32(ds.Tables[0].Rows[0]["usernameid"].ToString());
                     //    lead.tran_id = Convert.ToInt32(ds.Tables[0].Rows[0]["tran_id"].ToString());
                     //    lead.is_tran = Convert.ToInt32(ds.Tables[0].Rows[0]["is_tran"].ToString());
                     //    lead.color = ds.Tables[0].Rows[0]["color"].ToString();
                     //    lead.flag = ds.Tables[0].Rows[0]["flag"].ToString();
                     //    lead.priority = Convert.ToInt32(ds.Tables[0].Rows[0]["priority"].ToString());
                     //    lead.Update();
                     //}
                     //else
                     //{
                     //    lead.online_id = Convert.ToInt32(strid[i]);
                     //    lead.usernameid = Convert.ToInt32(dss.Tables[0].Rows[0]["userid"].ToString());
                     //    lead.Add();
                     //}
                 }
             }
         }
    }
}
