using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Data;
using xabaraCOM;

public partial class inClude_bottom : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            sqlServer sql = new sqlServer();
            javasrcipt js = new javasrcipt();
            DataTable dt;

            miibeian.Text = xml.read("xabara.config", "miibeian", 180);
            webTitle.Text = xml.read("xabara.config", "webName", 180);
            webVer.Text = xml.read("xabara.config", "webVer", 180);

            string qqID = xml.read("xabara.config", "qq", 180);
            qqLink.Text = xabara.QQ(qqID, "41");
            string[] qq = xabara.QQ(qqID, "41").Replace("&nbsp;", "|").Split(new char[] { '|' });
            for (int q = 0; q < qq.GetUpperBound(0); q++)
            {
                qqLi.Text += "<li style=\"height:28px; line-height:28px;\">" + qq[q].ToString().Trim() + "</li>";
            }

            string tbID = xml.read("xabara.config", "taobao", 180);
            tbLink.Text = xabara.taobao(tbID, "1");
            string[] tb = xabara.taobao(tbID, "1").Replace("&nbsp;", "|").Split(new char[] { '|' });
            for (int t = 0; t < tb.GetUpperBound(0); t++)
            {
                tbLi.Text += "<li style=\"height:28px; line-height:28px;\">" + tb[t].ToString().Trim() + "</li>";
            }

            string tel = xml.read("xabara.config", "freePhone", 180);
            if (!string.IsNullOrEmpty(tel as string))
            {
                telInfo.Text = tel + "&nbsp;";
                telLi.Text = "<li style=\"height:22px; line-height:22px;\">" + tel + "</li>";
            }
            tel = xml.read("xabara.config", "mobile", 180);
            if (!string.IsNullOrEmpty(tel as string))
            {
                telInfo.Text += tel + "&nbsp;";
                telLi.Text += "<li style=\"height:22px; line-height:22px;\">" + tel + "</li>";
            }
            tel = xml.read("xabara.config", "webTel", 180);
            if (!string.IsNullOrEmpty(tel as string))
            {
                telInfo.Text += tel + "&nbsp;";
                telLi.Text += "<li style=\"height:22px; line-height:22px;\">" + tel + "</li>";
            }

            yearLab.Text = DateTime.Now.Year.ToString();

            countStr.Text = xml.read("xabara.config", "countScript", 180);

            long divJs = xabara.isNum(xml.read("xabara.config", "openWin", 180));
            if (divJs > 0)
            {
                if (Request.Cookies["XabaraUser"] != null)
                {
                    string userCardID = Request.Cookies["XabaraUser"]["userCardID"].ToString().Trim();
                    //检查家教信息资料填写
                    long teachCount = 0;
                    dt = sql.getDataTable("select count(tID) as c from teacherinfo where workFlag>0 and workFlag<3 and uID='" + userCardID + "'");
                    teachCount += xabara.isNum(dt.Rows[0]["c"].ToString());
                    dt.Dispose();
                    dt = sql.getDataTable("select count(sID) as c from studentinfo where workFlag>0 and workFlag<3 and uID='" + userCardID + "'");
                    teachCount += xabara.isNum(dt.Rows[0]["c"].ToString());
                    dt.Dispose();

                    if (teachCount < 1)
                    {
                        string jsStr = "<script type=\"text/javascript\">jQuery(document).ready(function ($) {Util.loadJS(\"XY_Dialog.js\", function () {Util.Dialog({title: \"发布信息提示框\",width: 320,height: 0,fixed: true,showborder: false, content: \"text:<div style='text-align:center; padding:30px'><a href='/member/teacher/add.aspx' style='font-size:14px; font-weight:bold;'>如是教员，请点击这里发布信息！</a><br /><br /><a href='/member/student/add.aspx' style='font-size:14px; font-weight:bold;'>如是学员，请点击这里发布信息！</a></div>\",position: {left: \"0\",bottom: \"0\"}});});});</script>";
                        js.writeEnd(jsStr);
                    }
                }
            }
        }
    }
}