Пример #1
0
    private void ShowMission()
    {
        if (Request.QueryString["id"] != null)
        {
            int wid = Int32.Parse(Request.QueryString["id"].ToString());
            LearnSite.BLL.Works   wbll  = new LearnSite.BLL.Works();
            LearnSite.Model.Works model = new LearnSite.Model.Works();
            string ipwid = "ip" + LearnSite.Common.Computer.MyIp().Replace('.', 'a') + "_" + wid.ToString();
            if (Session[ipwid] == null)
            {
                wbll.UpdateWhit(wid);
                Session[ipwid] = wid;
            }

            model           = wbll.GetModel(wid);
            Id              = wid.ToString();
            Owner           = model.Wname;
            Titles          = model.Wtitle;
            this.Page.Title = Titles + "  " + Owner;
            int Wcid   = model.Wcid.Value;
            int Wgrade = model.Wgrade.Value;

            if (Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname] != null)
            {
                LearnSite.Model.Cook cook = new LearnSite.Model.Cook();

                LearnSite.BLL.Room rbll   = new LearnSite.BLL.Room();
                string             result = rbll.GetRcid(cook.Sgrade, cook.Sclass);
                if (!string.IsNullOrEmpty(result))
                {
                    int cid = Int32.Parse(result);
                    if (cid == Wcid && cook.Sgrade == Wgrade)
                    {
                        //如果是正在上的课节内容,则不显示作品的脚本
                        ViewMode = "true";
                    }
                    if (Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname] != null)
                    {
                        ViewMode = "false";
                    }
                }
            }
        }
    }
Пример #2
0
    protected void showScratch()
    {
        if (Request.QueryString["id"] != null)
        {
            int wid = Int32.Parse(Request.QueryString["id"].ToString());
            LearnSite.BLL.Works   wbll  = new LearnSite.BLL.Works();
            LearnSite.Model.Works model = new LearnSite.Model.Works();

            model           = wbll.GetModel(wid);
            Id              = wid.ToString();
            LabelTitle.Text = model.Wtitle + " 作者:" + model.Wname;
            Owner           = Owner + " 作者:" + model.Wname;
            Pic             = "http://" + Request.Url.Host + model.Wthumbnail.Replace("~", "");
            Titles          = model.Wtitle;
        }
        else
        {
            Pic = Request.ApplicationPath + "Images/thumbnail.png";
        }
    }
Пример #3
0
    private void ShowMission()
    {
        if (Request.QueryString["id"] != null)
        {
            int wid = Int32.Parse(Request.QueryString["id"].ToString());
            LearnSite.BLL.Works   wbll  = new LearnSite.BLL.Works();
            LearnSite.Model.Works model = new LearnSite.Model.Works();
            string ipwid = "ip" + LearnSite.Common.Computer.MyIp().Replace('.', 'a') + "_" + wid.ToString();
            if (Session[ipwid] == null)
            {
                wbll.UpdateWhit(wid);
                Session[ipwid] = wid;
            }

            model  = wbll.GetModel(wid);
            Id     = wid.ToString();
            Owner  = model.Wname;
            Titles = model.Wtitle;
        }
    }
Пример #4
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);
        }
    }