<%@ Control Language="C#" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.HtmlTags" %>
<%@ Import Namespace="Kesion.APPCode" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Course" %>
<%@ Import Namespace="Kesion.Components" %>
<%@ Import Namespace="System.Xml" %>
<script runat="server" type="text/C#">
    dynamic __user = HttpContext.Current.Items["user"];                //初始化用户信息，
    private static dynamic __info = new System.Dynamic.ExpandoObject();   //初始化当前页信息
    bool isLoadPage = true;  //定义页面是否加载
    public string KejianID = string.Empty;
    public string KeJianUrl = string.Empty;
    public string sqlParam = "";
    public int t_free = 0;
    public EpConfig ep = new EpConfig();
    public int CurrPage = new BasicField().GetCurrPage;
    public int PageSize = 14;
    public int recordcount, pagecount;
    public string TcVerify = "1";
    public int system = 0;
    public int pid = 0;



    protected void Page_Load(object sender, EventArgs e)
    {
        if (__user.GroupID != 3 && __user.GroupID != 4)
        {
            Msg.Alert("对不起，没有权限！");
            isLoadPage = false;
            return;
        }


        Course.CheckMVCVerify();//判断权限



        if (__user.GroupID == 4)
        {
            sqlParam = "KS_Course Where TeachWay IN(1,2) and userid=" + __user.UserID;
            system = 2;
        }
        else
        {
            system = 1;
            sqlParam = "KS_Course Where TeachWay IN(1,2) and schoolid=" + __user.UserID;
        }


        infoInitial();
        string DoMethod = KSCMS.S("do");

        switch (DoMethod)
        {
            case "add":
                new Kesion.Course.Course().CheckFree(0);
                if (!EnterPrise.GetTotal("course", 0))
                {
                    Msg.Alert("对不起，您添加的课程数量已达到上限!", KSCMS.GetComeUrl());
                    isLoadPage = false;
                    return;
                }
                break;
            case "verify":
                DataFactory.ExecuteNonQuery("UPDATE [KS_Course] SET [verify] = 0 WHERE system=2 and  courseid =" + __info.courseid);
                KSCMS.Redirect(KSCMS.GetComeUrl());
                break;
            case "modify":
                initialEdit(__info.courseid); //编辑
                break;
            case "del":
                deleteCourse(__info.courseid.ToString());
                break;
            case "getsj":
                GetSJ();
                break;
            case "sell":
                //操作上下架
                CommonData.UpdateFieldStatus("KS_Course", "IsOff", "courseid", Utils.StrToInt(KSCMS.S("courseid")));
                Msg.Alert("操作成功", BasicField.GetUserUrl("teacher/courselist"));
                break;
        }


        if (KSCMS.S("action").Equals("save"))
        {
            Utils.TipsDisabled();  //检查是否演示状态
            saveCourse();
        }
        if (KSCMS.S("action").Equals("del"))
        {
            deleteCourse(KSCMS.S("ids"));
        }
        if (KSCMS.S("action").Equals("getsj"))
        {
            GetSJ();
        }
        string sql = "select top 1 DefaultPic,free,courseClass from KS_enterprise where userid=" + new TemporaryVar().UserID;
        if (new TemporaryVar().GroupID == 4)
        {
            sql = "select top 1  FaceClass,CourseClass,ExamClass from KS_CosTeacher where userid=" + new TemporaryVar().UserID;
        }
        using (DataTable dt = DataFactory.GetDataTable(sql))
        {
            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];

                if (string.IsNullOrEmpty(dr["courseClass"].ToString()) && new TemporaryVar().SchoolID == 0)
                {
                    Msg.Alert("请先设置在线分类", KSCMS.GetComeUrl());

                }
            }
        }
    }


    protected void saveCourse()
    {
        infoInitial();
        Hashtable ht = new Hashtable();

        ht.Add("ClassID", Utils.StrToInt(__info.ClassID));
        /** 多课程分类选择  ***/
        string proids = string.Empty;

        ht.Add("MoreClass", __info.MoreClass); //多课程分类
                                               /** 多课程分类选择  ***/
        ht.Add("tcid", __info.tcid);
        ht.Add("IsOtherTc", Utils.StrToInt(__info.IsOtherTc)); //是否有其他教师    

        if (Utils.StrToInt(__info.IsOtherTc) == 0)
        {
            ht.Add("TeacherName", "");//其他教师名称
        }
        else
        {
            ht.Add("TeacherName", Utils.RemoveXss(__info.techertest));//其他教师名称
        }
        ht.Add("teacher", BaseFun.GetTeacher(KSCMS.S("teacherlist")));  //主教
        ht.Add("cityid", __info.CityId);
        ht.Add("Provinceid", __info.Provinceid);
        ht.Add("CountyId", __info.CountyId);
        ht.Add("name", __info.TxtName);
        if (string.IsNullOrEmpty(__info.TxtShortName))
        {
            ht.Add("ShortName", Utils.CutStr(__info.TxtName, 100));//短课程名称（新增加的字段）
        }
        else
        {
            ht.Add("ShortName", __info.TxtShortName);//短课程名称（新增加的字段）
        }
        ht.Add("Intro", (__info.TxtIntro));
        ht.Add("Target", (__info.TxtTarget));
        ht.Add("Notice", (__info.TxtNotice));
        ht.Add("recommend", 0);
        ht.Add("popular", 0);
        ht.Add("istop", 0);
        ht.Add("huandeng", 0);
        ht.Add("comment", 0);
        ht.Add("tryout", 0);
        ht.Add("is3g", 1);
        ht.Add("shixian", Utils.StrToInt(__info.shixian));//有效期
        ht.Add("seotitle", Utils.RemoveXss(__info.TxtName));
        // ht.Add("listeningID", Utils.RemoveXss(__info.listeningID));  //试听
        ht.Add("system", system);
        //ht.Add("IsExam", 1);//是否有试卷
        #region 服务统一管理
        ht.Add("liveType", __info.LiveType);
        ht.Add("accountid", KSCMS.S("accountid"));
        #endregion
        if (Utils.StrToInt(__info.regulations) > 100)
        {
            ht.Add("regulations", 100);
        }
        else if (Utils.StrToInt(__info.regulations) <= 0)
        {
            ht.Add("regulations", 0);
        }
        else
        {
            ht.Add("regulations", Utils.StrToInt(__info.regulations));
        }
        ht.Add("zhekou", __info.zhekou);   //折扣
        ht.Add("Money", Utils.StrToFloat(__info.Money)); //参考价
        ht.Add("Price_Member", Utils.StrToFloat(__info.Price_Member)); //市场价
        #region 设置VIP
        if (__info.Promotion != 3)
        {
            ht.Add("ISLoad", Utils.StrToInt(__info.ISLoad));
            if (__info.ISLoad == "1")
            {
                if (Utils.StrToFloat(__info.Loadzhekou) < 0)
                {
                    __info.Loadzhekou = "0";
                }
                else if (Utils.StrToFloat(__info.Loadzhekou) > 10)
                {
                    __info.Loadzhekou = "10";
                }

                ht.Add("Loadzhekou", Utils.StrToFloat(__info.Loadzhekou));
                ht.Add("FixedPrice", 0);
            }
            else if (__info.ISLoad == "0")
            {
                ht.Add("Loadzhekou", 0);
                ht.Add("FixedPrice", 0);
            }
            else if (__info.ISLoad == "2")
            {
                ht.Add("Loadzhekou", 0);
                ht.Add("FixedPrice", Utils.StrToFloat(__info.FixedPrice));
            }
        }
        else
        {
            #region 积分设置VIP
            if (Utils.StrToInt(__info.IsVip) == 3)
            {
                ht.Add("ISLoad", 0);//VIP免费
            }
            else
            {
                ht.Add("ISLoad", -1);
            }
            #endregion
        }
        #endregion
        #region 促销类型  普通课程才有捆绑销售
        if (Utils.StrToInt(__info.Promotion) == 1)
        {
            ht.Add("isBind", 0);
            ht.Add("begintime", __info.begintime);//开始
            ht.Add("endtime", __info.endtime);//结束
            ht.Add("PanicMoney", Utils.StrToFloat(__info.PanicMoney));//抢购价
            ht.Add("Limited", Utils.StrToInt(__info.Limited));//报名人数上限
        }
        else if (Utils.StrToInt(__info.Promotion) == 2)
        {
            ht.Add("isBind", 0);
            ht.Add("PanicMoney", Utils.StrToFloat(__info.PanicMoney));//抢购价
            ht.Add("Limited", Utils.StrToInt(__info.Limited));//报名人数上限
        }
        else if (Utils.StrToInt(__info.Promotion) == 3)
        {
            #region 积分
            ht.Add("isBind", 0);
            ht.Add("PanicMoney", 0);//抢购价
            ht.Add("jifen", Utils.StrToInt(__info.jifen));//积分
            #endregion
        }
        ht.Add("Promotion", Utils.StrToInt(__info.Promotion));//促销类型
        #endregion
        ht.Add("photourl", Utils.ChkSQL(__info.DefaultPic));//图片
        ht.Add("IsOff", __info.RBIsOff);//出售方式
        #region 课时
        Hashtable ht2 = new Hashtable();
        if (__info.IsKS == "0")//没有课时隐形加入课时表的
        {
            ht2.Add("PeriodName", __info.TxtName);
            ht2.Add("Addtype", 4);
            ht2.Add("ParentID", 0);
            if (Utils.StrToInt(__info.ChargeType) == 2)
            {
                ht2.Add("IsFree", 1);
            }
            else
            {
                ht2.Add("IsFree", Utils.StrToInt(__info.ChargeType));//是否免费
            }
            ht2.Add("ban_seek", Utils.StrToInt(KSCMS.S("ban_seek")));

            if (__info.LiveType == "0")
            {
                ht2.Add("OtherVideo", __info.TxtOrherVideo);
                ht2.Add("IsMobilePlayerJS", KSCMS.S("TxtIsMobileLivePlayerJS"));
            }


            Kesion.Course.Course.DoCoursePeiodSave(ht2);

        }
        #endregion
        string SJIDs = string.Empty;
        if (KSCMS.S("action").Equals("add"))
        {
            SJIDs = KSCMS.S("LstB1");
        }
        else
        {
            string sql = "select examPleID,IsExam from KS_Course where CourseId=" + __info.courseid;
            using (DataTable dt = DataFactory.GetDataTable(sql))
            {
                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];

                    if (Utils.StrToInt(__info.RadioButtonList1) == 2)
                    {
                        if (string.IsNullOrEmpty(dr["examPleID"].ToString()) || dr["examPleID"].ToString() == "0")
                        {
                            SJIDs = KSCMS.S("LstB1");
                        }
                        else if (string.IsNullOrEmpty(KSCMS.S("LstB1")))
                        {

                        }
                        else
                        {
                            SJIDs = SJIDs + "," + KSCMS.S("LstB1");
                        }
                    }
                }
            }
        }
        SJIDs = Utils.FilterIDs(SJIDs);
        SJIDs = Utils.FilterRepeatInArray(SJIDs, ",");
        ht.Add("examPleID", SJIDs);
        ht.Add("IsExam", __info.RadioButtonList1);

        if (BaseFun.CheckFieldExists("KS_Course", "IsSendNote"))   //是否邮寄资料
        {
            ht.Add("IsSendNote", Utils.StrToInt(__info.IsSendNote1));
            ht.Add("NotePrice", Utils.StrToDecimal(Utils.StrToDecimal(__info.NotePrice).ToString("f2")));   //保留2位小数
            ht.Add("NoteContent", __info.NoteContent);
            ht.Add("IsContainTax", Utils.StrToInt(__info.IsContainTax1));  //课程是否含税
        }

        if (KSCMS.S("do").Equals("add"))
        {
            ht.Add("IsPeriod", Utils.StrToInt(__info.IsKS.ToString()));
            ht.Add("IsFree", Utils.StrToInt(__info.ChargeType));//是否免费
            ht.Add("ChargePeriod", 1);//1不允许设置课时的价格
            ht.Add("TeachWay", Utils.StrToInt(KSCMS.S("RdbTeachWay").ToString()));   //授课方式 1为网上授课 0为面授 2为组合课程
            //企业/教师添加这了段
            Kesion.Controls.CustomFields.DoSchoolFieldSave(ref ht, "course");
            ht.Add("UserID", __user.UserID);//后台管理者
            ht.Add("username", __user.UserName);//后台管理者
            DateTime _time = DateTime.Now;
            ht.Add("addTime", _time);
            if (EnterPrise.GetTotal("course", 0))
            {
                CommonData.Insert("KS_Course", ht);

                if (ep.GetEpConfig(8) == "0" || Teacher.TcAddIsVeryfy("course") == "0")
                {
                    EnterPrise.AddInorOutScore("course", "cosadd", __user.UserName, __user.UserID);
                }

                int courseId = Utils.StrToInt(CommonData.GetMaxId("KS_Course", "courseid"));
                #region 课时
                if (__info.IsKS == "0")//没有课时隐形加入课时表的
                {
                    ht2.Add("AddDate", DateTime.Now);
                    ht2.Add("UserName", __user.UserName);
                    ht2.Add("CourseID",courseId );
                    CommonData.Insert("KS_CosPeriod", ht2);
                }
                #endregion
                if (__user.GroupID == 3 || __user.GroupID == 3 && new TemporaryVar().SchoolID > 0)
                {
                    int uid = new TemporaryVar().SchoolID;
                    if (__user.GroupID == 3)
                    {
                        uid = new TemporaryVar().UserID; ;
                    }
                    DataFactory.ExecuteNonQuery("UPDATE [KS_EnterPrise] SET [CourseTotal] = [CourseTotal] + 1 WHERE  userid ='" + uid + "'");//            
                }
                if (__user.GroupID == 4)
                {
                    DataFactory.ExecuteNonQuery("UPDATE [KS_CosTeacher] SET [CourseTotal] = [CourseTotal] + 1 WHERE system=2 and Field ='" + __user.UserName + "'");//
                }
                Kesion.Course.Course.UpdateCourseInfo(courseId.ToString());  //更新课程统计及缓存
                Msg.Alert("恭喜,课程添加成功!", BasicField.GetUserUrl("teacher/CourseList"));

            }
            else
            {
                JS.Alert("您添加课数已达上限", BasicField.GetUserUrl("teacher/courselist"));
            }

            isLoadPage = false;
            return;
        }
        else
        {
            Kesion.Controls.CustomFields.DoSchoolFieldSave(ref ht, "edit");
            CommonData.Update("KS_Course", ht, "where CourseId=" + __info.courseid);
            #region 课时
            if (__info.IsKS == "0")//没有课时隐形加入课时表的
            {
                ht2.Add("CourseID", __info.courseid);
                CommonData.Update("KS_CosPeriod", ht2, " where Addtype=4 and CourseId=" + __info.courseid);
            }
            #endregion
            #region 更新课时的收费状态
            if (Utils.StrToInt(__info.ChargeType) == 0)
            {
                #region 免费
                DataFactory.ExecuteNonQuery("update KS_CosPeriod set IsFree=0 where CourseId=" + Utils.StrToInt(__info.courseid));
                #endregion
            }
            else if (Utils.StrToInt(__info.ChargeType) == 1)
            {
                #region 收费
                if (Utils.StrToFloat(__info.Money) <= 0 && Utils.StrToFloat(__info.Price_Member) <= 0)
                {
                    DataFactory.ExecuteNonQuery("update KS_CosPeriod set IsFree=0 where CourseId=" + Utils.StrToInt(__info.courseid));
                }
                #endregion
            }
            #endregion
            Kesion.Course.Course.UpdateCourseInfo(__info.courseid.ToString());  //更新课程统计及缓存
            Msg.Alert("恭喜,课程修改成功!", BasicField.GetUserUrl("teacher/CourseList"));
            isLoadPage = false;
            return;
        }
    }
    private void deleteCourse(string CourseId)
    {
        if (CourseId == null || CourseId == "0") return;

        CourseId = Utils.FilterIDs(CourseId);

        string result = Kesion.Course.Course.DeleteCourse(CourseId, true, false, true, __user.UserID);  //调用删除课程

        Msg.Alert("恭喜,课程删除成功!", BasicField.GetUserUrl("teacher/courselist"));
        isLoadPage = false;
        return;
    }


    private void infoInitial()
    {
        if (KSCMS.S("do").Equals("add"))
        {

            __info.Label1 = "添加点播课程";
            __info.RdbTeachWay =Utils.StrToInt(KSCMS.S("RdbTeachWay").ToString(),1).ToString();
            __info.IsKS = Utils.StrToInt(KSCMS.S("IsKS"),1).ToString();
            __info.ChargeType =Utils.StrToInt(KSCMS.S("ChargeType"),0).ToString();//是否免费
            Dictionary<string, string> PeriodInfo = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
            Kesion.Course.Course.InitalCoursePeriod(PeriodInfo, 0, "user");
            Context.Items["courseperiod"] = PeriodInfo;
            this.PeriodPlace.Controls.Add(base.LoadControl("~/Config/Control/SystemCourse/CoursePeriod.ascx"));
            __info.begintime = DateTime.Now.ToString();
            __info.endtime = DateTime.Now.AddMonths(1).ToString();
        }
        else
        {

            __info.Label1 = "修改点播课程";
            __info.begintime = KSCMS.S("begintime");
            __info.endtime = KSCMS.S("endtime");

        }
        __info.IsVip= Utils.StrToInt(KSCMS.S("IsVip"));
        __info.courseid = Utils.StrToInt(KSCMS.S("courseid"));
        __info.TxtName = KSCMS.S("TxtName");//课程名称
        __info.TxtShortName = KSCMS.S("TxtShortName");//简短标题
        __info.TxtIntro = KSCMS.S("TxtIntro");//课程介绍
        __info.TxtTarget = KSCMS.S("TxtTarget");//课程目标                                                                               
        __info.photourl = KSCMS.S("photourl");//图片
        __info.shixian = Utils.StrToInt(KSCMS.S("shixian")).ToString();
        __info.TxtNotice = KSCMS.S("TxtNotice");//课程公告                                    
        __info.RadioButtonList1 = Utils.StrToInt(KSCMS.S("RadioButtonList1")).ToString();//是否免费
        __info.IsSendNote1 = Utils.StrToInt(KSCMS.S("IsSendNote1"), 0).ToString();
        __info.NotePrice = Utils.StrToFloat(KSCMS.S("NotePrice"), 0).ToString();
        __info.NoteContent = KSCMS.S("NoteContent");
        __info.IsContainTax1 = Utils.StrToInt(KSCMS.S("IsContainTax")).ToString();

        __info.zhekou = KSCMS.S("zhekou");//折扣        
        __info.ISLoad = Utils.StrToInt(KSCMS.S("ISLoad")).ToString();//是否年费用户收费
        __info.Loadzhekou = KSCMS.S("Loadzhekou");//收费折扣
        __info.FixedPrice = KSCMS.S("FixedPrice");//收费固定价格
        __info.Price_Member = KSCMS.S("Price_Member");//课程市场价格
        __info.Money = KSCMS.S("Money");//课程参考价
        __info.radiotype = Utils.StrToInt(KSCMS.S("radiotype")).ToString();
        __info.TxttimeCount = KSCMS.S("TxttimeCount");
        __info.TxtUrl = KSCMS.S("TxtUrl");
        __info.WapUrl = KSCMS.S("WapUrl");
        __info.TextAddress = KSCMS.S("TextAddress");
        __info.TxtYunVideoID = KSCMS.S("TxtYunVideoID");
        __info.TxtOrherVideo = KSCMS.S("TxtOrherVideo");
        __info.TxtMobileOrherVideo = KSCMS.S("TxtMobileOrherVideo");
        __info.Textppt = KSCMS.S("Textppt");
        __info.PeriodTxtIntro = KSCMS.S("PeriodTxtIntro");
        __info.ClassID = KSCMS.S("DrpClassID1");//课程分类
        __info.MoreClass = KSCMS.S("MoreClassList");//更多分类

        __info.LiveType = KSCMS.S("LiveType");
        __info.listeningID = KSCMS.S("listeningID");
        __info.RBIsOff = Utils.StrToInt(KSCMS.S("RBIsOff").ToString()).ToString();
        __info.regulations = Utils.StrToInt(KSCMS.S("regulations"));
        __info.DefaultPic = KSCMS.S("DefaultPic");
        __info.IsOtherTc = Utils.StrToInt(KSCMS.S("IsOtherTc").ToString()).ToString();
        __info.techertest = KSCMS.S("techertest");
        __info.Promotion = Utils.StrToInt(KSCMS.S("Promotion").ToString());
        __info.PanicMoney = Utils.StrToFloat(KSCMS.S("PanicMoney").ToString());
        __info.Provinceid = Utils.StrToInt(KSCMS.S("Provinceid").ToString());
        __info.CityId = Utils.StrToInt(KSCMS.S("CityId").ToString());
        __info.CountyId = Utils.StrToInt(KSCMS.S("CountyId").ToString());
        __info.t_free = 0;
        __info.epDefaultPic = KSCMS.S("epDefaultPic").ToString();
        __info.jifen = Utils.StrToInt(KSCMS.S("jifen"));
        __info.IsSetPrice = 1;
        __info.LstB1 = KSCMS.S("LstB1").ToString();
        __info.Limited = KSCMS.S("Limited");
        __info.LstB2 = "";
        __info.tcid = Teacher.getTcID();



    }
    private void initialEdit(int CourseId)
    {
        SqlParam[] param = new SqlParam[1];
        param[0] = new SqlParam("CourseId", CourseId);

        using (DataTable dt = CommonData.GetDataTable("[KS_Course]", "*", param))
        {
            if (dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];
                pid = Utils.StrToInt(dr["accountid"].ToString());

                #region 隐形课时
                __info.IsKS = dr["IsPeriod"].ToString();
                __info.LiveType = dr["LiveType"].ToString();
                if (dr["teachway"].ToString() == "2")
                {
                    __info.IsKS = "1";
                }
                if (__info.IsKS == "0")
                {
                    using (DataTable dtt = DataFactory.GetDataTable("select top 1 * from KS_CosPeriod where   username='" + __user.UserName + "'and Addtype=4 and Courseid=" + CourseId))
                    {
                        if (dtt.Rows.Count > 0)
                        {
                            DataRow drr = dtt.Rows[0];

                            Dictionary<string, string> PeriodInfo = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

                            Kesion.Course.Course.InitalCoursePeriod(PeriodInfo, 0, "user", drr, 1);
                            Context.Items["courseperiod"] = PeriodInfo;
                            this.PeriodPlace.Controls.Add(base.LoadControl("~/Config/Control/SystemCourse/CoursePeriod.ascx"));

                        }
                    }
                }
                else
                {
                    Dictionary<string, string> PeriodInfo = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

                    Kesion.Course.Course.InitalCoursePeriod(PeriodInfo, 0, "user");
                    Context.Items["courseperiod"] = PeriodInfo;
                    this.PeriodPlace.Controls.Add(base.LoadControl("~/Config/Control/SystemCourse/CoursePeriod.ascx"));

                }
                #endregion

                if (__user.GroupID == 4 || DataFactory.GetOnlyValue("select top 1 IsSetPrice from KS_EnterPrise where userid=" + new TemporaryVar().UserID + "") == "1" || Utils.StrToInt(dr["IsFree"].ToString()) == 1)
                {
                    __info.IsSetPrice = 1;
                    __info.ISLoad = Utils.StrToInt(dr["ISLoad"].ToString()).ToString();//是否年费用户收费
                    __info.Loadzhekou = dr["Loadzhekou"].ToString();//收费折扣
                    __info.FixedPrice = Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(dr["FixedPrice"].ToString()));//收费固定价格

                    __info.Promotion = Utils.StrToInt(dr["promotion"].ToString());
                    if (Utils.StrToInt(dr["promotion"].ToString(), 0) == 1)
                    {
                        __info.begintime = dr["begintime"].ToString();
                        __info.endtime = dr["endtime"].ToString();
                        __info.PanicMoney = Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(dr["PanicMoney"].ToString()));
                        __info.Limited = dr["Limited"].ToString();
                    }
                    else if (Utils.StrToInt(__info.Promotion) == 2)
                    {
                        __info.PanicMoney = Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(dr["PanicMoney"].ToString()));
                        __info.Limited = dr["Limited"].ToString();

                    }
                    else if (Utils.StrToInt(__info.Promotion) == 3)
                    {
                        __info.jifen = dr["jifen"].ToString();
                    }
                }
                else
                {
                    __info.IsSetPrice = 0;
                }
                __info.RdbTeachWay = dr["TeachWay"].ToString();
                __info.RBIsOff = dr["IsOff"].ToString();
                __info.CountyId = Utils.StrToInt(dr["CountyId"].ToString());
                __info.Provinceid = Utils.StrToInt(dr["Provinceid"].ToString());
                __info.CityId = Utils.StrToInt(dr["Cityid"].ToString());
                __info.courseid = Utils.StrToInt(dr["courseid"].ToString());
                __info.TxtName = dr["Name"].ToString();//课程名称
                __info.TxtShortName = dr["ShortName"].ToString();//简短标题
                __info.TxtIntro = dr["Intro"].ToString();//课程介绍
                __info.TxtTarget = dr["Target"].ToString();//课程目标                                                                               
                __info.photourl = dr["photourl"].ToString();//图片
                __info.shixian = dr["shixian"].ToString();
                __info.TxtNotice = dr["Notice"].ToString();//课程公告                                
                __info.ChargeType = Utils.StrToInt(dr["IsFree"].ToString()).ToString();//是否免费
                __info.zhekou = dr["zhekou"].ToString();//折扣        
                __info.ISLoad = Utils.StrToInt(dr["ISLoad"].ToString()).ToString();//是否年费用户收费
                #region 积分设置VIP
                if (Utils.StrToInt(dr["ISLoad"].ToString()) == 0)
                {
                    __info.IsVip = 3;//是否年费用户收费
                }
                #endregion
                __info.Loadzhekou = dr["Loadzhekou"].ToString();//收费折扣
                                                                //__info.FixedPrice = Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(dr["FixedPrice"].ToString()));//收费固定价格
                __info.Price_Member = Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(dr["Price_Member"].ToString()));//课程市场价格
                __info.Money = Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(dr["Money"].ToString()));//课程参考价
                __info.ClassID = dr["classid"].ToString();
                __info.MoreClass = dr["MoreClass"].ToString();
                __info.regulations = dr["regulations"].ToString(); // 试卷状态规定
                //__info.listeningID = dr["listeningID"].ToString();
                __info.IsOtherTc = Utils.StrToInt(dr["IsOtherTc"].ToString()).ToString();//是否其他教师
                __info.techertest = dr["TeacherName"].ToString();  //其他教师                   
                __info.tcid = dr["tcid"].ToString(); //名师ID；
                __info.DefaultPic = dr["photourl"].ToString();
                __info.RadioButtonList1 = dr["IsExam"].ToString();//是否有试卷

                if (BaseFun.CheckFieldExists("KS_Course", "IsSendNote"))   //是否邮寄资料
                {
                    __info.IsSendNote1 = Utils.StrToInt(dr["IsSendNote"]).ToString();
                    __info.NotePrice = Utils.StrToDecimal(dr["NotePrice"]).ToString("f2");
                    __info.NoteContent = dr["NoteContent"].ToString();
                    __info.IsContainTax1 = Utils.StrToInt(dr["IsContainTax"]).ToString();
                }

                string examPleID = dr["examPleID"].ToString();

                switch (Utils.StrToInt(dr["IsExam"].ToString()))
                {
                    case 2:
                        if (string.IsNullOrEmpty(examPleID) || examPleID == "0")
                        {
                            //  this.Label2.Text = "暂无指定试卷！";
                        }
                        else
                        {
                            StringBuilder sb = new StringBuilder();
                            string sql2 = "select ID,Title from KS_SJ where id in(" + examPleID + ")";
                            using (DataTable dt2 = DataFactory.GetDataTable(sql2))
                            {
                                if (dt2.Rows.Count > 0)
                                {
                                    foreach (DataRow dr2 in dt2.Rows)
                                    {
                                        sb.AppendFormat("<option value=\"{1}\" selected>{0}</option>", dr2["title"].ToString(), dr2["id"].ToString());
                                    }
                                }
                            }
                            __info.LstB1 = sb.ToString();
                        }
                        break;
                }
                //************收费方式*********

            }
        }
    }
    public string InniaLivePlay()
    {
        #region 初始直播视频类型
        StringBuilder sb = new StringBuilder();
        XmlDocument xmldoc = new XmlDocument();
        xmldoc.Load(Utils.GetMapPath(KSCMS.GetInstallDir() + "config/course/PCLivePlay.config"));
        foreach (XmlNode xn in xmldoc.SelectNodes("//liveplay/item"))
        {
            ListItem li = new ListItem();
            if (xn.SelectSingleNode("@enable").InnerText == "true")
            {
                sb.AppendFormat("<option value=\"{0}\" {2}>{1}</option>", xn.SelectSingleNode("@id").InnerText, xn.SelectSingleNode("@name").InnerText, __info.LiveType == xn.SelectSingleNode("@id").InnerText ? "selected" : "");
            }

        }
        sb.AppendFormat("<option value=\"{0}\" {2}>{1}</option>", "0", "其他", __info.LiveType == "0" ? "selected" : "");
        return sb.ToString();
        #endregion

    }

    private string initial1(int parentId, int type = 0)
    {
        #region 按分类快速搜索
        string selceted = "," + __info.ClassID + ",";
        if (type == 1)//更多分类
        {
            selceted = "," + __info.MoreClass + ",";
        }
        StringBuilder sb = new StringBuilder();
        using (DataTable dt = EnterPrise.getEpriseBusiness(__user.UserName, 0, 0))
        {
            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    int depth = Utils.StrToInt(dr[2].ToString());
                    if (depth <= 3)
                    {
                        int id = Utils.StrToInt(dr[0].ToString());
                        string CatetoryName = dr[1].ToString();
                        if (depth == 2)
                        {
                            CatetoryName = "　├ " + CatetoryName;
                        }
                        if (depth == 3)
                        {
                            CatetoryName = "　   　├ " + CatetoryName;
                        }
                        if (selceted.IndexOf("," + id.ToString() + ",") != -1)
                            sb.AppendFormat("<option value=\"{0}\" {2}>{1}</option>", id.ToString(), CatetoryName, "selected");
                        else
                            sb.AppendFormat("<option value=\"{0}\" {2}>{1}</option>", id.ToString(), CatetoryName, "");
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }
        if (string.IsNullOrEmpty(sb.ToString()))
        {

            Msg.Alert("请先设置网授的分类", BasicField.GetUserUrl("teacher/CsMemberClass"));

        }

        return sb.ToString();
        //return __info.CourseClass;
        #endregion
    }
    public string DataBinder()
    {
        StringBuilder sb = new StringBuilder();
        int Type = Utils.StrToInt(KSCMS.S("Type"));
        if (!string.IsNullOrEmpty(KSCMS.S("Type")))
        {
            switch (Type)
            {
                case 1:
                    sqlParam += " and verify=0 ";
                    break;
                case 2:
                    sqlParam += " and verify=1 ";
                    break;
                case 3:
                    sqlParam += " and IsOff=1 ";
                    break;
                case 4:
                    sqlParam += " and IsOff=0 ";
                    break;
                case 5:
                    sqlParam += " and isfree=0 ";
                    break;
                case 6:
                    sqlParam += " and isfree=1 ";
                    break;

            }
        }
        if (!string.IsNullOrEmpty(KSCMS.S("TextBox1")))
        {
            sqlParam += " and name like '%" + Utils.ChkSQL(KSCMS.S("TextBox1")) + "%'";
        }
        using (DataTable dt = DataFactory.GetPage("*", sqlParam, "Courseid", "order by  addTime desc", CurrPage, PageSize, out recordcount, out pagecount))
        {
            if (dt.Rows.Count > 0)
            {

                foreach (DataRow dr in dt.Rows)
                {
                    int teachway = Utils.StrToInt(dr["teachway"].ToString());
                    sb.Append(" <li class=\"photo_box_list_li clearfix\">" +
                    "<span class=\"checkbtn_box border\"><input type=\"checkbox\"  name=\"ids\" id=\"ids\" value=\"" + dr["courseid"] + "\"   " + ((Convert.ToString(dr["verify"]) == "1") ? "class=\"checkbtn\"" : (Convert.ToString(dr["verify"]) == "0" ? "class=\"checkbtn\"" : " class=\"checkbtn checkno\" disabled")) + " /></span>" +
                    "<div class=\"infos-pic\"><i class=\"tips\"  " + (Convert.ToString(dr["verify"]) == "1" ? (Convert.ToString(dr["IsOff"]) == "1" ? "" : "style=\"color: white; background-color:rgba(255,108,0,0.8);\" ") : "") + ">" + (Convert.ToString(dr["verify"]) == "1" ? (Convert.ToString(dr["IsOff"]) == "1" ? "在售" : "停售") : "未审核") + "</i><a href=\"" + (Convert.ToString(dr["verify"]) == "0" ? "javascript:;" : BasicField.GetRewriteUrl("courseview", Utils.StrToInt(dr["courseid"].ToString()))) + "\" target=\"_blank\">" +
                    "<img src=\"" + dr["photourl"].ToString() + "\" onerror=\"this.src='" + (string.IsNullOrEmpty(__info.epDefaultPic) ? "/sysimg/nopic.gif" : __info.epDefaultPic) + "'\"> </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>" +

                    "<div class=\"infoConBox\"><div class=\"infos-title\"><h2 class=\"h5\"><a href=\"" + (Convert.ToString(dr["verify"]) == "0" ? "javascript:;" : BasicField.GetRewriteUrl("courseview", Utils.StrToInt(dr["courseid"].ToString()))) + "\" title=\"" + dr["name"].ToString() + "\" target=\"_blank\">" + Utils.CutStr(dr["name"].ToString(), 15) +"</a>"+
                    (teachway == 2 ? "<span class=\"grayFont\">(组合)</span>" : "<span class=\"grayFont\">(纯点播)</span>") +
                    (Convert.ToString(dr["recommend"]) == "1" ? "<font class=\"bg1\">荐</font>" : "") +
                    (Convert.ToString(dr["popular"]) == "1" ? "<font class=\"bg2\">精</font>" : "") +
                    (Convert.ToString(dr["istop"]) == "1" ? "<font class=\"bg3\">头</font>" : "") +
                    (Convert.ToString(dr["huandeng"]) == "1" ? "<font class=\"bg4\">幻</font>" : "") +
                    (Convert.ToString(dr["is3g"]) == "1" ? "<font class=\"bg5\">3g</font>" : "") +
                "<span class=\"type\">" + (Convert.ToString(dr["isFree"]) == "0" ? "<a mark=\"video\">免费</a>" : "<a mark=\"video\" class=\"redBg\">付费</a>") + "</span></h2></div>" +
                "<div class=\"infoTitle\">" +
                   "<span class=\"price\">" +
                (Utils.StrToInt(dr["IsFree"].ToString()) == 0 ? "<font class='green'>免费</font>" : (dr["promotion"].ToString() == "3" ? dr["jifen"].ToString() + "积分" : (dr["promotion"].ToString() == "1" || dr["promotion"].ToString() == "2" ? "¥" + Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(dr["PanicMoney"].ToString())) : (Utils.StrToDecimal(dr["price_member"].ToString()) == 0 ? "<font class='green'>免费</font>" : "¥" + Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(dr["price_member"].ToString())) + "" + (dr["promotion"].ToString() == "4" ? "+" + dr["jifen"].ToString() + "积分" : ""))))) +
                   "<del>¥" + Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(dr["Money"])) + "</del></span><span>" + dr["StudentNum"].ToString() + "人学习</span></div>" +
                "<div class=\"btns\">" + (Utils.StrToInt(dr["IsPeriod"].ToString()) == 1 ? "<span><a href=\"" + BasicField.GetUserUrl("teacher/" + (teachway == 2 ? "CsGroupZj" : "CsZj") + "", "courseid-" + dr["courseid"].ToString() + ",costype-" + teachway) + "\">"+dr["CountPid"].ToString()+"个课时</a></span>" : "") +
                "<span><a href=\"" + BasicField.GetUserUrl("teacher/CsZlList", "type=0,courseid-" + dr["courseid"].ToString() + ",prt-0,costype-" + teachway) + "\">"+Utils.StrToInt(dr["zlnum"].ToString())+"份资料</a></span>" +
                "<span><a href=\"" + BasicField.GetUserUrl("teacher/tcsendinfo", "courseid-" + dr["courseid"] + "") + "\">通知</a></span>" +
                "<span><a href=\"" + BasicField.GetUserUrl("teacher/CosLearnRecord", "courseid-" + dr["courseid"] + "") + "\">进度</a></span>" +
                "<span>" + ((Convert.ToString(dr["verify"]) == "1") ? "<a href=\"" + BasicField.GetUserUrl("teacher/courselist", "do-modify,courseid-" + dr["courseid"].ToString()) + "\">编辑</a>" : (Convert.ToString(dr["verify"]) == "0" ? "<a href=\"" + BasicField.GetUserUrl("teacher/courselist", "do-modify,courseid-" + dr["courseid"].ToString() + "") + "\">编辑</a>" : "")) + "</span>" +
                "<span>" + (Convert.ToString(dr["verify"]) == "1" ? (Convert.ToString(dr["IsOff"]) == "1" ? "<a href=\"" + BasicField.GetUserUrl("teacher/courselist", "do-sell,courseid-" + dr["courseid"]) + "\" onclick=\"return(confirm('您确定要下架此课程吗?下架后学员将无法再报名此>下架</a>" : "<a href=\"" + BasicField.GetUserUrl("teacher/courselist", "do-sell,courseid-" + dr["courseid"].ToString()) + "\">上架</a>") : "") + "</span>" +
                "<span class=\"grayBtn\">" + ((Convert.ToString(dr["verify"]) == "1") ? "<a href=\"" + BasicField.GetUserUrl("teacher/courselist", "do-del,courseid-" + dr["courseid"].ToString()) + "\" onclick=\"return(confirm('您确定要删除此课程吗?删除后会影响到您的综合积分'));\">删除</a>" : (Convert.ToString(dr["verify"]) == "0" ? "<a href=\"" + BasicField.GetUserUrl("teacher/courselist", "do-del,courseid-" + dr["courseid"].ToString()) + "\" onclick=\"return(confirm('您确定要删除此课程吗?'));\">删除</a>" : "")) + "</span>");
				if (DataFactory.Exists("KS_CosGroupPeriod", "teachway=5 and courseid=" + dr["courseid"].ToString() + ""))
				{
					sb.Append(" <span class=\"grayBtn\"><a onclick='upliveRoom(" + dr["courseid"].ToString() + "," + Utils.StrToInt(dr["livetype"].ToString()) + "," + dr["accountid"].ToString() + ",1)'>获取直播</a></span>" +
					"<span class=\"grayBtn\"><a onclick='livenotice(" + dr["courseid"].ToString() + ")'>通知学员</a></span>");
				}


                    sb.Append("</div></div> </li>");
                }

            }else
            {
				KSCMS.W("<div class=\"empty\">没有添加任何课程信息</div>");
            }

        }
        return sb.ToString();
    }
    public string GetTeacherList(string tcid)
    {
        string selcected = "";
        StringBuilder sb = new StringBuilder();

        string sql = "select top 100 Tcid,Tname from KS_CosTeacher where verify=1 and tcid in(" + tcid + ") order by tcid desc";

        if (tcid == "0" || string.IsNullOrEmpty(tcid))
        {
            sql = "select top 100 Tcid,Tname from KS_CosTeacher where verify=1 and (userid=" + __user.UserID + " or   schoolid=" + __user.UserID + ") order by tcid desc";
        }
        //Utils.WriteLog("sss=" + sql);
        using (DataTable dt = DataFactory.GetDataTable(sql))
        {
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    ListItem lii = new ListItem();

                    if (("," + tcid + ",").IndexOf("," + dr["tcid"].ToString() + ",") != -1 || (new TemporaryVar().GroupID == 4))
                    {
                        selcected = "selected";
                    }
                    else
                    {
                        selcected = "";
                    }
                    sb.AppendFormat("<option value=\"{0}\" {2} >{1}</option>", dr["tcid"].ToString(), dr["tname"].ToString(), selcected);
                }
            }
        }
        return sb.ToString();
    }
    public void GetSJ()
    {
        StringBuilder sb = new StringBuilder();
        string Key = KSCMS.S("TxtSJKey");
        if (Key == "")
        {

        }
        else
        {
            string sql2 = "select top 200 ID,Title from KS_SJ where Title like '%" + Key + "%'";
            using (DataTable dt = DataFactory.GetDataTable(sql2))
            {

                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        sb.AppendFormat(@"<option value=""{0}""{2}>{1}</option>", dr[0].ToString(), dr[1].ToString(), Utils.StrToInt(KSCMS.S("examPleID")) == Utils.StrToInt(dr[0].ToString()) ? " selected" : string.Empty);
                    }
                }
            }
        }
        __info.LstB2 = sb.ToString();
    }

</script>
<style>
    .righttd {
        padding: 10px 20px !important;
        text-align: left !important;
    }
</style>
<script>
    function upliveRoom(courseid, liveType, accountid, costype) {

        if (liveType == 1) {
            jQuery.dialog.open('/plus/course/openliveroom.aspx?costype=' + costype + '&CourseId=' + courseid + "&liveType=" + liveType + "&accountid=" + accountid + "&istop=0", { lock: true, fixed: true, title: "<div style='text-align:left'>直播管理</div>", width: 600, height: 400, max: false, min: false });

        } else if (liveType == 0 || liveType > 5) {
            alert("您选择其他服务器系统不能自动分配");
        } else {
            jQuery.dialog.open('/plus/course/openliveroom.aspx?costype=' + costype + '&CourseId=' + courseid + "&liveType=" + liveType + "&accountid=" + accountid + "&istop=0", { lock: true, fixed: true, title: "<div style='text-align:left'>直播管理</div>", width: 600, height: 400, max: false, min: false });
        }
    }
    function livenotice(courseid) {
        jQuery.dialog.open('/plus/course/liveNotice.aspx?CourseId=' + courseid + "&istop=0", { lock: true, fixed: true, title: "<div style='text-align:left'>直播管理</div>", width: 600, height: 400, max: false, min: false });

    }
</script>
<script>
    function changedo(i) {
        if (i == 0) {
            $("#actiondel").val("search");
        }
    }
</script>

<%
    if (!isLoadPage) return;
    if (KSCMS.S("do") != "modify" && KSCMS.S("do") != "add")
    {
%>
<form name="aspnetForm" method="post" action="<%=BasicField.GetUserUrl("teacher/CourseList")%>" id="aspnetForm">

    <div class="t_tybox">
        <div class="tytitle clearfix" style="padding:0;">
           <div class="tabs_header">
            	<ul class="tabs clearfix">
                	<li class="active"><a href="<%=BasicField.GetUserUrl("teacher/CourseList") %>"><span>点播课程</span></a></li>
                 	<li><a href="<%=BasicField.GetUserUrl("teacher/livelist") %>"><span>直播课程</span></a></li>
                 	<li><a href="<%=BasicField.GetUserUrl("teacher/facelist") %>"><span>面授课程</span></a></li>
                </ul>
            </div>
            <a href="<%=BasicField.GetUserUrl("teacher/Courselist","do-add") %>" class="addbtn" style="float:right; margin-left:0; margin-right:20px;">+添加点播课程</a>
            <div class="property">
                <div class="name fr">筛选</div>
                <div class="propertyBox">
                    <ul class="tabs clearfix">
                        <span class="screen fl">选择状态：</span>
                        <li <%=KSCMS.S("Type")==""?" class='active'":string.Empty %>><a href="<%=BasicField.GetUserUrl("teacher/Courselist") %>"><span>所有记录</span></a></li>
                        <% if (ep.GetEpConfig("Setting", 8) == "1")  //bu需要审核
                            { %>
                        <li <%=KSCMS.S("Type")=="1"?" class='active'":string.Empty %>><a href="<%=BasicField.GetUserUrl("teacher/Courselist","Type-1") %>"><span>待审核</span></a></li>
                        <li <%=KSCMS.S("Type")=="2"?" class='active'":string.Empty %>><a href="<%=BasicField.GetUserUrl("teacher/Courselist","Type-2") %>"><span>已审核</span></a></li>
                        <%} %>
                        <li <%=KSCMS.S("Type")=="3"?" class='active'":string.Empty %>><a href="<%=BasicField.GetUserUrl("teacher/Courselist","Type-3") %>"><span>已上架</span></a></li>
                        <li <%=KSCMS.S("Type")=="4"?" class='active'":string.Empty %>><a href="<%=BasicField.GetUserUrl("teacher/Courselist","Type-4") %>"><span>已下架</span></a></li>
                        <li <%=KSCMS.S("Type")=="5"?" class='active'":string.Empty %>><a href="<%=BasicField.GetUserUrl("teacher/Courselist","Type-5") %>"><span>免费</span></a></li>
                        <li <%=KSCMS.S("Type")=="6"?" class='active'":string.Empty %>><a href="<%=BasicField.GetUserUrl("teacher/Courselist","Type-6") %>"><span>付费</span></a></li>
                    </ul>
                </div>
            </div>
            <div class="top_c_sc" style="margin-right: 10px;">
                <span>课程名称：</span>
                <input name="TextBox1" type="text" id="TextBox1" class="textbox coursename" />
                <input type="submit" name="Button4" value=" 搜索 " onclick="changedo(0)" id="Button4" class="button" />
                
            </div>
            
        </div>
     
        <div class="photo_box">
            <ul class="photo_box_list clearfix">
                <%=DataBinder() %>
            </ul>
        </div>
     
        <div class="cz_btn">
            <span>
                <input type="checkbox" class="checkbtn" name="chkall" id="chkall" onclick="CheckAll(this.form);" /><label for="chkall">全部选中</label></span>
            <span>
                <input type="submit" class="button" value="批量删除" onclick="return (GetIDS('del'));"></span>
            <input type="hidden" id="actiondel" value="del" name="action">
        </div>
        <div class="fy_box">
            <%
                #region 分页
                string PageStr = "[KS:PageStr1]";
                BasicField.ReplaceFilterPage(ref PageStr, CurrPage, PageSize, pagecount, recordcount);
                KSCMS.W(PageStr);
                #endregion
            %>
        </div>
        <div class="clearfix"></div>
    </div>
    <div>
        <script type="text/javascript">
            showtips(' <span>操作说明：<br /></span><span class="tips_cor" style="display:block;margin-top:5px;">1.如果是待审核是不能点击预览的,而且没有上下架的功能！<br>2.如果复选框是<font color="blue">打X</font>，代表是不能点击<br>3.如果审核通过而且后台设置你有删除的功能，那么你确定要执行的将影响你的<font color="blue">综合积分</font></span>');
        </script>
    </div>
</form>

<%}
    else
    {
        Kesion.APPCode.EditorAPI.EchoHead(); %>


<div class="t_tybox">
    <div class="tytitle">
        <h4 id="Label1"><%=__info.Label1 %></h4>
    </div>
    <script src="/ks_inc/DatePicker/WdatePicker.js"></script>

    <form name="aspnetForm" method="post" action="<%=BasicField.GetUserUrl("teacher/CourseList","do-"+KSCMS.S("do")+"") %>" id="Form1">
        <input type="hidden" name="action" id="action" value="save">
        <input type="hidden" name="courseid" value="<%=__info.courseid %>">
        <!--选项卡-->
        <div class="tabs_header">
            <ul class="tabs tabs-spec clearfix">

                <li class="active"><a href="JavaScript:;"><span>基本信息</span></a></li>
                <li><a href="javascript:;"><span>课时管理</span></a></li>
                <li><a href="javascript:;"><span>其他选项</span></a></li>
            </ul>
        </div>
        <div class="tab-content">
            <div class="tab-pane" style="display: block">
                <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="border" style="table-layout: fixed">
                    <tr>
                        <td class="lefttd" height="30"><font color="red">*</font>课程名称：</td>
                        <td class="tag_left">
                            <input type="text" value="<%=__info.TxtName %>" class="textbox" id="TxtName" name="TxtName" style="width: 350px;">
                        </td>
                    </tr>
                    <tr style="display: none">
                        <td class="lefttd" height="30">简短标题：</td>
                        <td class="tag_left">
                            <input type="text" value="<%=__info.TxtShortName %>" class="textbox" name="TxtShortName" style="width: 150px">
                            <span class="tips">该字段的字数是100，该字段如果为空的话，就去截取”课程名称“的字数</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="lefttd" height="30" align="right">课程类型：</td>
                        <td class="tag_left">
                            <div class="DivSelect">
                                <select name="DrpClassID1" id="DrpClassID1">
                                    <%=initial1(0) %>
                                </select>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="lefttd">课程多分类：</td>
                        <td class="tag_left" height="230">
                            <select size="4" name="MoreClassList" multiple="multiple" id="MoreClassList" style="width: 262px; height: 250px !important; background: none;">
                                <%=initial1(0,1) %>
                            </select>
                        </td>
                    </tr>
                    <%if (UserManage.GetUserInfo().SchoolID == 0)
                        { %>
                    <tr>
                        <td class="lefttd"><font color="red">*</font>课程主教：</td>
                        <td class="tag_left">
                            <select name="teacherlist" id="teacherlist" style="width: 200px; height: 140px !important; vertical-align: middle;" multiple="multiple">
                                <%=GetTeacherList(__info.tcid.ToString()) %>
                            </select>
                            <a href="<%=BasicField.GetUserUrl("teacher/CsTeacher") %> " style="color: #999;">名师管理</a>&nbsp;&nbsp;
                                <input type="checkbox" class="checkbtn" name="IsOtherTc" value="1" <%=__info.IsOtherTc=="1"?" checked":"" %> onclick="if (this.checked) { $('#otherTeacher').show(); } else { $('#otherTeacher').hide(); }" style="margin-top: 0;" />助教
                                <span id="otherTeacher" <%=__info.IsOtherTc=="1"?"":" style='margin-top:10px;display:none'" %>>
                                    <input name="techertest" type="text" style="width: 120px;" id="techertest" value="<%=__info.techertest %>" class="textbox" />
                                    如：王老师      
                                </span>
                        </td>
                    </tr>
                    <%} %>
                    <tr>
                        <td class="lefttd" height="30">收费方式：</td>
                        <td class="tag_left">
                            <table id="ChargeType" class="radio" onclick="free()" border="0">
                                <tr>
                                    <td class="bo-min">
                                        <input type="radio" name="ChargeType" value="0" <%=__info.ChargeType=="0"?"checked":"" %> <%=KSCMS.S("do")=="modify"?"disabled='disabled'":"" %>/><label for="ChargeType_0">免费</label></td>
                                    <td class="bo-min">
                                        <input type="radio" name="ChargeType" value="1" <%=__info.ChargeType=="1"?"checked":"" %>  <%=KSCMS.S("do")=="modify"?"disabled='disabled'":"" %>/><label for="ChargeType_1">付费</label></td>
                                <span class="tips">TIPS:收费方式一旦设置，不允许修改。</span>
                                    </tr>
                            </table>
                            <script>
                                function free() {
                                    var checkrad = jQuery("#ChargeType :radio[checked]").val();
                                    if (checkrad == "0") {
                                        jQuery("#Tbody1").css("display", "");

                                        jQuery("#Tbody8").css("display", "none");
                                        jQuery("#Tbody2").css("display", "none");
                                        jQuery("#TbodyUserVIP").css("display", "none");

                                    } else {
                                        jQuery("#Tbody1").css("display", "none");
                                        jQuery("#Tbody2").css("display", "");
                                        jQuery("#Tbody8").css("display", "");

                                        Promotion();
                                    }
                                }

                                function Promotion() {
                                    var checkrad = jQuery("#Promotion :radio[checked]").val();
                                    if (checkrad == "1") {
                                        jQuery("#Tbody5").css("display", "");
                                        jQuery("#Tbody6").css("display", "");
                                        jQuery("#Tbody7").css("display", "none");
                                        jQuery("#TbodyUserVIP").css("display", "");
                                        jQuery("#Tbody2").css("display", "none");

                                    } else if (checkrad == "2") {
                                        jQuery("#Tbody5").css("display", "none");
                                        jQuery("#Tbody6").css("display", "");
                                        jQuery("#Tbody7").css("display", "none");
                                        jQuery("#TbodyUserVIP").css("display", "");
                                        jQuery("#Tbody2").css("display", "none");

                                    } else if (checkrad == "3") {
                                        jQuery("#Tbody5").css("display", "none");
                                        jQuery("#Tbody6").css("display", "none");
                                        jQuery("#Tbody7").css("display", "");
                                        jQuery("#Tbody2").css("display", "none");
                                        jQuery("#TbodyUserVIP").css("display", "none");
                                    }
                                    else {
                                        jQuery("#Tbody5").css("display", "none");
                                        jQuery("#Tbody6").css("display", "none");
                                        jQuery("#Tbody7").css("display", "none");
                                        jQuery("#TbodyUserVIP").css("display", "");
                                        jQuery("#Tbody2").css("display", "");
                                    }
                                }
                                var puburl ="<%= BasicField.GetUserUrl("teacher/courselist")%>";
                                function searchSJ() {

                                    var key = jQuery("#TxtSJKey").val();
                                    if (key == '') {
                                        KesionJS.Alert("请输入试卷关键字！", "jQuery('#TxtSJKey').focus()");
                                        return false;
                                    } else {

                                        puburl ="/plus/course/CourseAjax.ashx?action=getsearchsj&courseid=<%=__info.courseid%>&key=" + escape(key)

                                        jQuery.ajax({
                                            url: puburl, success: function (d) {
                                                jQuery("#LstB2").empty();
                                                jQuery("#LstB2").html(d);
                                            }
                                        });

                                    }
                                }
                                function iszhekou() {

                                    var ISLoad = jQuery("#ISLoad :radio[checked]").val();

                                    if (ISLoad == "1") {
                                        //折扣价
                                        jQuery("#Iszhekou").css("display", "");
                                        jQuery("#IsFixedPrice").css("display", "none");
                                    } else if (ISLoad == "0") {
                                        //免费
                                        jQuery("#Iszhekou").css("display", "none");
                                        jQuery("#IsFixedPrice").css("display", "none");
                                    } else {
                                        //固定价格
                                        jQuery("#Iszhekou").css("display", "none");
                                        jQuery("#IsFixedPrice").css("display", "");
                                    }
                                }
                                $(document).ready(function () {
                                    free();

                                    iszhekou();
                                    showwatermarkarea();
                                    ShowNoteSetting();
                                })

                            </script>
                        </td>
                    </tr>
                    <tbody id="Tbody1"></tbody>


                    <tbody id="Tbody8" style="display: none">
                        <tr>
                            <td class="lefttd" height="30" style="width: 102px">促销类型：</td>
                            <td class="tag_left">
                                <table id="Promotion" class="radio" onclick="Promotion()" border="0" style="height: 24px;">
                                    <tr>
                                        <td>
                                            <input id="Promotion_0" type="radio" name="Promotion" value="0" <%=__info.Promotion==0?"checked":"" %> /><label for="Promotion_0">普通课程</label></td>
                                        <td>
                                            <input id="Promotion_1" type="radio" name="Promotion" value="1" <%=__info.Promotion==1?"checked":"" %> /><label for="Promotion_1">限时抢购</label></td>
                                        <td>
                                            <input id="Promotion_2" type="radio" name="Promotion" value="2" <%=__info.Promotion==2?"checked":"" %> /><label for="Promotion_2">课程团购</label></td>
                                        <td>
                                            <input id="Promotion_3" type="radio" name="Promotion" value="3" <%=__info.Promotion==3?"checked":"" %> /><label for="Promotion_3">积分兑换</label></td>
                                    </tr>
                                </table>
                                <span class="tips">促销属性，促销价格为最终价格</span>
                            </td>
                        </tr>

                        <tr>
                            <td class="lefttd" height="30"><font color="red">*</font>参考价格：</td>
                            <td class="tag_left">

                                <input name="Money" type="text" value="<%=__info.Money %>" id="Money" class="textbox" onfocus="zhekouss();" style="width: 74px;" />
                                &nbsp; 元                        
                            
                            </td>
                        </tr>
                        <tbody id="Tbody2" style="display: none">
                            <tr>
                                <td class="lefttd" height="30">折扣：</td>
                                <td class="tag_left">
                                    <input name="zhekou" type="text" value="<%=__info.zhekou %>" class="textbox" id="zhekou" style="width: 30px;" />
                                    折 
                                </td>
                            </tr>
                            <tr>
                                <td class="lefttd" height="30"><font color="red">*</font>课程价格：</td>
                                <td class="tag_left">
                                    <input name="Price_Member" type="text" value="<%=__info.Price_Member %>" id="Price_Member" class="textbox" onkeyup="zhekouss();" onkeydown="zhekouss();" style="width: 74px;" />
                                    &nbsp; 元
                                  &nbsp; &nbsp; &nbsp;<input name="IsContainTax" class="checkbtn" type="checkbox" value="1" <%=__info.IsContainTax1=="1"?"checked":"" %> />
                                    是否含税
                                </td>
                            </tr>
                        </tbody>
                        <tbody id="Tbody5" style="display: <%= Utils.StrToInt(__info.Promotion)==1?"":"none" %>">
                            <tr>
                                <td class="lefttd" height="30"><font color="red">*</font>抢购时间段：</td>
                                <td class="tag_left">
                                    <script>isHour = 1;</script>
                                    <input name="begintime" type="text" id="begintime" value="<%=__info.begintime %>" class="textbox  Wdate" onclick="WdatePicker({ dateFmt:&#39; yyyy-MM - dd HH: mm: ss&#39;, minDate:&#39;% y -% M -% d &#39;
});" />
                                    至
                                    <input name="endtime" type="text" id="endtime" value="<%=__info.endtime %>" class="textbox  Wdate" onclick="WdatePicker({ dateFmt:&#39; yyyy-MM - dd HH: mm: ss&#39;, minDate:&#39;% y -% M -% d &#39;
});" />

                                </td>
                            </tr>
                        </tbody>
                        <tbody id="Tbody6" style="display: <%= Utils.StrToInt(__info.Promotion)==1?"":(Utils.StrToInt(__info.Promotion)==2?"":"none") %>">
                            <tr>
                                <td class="lefttd" height="30"><font color="red">*</font>抢购价：</td>
                                <td class="tag_left">
                                    <input name="PanicMoney" type="text" id="PanicMoney" value="<%=__info.PanicMoney %>" class="textbox" style="width: 74px;" />元       
                                </td>
                            </tr>
                            <tr>
                                <td class="lefttd" height="30">报名人数上限：</td>
                                <td class="tag_left">
                                    <input name="Limited" type="text" value="100" id="Limited" class="textbox" style="width: 74px;" />人（设置“0”为不限）      
                                </td>
                            </tr>
                        </tbody>
                        <tbody id="Tbody7" style="display: <%= Utils.StrToInt(__info.Promotion)==3?"":"none" %>">
                            <tr>
                                <td class="lefttd" height="30"><font color="red">*</font>兑换积分：</td>
                                <td class="tag_left">
                                    <input name="jifen" value="<%=__info.jifen %>" type="text" id="jifen" class="textbox" style="width: 50px;" />分
                                   <input name="IsVip" class="checkbtn" type="checkbox" value="3" <%=__info.IsVip==3?"checked":"" %> />
                                    是否VIP免费 <span class="tips">纯积分兑换</span>
                                </td>
                            </tr>
                        </tbody>

                        <tbody id="TbodyUserVIP" style="display: <%=Utils.StrToInt(__info.IsSetPrice)==1?"":"none" %>">
                            <tr>
                                <td class="lefttd" height="30"><font color="red">*</font>VIP用户：</td>
                                <td class="tag_left">
                                    <table id="ISLoad" onclick="iszhekou()" border="0">
                                        <tr>
                                            <td>
                                                <input type="radio" class="radiobtn" id="ISLoad_0" name="ISLoad" value="0" <%= __info.ISLoad=="0"?"checked":"" %> /><label for="ISLoad_0">免费</label></td>
                                            <td>
                                                <input type="radio" class="radiobtn" id="ISLoad_1" name="ISLoad" value="1" <%= __info.ISLoad=="1"?"checked":"" %> /><label for="ISLoad_1">收费</label></td>
                                            <td>
                                                <input type="radio" class="radiobtn" id="ISLoad_2" name="ISLoad" value="2" <%= __info.ISLoad=="2"?"checked":"" %> /><label for="ISLoad_2">固定价格</label></td>
                                        </tr>
                                    </table>
                                    <span id="Iszhekou" style="display: none;">折扣：
                                        <input name="Loadzhekou" type="text" value=" <%=__info.Loadzhekou%>" class="textbox" style="width: 30px;" />折（请输入0-10范围之内，例如 8.5 或者 6 ）
                                    </span>
                                    <span id="IsFixedPrice" style="display: none;">固定价格：<input name="FixedPrice" type="text" value="<%=__info.FixedPrice %>" class="textbox" />元</span>
                                    <br />
                                    <font color="red">"收费"为年费用户购买付折扣费用,"免费"为对年费用户为免费课程，"固定价格"为年费用户购买的价格</font>
                                </td>
                            </tr>

                        </tbody>

                    </tbody>





                    <tr id="showvalide" style="display: none">
                        <td class="lefttd" height="30">有效时限：</td>
                        <td class="tag_left">
                            <input name="shixian" type="text" value="<%=__info.shixian %>" id="shixian" class="textbox" style="width: 50px; text-align: center; padding-left: 0;" />
                            &nbsp; 天 （设置“0”为不限,否则过期将不能再观看。） 
                        </td>
                    </tr>
                    <tr>
                        <td class="lefttd">课程图片：</td>
                        <td class="tag_left" style="padding-left: 0;">
                            <table class="coimgBox">
                                <tr>
                                    <td>
                                        <input id="DefaultPic" name="DefaultPic" width="350px" class="textbox" style="float: left" type="text" value="<%=__info.DefaultPic%>" />
                                    </td>
                                    <td style="width: 550px;" class="DefaultIframe"><%=Kesion.APPCode.UploadAPI.EchoUpload("courseUserPic","DefaultPic") %></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr style="display: none">
                        <td class="lefttd">试听课程：</td>
                        <td class="tag_left">
                            <textarea name="listeningID" rows="2" cols="20" id="listeningID" class="textbox" style="height: 70px; width: 600px; padding: 10px"><%=__info.listeningID %>
                </textarea><span class="tips">用脚本执行</span>
                            <input type="hidden" name="" value="1">
                        </td>
                    </tr>
                    <tr>
                        <td class="lefttd" height="30">课程介绍：</td>
                        <td class="tag_left">
                            <textarea name="TxtIntro" rows="2" cols="20" id="TxtIntro" style="height: 200px; width: 80%;"><%=__info.TxtIntro %></textarea>
                            <% Kesion.APPCode.EditorAPI.EchoEditor("editor", "TxtIntro", "Basic", 0, false, true, true, false);     %>
                        </td>
                    </tr>

                    <tr>
                        <td class="lefttd" height="30" style="width: 102px">出售方式：</td>
                        <td class="tag_left">
                            <table id="RBIsOff" class="radio" border="0">
                                <tr>
                                    <td class="bo-min">
                                        <input id="RBIsOff_0" type="radio" name="RBIsOff" value="1" <%=__info.RBIsOff=="1"?"checked":"" %> /><label for="RBIsOff_0">上架</label></td>
                                    <td class="bo-min">
                                        <input id="RBIsOff_1" type="radio" name="RBIsOff" value="0" <%=__info.RBIsOff=="0"?"checked":"" %> /><label for="RBIsOff_1">下架</label></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="tab-pane" style="display: none">
                <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="border">
                    <tr>
                        <td class="lefttd" height="30">是否开启课时管理：</td>
                        <td class="tag_left radio">
                            <table id="IsKS" onclick="doPeriod()" border="0" style="height: 24px;">
                                <tr>
                                    <td class="bo-min">
                                        <input id="IsKS_0" type="radio" name="IsKS" value="0" <%=__info.IsKS=="0"?"checked":"" %> <%=KSCMS.S("do")=="modify"?"disabled='disabled'":"" %>/><label for="IsKS_0">关闭</label></td>
                                    <td class="bo-min">
                                        <input id="IsKS_1" type="radio" name="IsKS" value="1" <%=__info.IsKS=="1"?"checked":"" %> <%=KSCMS.S("do")=="modify"?"disabled='disabled'":"" %>/><label for="IsKS_1">开启</label></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tbody id="showTeachWay" style="display: none">
                        <tr>
                            <td class="lefttd">课程类型：</td>
                            <td class="tag_left ">
                                <input id="RdbTeachWay_1" onclick="showCourseType()" type="radio" name="RdbTeachWay" value="1" <%=__info.RdbTeachWay=="1"?"checked":"" %> <%=KSCMS.S("do")=="modify"?"disabled='disabled'":"" %> /><label for="RdbTeachWay_1">纯点播</label>
                                <input id="RdbTeachWay_2" onclick="showCourseType()" type="radio" name="RdbTeachWay" value="2" <%=__info.RdbTeachWay=="2"?"checked":"" %> <%=KSCMS.S("do")=="modify"?"disabled='disabled'":"" %> /><label for="RdbTeachWay_2">组合（点播、直播及面授）</label>

                                <span class="tips">TIPS:课程类型一旦设置，不允许修改。</span>

                            </td>
                        </tr>
                        <tr id="showTeachWayLiveServer" style="display: none">
                            <td class="lefttd" height="30" style="width: 150px"><span style="background-color: #f0f9fe">服务器选择</span>：</td>
                            <td class="tag_left">
                                <select name="LiveType" id="LiveType" onchange="getaccountlist(this.value)">
                                    <%=InniaLivePlay() %>
                                </select>
                                <span id="showaccount" style="display: none">
                                    <select name="accountid" id="accountlist">
                                    </select></span>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table id="Tbody10" style="display: none" width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="border">
                    <asp:PlaceHolder ID="PeriodPlace" runat="server"></asp:PlaceHolder>
                </table>
            </div>
            <div class="tab-pane" style="display: none">
                <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="border">
                    <tr>
                        <td class="lefttd" height="30">课程省市：</td>
                        <td class="tag_left">
                            <script src="/plus/area.aspx?pid=<%=__info.Provinceid %>&cityid=<%=__info.CityId %>&CountyID=<%=__info.CountyId %>"></script>
                            <span class="tips">选择课程所在的省份和城市,方便检索。</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="lefttd" height="30">是否有模拟试卷：</td>
                        <td class="tag_left">
                            <table id="RadioButtonList1" class="radio" onclick="showwatermarkarea()" border="0">
                                <tr>
                                    <td class="bo-min">
                                        <input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="0" <%=__info.RadioButtonList1=="0"?"checked":"" %> />
                                        <label for="RadioButtonList1_0">无</label></td>
                                    <td class="bo-min">
                                        <input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="2" <%=__info.RadioButtonList1=="2"?"checked":"" %> />
                                        <label for="RadioButtonList1_1">指定试卷ID</label></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tbody id="watermark0">
                    </tbody>
                    <tbody id="watermark2" style="display: none">
                        <tr>
                            <td class="lefttd" height="30"></td>
                            <td class="tag_left" valign="top">
                                <div class="clear blank10"></div>
                                <table border="0">
                                    <tr>
                                        <td>
                                            <span style="float: left; line-height: 40px">搜索试卷：</span>
                                            <input name="TxtSJKey" type="text" id="TxtSJKey" class="textbox" style="width: 160px;" style="float: left;" />
                                            <input type="button" value="搜索" class="button" onclick="searchSJ()" class="button" style="margin-left: 10px; border-radius: 5px; border: 1px solid #dce2e4;" />
                                            <div class="clear"></div>
                                        </td>
                                    </tr>
                                </table>
                                <table border="0">
                                    <tr>
                                        <td style="width: 300px">
                                            <span style="text-align: left; display: block; height: 30px; line-height: 30px;">指定试卷id：</span>
                                            <div class="clear"></div>
                                            <select size="4" name="LstB2" multiple="multiple" id="LstB2" style="height: 300px; width: 200px; float: left; height: 200px !important; background: #fff"></select>
                                        </td>
                                        <td>
                                            <p>
                                                <input type="button" value=" > " onclick="addUser()" class="button" />
                                            </p>
                                            <br />
                                            <p>
                                                <input type="button" value=" < " onclick="delUser()" class="button" />
                                            </p>
                                        </td>
                                        <td>
                                            <span style="text-align: left; display: block; height: 30px; line-height: 30px; padding-left: 15px;">指定试卷如下：</span>
                                            <div class="clear"></div>
                                            <select size="4" name="LstB1" multiple="multiple" id="LstB1" style="height: 300px; width: 200px; float: left; height: 200px !important; background: #fff"><%=__info.LstB1 %></select>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr style="display: none">
                            <td class="lefttd" height="30">考试状态规定：</td>
                            <td class="righttd">
                                <input name="regulations" type="text" id="regulations" value="<%=__info.regulations %>" class="textbox" style="height: 23px; width: 40px;" />%
                                    <font color="red">学习达到总课时的多少比例时才能考试，留空或0为不限制</font>
                            </td>
                        </tr>
                    </tbody>
                    <tr>
                        <td class="lefttd" height="30">是否邮寄资料：</td>
                        <td class="tag_left">
                            <table id="IsSendNote" class="radio" onclick="ShowNoteSetting()" border="0">
                                <tr>
                                    <td class="bo-min">
                                        <input id="IsSendNote1_1" type="radio" name="IsSendNote1" value="1" <%=__info.IsSendNote1=="1"?"checked":"" %> />
                                        <label for="IsSendNote1_1">是</label>
                                    </td>
                                    <td class="bo-min">
                                        <input id="IsSendNote1_0" type="radio" name="IsSendNote1" value="0" <%=__info.IsSendNote1=="0"?"checked":"" %> />
                                        <label for="IsSendNote1_0">否</label>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr class="note">
                        <td class="lefttd" height="30">资料价格：</td>
                        <td class="tag_left">
                            <input name="NotePrice" type="text" value="<%=__info.NotePrice %>" id="NotePrice" class="textbox" style="width: 50px; text-align: center; padding-left: 0;" />
                            &nbsp; 元 
                                 <span class="tips"></span><span class="tips">只保留两位小数</span>
                        </td>
                    </tr>
                    <tr class="note">
                        <td class="lefttd" height="30">资料简介：</td>
                        <td class="tag_left">
                            <textarea name="NoteContent" rows="2" cols="20" id="NoteContent" style="height: 100px; width: 40%;"><%=__info.NoteContent %></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td class="lefttd" height="30">课程目标：</td>
                        <td class="tag_left">
                            <textarea name="TxtTarget" rows="2" cols="20" id="TxtTarget" style="height: 200px; width: 80%;"><%=__info.TxtTarget %></textarea>
                            <% Kesion.APPCode.EditorAPI.EchoEditor("editor", "TxtTarget", "Basic", 0, false, true, true, false);     %>
                        </td>
                    </tr>
                    <tr>
                        <td class="lefttd" height="30">课程公告：</td>
                        <td class="tag_left">
                            <textarea name="TxtNotice" rows="2" cols="20" id="TxtNotice" style="height: 200px; width: 80%;"><%=__info.TxtNotice %></textarea>
                            <% Kesion.APPCode.EditorAPI.EchoEditor("editor", "TxtNotice", "Basic", 0, false, true, true, false);     %>
                        </td>
                    </tr>
                </table>
            </div>
            <script>
                $('.tabs-spec li').click(function () {
                    $(this).addClass('active').siblings().removeClass('active');
                    $('.tab-content>.tab-pane:eq(' + $(this).index() + ')').show().siblings().hide();
                })
            </script>
            <!--选项卡 end-->
        </div>
        <div class="cz_btn nofloat " style="padding-left: 192px; margin-bottom: 100px;">
            <span>
                <input type="submit" name="Button2" value="确定保存(O)" onclick="return (CheckForm());" id="Button2" class="button" /></span>
            <span>
                <input type="button" class="button" onclick="window.history.go(-1);" value=" 返 回 "></span>
        </div>
    </form>
    <div class="clear blank10"></div>
    <%} %>
    <script>

        function showwatermarkarea() {
            // alert("dd");
            var checkrad = jQuery("#RadioButtonList1 :radio[checked]").val();
            if (checkrad == "2") {
                jQuery("#watermark0").css("display", "none");
                jQuery("#watermark2").css("display", "");
            } else if (checkrad == "1") {
                jQuery("#watermark0").css("display", "");
                jQuery("#watermark2").css("display", "none");
            }
            else {
                jQuery("#watermark0").css("display", "none");
                jQuery("#watermark2").css("display", "none");
            }
        }
        function ShowNoteSetting() {
            var checkrad2 = jQuery("#IsSendNote :radio[checked]").val();
            if (checkrad2 == '1') {
                jQuery(".note").show();
            }
            else {
                jQuery(".note").hide();
            }
        }
        $(function () {
            if ($(".price_cor font").text() == "免费") {
                $(".price_cor font").css("color", "green");
            }
        })
        function doPeriod() {
            var checkrad1 = jQuery("#IsKS :radio[checked]").val();
            if (checkrad1 == '0') {
                $("#showTeachWay").hide();
                jQuery("#Tbody10").show();
                isType();
                checked();
                SetListening1();
            }
            else {
                $("#showTeachWay").show();
                jQuery("#Tbody10").hide();
                jQuery("#Tbody11").hide();
                jQuery("#Tbody12").hide();
                jQuery("#Tbody13").hide();
                jQuery("#threencscreen").hide();
                jQuery("#UploadThreen").hide();
                jQuery("#UploadThreen1").hide();
                jQuery("#SetListening").hide();
            }
        }
        $(document).ready(function () {
            doPeriod();
            showCourseType();
            getaccountlist(0);
        });
        function zhekouss() {
            var money = document.getElementById('Money').value;
            var Price = document.getElementById('Price_Member').value;
            var zhekou = (parseFloat(Price / money) * 10).toFixed(1);

            if (zhekou == "NaN" || zhekou <= 0) {
                zhekou = 0;
            } else if (zhekou == "Infinity" || zhekou >= 10) {
                zhekou = 10;
            }
            document.getElementById('zhekou').value = zhekou;
        }
        function CheckForm() {
            if ($('#TxtName').val() == "") {
                KesionJS.Alert("请填写课程名称！", "jQuery('#TxtName').focus()");
                return false;
            }
            var dest = document.getElementById('teacherlist').value;

            if (dest == '') {
                KesionJS.Alert('请选择课程主教!', "jQuery('#teacherlist').focus()");
                return false;
            }
            var checkrad = jQuery("#ChargeType :radio[checked]").val();
            var promotion1 = jQuery("#Promotion :radio[checked]").val();
            if (checkrad == "1") {
                if ($('#Money').val() == "") {
                    KesionJS.Alert("请设置参考价格！", "jQuery('#Money').focus()");
                    return false;
                }
                if (promotion1 == "0") {
                    if ($('#Price_Member').val() == "") {
                        KesionJS.Alert("请设置课程价格！", "jQuery('#Price_Member').focus()");
                        return false;
                    }
                    if (parseFloat($('#Price_Member').val()) > parseFloat($('#Money').val())) {
                        KesionJS.Alert("课程价格不能大于参考价格！", "jQuery('#Price_Member').focus()");
                        return false;
                    }
                    if (parseFloat($('#Price_Member').val()) <= 0) {
                        KesionJS.Alert("课程价格不能小于等于0！", "jQuery('#Price_Member').focus()");
                        return false;
                    }
                } else if (promotion1 == "3") {
                     if ($('#Money').val() == "") {
                    KesionJS.Alert("请设置参考价格！", "jQuery('#Money').focus()");
                    return false;
                }
                     if ($('#jifen').val() == "") {
                        KesionJS.Alert("请设置兑换积分！", "jQuery('#jifen').focus()");
                        return false;
                    }
                     if (parseInt($('#jifen').val()) <= 0) {
                        KesionJS.Alert("设置兑换积分不能小于等于0！", "jQuery('#jifen').focus()");
                        return false;
                    }
                }
            } else if (checkrad == "0") {
                if (jQuery("#IsSendNote :radio[checked]").val() == "1") {
                    KesionJS.Alert("免费课程不能邮寄资料啦！", "jQuery('#NotePrice').focus()");
                    return false;
                }
            }
            if (jQuery("#IsSendNote :radio[checked]").val() == "1" && parseFloat(jQuery('#NotePrice').val()) < 0) {
                KesionJS.Alert("资料价格不能小于0，请重新输入！", "jQuery('#NotePrice').focus()");
                return false;
            }
            return true;
        }
        function addUser() {
            var src = document.getElementById('LstB2');
            var dest = document.getElementById('LstB1');

            for (var i = 0; i < src.options.length; i++) {
                if (src.options[i].selected) {
                    var exist = false;
                    for (var j = 0; j < dest.options.length; j++) {
                        if (dest.options[j].value == src.options[i].value) {
                            exist = true;
                            break;
                        }
                    }
                    if (!exist) {
                        var opt = document.createElement('OPTION');
                        opt.value = src.options[i].value;
                        opt.text = src.options[i].text;
                        opt.selected = true;
                        dest.options.add(opt);
                    }
                }
            }
        }
        function delUser() {
            var dest = document.getElementById('LstB1');
            for (var i = dest.options.length - 1; i >= 0; i--) {
                if (dest.options[i].selected) {
                    dest.options[i] = null;
                }
            }
        }

        function showCourseType() {

            var checkrad1 = jQuery("[name='RdbTeachWay']:checked").val();

            if (checkrad1 == '1') {
                $("#showTeachWayLiveServer").hide();
            }
            else {
                $("#showTeachWayLiveServer").show();
            }
        }
        function getaccountlist(id) {
            livechecked0();
            var id = jQuery("#LiveType").val();
            var pid ='<%=pid%>';

            if (id != '0') {
                jQuery.get("/plus/course/LiveRoom.aspx", { a: "accountlist", id: id, pid: pid },
                    function (data) {

                        if (data != null && data != '') {
                            jQuery("#showaccount").show();
                            jQuery("#accountlist").empty().append(data);
                        } else {
                            jQuery("#showaccount").hide();
                            jQuery("#accountlist").empty().append("<option value='0'>请选择账号...</option>");
                        }
                    });
            } else {
                jQuery("#showaccount").hide();

                jQuery("#accountlist").empty().append("<option value='0'>请选择账号...</option>");
            }
        }
        function livechecked0() {
            var a = jQuery("#LiveType").val();
            if (a == 0) {
                jQuery("input[name=RadioLiveStatus]").attr("disabled", false);
                $("#othervideo").show();
                $("#zdylive").hide();
            } else if (a > 4) {
                $("#zdylive").show();
                $("#othervideo").hide();
                jQuery("input[name=RadioLiveStatus]").attr("disabled", false);
            } else {
                jQuery("input[name=RadioLiveStatus]").attr("disabled", true);
                $("#zdylive").hide();
                $("#othervideo").hide();
            }
        }
        var box = null;
        var isreload = false;
        function openWin(title, url, reload, width, height) {
            if (width == null) width = 760;
            if (height == null) height = 450;
            isreload = reload;
            box = $.dialog.open(url, {
                id: 'topbox', lock: true, title: title, width: width, height: height, close: function () {
                    if (isreload) {
                        top.frames['main'].location.reload();
                    }
                }
            });
        }
    </script>
