Exemplo n.º 1
0
    private void showmission()
    {
        string Mcid = Request.QueryString["Mcid"].ToString();
        string Mid = Request.QueryString["Mid"].ToString();

        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)
        {
            LabelMtitle.Text = model.Mtitle;
            LabelMcid.Text = model.Mcid.ToString();
            Mcontent.InnerHtml = HttpUtility.HtmlDecode(model.Mcontent);
            LabelMdate.Text = model.Mdate.ToString();
            LabelMfiletype.Text = model.Mfiletype;
            ImageType.ImageUrl = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif";
            CheckBoxMupload.Checked = model.Mupload;
            LabelMsort.Text = model.Msort.ToString();
            GVmission.DataSource = mn.GetMissions(Int32.Parse(Mcid));
            GVmission.DataBind();
        }
    }
Exemplo n.º 2
0
    private void uploadgroupwork()
    {
        HttpPostedFile group_upload = Request.Files["imgFilegroup"];
        int            maxSize      = 104857600;//定义上传最大值为100MB

        if (group_upload != null)
        {
            // Get the data
            string Gtype = group_upload.FileName.Substring(group_upload.FileName.LastIndexOf(".") + 1).ToLower();
            string Gmid  = Request.QueryString["mid"].ToString();
            string Gnum  = Request.QueryString["num"].ToString();
            LearnSite.BLL.Mission   mbll   = new LearnSite.BLL.Mission();
            LearnSite.Model.Mission mmodel = new LearnSite.Model.Mission();
            mmodel = mbll.GetModel(Int32.Parse(Gmid));
            string Gextention = mmodel.Mfiletype;
            string Gcid       = mmodel.Mcid.ToString();
            string limitext   = Gextention;//初始化,随意
            switch (Gextention)
            {
            case "doc":
                limitext = "*.doc;*.docx";
                break;

            case "ppt":
                limitext = "*.ppt;*.pptx";
                break;

            case "xls":
                limitext = "*.xls;*.xlsx";
                break;

            case "office":
                limitext = "*.doc;*.docx;*.ppt;*.pptx;*.xls;*.xlsx";
                break;

            case "sb":
                limitext = "*.sb;*.sb2";
                break;

            default:
                limitext = "*." + Gextention;
                break;
            }
            if (Gtype == Gextention || limitext.Contains(Gtype))
            {
                if (group_upload.InputStream != null || group_upload.InputStream.Length < maxSize)
                {
                    LearnSite.BLL.Signin   sn     = new LearnSite.BLL.Signin();
                    LearnSite.Model.Signin qmodel = sn.GetModelm(Gnum);

                    LearnSite.Model.Cook cook = new LearnSite.Model.Cook();

                    string Ggroup    = cook.Sid.ToString();//取组长
                    string Gyear     = cook.Syear.ToString();
                    string Ggrade    = cook.Sgrade.ToString();
                    string Gclass    = cook.Sclass.ToString();
                    string Gip       = cook.LoginIp;
                    string LoginTime = cook.LoginTime;
                    string Gterm     = cook.ThisTerm.ToString();

                    if (qmodel != null)
                    {
                        Gyear     = qmodel.Qsyear.ToString();
                        Ggrade    = qmodel.Qgrade.ToString();
                        Gclass    = qmodel.Qclass.ToString();
                        Gip       = qmodel.Qip;
                        LoginTime = qmodel.Qdate.ToString();
                        Gterm     = qmodel.Qterm.ToString();
                    }


                    int      Glengh = group_upload.ContentLength;
                    DateTime Gdate  = DateTime.Now;


                    LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork();
                    bool   gdone      = gbll.DoneGroupWork(Gnum, Int32.Parse(Gmid));
                    string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Gyear, Ggrade, Gclass, Gcid, Gmid);//获得作品保存路径(如果不存在,自动创建)

                    string NewFileName  = "g" + Gnum + Gcid + "_" + Gmid + "." + Gtype;
                    string Gurl         = MySavePath + "/" + NewFileName;
                    string saveFilename = Server.MapPath(Gurl);

                    //如果作品未提交,提交作品
                    if (!gdone)
                    {
                        int Gtime = LearnSite.Common.Computer.TimePassed();
                        LearnSite.Model.GroupWork gmodel = new LearnSite.Model.GroupWork();
                        gmodel.Gcheck    = false;
                        gmodel.Gcid      = Int32.Parse(Gcid);
                        gmodel.Gclass    = Int32.Parse(Gclass);
                        gmodel.Gdate     = DateTime.Now;
                        gmodel.Gfilename = NewFileName;
                        gmodel.Ggrade    = Int32.Parse(Ggrade);
                        gmodel.Ghit      = 0;
                        gmodel.Gip       = Gip;
                        gmodel.Glengh    = Glengh;
                        gmodel.Gmid      = Int32.Parse(Gmid);
                        gmodel.Gnote     = "";
                        gmodel.Gnum      = Gnum;
                        gmodel.Grank     = -1;
                        gmodel.Gscore    = 0;
                        LearnSite.BLL.Students sbll = new LearnSite.BLL.Students();
                        gmodel.Gstudents = sbll.GroupSnum(Gnum);
                        gmodel.Gterm     = Int32.Parse(Gterm);
                        gmodel.Gtime     = Gtime;
                        gmodel.Gtype     = Gtype;
                        gmodel.Gurl      = Gurl;
                        gmodel.Gvote     = 0;
                        gmodel.Ggroup    = Int32.Parse(Ggroup);
                        gbll.Add(gmodel);//添加小组作品提交记录
                    }
                    else
                    {
                        //已交则不更新记录
                    }
                    group_upload.SaveAs(saveFilename);//保存或更新提交作品
                    Hashtable hash = new Hashtable();
                    hash["error"] = 0;
                    Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                    Response.Write(JsonMapper.ToJson(hash));
                    Response.End();
                }
                else
                {
                    showError("选择的文件大小超过限制!(最大为10MB)");
                }
            }
            else
            {
                showError("选择的文件类型错误!");
            }
        }
        else
        {
            showError("请选择文件!");
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// 显示信息
    /// </summary>
    private void ShowInfo()
    {
        string Studentnum = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString();

        int MySgrade = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString());
        int MySclass = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString());
        int MySyear  = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Syear"].ToString());
        int MySgroup = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgroup"].ToString());

        if (MySgroup == 0)
        {
            Labelscope.Text = "全班";
        }
        else
        {
            Labelscope.Text = "组内";
        }
        string Mid = Request.QueryString["Mid"].ToString();

        if (LearnSite.Common.WordProcess.IsNum(Mid))
        {
            LearnSite.Model.Works   wmodel = new LearnSite.Model.Works();
            LearnSite.BLL.Works     ws     = new LearnSite.BLL.Works();
            LearnSite.BLL.Mission   mbll   = new LearnSite.BLL.Mission();
            LearnSite.Model.Mission mModel = new LearnSite.Model.Mission();
            mModel = mbll.GetModel(Int32.Parse(Mid));
            ImageWtype.ImageUrl = "~/Images/FileType/" + mModel.Mfiletype + ".gif";
            Labelmtitle.Text    = "〖" + mModel.Mtitle + "〗";
            LabelMgid.Text      = mModel.Mgid.ToString();
            Labelwmid.Text      = Mid;
            LabelWtype.Text     = mModel.Mfiletype;
            wmodel = ws.GetModelByStu(Int32.Parse(Mid), Studentnum);
            if (wmodel != null)
            {
                DataListvote.DataSource = ws.ShowMissionWorksGroup(MySgrade, MySclass, Int32.Parse(Mid), MySgroup);
                DataListvote.DataBind();
                Labelhow.Text = DataListvote.Items.Count.ToString();
                Labelme.Text  = wmodel.Wvote.ToString();
                string   workIp    = wmodel.Wip;
                string   worknum   = wmodel.Wnum;
                DateTime workdate  = wmodel.Wdate.Value;
                DateTime nowdate   = DateTime.Now;
                bool     worklimit = LearnSite.Common.XmlHelp.GetWorkIpLimit();
                Labelegg.Text     = wmodel.Wegg.ToString();
                Labelwfscore.Text = wmodel.Wfscore.ToString();

                TimeSpan ts      = nowdate - workdate;
                int      lastday = ts.Days;
                Labelwdate.Text = lastday.ToString();///取短日期
                if (lastday < 30)
                {
                    if (showRgaugeSet())
                    {
                        LimitVote();//限制为可预览的投票
                    }
                    else
                    {
                        Labelmsg.Text   = "当前作品互评暂停!";
                        BtnVote.Enabled = false;
                    }
                }
                else
                {
                    Labelmsg.Text   = "一个月前的作品不能再投票了!";
                    BtnVote.Enabled = false;
                }
            }
            else
            {
                if (Studentnum.StartsWith("s"))
                {
                    DataListvote.DataSource = ws.ShowMissionWorksGroup(MySgrade, MySclass, Int32.Parse(Mid), MySgroup);
                    DataListvote.DataBind();
                    Labelhow.Text   = DataListvote.Items.Count.ToString();
                    BtnVote.Enabled = true;
                }
                else
                {
                    Labelmsg.Text   = "您未提交作品,无法互评!";
                    BtnVote.Enabled = false;
                }
            }
        }
    }
Exemplo n.º 4
0
 private void missionview()
 {
     if (Request.QueryString["Mid"] != null)
     {
         int Mid = Int32.Parse(Request.QueryString["Mid"].ToString());
         LearnSite.Model.Mission mission = new LearnSite.Model.Mission();
         LearnSite.BLL.Mission missionbll = new LearnSite.BLL.Mission();
         mission = missionbll.GetModel(Mid);
         FCKeditor1.Value = HttpUtility.HtmlDecode(mission.Mcontent);
         DDLmfiletype.SelectedValue = mission.Mfiletype;
         CheckPublish.Checked = mission.Mpublish;
         DDLsort.SelectedValue = mission.Msort.ToString();
         Texttitle.Text = mission.Mtitle;
         CheckUpload.Checked = mission.Mupload;
     }
 }
Exemplo n.º 5
0
    private void uploadthiswork()
    {
        if (Request.Files["Filedata"] != null)
        {
            try
            {
                HttpPostedFile          work_upload = Request.Files["Filedata"];
                string                  Wmid        = Request.QueryString["mid"].ToString();
                string                  Wnum        = Request.QueryString["num"].ToString();
                string                  info        = HttpUtility.UrlDecode(Request.QueryString["info"].ToString());
                LearnSite.BLL.Mission   mbll        = new LearnSite.BLL.Mission();
                LearnSite.Model.Mission mmodel      = new LearnSite.Model.Mission();
                mmodel = mbll.GetModel(Int32.Parse(Wmid));

                string Wcid      = mmodel.Mcid.ToString();
                string Wmsort    = mmodel.Msort.ToString();
                string Wfiletype = work_upload.FileName.Substring(work_upload.FileName.LastIndexOf(".") + 1).ToLower();
                // string Wextention = mmodel.Mfiletype;
                int Wlength = work_upload.ContentLength;
                //Syear | Sgrade | Sclass | Sid | Sname | Wip | Sterm | LoginTime
                string[] infoarray = info.Split('|');

                string Syear     = infoarray[0];
                string Sgrade    = infoarray[1];
                string Sclass    = infoarray[2];
                string Wsid      = infoarray[3];
                string Sname     = infoarray[4];
                string Wip       = infoarray[5];
                string Wterm     = infoarray[6];
                string Logintime = infoarray[7];

                DateTime Wdate    = DateTime.Now;
                bool     checkcan = true;

                LearnSite.BLL.Works ws = new LearnSite.BLL.Works();
                string Wid             = ws.WorkDone(Wnum, Int32.Parse(Wcid), Int32.Parse(Wmid));//返回空字符表示不存在该记录
                if (Wid != "")
                {
                    if (!ws.IsChecked(Int32.Parse(Wid)))
                    {
                        //如果未评价,则重新提交修改作品
                        string MySavePath     = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建)
                        string RndTime        = LearnSite.Common.WordProcess.GetRandomNum(99).ToString();
                        string OnlyFileName   = Wnum + "_" + Wcid + "_" + Wmid + "_" + RndTime;
                        string NewFileName    = OnlyFileName + "." + Wfiletype;
                        string Wurl           = MySavePath + "/" + NewFileName;
                        string resaveFilename = Server.MapPath(Wurl);
                        try
                        {
                            ws.UpdateWorkUp(Int32.Parse(Wid), Wurl, NewFileName, Wlength, Wdate, checkcan, "");//更新Wfilename, Wurl,Wlength, Wdate

                            //LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin();
                            //sn.UpdateQwork(Int32.Parse(Wsid), Int32.Parse(Wcid));//更新今天签到表中的作品数量
                            work_upload.SaveAs(resaveFilename);//保存提交作品
                            Response.StatusCode = 200;
                            Response.Write(NewFileName);
                        }
                        catch (Exception ex)
                        {
                            Response.StatusCode = 200;
                            Response.Write(ex);
                        }
                        finally
                        {
                            Response.End();
                        }
                    }
                    else
                    {
                        Response.StatusCode = 200;
                        Response.Write("老师已经评价了!");
                        Response.End();
                    }
                }
                else
                {
                    //如果作品未提交,提交作品(Wnum, Wcid,Wmid,Wmsort, Wfilename, Wurl,Wlength, Wdate, Wip, Wtime)
                    string MySavePath   = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建)
                    string RndTime      = LearnSite.Common.WordProcess.GetRandomNum(99).ToString();
                    string OnlyFileName = Wnum + "_" + Wcid + "_" + Wmid + "_" + RndTime;
                    string NewFileName  = OnlyFileName + "." + Wfiletype;
                    string Wurl         = MySavePath + "/" + NewFileName;
                    string Wtime        = LearnSite.Common.Computer.TimePassed(Logintime).ToString();

                    LearnSite.Model.Works wmodel = new LearnSite.Model.Works();
                    wmodel.Wnum      = Wnum;
                    wmodel.Wcid      = Int32.Parse(Wcid);
                    wmodel.Wmid      = Int32.Parse(Wmid);
                    wmodel.Wmsort    = Int32.Parse(Wmsort);
                    wmodel.Wfilename = NewFileName;
                    wmodel.Wtype     = Wfiletype;
                    wmodel.Wurl      = Wurl;
                    wmodel.Wlength   = Wlength;
                    wmodel.Wdate     = Wdate;
                    wmodel.Wip       = Wip;
                    wmodel.Wtime     = Wtime;
                    wmodel.Wcan      = checkcan;
                    wmodel.Wcheck    = false;
                    wmodel.Wegg      = 12;//设定票数为12张
                    wmodel.Whit      = 0;
                    wmodel.Wgrade    = Int32.Parse(Sgrade);
                    wmodel.Wterm     = Int32.Parse(Wterm);
                    wmodel.Wsid      = Int32.Parse(Wsid);
                    wmodel.Wclass    = Int32.Parse(Sclass);
                    wmodel.Wname     = HttpUtility.UrlDecode(Sname);
                    wmodel.Wyear     = Int32.Parse(Syear);
                    switch (Wfiletype)
                    {
                    case "doc":
                    case "ppt":
                    case "xls":
                    case "docx":
                    case "pptx":
                    case "xlsx":
                    case "wps":
                    case "dps":
                    case "et":
                        wmodel.Woffice = true;
                        break;

                    default:
                        wmodel.Woffice = false;
                        break;
                    }
                    wmodel.Wflash = false;
                    wmodel.Werror = false;
                    string saveFilename = Server.MapPath(Wurl);
                    try
                    {
                        ws.AddWorkUp(wmodel);                                 //添加作品提交记录
                        LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin();
                        sn.UpdateQwork(Int32.Parse(Wsid), Int32.Parse(Wcid)); //更新今天签到表中的作品数量

                        work_upload.SaveAs(saveFilename);                     //保存提交作品
                        Response.StatusCode = 200;
                        Response.Write(NewFileName);
                    }
                    catch (Exception ex)
                    {
                        Response.StatusCode = 200;
                        Response.Write(ex);
                    }
                    finally
                    {
                        Response.End();
                    }
                }
            }
            catch (Exception ex)
            {
                Response.StatusCode = 200;
                Response.Write(ex);
            }
            finally
            {
                Response.End();
            }
        }
    }
Exemplo n.º 6
0
    private void ShowMission()
    {
        string Mid = Request.QueryString["Mid"].ToString();
        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)
            {
                LabelMtitle.Text = model.Mtitle;
                LabelMcid.Text = model.Mcid.ToString();
                Mcontent.InnerHtml = HttpUtility.HtmlDecode(model.Mcontent);
                LabelMdate.Text = model.Mdate.ToString();
                LabelMfiletype.Text = model.Mfiletype;
                CheckBoxMupload.Checked = model.Mupload;
                LabelMsort.Text = model.Msort.ToString();
                Btnupload.Enabled = model.Mupload;
                if (LabelMfiletype.Text == "html")
                {
                    Labelmsg.Text = "远程网站连接设置";
                    string ftpstr = "ftp://" + LearnSite.Common.Computer.GetServerIp();
                    TextFtp.Text = ftpstr;
                    string userstr = Request.Cookies["StudentCookies"].Values["Snum"].ToString();
                    TextUser.Text = userstr;
                    string pwdstr = Request.Cookies["StudentCookies"].Values["Ftppwd"].ToString();
                    TextPwd.Text = pwdstr;
                    PanelFtp.Visible = true;
                    Panelworks.Visible = false;
                }
                else
                {
                    if (!CheckBoxMupload.Checked)
                    {
                        Panelworks.Visible = false;
                    }
                }
                ImageType.ImageUrl = "~/Images/FileType/"+LabelMfiletype.Text.ToLower()+".gif";
            }
            else
            {
                Mcontent.InnerHtml = "此课程活动不存在!";
            }
        }
    }
Exemplo n.º 7
0
    private void uploadthiswork()
    {
        HttpPostedFile work_upload = Request.Files["imgFile"];
        int            maxSize     = 104857600;//定义上传最大值为100MB

        if (work_upload != null)
        {
            string Wmid = Request.QueryString["mid"].ToString();
            string Wnum = Request.QueryString["num"].ToString();
            LearnSite.BLL.Mission   mbll   = new LearnSite.BLL.Mission();
            LearnSite.Model.Mission mmodel = new LearnSite.Model.Mission();
            mmodel = mbll.GetModel(Int32.Parse(Wmid));

            string Wcid       = mmodel.Mcid.ToString();
            string Wmsort     = mmodel.Msort.ToString();
            string Wfiletype  = work_upload.FileName.Substring(work_upload.FileName.LastIndexOf(".") + 1).ToLower();
            string Wextention = mmodel.Mfiletype;
            string limitext   = Wextention;//初始化,随意
            switch (Wextention)
            {
            case "doc":
                limitext = "*.doc;*.docx";
                break;

            case "ppt":
                limitext = "*.ppt;*.pptx";
                break;

            case "xls":
                limitext = "*.xls;*.xlsx";
                break;

            case "office":
                limitext = "*.doc;*.docx;*.ppt;*.pptx;*.xls;*.xlsx";
                break;

            case "sb":
                limitext = "*.sb;*.sb2";
                break;

            default:
                limitext = "*." + Wextention;
                break;
            }
            if (Wfiletype == Wextention || limitext.Contains(Wfiletype))
            {
                if (work_upload.InputStream != null || work_upload.InputStream.Length < maxSize)
                {
                    int      Wlength  = work_upload.ContentLength;
                    string   Syear    = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Syear"].ToString();
                    string   Sgrade   = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString();
                    string   Sclass   = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString();
                    string   Wsid     = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sid"].ToString();
                    string   Wip      = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["LoginIp"].ToString();
                    string   Sname    = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sname"].ToString();
                    string   Wterm    = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["ThisTerm"].ToString();
                    DateTime Wdate    = DateTime.Now;
                    bool     checkcan = true;

                    LearnSite.BLL.Works ws = new LearnSite.BLL.Works();
                    string Wid             = ws.WorkDone(Wnum, Int32.Parse(Wcid), Int32.Parse(Wmid));//返回空字符表示不存在该记录
                    if (Wid != "")
                    {
                        if (!ws.IsChecked(Int32.Parse(Wid)))
                        {
                            //如果未评价,则重新提交修改作品
                            string MySavePath     = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建)
                            string RndTime        = LearnSite.Common.WordProcess.GetRandomNum(99).ToString();
                            string OnlyFileName   = Wnum + "_" + Wcid + "_" + Wmid + "_" + RndTime;
                            string NewFileName    = OnlyFileName + "." + Wfiletype;
                            string Wurl           = MySavePath + "/" + NewFileName;
                            string resaveFilename = Server.MapPath(Wurl);
                            ws.UpdateWorkUp(Int32.Parse(Wid), Wurl, NewFileName, Wlength, Wdate, checkcan, ""); //更新Wfilename, Wurl,Wlength, Wdate
                            LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin();
                            sn.UpdateQwork(Int32.Parse(Wsid), Int32.Parse(Wcid));                               //更新今天签到表中的作品数量
                            work_upload.SaveAs(resaveFilename);                                                 //保存提交作品

                            Hashtable hash = new Hashtable();
                            hash["error"] = 0;
                            Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                            Response.Write(JsonMapper.ToJson(hash));
                            Response.End();
                        }
                        else
                        {
                            showError("老师已经评价了!");
                        }
                    }
                    else
                    {
                        //如果作品未提交,提交作品(Wnum, Wcid,Wmid,Wmsort, Wfilename, Wurl,Wlength, Wdate, Wip, Wtime)
                        string MySavePath   = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建)
                        string RndTime      = LearnSite.Common.WordProcess.GetRandomNum(99).ToString();
                        string OnlyFileName = Wnum + "_" + Wcid + "_" + Wmid + "_" + RndTime;
                        string NewFileName  = OnlyFileName + "." + Wfiletype;
                        string Wurl         = MySavePath + "/" + NewFileName;
                        string Wtime        = LearnSite.Common.Computer.TimePassed().ToString();

                        LearnSite.Model.Works wmodel = new LearnSite.Model.Works();
                        wmodel.Wnum      = Wnum;
                        wmodel.Wcid      = Int32.Parse(Wcid);
                        wmodel.Wmid      = Int32.Parse(Wmid);
                        wmodel.Wmsort    = Int32.Parse(Wmsort);
                        wmodel.Wfilename = NewFileName;
                        wmodel.Wtype     = Wextention;
                        wmodel.Wurl      = Wurl;
                        wmodel.Wlength   = Wlength;
                        wmodel.Wdate     = Wdate;
                        wmodel.Wip       = Wip;
                        wmodel.Wtime     = Wtime;
                        wmodel.Wcan      = checkcan;
                        wmodel.Wcheck    = false;
                        wmodel.Wegg      = 12;//设定票数为12张
                        wmodel.Whit      = 0;
                        wmodel.Wgrade    = Int32.Parse(Sgrade);
                        wmodel.Wterm     = Int32.Parse(Wterm);
                        wmodel.Wsid      = Int32.Parse(Wsid);
                        wmodel.Wclass    = Int32.Parse(Sclass);
                        wmodel.Wname     = HttpUtility.UrlDecode(Sname);
                        wmodel.Wyear     = Int32.Parse(Syear);

                        switch (Wfiletype)
                        {
                        case "doc":
                        case "ppt":
                        case "xls":
                        case "docx":
                        case "pptx":
                        case "xlsx":
                        case "wps":
                        case "dps":
                        case "et":
                            wmodel.Woffice = true;
                            break;

                        default:
                            wmodel.Woffice = false;
                            break;
                        }
                        wmodel.Wflash = false;
                        wmodel.Werror = false;
                        string saveFilename = Server.MapPath(Wurl);
                        ws.AddWorkUp(wmodel);                                 //添加作品提交记录
                        LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin();
                        sn.UpdateQwork(Int32.Parse(Wsid), Int32.Parse(Wcid)); //更新今天签到表中的作品数量

                        work_upload.SaveAs(saveFilename);                     //保存提交作品
                        Hashtable hash = new Hashtable();
                        hash["error"] = 0;

                        Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                        Response.Write(JsonMapper.ToJson(hash));
                        Response.End();
                    }
                }
                else
                {
                    showError("选择的文件大小超过限制!(最大为100MB)");
                }
            }
            else
            {
                showError("选择的文件类型错误!");
            }
        }
        else
        {
            showError("请选择文件!");
        }
    }
Exemplo n.º 8
0
    private void ShowMission()
    {
        string Mid = Request.QueryString["Mid"].ToString();

        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)
            {
                string sSyear   = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Syear"].ToString();
                string sSclass  = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString();
                string sSnum    = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString();
                string sLoginIp = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["LoginIp"].ToString();

                string sWcid      = model.Mcid.ToString();
                string sWmid      = Mid;
                string sWmsort    = model.Msort.ToString();
                string sWfiletype = model.Mfiletype;
                LabelMtitle.Text    = model.Mtitle;
                LabelMcid.Text      = model.Mcid.ToString();
                Mcontent.InnerHtml  = HttpUtility.HtmlDecode(model.Mcontent);
                LabelSnum.Text      = sSnum;
                LabelMfiletype.Text = sWfiletype;
                bool isupload = model.Mupload;
                CkMupload.Checked = isupload;
                if (isupload)
                {
                    VoteLink.Visible = true;
                }
                else
                {
                    VoteLink.Visible = false;
                }
                CkMgroup.Checked         = model.Mgroup;
                LabelMsort.Text          = sWmsort;
                LabelMid.Text            = Mid;
                upFileTypeGroup.ImageUrl = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif";
                upFileUrlGroup.Text      = "小组作品";
                switch (sWfiletype)
                {
                case "doc":
                    LabelUploadType.Text = "*.doc;*.docx";
                    break;

                case "ppt":
                    LabelUploadType.Text = "*.ppt;*.pptx";
                    break;

                case "xls":
                    LabelUploadType.Text = "*.xls;*.xlsx";
                    break;

                case "office":
                    LabelUploadType.Text = "*.doc;*.docx;*.ppt;*.pptx;*.xls;*.xlsx";
                    break;

                case "sb":
                    LabelUploadType.Text = "*.sb;*.sb2";
                    break;

                case "flash":
                    LabelUploadType.Text = "*.swf;*.fla";
                    break;

                default:
                    LabelUploadType.Text = "*." + sWfiletype;
                    break;
                }
                if (model.Mgroup)
                {
                    LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork();
                    string gurl = gbll.DoneGroupWorkUrl(sSnum, Int32.Parse(Mid));
                    upFileTypeGroup.Visible    = true;
                    upFileUrlGroup.Visible     = true;
                    upFileUrlGroup.NavigateUrl = "~/Plugins/download.aspx?Id=" + LearnSite.Common.EnDeCode.Encrypt(gurl, "ls");
                    LearnSite.BLL.Students sbll = new LearnSite.BLL.Students();
                    if (sbll.IsLeader(sSnum))//如果是组长则显示小组面板
                    {
                        Panelgroup.Visible = true;
                        showgroupWork();
                        if (gurl != "")
                        {
                            if (gbll.CheckGroupWork(sSnum, Int32.Parse(Mid)))
                            {
                                PanelGroupUp.Visible = false;
                                Labelgroupmsg.Text   = "小组作品已经评价!<br/>你不可以再重新提交!";
                            }
                            else
                            {
                                Labelgroupmsg.Text = "小组作品已提交但未评价!<br/>你可以修改后重新提交!";
                            }
                        }
                        else
                        {
                            upFileTypeGroup.Visible = false;
                            upFileUrlGroup.Visible  = false;
                        }
                    }
                    else
                    {
                        Panelgroup.Visible      = false;
                        upFileTypeGroup.Visible = false;
                    }
                }
                else
                {
                    Panelgroup.Visible      = false;
                    upFileTypeGroup.Visible = false;
                }

                if (!CkMupload.Checked)
                {
                    Panelworks.Visible = false;
                }

                ImageType.ImageUrl = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif";
            }
            else
            {
                Mcontent.InnerHtml = "此学案活动不存在!";
                Panelworks.Visible = false;
            }
        }
    }