コード例 #1
0
ファイル: showmission.aspx.cs プロジェクト: pyteach/Learnsite
    private void ShowIpWorkDone()
    {
        string Sname  = cook.Sname;
        int    Sgrade = cook.Sgrade;
        int    Sclass = cook.Sclass;
        string Snum   = cook.Snum;
        string Wip    = cook.LoginIp;

        string Wcid = Request.QueryString["Cid"].ToString();
        string Wmid = Request.QueryString["Mid"].ToString();

        LearnSite.BLL.Works ws = new LearnSite.BLL.Works();
        string Wid             = ws.WorkDone(Snum, Int32.Parse(Wcid), Int32.Parse(Wmid));//返回空字符表示不存在该记录
        string SnumDone        = ws.IpWorkDoneSnum(Sgrade, Sclass, Int32.Parse(Wcid), Int32.Parse(Wmid), Wip);
        string retureUrl       = ws.WorkUrl(Snum, Int32.Parse(Wmid));

        VoteLink.NavigateUrl = "~/Student/myevaluate.aspx?Mid=" + Wmid + "&Cid=" + Wcid;
        if (LearnSite.Common.XmlHelp.GetWorkIpLimit())//判断有无进行IP限制
        {
            if (Snum == SnumDone || isTeacher(Wid, Snum))
            {
                if (retureUrl != "")
                {
                    upFileUrl.Visible     = true;
                    upFileType.Visible    = true;
                    upFileType.ImageUrl   = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif";
                    upFileUrl.Text        = Server.UrlDecode(Sname);
                    upFileUrl.NavigateUrl = "~/Plugins/download.aspx?Id=" + LearnSite.Common.EnDeCode.Encrypt(retureUrl, "ls");
                }
            }
        }
        else
        {
            if (retureUrl != "")
            {
                upFileUrl.Visible     = true;
                upFileType.Visible    = true;
                upFileType.ImageUrl   = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif";
                upFileUrl.Text        = Server.UrlDecode(Sname);
                upFileUrl.NavigateUrl = "~/Plugins/download.aspx?Id=" + LearnSite.Common.EnDeCode.Encrypt(retureUrl, "ls");
            }
        }
        if (Wid != "")//判断有无作品提交
        {
            bool ischeck = ws.IsChecked(Int32.Parse(Wid));
            if (ischeck)//判断作品有无评价
            {
                Labelmsg.Text          = "该作品已经评分!<br/>你不可以重新提交!";
                Panelswfupload.Visible = false;
            }
            else
            {
                if (LearnSite.Common.XmlHelp.GetWorkIpLimit())//判断有无进行IP限制
                {
                    if (Snum == SnumDone || isTeacher(Wid, Snum))
                    {
                        Labelmsg.Text          = "你已经提交该活动作品.!<br/>你可以修改作品后重新提交!";
                        Panelswfupload.Visible = true;
                    }
                    else
                    {
                        Panelswfupload.Visible = false;
                        if (LabelMfiletype.Text != "htm")
                        {
                            Labelmsg.Text = SnumDone + "学号<br/>已经在该IP提交本活动作品.!";
                        }
                    }
                }
                else
                {
                    Labelmsg.Text          = "你已经提交该活动作品.!!<br/>你可以修改作品后重新提交!";
                    Panelswfupload.Visible = true;
                }
            }
        }
        else
        {
            LearnSite.BLL.Mission mbll = new LearnSite.BLL.Mission();
            int  minMsort        = mbll.GetLastMaxMsort(Int32.Parse(Wcid), Int32.Parse(LabelMsort.Text));//任务活动中查询
            bool isExitFirstWork = ws.ExistsMyFirstWork(Int32.Parse(Wcid), Snum, minMsort);

            if (LearnSite.Common.XmlHelp.GetWorkIpLimit())//判断有无进行IP限制
            {
                if (SnumDone == "")
                {
                    if (isExitFirstWork || minMsort == 0)//如果是上个任务已经提交或是第一个任务,则显示提交按钮
                    {
                        DateTime dt    = DateTime.Now;
                        string   today = dt.Year.ToString() + "-" + dt.Month.ToString() + "-" + dt.Day;
                        Labelmsg.Text          = today;
                        Panelswfupload.Visible = true;
                    }
                    else
                    {
                        Labelmsg.Text = "请先提交前面活动作品!";
                    }
                }
                else
                {
                    Panelswfupload.Visible = false;
                    if (LabelMfiletype.Text != "htm")
                    {
                        Labelmsg.Text = SnumDone + "学号<br/>已经在该IP提交本活动作品!";
                    }
                }
            }
            else
            {
                if (isExitFirstWork || minMsort == 0)//如果是上个任务已经提交或是第一个任务,则显示提交按钮
                {
                    DateTime dt    = DateTime.Now;
                    string   today = dt.Year.ToString() + "-" + dt.Month.ToString() + "-" + dt.Day;
                    Labelmsg.Text          = today;
                    Panelswfupload.Visible = true;
                }
                else
                {
                    Labelmsg.Text = "请先提交前面的活动作品!";
                }
            }
        }
    }