login() public method

public login ( )
コード例 #1
0
ファイル: header.ascx.cs プロジェクト: xiaomincui/100allin
 protected void Page_Load(object sender, EventArgs e)
 {
     login lg = new login();
     lg.login();
 }
コード例 #2
0
ファイル: lcl_order.aspx.cs プロジェクト: xiaomincui/100allin
    protected void Page_Load(object sender, EventArgs e)
    {
        login l = new login();
        l.login();

        ltrLoginName.Text = Server.UrlDecode(GetRequest1.GetRequestCookies("Realname", ""));

        ltrBasicOrderCode.Text = GetRequest1.GetRequestQueryString("orderid", "0");

        if (!Page.IsPostBack)
        {
            phEditDisabled.Visible = false;
            phEditEnabled.Visible = false;

            switch (GetRequest1.GetRequestQueryString("filter", "0"))
            {
                case "new":
                    PlaceHolder2.Visible = true;//确认订舱的按钮
                    PlaceHolder1.Visible = false;//接受订舱的按钮
                    PlaceHolder5.Visible = false;//保存订舱单的按钮
                    PlaceHolder6.Visible = false;//弹出窗口内修改订舱单后保存的按钮
                    PlaceHolder7.Visible = true;//弹出窗口内提交定舱单的按钮
                    phOrderView.Visible = false;
                    phOrderView1.Visible = false;
                    phOrderNew.Visible = true;
                    phOrderNew1.Visible = true;
                    PlaceHolder3.Visible = true;
                    LoadNewOrder();
                    break;
                case "view":
                    PlaceHolder1.Visible = true;
                    PlaceHolder2.Visible = false;
                    PlaceHolder5.Visible = false;
                    PlaceHolder6.Visible = false;
                    PlaceHolder7.Visible = true;
                    phOrderView.Visible = true;
                    phOrderView1.Visible = true;
                    phOrderNew.Visible = false;
                    phOrderNew1.Visible = false;
                    LoadSavedOrder();
                    break;
                case "edit":
                    PlaceHolder1.Visible = false;
                    PlaceHolder2.Visible = false;
                    PlaceHolder5.Visible = true;
                    PlaceHolder6.Visible = true;
                    PlaceHolder7.Visible = false;
                    phOrderView.Visible = false;
                    phOrderView1.Visible = false;
                    phOrderNew.Visible = true;
                    phOrderNew1.Visible = true;
                    LoadEditOrder();
                    break;
                default:
                    Response.Redirect("/search/err.aspx");
                    break;
            }

            switch (GetRequest1.GetRequestQueryString("role", "0"))
            {
                case "shipper":
                    PlaceHolder1.Visible = false;//接受订舱的按钮
                    break;
                case "forward":
                    break;
                default:
                    break;
            }
        }
    }
コード例 #3
0
ファイル: list.aspx.cs プロジェクト: xiaomincui/100allin
    protected void Page_Load(object sender, EventArgs e)
    {
        login lg = new login();
        lg.login();

        LoadPageBase();
        LoadListData();
    }
コード例 #4
0
ファイル: addfriend.aspx.cs プロジェクト: xiaomincui/100allin
    protected void Page_Load(object sender, EventArgs e)
    {
        login lg = new login();
        lg.login();
        order order1 = new order();
        check ck = new check();
        string u = ck.CheckNumber(order1.GetRequestQueryString("u", "0"));
        string myu = ck.CheckNumber(order1.GetRequestCookies("user_id", ""));

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();

        string sql = "SELECT * FROM TB_USER WHERE userid = " + u;

        ds = cn.mdb_ds(sql, "user");

        Label1.Text = ds.Tables["user"].Rows[0]["companyname"].ToString();
        Label9.Text = ds.Tables["user"].Rows[0]["postnumber"].ToString();
        Label11.Text = ds.Tables["user"].Rows[0]["address"].ToString();

        Label4.Text = "<span><a href=\"/company/" + setkey(u) + "\" style='font-size:14px; font-weight:bold; color:#FF6600;' target=\"_blank\">" + ds.Tables["user"].Rows[0]["realname"].ToString() + "</a></span>";
        Literal25.Text = "<a href=\"/member/pm_detail.aspx?pid=1&cid=" + u + "\" target=\"_blank\"><img src=\"/images/fcl/bot_1.jpg\"  border=\"0\" style= 'margin-top: 12px;'/></a>";

        if ((bool)ds.Tables["user"].Rows[0]["HeadURL"] == true)
        {
            imghead.Src = "/member/Head/" + ds.Tables["user"].Rows[0]["UserID"].ToString() + ".jpg";
        }
        else
        {
            imghead.Src = "/member/Head/default.jpg";
        }

        LtrStars1.Text = Star1(ds.Tables["user"].Rows[0]["star_allin"].ToString());
        LtrStars2.Text = Star2(ds.Tables["user"].Rows[0]["star_user"].ToString());

        try
        {
            ImageButton1.ImageUrl = "/images/get/company_tel.aspx?u=" + setkey(u);
            ImageButton3.ImageUrl = "/images/get/company_email.aspx?u=" + setkey(u);
            ImageButton4.ImageUrl = "/images/get/company_mobile.aspx?u=" + setkey(u);
        }
        catch
        {

        }

        AllinUser AllinUser1 = new AllinUser();

        mysqldata_conn mycn = new mysqldata_conn();
        sql = "SELECT uid FROM uc_friends WHERE uid = " + AllinUser1.GetUserDetail(myu)[10] + " AND friendid = " + ds.Tables["user"].Rows[0]["UCenterHomeUid"].ToString();
        //Response.Write(sql);
        DataSet dsu = new DataSet();
        dsu = mycn.mdb_ds(sql, "ufriend");

        if (dsu.Tables["ufriend"].Rows.Count > 0)
        {
            ImageButton2.Visible = false;
            Label2.Visible = true;
        }
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        login l = new login();
        l.login();

        ltrLoginName.Text = GetRequestCookies("user_name", "");

        if (!Page.IsPostBack)
        {
            switch (GetRequestQueryString("filter", "0"))
            {
                case "new":
                    PlaceHolder2.Visible = true;
                    PlaceHolder1.Visible = false;
                    PlaceHolder5.Visible = false;
                    PlaceHolder6.Visible = false;
                    PlaceHolder7.Visible = true;
                    PlaceHolder3.Visible = true;
                    LoadNewOrder();
                    break;
                case "view":
                    PlaceHolder1.Visible = true;
                    PlaceHolder2.Visible = false;
                    PlaceHolder5.Visible = false;
                    PlaceHolder6.Visible = false;
                    PlaceHolder7.Visible = true;
                    LoadSavedOrder();
                    break;
                case "edit":
                    PlaceHolder1.Visible = false;
                    PlaceHolder2.Visible = false;
                    PlaceHolder5.Visible = true;
                    PlaceHolder6.Visible = true;
                    PlaceHolder7.Visible = false;
                    LoadEditOrder();
                    break;
                default:
                    Response.Redirect("/search/err.aspx");
                    break;
            }
        }
    }
コード例 #6
0
ファイル: new.aspx.cs プロジェクト: xiaomincui/100allin
    protected void Page_Load(object sender, EventArgs e)
    {
        login lg = new login();
        lg.login();

        Random rd = new Random();

        ltrGongZuoBianHao.Text = "FCL" + DateTime.Now.ToString("yyMMddHHmm") + GetFourDigits(Convert.ToInt32(10000 * rd.NextDouble()).ToString());

        LoadFreightData();
    }
コード例 #7
0
ファイル: index.aspx.cs プロジェクト: xiaomincui/100allin
    protected void Page_Load(object sender, EventArgs e)
    {
        login lg = new login();
        lg.login();

        check ck = new check();
        string u = "0";

        u = ck.CheckNumber(GetRequestCookies("user_id", "0"));

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();

        string sql = "";

        sql = "SELECT Fax,MovePhone,Usermsn,Userqq,Address,PostNumber,introduction,Realname FROM TB_User WHERE userid = " + u;

        ds = cn.mdb_ds(sql, "tb_user");

        //显示名字和头像
        ltrMyName.Text = ds.Tables["tb_user"].Rows[0]["Realname"].ToString();

        //Response.Write(Server.MapPath("/member/head/") + u + ".jpg");
        if (System.IO.File.Exists(Server.MapPath("/member/head/") + u + ".jpg") == true)
        {
            ltrHead.Text = u;
        }
        else
        {
            ltrHead.Text = "default";
        }

        //显示资料完整度
        int infopercent = 0;

        if (ds.Tables["tb_user"].Rows[0]["Fax"].ToString() != "")
        {
            infopercent += 20;
        }

        if (ds.Tables["tb_user"].Rows[0]["MovePhone"].ToString() != "")
        {
            infopercent += 20;
        }

        if (ds.Tables["tb_user"].Rows[0]["Usermsn"].ToString() != "")
        {
            infopercent += 10;
        }

        if (ds.Tables["tb_user"].Rows[0]["Userqq"].ToString() != "")
        {
            infopercent += 10;
        }

        if (ds.Tables["tb_user"].Rows[0]["Address"].ToString() != "")
        {
            infopercent += 20;
        }

        if (ds.Tables["tb_user"].Rows[0]["PostNumber"].ToString() != "")
        {
            infopercent += 10;
        }

        if (ds.Tables["tb_user"].Rows[0]["introduction"].ToString() != "")
        {
            infopercent += 10;
        }

        ltrPercent.Text = infopercent.ToString();

        ltrPercentLength.Text = "<img src=\"images/tt.gif\" width=\"" + (infopercent*200/100).ToString() +"\" height=\"10\" />";

        ltrPreviewCompany.Text = "<a href=\"/company/" + setkey(u) + "/\" target=\"_blank\"><strong>预览</strong></a>";

        //显示未读消息
        sql = "select count(mid) as count from TB_PM where readed = 0 and listener = " + u;

        ds = cn.mdb_ds(sql, "tb_pm");

        ltrNewMessage.Text = ds.Tables["tb_pm"].Rows[0]["count"].ToString();

        //sql = "select count(oid) as count from TB_ORDER where (order_status = 2 or order_status = 4) and order_forward = " + u;

        //ds = cn.mdb_ds(sql, "TB_ORDER");

        //ltrNewBooking.Text = ds.Tables["TB_ORDER"].Rows[0]["count"].ToString();

        //sql = "select credit,overage from TB_ORDER_ACCOUNT where userid = " + u;

        //ds = cn.mdb_ds(sql, "TB_ORDER_ACCOUNT");

        //ltrOverage.Text = ds.Tables["TB_ORDER_ACCOUNT"].Rows[0]["overage"].ToString() + " / " + ds.Tables["TB_ORDER_ACCOUNT"].Rows[0]["credit"].ToString();

        ltrOverageTips.Text = "<a href=\"/member/order/pay_sel.aspx\">立即预存</a>";

        //if (Convert.ToDouble(ds.Tables["TB_ORDER_ACCOUNT"].Rows[0]["overage"].ToString()) < 1000)
        //{
        //    ltrOverageTips.Text = "您的订舱费余额已不多,提醒您<a href=\"/member/order/pay_sel.aspx\">立即预存</a>";
        //}

        //if (Convert.ToDouble(ds.Tables["TB_ORDER_ACCOUNT"].Rows[0]["credit"].ToString()) == 0)
        //{
        //    ltrOverageTips.Text = "还不是安运通会员?提醒您<a href=\"/member/order/pay_sel.aspx\">立即预存</a>";
        //}

        sql = "";

        sql = "SELECT UCenterHomeUid FROM TB_User WHERE userid = " + u;

        //Response.Write(sql);

        ds = cn.mdb_ds(sql, "tb_user");

        string uid = "0";

        uid = ds.Tables["tb_user"].Rows[0][0].ToString();

        if (uid == "")
        {
            uid = "0";
        }

        //mysqldata_conn mysqlcn = new mysqldata_conn();

        ////以下为获得“我的好友”
        //sql = "SELECT friendid FROM uc_friends WHERE uid = " + uid;

        //ds = mysqlcn.mdb_ds(sql, "uc_friends");

        //string uidlist = "0,";

        //for (int i = 0; i < ds.Tables["uc_friends"].Rows.Count; i++)
        //{
        //    if (uid != "")
        //    {
        //        uidlist += ds.Tables["uc_friends"].Rows[i][0].ToString() + ",";
        //    }
        //}

        //uidlist += "0";

        //sql = "SELECT TOP 4 * FROM V_SHOW_ALL WHERE UCenterHomeUid in (" + uidlist + ") ORDER BY POSTDATE DESC";

        //ds = cn.mdb_ds(sql, "myfriends");

        //Repeater1.DataSource = ds.Tables["myfriends"].DefaultView;
        //Repeater1.DataBind();

        //sql = "SELECT TOP 4 * FROM V_SHOW_ALL WHERE userid = " + u + " ORDER BY POSTDATE DESC";

        //ds = cn.mdb_ds(sql, "mydongtai");

        //Repeater2.DataSource = ds.Tables["mydongtai"].DefaultView;
        //Repeater2.DataBind();

        //string[] udetail;
        //udetail = AllinUser1.GetUserDetail(u);

        //if (udetail[11] == "0")
        //{
        //    PlaceHolder2.Visible = true;
        //}
        //else
        //{
        //    PlaceHolder2.Visible = false;
        //}
        PlaceHolder2.Visible = false;

        PlaceHolder3.Visible = false;

        //string[][] fn=new string[8][];

        //fn[0] = new string[] { "宁波市", "宁波港---美加线", "1400", "<a href=\"http://www.100allin.com/topic/supplier20101122/ningbo.aspx\" target=\"_blank\">http://www.100allin.com/topic/supplier20101122/ningbo.aspx</a>" };
        //fn[1] = new string[] { "大连市", "大连港---日韩线", "1000", "<a href=\"http://www.100allin.com/topic/supplier20101122/dalian.aspx\" target=\"_blank\">http://www.100allin.com/topic/supplier20101122/dalian.aspx</a>" };
        //fn[2] = new string[] { "厦门市", "厦门港---美加线", "1200", "<a href=\"http://www.100allin.com/topic/supplier20101122/xiamen.aspx\" target=\"_blank\">http://www.100allin.com/topic/supplier20101122/xiamen.aspx</a>" };
        //fn[3] = new string[] { "广州市", "广州港---中东印巴线", "1000", "<a href=\"http://www.100allin.com/topic/supplier20101122/guangzhou.aspx\" target=\"_blank\">http://www.100allin.com/topic/supplier20101122/guangzhou.aspx</a>" };
        //fn[4] = new string[] { "青岛市", "青岛港---中南美线", "1000", "<a href=\"http://www.100allin.com/topic/supplier20101122/qingdao.aspx\" target=\"_blank\">http://www.100allin.com/topic/supplier20101122/qingdao.aspx</a>" };
        //fn[5] = new string[] { "天津市", "天津港---中南美线", "1200", "<a href=\"http://www.100allin.com/topic/supplier20101122/tianjin.aspx\" target=\"_blank\">http://www.100allin.com/topic/supplier20101122/tianjin.aspx</a>" };
        //fn[6] = new string[] { "深圳市", "深圳港---美加线", "2400", "<a href=\"http://www.100allin.com/topic/supplier20101122/shenzhen.aspx\" target=\"_blank\">http://www.100allin.com/topic/supplier20101122/shenzhen.aspx</a>" };
        //fn[7] = new string[] { "上海市", "上海港---澳洲线", "1500", "<a href=\"http://www.100allin.com/topic/supplier20101122/shanghai.aspx\" target=\"_blank\">http://www.100allin.com/topic/supplier20101122/shanghai.aspx</a>" };

        //for (int i = 0; i <= 7; i++)
        //{
        //    if (udetail[62] == fn[i][0])
        //    {
        //        PlaceHolder3.Visible = true;
        //        Literal0.Text = fn[i][0].Replace("市","");
        //        Literal1.Text = fn[i][1];
        //        Literal2.Text = fn[i][2];
        //        Literal3.Text = fn[i][3];
        //    }
        //}
    }
コード例 #8
0
ファイル: friend.aspx.cs プロジェクト: xiaomincui/100allin
    protected void Page_Load(object sender, EventArgs e)
    {
        login login1 = new login();
        login1.login();

        check check1 = new check();
        GetRequest GetRequest1 = new GetRequest();
        string p = "";
        p = check1.CheckNumber(GetRequest1.GetRequestQueryString("p", "1"));

        string u = "";
        u = check1.CheckNumber(GetRequest1.GetRequestCookies("user_id", "0"));

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();
        string sql = "";

        sql = "SELECT UCenterHomeUid FROM TB_User WHERE userid = " + u;

        //Response.Write(sql);

        ds = cn.mdb_ds(sql, "tb_user");

        string uid = "0";

        uid = ds.Tables["tb_user"].Rows[0][0].ToString();

        mysqldata_conn mysqlcn = new mysqldata_conn();

        //以下为获得“我的好友”
        sql = "SELECT friendid FROM uc_friends WHERE uid = " + uid;

        ds = mysqlcn.mdb_ds(sql, "uc_friends");

        //ltrMyFriendCount.Text = ds.Tables["uc_friends"].Rows.Count.ToString();

        string uidlist = "";

        for (int i = 0; i < ds.Tables["uc_friends"].Rows.Count; i++)
        {
            if (uid != "")
            {
                uidlist += ds.Tables["uc_friends"].Rows[i][0].ToString() + ",";
            }

        }

        uidlist += "0";

        sql = "SELECT * FROM TB_User WHERE UCenterHomeUid in (" + uidlist + ") ORDER BY USERID";

        ds = cn.mdb_ds(sql, "myfriends");

        int item = 0;
        item = (Convert.ToInt32(p) - 1) * 10;

        sql = "SELECT TOP 10 * ";
        sql += "FROM (SELECT * FROM V_REPASTE_INDEX) AS T WHERE uhomeid2 in (" + uidlist + ") AND rid NOT IN ";
        sql += "(SELECT TOP " + item.ToString() + " rid FROM V_REPASTE_INDEX WHERE uhomeid2 in (" + uidlist + ") ORDER BY rid DESC) ORDER BY rid DESC";

        //Response.Write(sql);
        ds = cn.mdb_ds(sql, "repaste");
        Repeater1.DataSource = ds.Tables["repaste"].DefaultView;
        Repeater1.DataBind();

        sql = "SELECT rid as c FROM V_REPASTE_INDEX WHERE uhomeid2 in (" + uidlist + ")";
        ds = cn.mdb_ds(sql, "repaste");

        string base_url = "friend.aspx?p=";

        string end_url = "";

        int cp = Convert.ToInt32(p);
        int tp = 1;
        int count = 0;
        count = ds.Tables["repaste"].Rows.Count;

        if (count % 10 > 0 || count == 0)
        {
            tp = count / 10 + 1;
        }
        else
        {
            tp = count / 10;
        }

        string s = "";
        if (cp == 1)
        {
            //s = s + " <span class=\"selected2\">首页</span> ";
            //s = s + " <span class=\"selected2\">上一页</span> ";
            s = s + " <span class=\"selected2\">1</span> ";
            for (int i = 2; i <= (tp < 10 ? tp : 10); i++)
            {
                s = s + " <a href=\"" + base_url + "" + i + end_url + "\"><span>" + i + "</span></a> ";
            }
        }
        else
        {
            s = s + " <a href=\"" + base_url + "1" + end_url + "\"><span>首页</span></a> ";
            s = s + " <a href=\"" + base_url + (cp - 1) + end_url + "\"><span>上一页</span></a> ";
            for (int i = (cp <= 5 ? 1 : (tp - cp < 5 ? (tp - 9 < 1 ? 1 : tp - 9) : cp - 4)); i <= cp - 1; i++)
            {
                s = s + " <a href=\"" + base_url + i + end_url + "\"><span>" + i + "</span></a> ";
            }

            s = s + " <span class=\"selected2\">" + cp + "</span> ";

            for (int i = cp + 1; i <= (cp + 5 >= tp ? tp : (cp <= 5 ? (tp >= 10 ? 10 : tp) : cp + 5)); i++)
            {
                s = s + " <a href=\"" + base_url + i + end_url + "\"><span>" + i + "</span></a> ";
            }
        }

        if (cp == tp)
        {
            //s = s + " <span class=\"selected2\">下一页</span> ";
            //s = s + " <span class=\"selected2\">尾页</span> ";
        }
        else
        {
            s = s + " <a href=\"" + base_url + (cp + 1) + end_url + "\">下一页</a> ";
            s = s + " <a href=\"" + base_url + tp + end_url + "\">尾页</a> ";
        }
        pagecontrol_string = s;
    }
コード例 #9
0
ファイル: other.aspx.cs プロジェクト: xiaomincui/100allin
    protected void Page_Load(object sender, EventArgs e)
    {
        login login1 = new login();
        login1.login();

        check check1 = new check();
        GetRequest GetRequest1 = new GetRequest();
        string p = "";
        p = check1.CheckNumber(GetRequest1.GetRequestQueryString("p", "1"));

        string u = "";
        u = check1.CheckNumber(GetRequest1.GetRequestQueryString("uid", "0"));

        int item = 0;
        item = (Convert.ToInt32(p) - 1) * 10;

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();
        string sql = "";
        sql += "SELECT TOP 10 * ";
        sql += "FROM (SELECT * FROM V_REPASTE_INDEX WHERE userid2 = " + u + ") AS T WHERE rid NOT IN ";
        sql += "(SELECT TOP " + item.ToString() + " rid FROM V_REPASTE_INDEX WHERE userid2 = " + u + " ORDER BY rid DESC) ORDER BY rid DESC";

        ds = cn.mdb_ds(sql, "repaste");
        Repeater1.DataSource = ds.Tables["repaste"].DefaultView;
        Repeater1.DataBind();

        sql = "SELECT rid as c FROM V_REPASTE_INDEX WHERE userid2 = " + u;
        ds = cn.mdb_ds(sql, "repaste");

        string base_url = "other.aspx?uid=" + u + "&p=";

        string end_url = "";

        int cp = Convert.ToInt32(p);
        int tp = 1;
        int count = 0;
        count = ds.Tables["repaste"].Rows.Count;

        if (count % 10 > 0 || count == 0)
        {
            tp = count / 10 + 1;
        }
        else
        {
            tp = count / 10;
        }

        string s = "";
        if (cp == 1)
        {
            //s = s + " <span class=\"selected2\">首页</span> ";
            //s = s + " <span class=\"selected2\">上一页</span> ";
            s = s + " <span class=\"selected2\">1</span> ";
            for (int i = 2; i <= (tp < 10 ? tp : 10); i++)
            {
                s = s + " <a href=\"" + base_url + "" + i + end_url + "\"><span>" + i + "</span></a> ";
            }
        }
        else
        {
            s = s + " <a href=\"" + base_url + "1" + end_url + "\"><span>首页</span></a> ";
            s = s + " <a href=\"" + base_url + (cp - 1) + end_url + "\"><span>上一页</span></a> ";
            for (int i = (cp <= 5 ? 1 : (tp - cp < 5 ? (tp - 9 < 1 ? 1 : tp - 9) : cp - 4)); i <= cp - 1; i++)
            {
                s = s + " <a href=\"" + base_url + i + end_url + "\"><span>" + i + "</span></a> ";
            }

            s = s + " <span class=\"selected2\">" + cp + "</span> ";

            for (int i = cp + 1; i <= (cp + 5 >= tp ? tp : (cp <= 5 ? (tp >= 10 ? 10 : tp) : cp + 5)); i++)
            {
                s = s + " <a href=\"" + base_url + i + end_url + "\"><span>" + i + "</span></a> ";
            }
        }

        if (cp == tp)
        {
            //s = s + " <span class=\"selected2\">下一页</span> ";
            //s = s + " <span class=\"selected2\">尾页</span> ";
        }
        else
        {
            s = s + " <a href=\"" + base_url + (cp + 1) + end_url + "\">下一页</a> ";
            s = s + " <a href=\"" + base_url + tp + end_url + "\">尾页</a> ";
        }
        pagecontrol_string = s;

        string[] udetail;
        AllinUser AllinUser1 = new AllinUser();
        udetail = AllinUser1.GetUserDetail(u);

        Literal1.Text = udetail[3];
    }
コード例 #10
0
ファイル: pm_detail.aspx.cs プロジェクト: xiaomincui/100allin
    protected void Page_Load(object sender, EventArgs e)
    {
        login lg = new login();
        lg.login();

        LoadRecord();

        Literal2.Text = "<a href=\"/member/pm_detail_all.aspx?pid=" + GetRequestQueryString("pid", "0") + "&cid=" + GetRequestQueryString("cid", "0") + "\">点击查看您与Ta之间的所有留言</a>";
    }
コード例 #11
0
ファイル: index.aspx.cs プロジェクト: xiaomincui/100allin
    protected void Page_Load(object sender, EventArgs e)
    {
        login login1 = new login();
        login1.login();

        check check1 = new check();
        GetRequest GetRequest1 = new GetRequest();
        string p = "";
        p = check1.CheckNumber(GetRequest1.GetRequestQueryString("p", "1"));

        string u = "";
        u = check1.CheckNumber(GetRequest1.GetRequestCookies("user_id", "0"));

        string tip = "";
        tip = GetRequest1.GetRequestQueryString("tip", "0");

        if (tip == "delete")
        {
            Literal1.Text = "<div class=\"main2box_notice\" id=\"main2box_notice\"><img src=\"images/LedIcon_001.GIF\">&nbsp;&nbsp;转帖删除成功</div>";
            Literal1.Text = Literal1.Text + "<script>function hidetip(){document.getElementById(\"main2box_notice\").style.display = \"none\"};setTimeout(\"hidetip()\",\"2000\");</script>";
        }

        int item = 0;
        item = (Convert.ToInt32(p) - 1) * 10;

        data_conn cn = new data_conn();
        DataSet ds = new DataSet();
        string sql = "";
        sql += "SELECT TOP 10 * ";
        sql += "FROM (SELECT * FROM V_REPASTE_INDEX WHERE userid2 = " + u + ") AS T WHERE rid NOT IN ";
        sql += "(SELECT TOP " + item.ToString() + " rid FROM V_REPASTE_INDEX WHERE userid2 = " + u + " ORDER BY rid DESC) ORDER BY rid DESC";

        ds = cn.mdb_ds(sql, "repaste");
        Repeater1.DataSource = ds.Tables["repaste"].DefaultView;
        Repeater1.DataBind();

        sql = "SELECT rid as c FROM V_REPASTE_INDEX WHERE userid2 = " + u;
        ds = cn.mdb_ds(sql, "repaste");

        string base_url = "index.aspx?p=";

        string end_url = "";

        int cp = Convert.ToInt32(p);
        int tp = 1;
        int count = 0;
        count = ds.Tables["repaste"].Rows.Count;

        if (count % 10 > 0 || count == 0)
        {
            tp = count / 10 + 1;
        }
        else
        {
            tp = count / 10;
        }

        string s = "";
        if (cp == 1)
        {
            //s = s + " <span class=\"selected2\">首页</span> ";
            //s = s + " <span class=\"selected2\">上一页</span> ";
            s = s + " <span class=\"selected2\">1</span> ";
            for (int i = 2; i <= (tp < 10 ? tp : 10); i++)
            {
                s = s + " <a href=\"" + base_url + "" + i + end_url + "\"><span>" + i + "</span></a> ";
            }
        }
        else
        {
            s = s + " <a href=\"" + base_url + "1" + end_url + "\"><span>首页</span></a> ";
            s = s + " <a href=\"" + base_url + (cp - 1) + end_url + "\"><span>上一页</span></a> ";
            for (int i = (cp <= 5 ? 1 : (tp - cp < 5 ? (tp - 9 < 1 ? 1 : tp - 9) : cp - 4)); i <= cp - 1; i++)
            {
                s = s + " <a href=\"" + base_url + i + end_url + "\"><span>" + i + "</span></a> ";
            }

            s = s + " <span class=\"selected2\">" + cp + "</span> ";

            for (int i = cp + 1; i <= (cp + 5 >= tp ? tp : (cp <= 5 ? (tp >= 10 ? 10 : tp) : cp + 5)); i++)
            {
                s = s + " <a href=\"" + base_url + i + end_url + "\"><span>" + i + "</span></a> ";
            }
        }

        if (cp == tp)
        {
            //s = s + " <span class=\"selected2\">下一页</span> ";
            //s = s + " <span class=\"selected2\">尾页</span> ";
        }
        else
        {
            s = s + " <a href=\"" + base_url + (cp + 1) + end_url + "\">下一页</a> ";
            s = s + " <a href=\"" + base_url + tp + end_url + "\">尾页</a> ";
        }
        pagecontrol_string = s;
    }