示例#1
0
    private void ShowMission()
    {
        string Mid = Request.QueryString["Mid"].ToString();
        string Cid = Request.QueryString["Cid"].ToString();

        Id = Cid + "-" + Mid;
        int mill = DateTime.Now.Millisecond;

        Fpage = "program.aspx?Cid=" + Cid + "&Mid=" + Mid + "&Mill=" + mill;

        if (LearnSite.Common.WordProcess.IsNum(Mid))
        {
            LearnSite.Model.Mission model = new LearnSite.Model.Mission();
            LearnSite.BLL.Mission   mn    = new LearnSite.BLL.Mission();
            model = mn.GetModel(Int32.Parse(Mid));
            if (model != null)
            {
                LearnSite.Model.Cook cook = new LearnSite.Model.Cook();

                string Sname = cook.Sname;
                string Snum  = cook.Snum;

                this.Page.Title = HttpUtility.UrlDecode(Sname) + " " + model.Mtitle + "—>" + DateTime.Now.ToString();
                Microworld      = model.Microworld.ToString().ToLower();
                Mcontents       = HttpUtility.HtmlDecode(model.Mcontent);
                Owner           = HttpUtility.UrlDecode(Sname);
                Titles          = model.Mtitle;
                Filename        = LearnSite.Common.WordProcess.getshortfname(model.Mexample);
                LearnSite.BLL.Works wbll = new LearnSite.BLL.Works();
                if (!Snum.Contains("s"))
                {
                    if (wbll.ExistsMyMissonWork(Int32.Parse(Mid), Snum))
                    {
                        Filename = Owner + " " + Filename;
                    }
                }
                else
                {
                    Owner = "老师";
                }
            }
        }
    }
示例#2
0
    private void ShowWork()
    {
        string Wfiletype, Wurl;
        string Wid = Request.QueryString["Wid"].ToString();

        if (LearnSite.Common.WordProcess.IsNum(Wid))
        {
            LearnSite.Model.Works wmodel = new LearnSite.Model.Works();
            LearnSite.BLL.Works   ws     = new LearnSite.BLL.Works();
            wmodel = ws.GetModel(Int32.Parse(Wid));
            string workfilename = wmodel.Wfilename;
            WorkSnum  = wmodel.Wnum;
            Wurl      = wmodel.Wurl;
            Wfiletype = wmodel.Wtype;
            int     worklength = wmodel.Wlength.Value;
            decimal kblen      = worklength / 1024;
            LbWscore.Text   = wmodel.Wscore.ToString();
            LbWfscore.Text  = wmodel.Wfscore.ToString();
            LabelWdate.Text = wmodel.Wdate.ToString();
            LbWself.Text    = HttpUtility.HtmlDecode(wmodel.Wself);
            LbWdscore.Text  = wmodel.Wdscore.ToString();
            bool     Wflash   = wmodel.Wflash.Value;
            DateTime workdate = wmodel.Wdate.Value;
            TimeSpan ts       = DateTime.Now - workdate;
            int      days     = Int32.Parse(LearnSite.Common.XmlHelp.GetWorkDowntime());//获取作品查看天数

            int    wgrade = wmodel.Wgrade.Value;
            int    wterm  = wmodel.Wterm.Value;
            string Wip    = wmodel.Wip;
            ShowSelf(Int32.Parse(Wid), WorkSnum);
            ShowFeedback(Int32.Parse(Wid));
            ShowGauge(wmodel.Wmid.Value);
            LearnSite.BLL.Students stbll = new LearnSite.BLL.Students();
            string mySname = stbll.GetSnameBySnum(WorkSnum);
            if (mySname != "")
            {
                HLfile.Text = mySname + "." + Wfiletype;
            }
            else
            {
                HLfile.Text = "模拟学生" + WorkSnum + "." + Wfiletype;
            }
            Labelsize.Text = kblen.ToString("N2") + "kb";
            Labelgood.Text = "推荐" + LearnSite.Common.WordProcess.StrCountNew(MyFeedback, "T,").ToString() + "次";
            Labelwid.Text  = Wid;
            Labeltype.Text = Wfiletype;
            Labelwurl.Text = Wurl;
            if (isOffice(Wfiletype))
            {
                if (ws.ExistsMyMissonWork(wmodel.Wmid.Value, cook.Snum))
                {
                    Buttonpreview.Visible = true;//是office文档则显示预览查看按钮,以防止因为控件下载而卡页面
                }
                else
                {
                    Buttonpreview.Visible = false;//如果未交作品的,则无法查看
                }
            }
            else
            {
                Buttonpreview.Visible = false;//不是office文档则直接预览
                Literal1.Text         = LearnSite.Common.WordProcess.SelectEvaluateShow(Wid, Wfiletype, Wurl, false);
            }
            ImageType.ImageUrl = "~/Images/FileType/" + Wfiletype.ToLower() + ".gif";
            if (ts.Days < days)
            {
                int waitdays = days - ts.Days;

                if (LearnSite.Common.XmlHelp.GetWorkIpLimit())///如果作品提交IP限制
                {
                    if (cook.Snum == WorkSnum && cook.LoginIp == Wip)
                    {
                        HLfile.Visible = true;
                    }
                    else
                    {
                        HLfile.Visible = false;
                        Labelmsg.Text  = waitdays.ToString() + "天后可下载";
                    }
                }
                else
                {
                    if (cook.Snum == WorkSnum)
                    {
                        HLfile.Visible = true;
                    }
                    else
                    {
                        HLfile.Visible = false;//否则 IP没限制或IP不同则限制几天后下载
                        Labelmsg.Text  = waitdays.ToString() + "天后可下载";
                    }
                }
            }
            else
            {
                if (cook.Sgrade == wgrade && cook.ThisTerm == wterm)
                {
                    if (cook.Snum == WorkSnum)
                    {
                        HLfile.Visible = true;//本学期的作品自己可见,别人不可下载
                    }
                    else
                    {
                        HLfile.Visible   = false;//如果是本学期的作品,则无法下载,呵呵
                        Labelmsg.Text    = "隐藏下载";
                        Labelmsg.ToolTip = "该作品在版权保护期内,暂时无法下载.";
                    }
                }
                else
                {
                    HLfile.Visible = true;//超过,都可下载
                }
            }

            HLfile.NavigateUrl = "~/Plugins/download.aspx?Id=" + LearnSite.Common.EnDeCode.Encrypt(Wurl, "ls");
            LearnSite.BLL.Mission mbll = new LearnSite.BLL.Mission();
            Labelmission.Text = mbll.GetMissionTitle(wmodel.Wmid.Value);
        }
    }