コード例 #1
0
ファイル: autonomic.aspx.cs プロジェクト: pyteach/Learnsite
    protected string ListNews(object yid, int num, string css, int len)
    {
        LearnSite.BLL.Autonomic abll = new LearnSite.BLL.Autonomic();
        string html = abll.GetListTopHtml(Convert.ToInt32(yid), num, css, len);

        return(html);
    }
コード例 #2
0
    private void Readwork()
    {
        string afid = DDLsoft.SelectedValue;

        if (!string.IsNullOrEmpty(afid))
        {
            LearnSite.BLL.Autonomic abll = new LearnSite.BLL.Autonomic();
            DDLstore.DataSource     = abll.GetListCircleNomic(Int32.Parse(afid));
            DDLstore.DataTextField  = "Aname";
            DDLstore.DataValueField = "Aurl";
            DDLstore.DataBind();
            int curindex = Int32.Parse(lbcurindex.Text);
            if (DDLstore.Items.Count > 0)
            {
                int allindex = DDLstore.Items.Count - 1;
                if (curindex == allindex)
                {
                    lbcurindex.Text = "0";
                }
                if (curindex < allindex)
                {
                    DDLstore.SelectedIndex = curindex;
                }
            }
        }
    }
コード例 #3
0
ファイル: autonomic.aspx.cs プロジェクト: pyteach/Learnsite
    private void showMy()
    {
        LearnSite.Model.Cook cook = new LearnSite.Model.Cook();

        LearnSite.BLL.Autonomic abll = new LearnSite.BLL.Autonomic();
        RepMy.DataSource = abll.GetMyList(cook.Sid);//Aid,Aurl,Ftitle
        RepMy.DataBind();
    }
コード例 #4
0
    private void showMy()
    {
        int mySid = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sid"].ToString());

        LearnSite.BLL.Autonomic abll = new LearnSite.BLL.Autonomic();
        RepMy.DataSource = abll.GetMyList(mySid);//Aid,Aurl,Ftitle
        RepMy.DataBind();
    }
コード例 #5
0
 private void ListAll()
 {
     if (Request.QueryString["yid"] != null)
     {
         int yid = Int32.Parse(Request.QueryString["yid"].ToString());
         LearnSite.BLL.Autonomic abll = new LearnSite.BLL.Autonomic();
         GridView1.DataSource = abll.GetListByYid(yid);
         GridView1.DataBind();
     }
 }
コード例 #6
0
    protected void Btndel_Click(object sender, EventArgs e)
    {
        string afid = DDLsoft.SelectedValue;
        string anum = Labelnum.ToolTip;

        if (anum != "")
        {
            LearnSite.BLL.Autonomic abll = new LearnSite.BLL.Autonomic();
            abll.Delbynum(Int32.Parse(afid), anum);
            System.Threading.Thread.Sleep(200);//延时
            Readwork();
            showflash();
        }
    }
コード例 #7
0
    private void GetScore(string mySnum)
    {
        string afid = DDLsoft.SelectedValue;

        if (!string.IsNullOrEmpty(afid))
        {
            LearnSite.BLL.Autonomic abll = new LearnSite.BLL.Autonomic();
            string[] myscoreself         = abll.GetScoreSelf(Int32.Parse(afid), mySnum);
            string   myscore             = myscoreself[0].ToString();
            TextBoxWself.Text = myscoreself[1].ToString();
            if (myscore != "")
            {
                int ascore = Int32.Parse(myscore);
                switch (ascore)
                {
                case 12:
                    RBLselect.SelectedValue = "G";
                    break;

                case 10:
                    RBLselect.SelectedValue = "A";
                    break;

                case 8:
                    RBLselect.SelectedValue = "B";
                    break;

                case 6:
                    RBLselect.SelectedValue = "C";
                    break;

                case 4:
                    RBLselect.SelectedValue = "D";
                    break;

                case 2:
                    RBLselect.SelectedValue = "E";
                    break;

                case 0:
                    RBLselect.SelectedValue = "O";
                    break;
                }
            }
        }
    }
コード例 #8
0
    private void ShowUpload()
    {
        if (Request.QueryString["Fid"] != null)
        {
            string ch = Labelclass.Text;
            switch (ch)
            {
            case "微课":
            case "教程":
            {
                Panelswfupload.Visible = true;
                string Fid = Request.QueryString["Fid"].ToString();
                string Sid = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sid"].ToString();
                LearnSite.BLL.Autonomic   abll   = new LearnSite.BLL.Autonomic();
                LearnSite.Model.Autonomic amodel = new LearnSite.Model.Autonomic();
                amodel = abll.GetModel(Int32.Parse(Sid), Int32.Parse(Fid));
                if (amodel != null)
                {
                    if (amodel.Acheck)
                    {
                        Panelswfupload.Visible = false;
                    }
                    else
                    {
                        Panelswfupload.Visible = true;
                    }

                    upFileUrl.Visible     = true;
                    upFileType.Visible    = true;
                    upFileType.ImageUrl   = "~/Images/FileType/" + amodel.Atype.ToLower() + ".gif";
                    upFileUrl.Text        = Server.UrlDecode(amodel.Afilename);
                    upFileUrl.NavigateUrl = "~/Plugins/download.aspx?Id=" + LearnSite.Common.EnDeCode.Encrypt(amodel.Aurl, "ls");
                }
                break;
            }

            default:
                Panelswfupload.Visible = false;
                break;
            }
        }
    }
コード例 #9
0
    private void uploadautonomic()
    {
        HttpPostedFile work_upload = Request.Files["imgFile"];
        int            maxSize     = 10485760;//定义上传最大值为10MB

        if (work_upload != null)
        {
            int ayid = Int32.Parse(Request.QueryString["yid"].ToString());
            int afid = Int32.Parse(Request.QueryString["fid"].ToString());
            int asid = Int32.Parse(Request.QueryString["sid"].ToString());

            string atype    = work_upload.FileName.Substring(work_upload.FileName.LastIndexOf(".") + 1).ToLower();
            string limitext = LearnSite.Common.XmlHelp.GetTypeName("WorksType");

            if (limitext.Contains(atype))
            {
                if (work_upload.InputStream != null || work_upload.InputStream.Length < maxSize)
                {
                    int      alength = work_upload.ContentLength;
                    string   ayear   = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Syear"].ToString();
                    string   agrade  = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString();
                    string   aclass  = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString();
                    string   anum    = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString();
                    string   aip     = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["LoginIp"].ToString();
                    string   aname   = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sname"].ToString();
                    string   aterm   = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["ThisTerm"].ToString();
                    DateTime adate   = DateTime.Now;
                    //bool checkcan = true;
                    /// Asid,Anum,Aname,Ayid,Afid,Atype,Afilename,Aurl,Alength,Ascore,Adate,Aip,Ayear,Agrade,Aclass,Aterm,Aoffice
                    LearnSite.BLL.Autonomic abll = new LearnSite.BLL.Autonomic();
                    int aid = abll.Exists(asid, afid);//返回空字符表示不存在该记录
                    if (aid > 0)
                    {
                        if (!abll.ExistsCheck(aid))
                        {
                            //如果未评价,则重新提交修改作品Atype Afilename Aurl Alength Adate Aflash Aid
                            string MySavePath     = LearnSite.Common.WorkUpload.GetAurl(asid);//获得作品保存路径(如果不存在,自动创建)
                            string RndTime        = LearnSite.Common.WordProcess.GetRandomNum(99).ToString();
                            string OnlyFileName   = anum + "_" + afid.ToString() + "_" + RndTime;
                            string NewFileName    = OnlyFileName + "." + atype;
                            string aurl           = MySavePath + "/" + NewFileName;
                            string resaveFilename = Server.MapPath(aurl);
                            abll.UpdateAutonomic(atype, NewFileName, aurl, alength, adate, false, aid);
                            work_upload.SaveAs(resaveFilename);//保存提交作品
                            showSuccess("重新提交作品成功!");
                        }
                        else
                        {
                            showError("老师已评分!");
                        }
                    }
                    else
                    {
                        //如果作品未提交Asid,Anum,Aname,Ayid,Afid,Atype,Afilename,Aurl,Alength,Adate,Aip,Ayear,Agrade,Aclass,Aterm,Aoffice
                        string MySavePath     = LearnSite.Common.WorkUpload.GetAurl(asid);//获得作品保存路径(如果不存在,自动创建)
                        string RndTime        = LearnSite.Common.WordProcess.GetRandomNum(99).ToString();
                        string OnlyFileName   = anum + "_" + afid.ToString() + "_" + RndTime;
                        string NewFileName    = OnlyFileName + "." + atype;
                        string aurl           = MySavePath + "/" + NewFileName;
                        string resaveFilename = Server.MapPath(aurl);

                        LearnSite.Model.Autonomic amodel = new LearnSite.Model.Autonomic();
                        amodel.Asid      = asid;
                        amodel.Anum      = anum;
                        amodel.Aname     = HttpUtility.UrlDecode(aname);
                        amodel.Ayid      = ayid;
                        amodel.Afid      = afid;
                        amodel.Atype     = atype;
                        amodel.Afilename = NewFileName;
                        amodel.Aurl      = aurl;
                        amodel.Alength   = alength;
                        amodel.Adate     = adate;
                        amodel.Aip       = aip;
                        amodel.Ayear     = Int32.Parse(ayear);
                        amodel.Agrade    = Int32.Parse(agrade);
                        amodel.Aclass    = Int32.Parse(aclass);
                        amodel.Aterm     = Int32.Parse(aterm);
                        switch (atype)
                        {
                        case "doc":
                        case "ppt":
                        case "xls":
                        case "docx":
                        case "pptx":
                        case "xlsx":
                        case "wps":
                        case "wpp":
                        case "et":
                            amodel.Aoffice = true;
                            break;

                        default:
                            amodel.Aoffice = false;
                            break;
                        }
                        amodel.Aflash = false;
                        amodel.Aerror = false;

                        string saveFilename = Server.MapPath(aurl);
                        abll.AddAutonomic(amodel);

                        work_upload.SaveAs(saveFilename);//保存提交作品
                        showSuccess("保存作品成功!");
                    }
                }
                else
                {
                    showError("选择的文件大小超过限制!(最大为10MB)");
                }
            }
            else
            {
                showError("选择的文件类型不允许!");
            }
        }
        else
        {
            showError("请选择文件!");
        }
    }
コード例 #10
0
    protected void RBLselect_SelectedIndexChanged(object sender, EventArgs e)
    {
        string afid = DDLsoft.SelectedValue;
        string Anum = Labelnum.ToolTip;

        if (Anum != "")
        {
            string selectStr = RBLselect.SelectedValue;
            int    myscore   = 0;
            switch (selectStr)
            {
            case "G":
                myscore = 12;
                break;

            case "A":
                myscore = 10;
                break;

            case "B":
                myscore = 8;
                break;

            case "C":
                myscore = 6;
                break;

            case "D":
                myscore = 4;
                break;

            case "E":
                myscore = 2;
                break;

            case "O":
                myscore = 0;
                break;
            }
            string aself = HttpUtility.HtmlEncode(TextBoxWself.Text.Trim());
            LearnSite.BLL.Autonomic abll = new LearnSite.BLL.Autonomic();
            if (aself == "")
            {
                switch (myscore)
                {
                case 12:
                    aself = "你的作品已进入收藏榜";
                    break;

                case 10:
                    aself = "你的作品很优秀";
                    break;

                case 8:
                    aself = "你的作品良好";
                    break;

                case 6:
                    aself = "你的作品一般";
                    break;

                case 4:
                    aself = "你的作品有待改进";
                    break;

                case 2:
                    aself = "你的作品不完整";
                    break;
                }
            }
            abll.UpdateScoreSelf(Int32.Parse(afid), Anum, myscore, aself);//打分并评语
            if (DDLstore.Items.Count > 0)
            {
                int sindex = DDLstore.SelectedIndex;
                if (sindex < DDLstore.Items.Count - 1)
                {
                    int curindex = sindex + 1;
                    DDLstore.SelectedIndex = curindex;//保存当前索引位置
                    lbcurindex.Text        = curindex.ToString();
                    showflash();
                }
            }
        }
    }