<%@ Control Language="C#" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Config" %>
<%@ Import Namespace="Kesion.Components" %>
<%@ Import Namespace="Kesion.HtmlTags" %>
<%@ Import Namespace="Kesion.UCenter" %>
<%@ Import Namespace="Kesion.XML" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<script runat="server" type="text/C#">

    dynamic __user = HttpContext.Current.Items["user"];                //初始化用户信息
    bool isLoadPage = true;  //定义页面是否加载

    public static int flag = 0;
    public string postTable = MyCache.GetAskPostTable();
    public static DataRow zjdr = null;
    public static int provinceId = 0;
    public static int cityId = 0;
    public static int countyId = 0;

    int recordcount, pagecount;
    int CurrPage = new BasicField().GetCurrPage;
    int PageSize = 10;

    protected void Page_Load(object sender, EventArgs e)
    {
        flag = Utils.StrToInt(KSCMS.S("flag"));
        if (flag==3){
            InitialZJ();
        }
        if (KSCMS.S("action") == "delete")
        {
            isLoadPage = false;
            DeleteTopic();
            return;
        }
        else if (KSCMS.S("action") == "delanswer")
        {
            isLoadPage = false;
            DeleteAnswer();
            return;
        }
        else if (KSCMS.S("action") == "dosave")
        {
            isLoadPage = false;
            DoSave();
            return;
        }
    }

    private void DoSave()
    {
        #region 保存申请
        string realName = KSCMS.Filter(KSCMS.S("RealName"));
        if (string.IsNullOrEmpty(realName))
        {
            Msg.Alert("请输入您的真实姓名!", KSCMS.GetComeUrl());
            return;
        }
        int typeId = Utils.StrToInt(KSCMS.S("TypeId"));
       
        Hashtable ht = new Hashtable();
        
        ht.Add("sex", KSCMS.S("sex"));
        ht.Add("userface", KSCMS.S("UserFace"));
        ht.Add("tel", KSCMS.S("Tel"));
        ht.Add("qq", KSCMS.S("QQ"));
        ht.Add("provinceid", Utils.StrToInt(KSCMS.S("provinceid")));
        ht.Add("cityid", Utils.StrToInt(KSCMS.S("cityid")));
        ht.Add("countyid", Utils.StrToInt(KSCMS.S("countyid")));
        ht.Add("address", KSCMS.Filter(KSCMS.S("AddRess")));
        ht.Add("danwei", KSCMS.Filter(KSCMS.S("DanWei")));
        ht.Add("zyz", KSCMS.Filter(KSCMS.S("ZYZ")));
        ht.Add("scfl", KSCMS.Filter(KSCMS.S("scfl")));
        ht.Add("intro", KSCMS.S("Intro"));
        if (DataFactory.Exists("KS_AskZJ", "userid=" + __user.UserID)) //已存在
        {
            int verify = Utils.StrToInt(DataFactory.GetOnlyValue("select top 1 verify From KS_AskZJ where userid=" + __user.UserID));
            if (verify != 1)
            {
                if (typeId == 0)
                {
                    Msg.Alert("请选择专家分类!", KSCMS.GetComeUrl());
                    return;
                }
                ht.Add("realname", realName);
                ht.Add("birthday", KSCMS.Filter(KSCMS.S("Birthday")));
                ht.Add("idcard", KSCMS.Filter(KSCMS.S("Idcard")));
                ht.Add("typeid", Utils.StrToInt(KSCMS.S("TypeID")));
                ht.Add("classid", Utils.StrToInt(KSCMS.S("ClassID")));
            }
            bool isSuccess = CommonData.Update("KS_AskZJ", ht, " WHERE userID=" + __user.UserID);
            Msg.Alert("恭喜，问答专家修改成功!",KSCMS.GetComeUrl());
            return;

        }
        else
        {
            if (typeId == 0)
            {
                Msg.Alert("请选择专家分类!", KSCMS.GetComeUrl());
                return;
            }
            ht.Add("realname", realName);
            ht.Add("birthday", KSCMS.Filter(KSCMS.S("Birthday")));
            ht.Add("idcard", KSCMS.Filter(KSCMS.S("Idcard")));
            ht.Add("typeid", Utils.StrToInt(KSCMS.S("TypeID")));
            ht.Add("classid", Utils.StrToInt(KSCMS.S("ClassID")));
            
            ht.Add("adddate", DateTime.Now);
            ht.Add("username", __user.UserName);
            ht.Add("userid", __user.UserID);
            CommonData.Insert("KS_AskZJ", ht);
            Msg.Alert("恭喜，问答专家申请成功!",KSCMS.GetComeUrl());
            return;

        }
        #endregion
    }
    
    private void InitialZJ()
    {
        using (DataTable dt = DataFactory.GetDataTable("select top 1 * FROM KS_AskZJ Where UserID=" + (new TemporaryVar()).UserID))
        {
            if (dt.Rows.Count > 0)
            {
                zjdr = dt.Rows[0];

                provinceId = Utils.StrToInt(zjdr["provinceid"].ToString());
                 cityId = Utils.StrToInt(zjdr["cityId"].ToString());
                 countyId = Utils.StrToInt(zjdr["countyid"].ToString());
            }


        }
    }
    public string GetZJValue(string fieldname)
    {
        if (zjdr == null)
        {
            return string.Empty;
        }
        else
        {
            return zjdr[fieldname].ToString();
        }
    }
    
    private void DeleteTopic()
    {
        #region 删除问题
        if (MyCache.GetAskCacheConfig(23).Equals("0"))
        {
            Msg.Alert("不允许删除", KSCMS.GetComeUrl());
            return;
        }
        else
        {
            if (string.IsNullOrEmpty(KSCMS.S("ids")))
            {
                Msg.Alert("没有选择要删除的问题!", KSCMS.GetComeUrl());
                return;
            }
            else if (AskManage.DelUserAskTopic(KSCMS.S("ids")) == "success")
            {
                Msg.Alert("恭喜，问吧问题删除成功!", KSCMS.GetComeUrl());
            }
            else
            {
                Msg.Alert("没有成功删除!", KSCMS.GetComeUrl());
            }

        }

        #endregion
    }

    private void DeleteAnswer()
    {
        #region 删除回答
        if (MyCache.GetAskCacheConfig(20).Equals("0") || MyCache.GetAskCacheConfig(20).Equals("1"))
        {
            Msg.Alert("对不起，不允许删除自已答案!", KSCMS.GetComeUrl());
            return;
        }
        else
        {
            string ids = Utils.FilterIDs(KSCMS.S("ids"));
            if (ids != "0")
            {
                AskManage.DelUserAskAnswer(postTable, ids);
                Msg.Alert("恭喜，问吧回答删除成功!", KSCMS.GetComeUrl());
                return;
            }
            else
            {
                Msg.Alert("对不起，没有选择记录！", KSCMS.GetComeUrl());
                return;
            }
        }
        #endregion
    }

    public string getAnsNum(int isbest)
    {
        int num = 0;
        using (DataTable dt = MyCache.GetCacheAskPostTable())
        {
            foreach (DataRow dr in dt.Rows)
            {
                string param = " where username='" + __user.UserName + "'";
                if (isbest == 1)
                {
                    param += " and isbest=1";
                }
                if (BaseFun.CheckTableExists(dr["tableName"].ToString()))
                {
                    num += Utils.StrToInt(DataFactory.GetOnlyValue("select count(1) From " + dr["tableName"].ToString() + " " + param));
                }
            }
        }
        return num.ToString();
    }
    public  string getCNL()
    {
        string cnl = string.Empty;
        float total = Utils.StrToFloat(getAnsNum(0));
        float bestTotal = Utils.StrToFloat(getAnsNum(1));
        if (total == 0)
        {
            cnl = "0%";
        }
        else
        {
            cnl = ((decimal)bestTotal / (decimal)total).ToString("F2") + "%";
        }
        return cnl;
    }


    /// <summary>
    /// 返回问题数
    /// </summary>
    /// <param name="isSolve"></param>
    /// <returns></returns>
    public string getQueNum(int isSolve)
    {
        #region 返回问题数
        string param = " Where UserName='" + __user.UserName + "'";
        switch (isSolve)
        {
            case 1:
                param += " and issolve=1";
                break;
            case 2:
                param += " and issolve=1";
                break;
            case 0:
                param += " and issolve=0";
                break;
            case 3:
                param += " and recommend=1";
                break;
        }
        return DataFactory.GetOnlyValue("select count(1) From KS_AskTopic " + param);
        #endregion
    }
    public string isAnswer(int topicId, string postTable)
    {
        if (DataFactory.Exists(postTable, "topicid=" + topicId + " and username='" + __user.UserName + "'"))
        {
            return "<span style='color:green'>已解答</span>";
        }
        else
        {
            return string.Format(@"<a href='{0}' style='color:red'>未解答</a>", BaseFun.GetRewriteUrl("askview", topicId));
        }

    }
</script>
<%
    if (!isLoadPage) return;
%>
	<style>
        .border-left tr td{text-align:left;}
    </style>
    
    <div class="t_tybox nomar">
        <div class="r_title tytitle  pd0">
            <h4 class="ty-none ">我的问吧</h4>
             <div class="tabs">  
                <ul>
                     <%
                  Response.Write(@"<li><a href=""" + BasicField.GetUserUrl("message/Receivedmessage") + @""">站内消息</a></li>");
                  Response.Write(@"<li><a href=""" + BasicField.GetUserUrl("other/mychatinfo") + @""">我的咨询</a></li>");
                  Response.Write(@"<li><a href=""" + BasicField.GetUserUrl("other/comment") + @""">我的评价</a></li>");
                  if (CommonJsonCache.CheckYunAPPHasAllow("plus.ask"))
                  {
                      Response.Write(@"<li  class=""puton""><a href=""" + BasicField.GetUserUrl("other/MyAsk") + @""">问题互动</a></li>");
                  }
                  if (BaseFun.CheckModulePower("edu"))
                  {
                      Response.Write(@"<li><a href=""" + BasicField.GetUserUrl("Course/MyCosZan", "optype") + @""">我的点赞</a></li>");
                      Response.Write(@" <li><a href=""" + BasicField.GetUserUrl("Course/MyInteractRecord") + @""">互动礼物</a></li>");
                  }
                 %>
                </ul>
                </div>  
        </div>
        
          <div class="top-sort clearfix ">
             <div class="top-sort-tab">    
                <ul>  
                    <li<%=KSCMS.S("flag")==""?" class='puton'":string.Empty %>><a href="<%=BasicField.GetUserUrl("other/myask") %>">我提问的问题</a></li>
                    <li<%=KSCMS.S("flag")=="1"?" class='puton'":string.Empty %>><a href="<%=BasicField.GetUserUrl("other/myask","flag-1") %>">我参与的回答</a></li>
                    <li<%=KSCMS.S("flag")=="2"?" class='puton'":string.Empty %>><a href="<%=BasicField.GetUserUrl("other/myask","flag-2") %>">谁向我提问</a></li>
                    <li<%=KSCMS.S("flag")=="3"?" class='puton'":string.Empty %>><a href="<%=BasicField.GetUserUrl("other/myask","flag-3") %>">申请问答专家</a></li>
                    <%if (BaseFun.CheckModulePower("plus.group"))
                     { %>
                    <li<%=KSCMS.S("flag") == "0" ? " class='puton'" : string.Empty %>><a href="<%=BasicField.GetUserUrl("other/MyTopic", "flag-0") %>">我的帖子</a></li>
                    <li<%=KSCMS.S("flag") == "5" ? " class='puton'" : string.Empty %>><a href="<%=BasicField.GetUserUrl("other/mytopic", "flag-5") %>">我参与的话题</a></li>
                     <%} %>
                  </ul>
            </div>
         </div>
        <%if (flag==0){ %>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
            <tr class="title" align="center">
                <td height="25" class="td-first">总分</td>
                <td>回答总数</td>
                <td>回答被采纳</td>
                <td>回答被采纳率</td>
                <td width="50"></td>
                <td>提问总数</td>
                <td>已解决</td>
                <td>解决中</td>
                <td>被推荐</td>
                <td class="td-last">被关闭</td>
            </tr>               
            <tr align="center">
                <td height="25" >
                    <font class=red-color>
                    <%=__user.Score %>
                    </font>
                </td>
                <td>
                    <%=getAnsNum(0)%>
                </td>
                <td>
                    <%=getAnsNum(1)%>
                </td>
                <td>
                    <%=getCNL()%>
                </td>
                <td width="50"></td>
                <td><%=getQueNum(-1)%></td>
                <td><%=getQueNum(1)%></td>
                <td><%=getQueNum(0)%></td>
                <td><%=getQueNum(3)%></td>
                <td><%=getQueNum(2)%></td>
            </tr>               
        </table>
        <form name="myform" action="{$GetCurrUrl}" method="post" id="myform">
            <input type="hidden" name="action" value="delete"/>
            <table id="tablist" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
                <tr align="center" class="title">
                    <td width="50" align="center">选择</td>
                    <td align="center"> 问题</td>
                    <td align="center" nowrap>悬赏分</td>
                    <td align="center">状态</td>
                    <td align="center">操作</td>
                </tr>
                <%
                    string param = "KS_AskTopic Where UserID=" + (new TemporaryVar()).UserID;
                    using (DataTable dt = DataFactory.GetPage("*", param, "topicid", "order by TopicID desc", CurrPage, PageSize, out recordcount, out pagecount)){
                        if (dt.Rows.Count > 0){
                            foreach (DataRow dr in dt.Rows){
                                KSCMS.W(@"<tr class=""tdbg"">
                                              <td class=""splittd"" style=""text-align:center""><input type=""checkbox"" name=""ids"" value=""" + dr["TopicID"].ToString() + @""" /></td>
                                              <td class=""splittd tag_left""> 
                                               <a href=""" + BaseFun.GetRewriteUrl("askview", Convert.ToInt32(dr["TopicID"].ToString())) + @""" target=""_blank"">" + Utils.CutStr(Utils.RemoveHtml(Convert.ToString(dr["Title"].ToString())), 80) + @"</a>
                                               <div style=""color:#999"">提问时间：" + Utils.FormatHumanizedTime(Convert.ToDateTime(dr["AddDate"].ToString())) + @" &nbsp; 是否审核：" + (Convert.ToString(dr["verify"].ToString()) == "1" ? "已审核" : "<span class=red-color>未审核</span>") + @" &nbsp; 分类：" + MyCache.GetCacheAskCategory(Convert.ToInt32(dr["ClassID"].ToString()), "classname") + @"</div>
                                              </td>
                                              <td class=""splittd"" style=""text-align:center""><font color=red>" + Convert.ToSingle(Convert.ToString(dr["reward"].ToString())).ToString() + @"
                                    </font> 分</td>
                                              <td class=""splittd"" style=""text-align:center"">" + (Convert.ToString(dr["IsSolve"].ToString()) == "1" ? "已解决" : Convert.ToInt32(dr["IsSolve"].ToString()) == 2 ? "已关闭" : "<span class=red-color>未解决</span>") + @"</td>
                                              <td class=""splittd"" align=""center"">" + (MyCache.GetAskCacheConfig(23).Equals("0") ? "---" : (MyCache.GetAskCacheConfig(23).Equals("2") || (MyCache.GetAskCacheConfig(23).Equals("1") && Convert.ToInt32(dr["IsSolve"].ToString()) == 0) ? " <div class=\"bt\"><a onclick=\"return(confirm('确定删除吗？'));\" href='" + BasicField.GetUserUrl("other/myask", "action-delete,ids-" + dr["topicid"].ToString()) + @"' title=""删除""><i class=""userfont uf-delete""></i></a></div>" : string.Empty)) + @"
                                               </td>
                                          </tr>  ");
                            }
                        }else{
                            KSCMS.W(@" <tr class=""tr-nobor"">
                                            <td class=""splittd"" style=""text-align:center"" colspan=""10"">
                                              <div class=""empty"">没有记录！</div>
                                            </td>
                                       </tr><style>.cz_btn{display:none;}</style>");
        
                        }
                       
                    }  
                %>
            </table>
            <div class="cz_btn clearfix">
                <div class="f-right">
                    <span>
                        <input type="hidden" name="do" value="del">
                        <input type="checkbox" class="checkbtn" name="chkall" id="chkall" onclick="CheckAll(this.form);"><label for="chkall">全选</label>
                    </span>
                    <span><input type="submit" value="删除记录" class="green-bt button"></span>
                </div>
            </div>
            <div class="clear"></div>
        </form>
        <%}else if (flag==1){  //我参与的回答
        %>
        <form name="myform" action="{$GetCurrUrl}" method="post" id="Form1">
            <input type="hidden" name="action" value="delanswer"/>
            <table id="Table1" width="100%" cellspacing="0" cellpadding="0" align="center"  class="border">
                <tr align="center" class="title">
                    <td width="50" align="center">选择</td>
                    <td align="center">问题</td>
                    <td align="center">悬赏分</td>
                    <td align="center">状态</td>
                    <td align="center">操作</td>
                </tr>
                <%
                  string sqlParam = postTable + " a inner join KS_AskTopic b ON a.topicid=b.topicid Where a.username='" + __user.UserName + "'";
                  using (DataTable dt = DataFactory.GetPage("a.*,b.Title,b.classid,b.reward,b.issolve,b.verify", sqlParam, "postid", "order by postID desc", CurrPage, PageSize, out recordcount, out pagecount)){
                            if (dt.Rows.Count > 0){
                                foreach (DataRow dr in dt.Rows){
                                    KSCMS.W(@"<tr class=""tdbg"">
                                                  <td class=""splittd"" style=""text-align:center""><input type=""checkbox"" name=""ids"" value=""" + dr["postID"].ToString() + @""" /></td>
                                                  <td class=""splittd tag_left""> 
                                                   <a href=""" + BaseFun.GetRewriteUrl("askview", Convert.ToInt32(dr["TopicID"].ToString())) + @""" target=""_blank"">" + Utils.CutStr(Utils.RemoveHtml(Convert.ToString(dr["Title"].ToString())), 80) + @"</a>
                                                   <div style=""color:#999"">我的回答：" + Utils.CutStr(Utils.RemoveHtml(Convert.ToString(dr["Content"].ToString())),80)+ @"</div>
                                                   <div style=""color:#999"">提问时间：" + Utils.FormatHumanizedTime(Convert.ToDateTime(dr["AddDate"].ToString())) + @" 提问者：" + dr["username"].ToString() + @" 分类：" + MyCache.GetCacheAskCategory(Convert.ToInt32(dr["ClassID"].ToString()), "classname") + @"</div>
                                                  </td>
                                                  <td class=""splittd"" style=""text-align:center""><font class=red-color>" + Convert.ToSingle(Convert.ToString(dr["reward"].ToString())).ToString() + @"
                                        </font> 分</td>
                                                  <td class=""splittd"" style=""text-align:center"">" + (Convert.ToString(dr["IsSolve"].ToString()) == "1" ? "已解决" : Convert.ToInt32(dr["IsSolve"].ToString()) == 2 ? "已关闭" : "<span class=red-color>未解决</span>") + @"</td>
                                                  <td class=""splittd"" align=""center"">" + (MyCache.GetAskCacheConfig(20).Equals("0") || MyCache.GetAskCacheConfig(20).Equals("1")  || Convert.ToString(dr["IsSolve"].ToString()) != "0" ? "---" :  " <div class=\"bt\"><a onclick=\"return(confirm('确定删除吗？'));\" href='"+BasicField.GetUserUrl("other/myask","action-deleteanswer,ids-" + dr["postid"].ToString()) + @"' title=""删除""><i class=""userfont uf-delete""></i></a></div>") + @"
                                                   </td>
                                              </tr>  ");
                                }
                            }else{
                                KSCMS.W(@" <tr class=""tr-nobor"">
                                                <td class=""splittd"" style=""text-align:center"" colspan=""10"">
                                                <div class=""empty"">
                                                 没有回答过问题！
                                                 </div>
                                                </td>
                                           </tr><style>.cz_btn{ display:none;}</style>");
                
                            }
                           
                
                  }    
                %>
            </table>
            <div class="cz_btn clearfix">
                <div class="f-right">
                    <span class="check-all">
                        
                        <input type="checkbox" class="checkbtn" name="chkall" id="Checkbox1" onclick="CheckAll(this.form);"><label for="chkall">全选</label>
                    </span>
                    <span><input type="submit" value="删除记录" class="button"></span>
                </div>
            </div>
        </form>
        <%}else if (flag==2){ //向我提问%>
        <table id="Table2" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="border mb15">
            <tr align="center" class="title">
                <td width="50" align="center">问题ID</td>
                <td align="center"> 问题</td>
                <td align="center" nowrap>悬赏分</td>
                <td align="center">状态</td>
                <td align="center">是否解答</td>
            </tr>
            <%
              string param = "KS_AskTopic Where AskUserID=" + (new TemporaryVar()).UserID + " and verify=1";
              using (DataTable dt = DataFactory.GetPage("*", param, "topicid", "order by TopicID desc", CurrPage, PageSize, out recordcount, out pagecount)){
                  if (dt.Rows.Count > 0){
                      foreach (DataRow dr in dt.Rows){
                          KSCMS.W(@"<tr class=""tdbg"">
                                      <td class=""splittd"" style=""text-align:center"">" + dr["topicID"].ToString() + @"</td>
                                      <td class=""splittd tag_left""> 
                                       <a href=""" + BaseFun.GetRewriteUrl("askview", Convert.ToInt32(dr["TopicID"].ToString())) + @""" target=""_blank"">" + Utils.CutStr(Utils.RemoveHtml(Convert.ToString(dr["Title"].ToString())), 80) + @"</a>
                                       <div style=""color:#999"">提问时间：" + Utils.FormatHumanizedTime(Convert.ToDateTime(dr["AddDate"].ToString())) + @" 提问者：" + dr["username"].ToString() + @" 分类：" + MyCache.GetCacheAskCategory(Convert.ToInt32(dr["ClassID"].ToString()), "classname") + @"</div>
                                      </td>
                                      <td class=""splittd"" style=""text-align:center""><font class=red-color>" + Convert.ToSingle(Convert.ToString(dr["reward"].ToString())).ToString() + @"
                            </font> 分</td>
                                      <td class=""splittd"" style=""text-align:center"">" + (Convert.ToString(dr["IsSolve"].ToString()) == "1" ? "已解决" : Convert.ToInt32(dr["IsSolve"].ToString()) == 2 ? "已关闭" : "<span class=red-color>未解决</span>") + @"</td>
                                      <td class=""splittd"" align=""center"">" + isAnswer(Convert.ToInt32(dr["topicid"].ToString()), Convert.ToString(dr["postTable"].ToString())) + @"
                                       </td>
                                  </tr>  ");
                      }
                  }else{
                      KSCMS.W(@"<tr class=""tr-nobor"">
                                    <td class=""splittd"" style=""text-align:center"" colspan=""10"">
                                     <div class=""empty"">没有记录！</div>
                                    </td>
                               </tr><style>.cz_btn{display:none;}</style>");
    
                  }
    
              }     
            %>
        </table>
        <%}else if (flag==3){ //申请专家%>
    
        <% Kesion.APPCode.EditorAPI.EchoHead();%>
    
        <%if (zjdr!=null){ %>
             <div class="toptips">
                <%if (zjdr["verify"].ToString() == "0")
                  {%>
                 <span style='color:Red'> 您好,<%=__user.UserName %>！您已申请了问吧专家认证，请耐心等待本站管理员的审核！</span>
                <%}else{%>
                 <span style='color:Green'> 您好,<%=__user.UserName %>！您已通过本站问吧专家认证！</span>
                <%} %>
             </div>
        <%} %>
        <iframe src="about:blank" style="display:none;width:0px;height:0px" name="hidiframe"></iframe>
        <form name="myform" action="{$GetCurrUrl}" method="post" id="Form2" target="hidiframe">
            <input type="hidden" name="action" value="dosave"/>
            <table class="border border-left" width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
                <tr class="tdbg">
                    <td class="lefttd" style="width:100px">专家分类</td>
                    <td>
                        <div class="select-wrap">
                            <select name="TypeId" id="TypeId"<%=GetZJValue("verify")=="1"?" disabled":"" %>>
                                <%
                                  using (DataTable dt = MyCache.GetCacheAskZJTypeTable())
                                  {
                                      if (dt.Rows.Count > 0)
                                      {
                                          foreach (DataRow dr in dt.Rows)
                                          {
                                              Response.Write(string.Format(@"<option value='{0}'{1}>{2}</option>", dr[0].ToString(), GetZJValue("typeid") == dr[0].ToString() ? " selected" : string.Empty, dr[1].ToString()));
                                          }
            
                                      }
                                  }
                                %>
                            </select>
                        </div>
                        <div class="tips">审核通过后不能修改。</div>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd" style="width:100px">问吧分类</td>
                    <td>
                        <div class="select-wrap">
                             <select name="ClassID" id="ClassID"<%=GetZJValue("verify")=="1"?" disabled":"" %>>
                                <%
                                  using (DataTable dt = MyCache.GetCacheAskCategoryTable())
                                  {
                                      if (dt.Rows.Count > 0)
                                      {
                                          foreach (DataRow dr in dt.Rows)
                                          {
                                              Response.Write(string.Format(@"<option value='{0}'{1}>{2}</option>", dr[0].ToString(), GetZJValue("classid") == dr[0].ToString() ? " selected" : string.Empty, dr[1].ToString()));
                                          }
            
                                      }
                                  }
                                %>
                            </select>
                        </div>
                        <div class="tips">审核通过后不能修改。</div>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">真实姓名</td>
                    <td><div class="textbox-wrap"><input type="text" <%=GetZJValue("verify")=="1"?" readonly":"" %> name="RealName" id="RealName" class="textbox" value="<%=GetZJValue("realname") %>" maxlength="20"/></div>
                     <div class="tips">填写真实姓名，审核通过后不能修改。</div>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">性别</td>
                    <td class="radio-group">
                        <label><input type="radio" name="Sex" value="男"<%=(GetZJValue("sex")=="" ||GetZJValue("sex")=="男")?" checked":"" %> />男</label>
                        <label><input type="radio" name="Sex" value="女"<%=GetZJValue("sex")=="女"?" checked":"" %> />女</label>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">出生年月</td>
                    <td><div class="textbox-wrap"><input type="text" <%=GetZJValue("verify")=="1"?" disabled":"" %> name="Birthday" id="Birthday" class="textbox" value="<%=GetZJValue("Birthday") %>" maxlength="120"/></div>
                     <div class="tips">格式：YYYY-MM-DD。</div>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">个人照片</td>
                    <td>
                    <div class="textbox-wrap p-b-10"><input type="text" name="UserFace" id="UserFace" class="textbox" value="<%=GetZJValue("UserFace") %>" maxlength="255"/></div>
                    <iframe src="/plus/include/UpLoad.aspx?FieldID=UserFace&ispic=1&ChannelID=1" frameborder="0" scrolling="no" style="overflow:hidden;width:320px;height:30px;padding-top:15px"></iframe>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">联系电话</td>
                    <td>
                        <div class="textbox-wrap"><input type="text" name="Tel" id="Tel" class="textbox" value="<%=GetZJValue("Tel") %>" /></div>
                        <div class="tips">填写手机号或是固定电话号码</div>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">联系QQ</td>
                    <td><div class="textbox-wrap"><input type="text" name="QQ" id="QQ" class="textbox" value="<%=GetZJValue("QQ") %>" maxlength="120"/></div></td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">所在地区</td>
                    <td>
                    <script src="/plus/area.aspx?pid=<%=provinceId %>&cityId=<%=cityId %>&countyId=<%=countyId %>"></script>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">联系地址</td>
                    <td>
                    <div class="textbox-wrap"><input type="text" name="Address" id="Address" class="textbox" value="<%=GetZJValue("Address") %>" maxlength="250"/></div>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">工作单位</td>
                    <td><div class="textbox-wrap"><input type="text" name="DanWei" id="DanWei" class="textbox" value="<%=GetZJValue("DanWei") %>" maxlength="120"/></div>
                     <span class="tips">填写您目前的工作单位。</span>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">执业证书</td>
                    <td>
                      <div class="textbox-wrap"><input type="text" name="ZYZ" id="ZYZ" class="textbox" value="<%=GetZJValue("ZYZ") %>" maxlength="120" /></div>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">擅长分类</td>
                    <td><div class="textbox-wrap"><input type="text" name="SCFL" id="SCFL" class="textbox" value="<%=GetZJValue("SCFL") %>" maxlength="120"/></div>
                     <div class="tips">填写您擅长的专业名称。</div>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">身份证号</td>
                    <td>
                        <div class="textbox-wrap"><input <%=GetZJValue("verify")=="1"?" disabled":"" %> type="text" name="IDCard" id="IDCard" class="textbox" value="<%=GetZJValue("IDCard") %>" maxlength="120"/></div>
                        <div class="tips">审核后不能修改。</div>
                    </td>
                </tr>
                <tr class="tdbg">
                    <td class="lefttd">个人介绍</td>
                    <td colspan="3">
                        <div class="textarea-wrap">
                            <textarea name="Intro" id="Intro" style="width:100%;height:200px"><%=GetZJValue("intro") %></textarea>
                        </div>
                        <%
                         Kesion.APPCode.EditorAPI.EchoEditor("editor", "Intro", "Basic", 0, false, true, true,false);    
                         %>
                    </td>
                </tr>
            </table>
            <div class="cz_btn t-a-center">
                <p class="d-inline-block">
                    <span><input type="submit" onclick="return(checkform())" class="green-bt bt-w-auto ty_button" value="OK,提交申请" /></span>
                    <span><input type="reset" class="mainButton green-bt  ty_button" value="重新录入" /></span>
                </p>
            </div>
         
            <div class="clear"></div>
        
        </form>
        <script>
          function checkform() {
              if ($("#RealName").val() == '') {
                  KesionJS.Alert("请输入真实姓名！", "$('#RealName').focus()");
                  return false;
              }
             
              return true;
          }
        </script>
        <%
         }
            #region 分页
            if (pagecount > 0)
            {
                string PageStr = "[KS:PageStr2]";
                BasicField.ReplaceFilterPage(ref PageStr, CurrPage, PageSize, pagecount, recordcount);
                KSCMS.W(PageStr);
            }
            #endregion
        %>
        <script>
            $('.paging').appendTo('.cz_btn').addClass('f-left');
        </script>
    </div> 