<%@ 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="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<script runat="server" type="text/C#">

    /* 页面修改于：自由的飞 at 2018-11-13
     * 注意事项：
     * 1、程序如要终止返回，不可以直接用KSCMS.Die("输出值"); 
     *    取而代之的为 KSCMS.W("输出值"); 
     *                 return;
     * 2、页面可以用 __user.字段 访问用户信息,如__user.UserName 访问用户名 __user.RealName 访问姓名;
     * 3、此页面除了支持C#语法还支持使用所有的标签调用，如{$GetSiteName} 网站名称 
     * 
     */

    dynamic __user = HttpContext.Current.Items["user"];                //初始化用户信息，
    public UserInfo __info = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUserLogin.Run();
        if (!IsPostBack)
        {
            __info = UserManage.GetUserInfo();
            if (__info == null || CheckUserLogin.Check() != "success")
            {
                (new TemporaryVar()).ComeUrl = Request.Url.ToString();
                Utils.ShowError("对不起，您没有登录!", "error.gif", 2, KSCMS.GetInstallDir() + "");
            }

            if (__info.GroupID == 3 && BaseFun.CheckModulePower("school") && BaseFun.CheckTableExists("KS_EnterPrise"))
            {
                Response.Redirect(Kesion.HtmlTags.BasicField.GetUserUrl("school/SchoolMain"));
            }
            else if (__info.GroupID == 4 && BaseFun.CheckTableExists("KS_CosTeacher"))
            {
                Response.Redirect(Kesion.HtmlTags.BasicField.GetUserUrl("teacher/TcMain"));
            }
            else if (BaseFun.CheckModulePower("edu"))
            {      
                Response.Redirect(Kesion.HtmlTags.BasicField.GetUserUrl("course/learnstudy"));
            }
            else if (Utils.GetSysInfo("//sysinfo/showver").ToLower() == "exam0")
            {
                Response.Redirect(Kesion.HtmlTags.BasicField.GetUserUrl("exam/MyExamRecord"));
            }
        }


    }
    /// <summary>
    /// 输出文章
    /// </summary>
    /// <param name="verify"></param>
    private void EchoArticle(int verify)
    {
        #region 输出文章
        string statusStr = string.Empty;
        switch (verify)
        {
            case 0:
                statusStr = "<span class=\"ws\">未审</span>";
                break;
            case 1:
                statusStr = "<span class=\"tips\">已审</span>";
                break;
            case 2:
                statusStr = "<span class=\"cg\">草稿</span>";
                break;
            case 3:
                statusStr = "<span class=\"tg\">退稿</span>";
                break;
        }
        using (DataTable dt = DataFactory.GetDataTable("select top 5 * From KS_InfoList Where Inputer='" + new TemporaryVar().UserName + "' and verify=" + verify + " order by infoid desc"))
        {
            if (dt.Rows.Count > 0)
            {
                int i = 1;
                foreach (DataRow dr in dt.Rows)
                {
                    KSCMS.W(@"<tr class=""tdbg""><td class=""splittd"" align=""center"">");
                    KSCMS.W(i.ToString());
                    KSCMS.W("</td>");
                    KSCMS.W("<td class=\"splittd\">");
                    KSCMS.W("<img class=\"img\" src=\"" + dr["DefaultPic"].ToString() + "\" width=\"45\" height=\"45\" align=\"left\" onerror=\"this.style.display='none'\"/>");
                    KSCMS.W("<a href='" + BasicField.GetItemUrl(Utils.StrToInt(dr["ChannelID"].ToString()), Utils.StrToInt(dr["infoid"].ToString()), Utils.StrToInt(dr["classid"].ToString())) + "' target=\"_blank\">" + dr["title"].ToString() + "</a>");
                    KSCMS.W("</td>");
                    KSCMS.W("<td class=\"splittd\" align=\"center\">" + dr["Inputer"].ToString() + "</td>");
                    KSCMS.W("<td class=\"splittd\" align=\"center\"><span class=\"tips\">" + Utils.FormatHumanizedTime(Convert.ToDateTime(dr["AddDate"].ToString())) + "</span></td>");
                    KSCMS.W("<td class=\"splittd\" style=\"text-align:center\">" + statusStr + "</td>");
                    KSCMS.W("<td class=\"splittd\" align=\"center\">");
                    KSCMS.W(MyCache.GetCacheModel(Utils.StrToInt(dr["ChannelID"].ToString()), 28) != "0" ? @" <a href=""PostInfo.aspx?classid=" + dr["classid"].ToString() + "&infoId=" + dr["infoid"].ToString() + @""">修改</a> <a href=""javascript:;"" onclick=""$.dialog.confirm('确定删除吗?',function(){location.href='main.aspx?action=delinfo&id=" + dr["InfoID"].ToString() + @"';},function(){});"">删除</a>" : "-");
                    KSCMS.W(@"</td></tr>");
                    i++;
                }
            }
            else
            {

                KSCMS.W(@"<tr class=""tr-nobor""><td class=""splittd"" style=""text-align:center"" colspan=""10""><div class=""empty"">找不到任何记录！</div></td></tr>");
            }
        }
        #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));
        }

    }

    public static string getProOrder(int ClassID, string FileName, string TurnUrl, int cartId, int channelId, int infoId, string title, int isBundleSale, int isChangeBuy, int isLimitBuy, string attributecart, int attrid, int orderType = 0)
    {
        if (orderType == 1)
        {
            return "<span><a target='_blank' href='" + BaseFun.GetRewriteUrl("groupbuyview", infoId) + "'>" + title + "</a></span>";

        }
        else
        {
            return Kesion.APPCode.OrderProcess.getProTitle(ClassID, FileName, TurnUrl, cartId, channelId, infoId, title, isBundleSale, isChangeBuy, isLimitBuy, attributecart, attrid);
        }
    }


</script>


<style>
table.border td {border-top: 0!important;}
.border > tr > td {border-bottom: 1px solid #eee;}
</style>
<div class="user_main_r">
 
          <div class="right_01 tabbox01" <%if (BaseFun.CheckModulePower("mall")) { Response.Write(" style='display:none'"); } %>>
             <div class="tit clearfix"><span>我的文章</span>
             <ul class="tabs">
                 <li><a href="#">已审核</a></li>
                 <li><a href="#">待审核</a></li>
                 <li><a href="#">草稿</a></li>
                 <li><a href="#">退稿</a></li>
             </ul>  
             
           </div>
            
             <div class="con right_box r_padbox">


              <!--已审核 begin-->
              <div>
                   <table id="tablist" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
                      <tr class="title">
        	                <td width="40" align="center">序号</td>
        	                <td align="center">标题</td>
                            <td align="center" width="110"> 录入 </td>
                            <td width="100" align="center"> 更新时间 </td>
                            <td align="center" width="50">状态</td>
	                        <td align="center" width="80">管理操作</td>
                        </tr>
                  <%
					  EchoArticle(1);
                  %>
                  </table>
               </div>
                <!---已审核 end--->
               
              <!---待审核 begin--->
               <div>
                    <table id="tablist" width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
                      <tr class="title">
        	                <td width="40" align="center">序号</td>
        	                <td align="center">标题</td>
                            <td align="center" width="110"> 录入 </td>
                            <td width="100" align="center"> 更新时间 </td>
                            <td align="center" width="50">状态</td>
	                        <td align="center" width="80">管理操作</td>
                        </tr>
                        <%
							EchoArticle(0);
                        %>
                    </table>
                    
               </div>
              <!---待审核 end--->

              <!---草稿 begin--->
               <div>
              <table id="tablist" width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
                      <tr class="title">
        	                <td width="40" align="center">序号</td>
        	                <td align="center">标题</td>
                            <td align="center" width="110"> 录入 </td>
                            <td width="100" align="center"> 更新时间 </td>
                            <td align="center" width="50">状态</td>
	                        <td align="center" width="80">管理操作</td>
                        </tr>
                        <%
							EchoArticle(2);
                        %>
                    </table>
               </div>
              <!---草稿 end--->

              <!---退稿 begin--->
               <div>
                    <table id="tablist" width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
                      <tr class="title">
        	                <td width="40" align="center">序号</td>
        	                <td align="center">标题</td>
                            <td align="center" width="110"> 录入 </td>
                            <td width="100" align="center"> 更新时间 </td>
                            <td align="center" width="50">状态</td>
	                        <td align="center" width="80">管理操作</td>
                        </tr>
                        <%
							EchoArticle(3);
                        %>
                    </table>
               </div>
              <!---退稿 end--->
                
             </div>
          </div>
          
     
          <%if (BaseFun.CheckModulePower("mall")&& BaseFun.CheckModulePower("edu")==false)
			{ %>
          <div class="r_tybox nomar">
             <div class="myCourse clearfix" style="border:none; background:#fff">
             <div class="title">
             <span>我买到的宝贝</span>                 
                 <span class="small"> 
                     <a href="<%=BasicField.GetUserUrl("shop/myorder","show--2") %>">待付款(<font><%=DataFactory.GetOnlyValue("select count(1) From KS_ProOrder Where ordertype!=2 and UserName='"+new TemporaryVar().UserName+"' and MoneyReceipt<=0") %></font>)</a>
                     <a href="<%=BasicField.GetUserUrl("shop/myorder","show--3") %>"">待收货(<font><%=DataFactory.GetOnlyValue("select count(1) From KS_ProOrder Where ordertype!=2 and UserName='"+new TemporaryVar().UserName+"' and DeliverStatus=1") %></font>)</a>
                     <a href="<%=BasicField.GetUserUrl("shop/myorder","show--4") %>"">退换货(<font><%=DataFactory.GetOnlyValue("select count(1) From KS_ProOrder Where  (status=3 or status=4) and  UserName='"+new TemporaryVar().UserName+"' and DeliverStatus=1") %></font>)</a>
                     <a href="<%=BasicField.GetUserUrl("shop/mycomment") %>">待评价(<font><%=DataFactory.GetOnlyValue("select count(1) From KS_ProOrder a inner Join KS_ProOrderItem b on a.OrderID=b.OrderID Where (a.DeliverStatus=2 or a.status=2) and b.IsCmt=0 and a.UserName='" + (new TemporaryVar()).UserName + "'")  %></font>)</a>
                 </span>
                 <span class="small" style="float:right;padding-right:20px;"><a href="<%=BasicField.GetUserUrl("shop/myorder") %>">所有订单</a></span>

             </div>
             </div>
             <div class="user_main_r_box r_padbox">

             <!--我的订单 beign-->
            <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="border">
              <tr class="title">
               <td height="25" width="40" nowrap><b>序号</b></td>
               <td style="width:500px;text-align:left">&nbsp;&nbsp;<b>商品</b></td>
               <td width="80" align="center"><b>单价</b></td>
               <td width="80" align="center"><b>数量</b></td>
               <td width="70" align="center"><b>实付</b></td>
               <td width="70" align="center" nowrap><b>状态</b></td>
               <td width="70" align="center" nowrap><b>操作</b></td>
              </tr>
              <%
				using (DataTable dt = DataFactory.GetDataTable("select top 5 * From KS_ProOrder Where ordertype!=2 and UserName='" + __user.UserName + "' order by id desc"))
				{
					if (dt.Rows.Count <= 0)
					{
						KSCMS.W(@" <tr class=""tdbg"">
                            <td class=""splittd"" style=""text-align:center"" colspan=""7"">
                              你买的东西太少了，这里空空的，快去挑选合适的商品吧！
                            </td>
                           </tr> ");

					}
					else
					{
						int i = 1;
						foreach (DataRow dr in dt.Rows)
						{
							KSCMS.W(@"<TR class=""title1"">
				 <td colspan=""7"" style=""padding-top:2px;padding-bottom:2px;padding-left:10px;"">
				 <strong>");

							KSCMS.W(i.ToString() + "、 ");
							KSCMS.W("订单编号：" + dr["orderid"].ToString() + " &nbsp;&nbsp;下单时间：" + Utils.FormatHumanizedTime(Convert.ToDateTime(dr["InputTime"].ToString())));

							KSCMS.W("</strong>");

							KSCMS.W(Convert.ToInt16(dr["ordertype"].ToString()) == 1 ? (string.Concat("<span style='color:Red'>团购</span>", !string.IsNullOrEmpty(dr["verifycode"].ToString()) ? " 消费验证码[<span style='color:green'>" + dr["verifycode"].ToString() + "</span>]" : string.Empty)) : string.Empty);
							KSCMS.W(Convert.ToInt32(dr["changescore"].ToString()) > 0 ? " <span style='color:green'>积分兑换</span>" : string.Empty);

							KSCMS.W(" </td>");

							KSCMS.W("</TR>");
							KSCMS.W(@"<tr class=""tdbg"">
                              <td class=""list_link"" align=""center"" width=""25""></td>
			                  <td  colspan=""3"" align=""left"">");

							#region  商品清单
							string typeId = Convert.ToString(dr["OrderID"]);
							int orderType = Utils.StrToInt(dr["orderType"].ToString());
							string strSQL = string.Empty;
							if (orderType == 1)
							{
								strSQL = "select top 100 0 as channelid,i.photourl as defaultpic,i.subject as title, i.classid,0 as filename,0 as turnurl,0 as AttributeCart,0 as isBundleSale,0 as isChangeBuy,0 as islimitBuy, o.* from KS_ProOrderItem o left join KS_ProGroupBuy I on i.id=o.infoid where o.Orderid='" + typeId + "' order by o.itemid";

							}
							else if (orderType == 2)
							{
								strSQL = "select top 100 0 as channelid,i.photourl as defaultpic,i.subject as title, i.classid,0 as filename,0 as turnurl,0 as AttributeCart,0 as isBundleSale,0 as isChangeBuy,0 as islimitBuy, o.* from KS_ProOrderItem o left join KS_ProFightGroup I on i.id=o.infoid where o.Orderid='" + typeId + "' order by o.itemid";

							}
							else
							{
								strSQL = "select top 100 i.channelid,i.defaultpic,i.title,i.classid,i.filename,i.turnurl,i.AttributeCart,o.isBundleSale,i.isChangeBuy,I.islimitBuy,o.* from KS_ProOrderItem o left join KS_ProductList I on i.infoid=o.infoid where o.Orderid='" + typeId + "' order by o.itemid";
							}
							using (DataTable dtt = DataFactory.GetDataTable(strSQL))
							{
								if (dtt.Rows.Count > 0)
								{
									foreach (DataRow drr in dtt.Rows)
									{
										KSCMS.W(@"<table width=""100%"" class=""table1"" cellpadding=""0"" cellspacing=""0"" border=""0"">");
										KSCMS.W(@"<tr class=""TR_BG_list"">");
										KSCMS.W(@"<td class=""splittd"" align=""left"" style=""width:500px"">");
										KSCMS.W(@"<table border='0' width=""100%"" cellpadding=""0"" cellspacing=""0"">");

										KSCMS.W(@"<tr>");

										KSCMS.W(@"<td width=""60"" height=""70"" align=""center"" class=""img""><img onerror=""this.src='" + MyCache.GetCacheShopConfig(9) + @"';"" src='" + drr["DefaultPic"].ToString() + "' width='50' height='50' align='left'/></td>");
										KSCMS.W(@"<td>");

										KSCMS.W(getProOrder(Utils.StrToInt((drr["ClassID"].ToString())), Convert.ToString(drr["FileName"].ToString() + ""), Convert.ToString(drr["TurnUrl"].ToString() + ""), Utils.StrToInt(drr["ItemID"].ToString()), Utils.StrToInt(drr["ChannelID"].ToString()), Utils.StrToInt(drr["InfoID"].ToString()), string.IsNullOrEmpty(Convert.ToString(drr["Title"].ToString() + "")) ? Convert.ToString(drr["Title"].ToString() + "") : Convert.ToString(drr["Title"].ToString()), Utils.StrToInt(drr["isBundleSale"].ToString()), Utils.StrToInt(drr["isChangeBuy"].ToString()), Utils.StrToInt(drr["isLimitBuy"].ToString()), Convert.ToString(drr["AttributeCart"].ToString()), Utils.StrToInt(drr["attrID"].ToString()), orderType));

										KSCMS.W(@"</td>");
										KSCMS.W(@"<tr>");
										KSCMS.W("</table>");
										KSCMS.W("</td>");
										KSCMS.W(@" <td class=""splittd"" style=""width:80px;"">" + MyCache.GetCurrencySymbol + Kesion.APPCode.Public.ReturnShopPrice(Convert.ToString(drr["Price"].ToString())) + "</td>");
										KSCMS.W(@"<td class=""splittd"" style=""width:80px;text-align:center"">" + drr["num"].ToString() + "</td>");
										KSCMS.W("</table>");


									}
								}
							}
							#endregion



							KSCMS.W("</td>");
							KSCMS.W(@"<td class=""list_link"" style=""text-align:center"" valign=""center"">");
							KSCMS.W(Utils.StrToInt(dr["ChangeScore"].ToString()) > 0 ? "" + dr["ChangeScore"].ToString() + "分+" : string.Empty);
							KSCMS.W(MyCache.GetCurrencySymbol + Kesion.APPCode.Public.ReturnShopPrice(Convert.ToString(dr["OrderTotalPrice"].ToString())));


							KSCMS.W("</td>");
							KSCMS.W(@"<td class=""list_link"" style=""text-align:center"" nowrap valign=""center"">");
							KSCMS.W(Kesion.APPCode.OrderProcess.GetOrderStatus(true, Utils.StrToInt(dr["ordertype"].ToString()), Convert.ToString(dr["OrderID"].ToString()), Utils.StrToInt(dr["ConsumptionMode"].ToString()), Utils.StrToInt(dr["IsBusinessConfirm"].ToString()), Convert.ToString(dr["alipaytradestatus"].ToString()), Convert.ToInt16(dr["status"].ToString()), Convert.ToInt16(dr["DeliverStatus"].ToString()), Utils.StrToDecimal(Convert.ToString(dr["MoneyReceipt"].ToString())), Utils.StrToDecimal(Convert.ToString(dr["OrderTotalPrice"].ToString()))));
							KSCMS.W("</td>");
							KSCMS.W(@"<td class=""list_link"" style=""text-align:center"" nowrap valign=""center"">");

							KSCMS.W(@"<a href=""" + BasicField.GetUserUrl("shop/ShowMyOrder", "id-" + dr["id"].ToString()) + @""">订单详情</a>");


							KSCMS.W(((((float)Convert.ToDouble(dr["MoneyReceipt"].ToString()) > 0 && Convert.ToString(dr["DeliverStatus"].ToString()) == "0") || Convert.ToString(dr["DeliverStatus"].ToString()) == "2") && Utils.StrToInt(dr["status"].ToString()) <= 1 && Utils.StrToInt(dr["IsBusinessConfirm"].ToString()) == 0) ? "<br/><a href='" + BasicField.GetUserUrl("shop/showmyorder", "action-returns,id-" + dr["id"].ToString()) + "'>退货退款</a>" : string.Empty);


							KSCMS.W(Convert.ToString(dr["DeliverStatus"].ToString()) == "1" || Convert.ToString(dr["DeliverStatus"].ToString()) == "13" ? @"<br/><a href='javascript:;' onclick=""KesionJS.Confirm('此操作不可逆，您确定收到商品了吗？', 'location.href=\'" + BasicField.GetUserUrl("shop/ShowMyOrder", "id-" + dr["id"].ToString() + @",action-signorder") + @"\';', null);"">确认收货</a>" : "");

							KSCMS.W((Convert.ToString(dr["status"].ToString()) == "1" && Convert.ToString(dr["DeliverStatus"].ToString()) == "2") ? @"<br/><a href='javascript:;' onclick=""KesionJS.Confirm('订单一旦结清，就可能再对该订单进行任何操作，确定结清吗？', 'location.href=\'" + BasicField.GetUserUrl("shop/ShowMyOrder", "id-" + dr["id"].ToString() + @",action-finishorder") + @"\';', null);"">结清订单</a>" : "");

							KSCMS.W(Convert.ToString(dr["status"].ToString()) == "0" && Convert.ToString(dr["DeliverStatus"].ToString()) == "0" && Utils.StrToFloat(Convert.ToString(dr["MoneyReceipt"].ToString())) == 0 ? "<br /><a href='" + BasicField.GetUserUrl("Shop/myorder", "action-delorder,id-" + dr["id"].ToString()) + @"' onClick=""return(confirm('此操作不可逆，确定执行删除操作吗？'))"">订单删除</a>" : "");

							KSCMS.W(Convert.ToString(dr["PayStatus"].ToString()) != "1" && Convert.ToInt16(dr["status"].ToString()) < 2 ? "<br/><a href='" + BasicField.GetUserUrl("Shop/myOrderPay", "id-" + dr["id"].ToString()) + "'>订单支付</a>" : "");
							KSCMS.W(!string.IsNullOrEmpty(MyCache.GetShopCommonConfig(42)) && Convert.ToString(dr["ConsumptionMode"].ToString()) == "1" && Convert.ToString(dr["DeliverStatus"].ToString()) == "1" ? "<br/><a href='" + BasicField.GetUserUrl("shop/showmyorder", "action-expresslog,orderid-" + dr["OrderID"].ToString()) + "'>查看物流</a>" : string.Empty);
							KSCMS.W("<br />");
							KSCMS.W(Kesion.APPCode.OrderProcess.GetCommentTips(Convert.ToInt16(dr["ordertype"].ToString()), Convert.ToInt16(dr["status"].ToString()), Convert.ToInt16(dr["DeliverStatus"].ToString()), Convert.ToString(dr["OrderID"].ToString())));

							KSCMS.W(Utils.StrToInt(dr["DeliverStatus"].ToString()) == 9 || Utils.StrToInt(dr["DeliverStatus"].ToString()) == 11 ? "<a href='" + BasicField.GetUserUrl("Shop/ShowMyOrder", "action-ExpressNumber,DeliverStatus-" + dr["DeliverStatus"].ToString() + ",id-" + dr["id"].ToString()) + "'>已同意,我要寄回</a>" : "");
							KSCMS.W((Utils.StrToInt(dr["ordertype"].ToString()) <= 1 && (Utils.StrToInt(dr["DeliverStatus"].ToString()) == 1 || Utils.StrToInt(dr["DeliverStatus"].ToString()) == 2)) ? @"<br/><input type=""button"" value=""再次购买"" class=""button"" onclick=""window.open('" + BasicField.GetUserUrl("shop/MyOrder", "action-rebuy,orderid-" + dr["OrderID"].ToString()) + @"')"" />" : string.Empty);


							KSCMS.W(@" </td>

                                  </tr>");

							i++;
						}
					}
				}
              %>
                </table>
                 <div>11111111</div>
                 <!--我的订单 end-->
             </div>
          </div>
            
            <script>
            	$(".tabbox01").FengTab({ titCell: ".tabs", mainCell: ".con", defaultIndex: 0, trigger: "mouseover", titOnClassName: "puton", showtime: 0 });
            	$(".tabbox03").FengTab({ titCell: ".tabs", mainCell: ".con", defaultIndex: 0, trigger: "mouseover", titOnClassName: "puton", showtime: 0 });
            </script>    
         
        <%} %> 
          
        


 <script runat="server">
	 public static DataRow dr;
	 public static DataRow dr1;
	 public static DataRow dr2;
	 public static DataRow dr3;
	 public static DataTable dk;
	 public static string name;
	 public static string tname;
	 public static string goodsmoney, paytime, Target;

	 protected static string load()
	 {
		 bind();
		 return "已购买课程";
	 }

	 public static void bind()
	 {
		 string sqlParam = "select top 6 a.id,c.CourseID as courseid,b.Name,b.TeacherName,b.CountPid,c.shixian,a.paytime,GoodsMoney,Target,c.ordertype from KS_CosOrderItem c inner join   KS_CosOrder a on c.orderid=a.orderid  inner join KS_course b  on (c.courseid=b.courseid and c.orderid=a.orderid)  where TeachWay=1 and c.ordertype<>5 and a.Status=1 and  a.username ='" + UserManage.GetUserInfo().UserName + "' order by  paytime deSC";

		 using (dk = DataFactory.GetDataTable(sqlParam))
		 {
			 if (dk.Rows.Count > 0)
			 {
				 dr = dk.Rows[0];
			 }
		 }
	 }
	 public static DataTable datadt()
	 {
		 string sqlParam = "select top 3 CourseID, Name,teacherid,TeacherName,addtime,Target,Intro,Price_Member,photourl,buycount from  KS_course where TeachWay=1 and isfree>=1 and verify=1  order by newid(), lookcount deSC";

		 using (DataTable dt = DataFactory.GetDataTable(sqlParam))

			 return dt;

	 }
	 

	 public static string ChangeTime(int times)
	 {
		 int h = times / 3600;
		 int m = (times - 3600 * h) / 60;
		 int s = times - h * 3600 - m * 60;

		 return (h + "小时" + m + "分" + s + "秒");
	 }
    

    </script>
    <script>
    	$('.tabs li').click(function () {
    		$(this).addClass('puton').siblings().removeClass('puton');
    		$('.per-content>.tabitem:eq(' + $(this).index() + ')').show().siblings().hide();

    	})
    </script>