Ejemplo n.º 1
0
    /// <summary>
    /// 先删除学生表中的毕业学生,再删除Ftp用户中的记录,再删除Signin表中的记录, 最后删除Web用户
    /// 学年升级(只是年级改变)不影响Ftp账号使用(因为Ftp账号是根据Syear,Sclass,Snum入学年份、班级、学号创建
    /// Ftp目录也是根据Syear,Sclass,Snum入学年份、班级、学号创建)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Btnupgrade_Click(object sender, EventArgs e)
    {
        LearnSite.BLL.Room rm = new LearnSite.BLL.Room();
        if (rm.GradeCount() > 0)
        {
            DateTime nowtime1         = DateTime.Now;
            LearnSite.BLL.Students st = new LearnSite.BLL.Students();
            if (st.GetCounts() > 0)
            {
                st.Upgrade();    //所有年级升一级,并删除班级表中不存在班级的学生
                System.Threading.Thread.Sleep(1000);
                LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin();
                sg.Upgrade();    // 在签到表中删除学生表中不存在班级的学生

                DateTime nowtime2 = DateTime.Now;
                Labelmsg.Text      = "学年升级成功! 用时" + LearnSite.Common.Computer.Datagone(nowtime1, nowtime2) + "秒";
                Btnupgrade.Enabled = false;
                LearnSite.BLL.Room rbll = new LearnSite.BLL.Room();
                rbll.UpdateRhidNone(); //清除班级选择
                LearnSite.BLL.Courses bll = new LearnSite.BLL.Courses();
                bll.HideCourse();      //将所有发布的学案收回,处于未发布状态
                LearnSite.Common.WordProcess.Alert("请给任课老师重新选择新学期任教班级!", this.Page);
                Session["Upgraded"] = "Done";
            }
            else
            {
                Labelmsg.Text = "没有学生";
            }
        }
        else
        {
            Labelmsg.Text = "班级未设置!";
        }
    }
Ejemplo n.º 2
0
 /// <summary>
 /// 先删除学生表中的毕业学生,再删除Ftp用户中的记录,再删除Signin表中的记录, 最后删除Web用户
 /// 学年升级(只是年级改变)不影响Ftp账号使用(因为Ftp账号是根据Syear,Sclass,Snum入学年份、班级、学号创建
 /// Ftp目录也是根据Syear,Sclass,Snum入学年份、班级、学号创建)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Btnupgrade_Click(object sender, EventArgs e)
 {
     LearnSite.BLL.Room rm = new LearnSite.BLL.Room();
     if (rm.GradeCount() > 0)
     {
             DateTime nowtime1 = DateTime.Now;
             LearnSite.BLL.Students st = new LearnSite.BLL.Students();
             if (st.GetCounts() > 0)
             {
                 st.Upgrade();//所有年级升一级,并删除班级表中不存在班级的学生
                 System.Threading.Thread.Sleep(1000);
                 LearnSite.Ftp.Reg.Upgrade();//删除学生表中不存在学号的账号(根据已经清除过的学生表与网页表对比)
                 System.Threading.Thread.Sleep(1000);
                 LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin();
                 sg.Upgrade();// 在签到表中删除学生表中不存在班级的学生
                 System.Threading.Thread.Sleep(1000);
                 LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy();
                 ws.Upgrade();//学年升级,删除Webstudy中学号不在Students的记录
                 DateTime nowtime2 = DateTime.Now;
                 Labelmsg.Text = "学年升级成功! 用时" + LearnSite.Common.Computer.Datagone(nowtime1, nowtime2) + "秒";
                 Btnupgrade.Enabled = false;
                 Session["Upgraded"] = "Done";
             }
             else
             {
                 Labelmsg.Text = "没有学生";
             }
     }
     else
     {
         Labelmsg.Text = "班级未设置!";
     }
 }
Ejemplo n.º 3
0
 private void ShowSigin()
 {
     if (Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname] != null)
     {
         string   Hid      = tcook.Hid.ToString();
         int      Rgrade   = Int32.Parse(DDLgrade.SelectedValue);
         int      Rclass   = Int32.Parse(DDLclass.SelectedValue);
         DateTime dt       = DateTime.Now;
         int      Qyear    = dt.Year;
         int      Qmonth   = dt.Month;
         int      Qday     = dt.Day;
         string   SignSort = RBsort.SelectedValue;//获取上课页面签到排序方法
         LabelToday.Text = " 服务器日期校准:" + Qyear.ToString() + "年" + Qmonth.ToString() + "月" + Qday.ToString() + "日";
         LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin();
         string pcroom           = DDLhouse.SelectedValue;
         if (SignSort.Equals("3"))
         {
             LearnSite.Model.SeatCollect sctm = sg.StartSignTable(Rgrade, Rclass, Qyear, Qmonth, Qday, pcroom);
             DLonline.DataSource = sctm.Dt;
             DLonline.DataBind();
             DLonline.RepeatColumns = sctm.Column;
             Labelsigin.Text        = sctm.Online.ToString();
         }
         else
         {
             DLonline.DataSource = sg.StartSignClass(Rgrade, Rclass, Qyear, Qmonth, Qday, SignSort);
             DLonline.DataBind();
             DLonline.RepeatColumns = 8;
             Labelsigin.Text        = DLonline.Items.Count.ToString();
         }
     }
 }
Ejemplo n.º 4
0
    protected void Btnlogin_Click(object sender, EventArgs e)
    {
        string Snum = TextBoxuser.Text.Trim();
        string Spwd = TextBoxpwd.Text.Trim();
        if (Snum != "" && Spwd != "")
        {
            if (LearnSite.Common.WordProcess.IsEnNum(Snum) && LearnSite.Common.WordProcess.IsEnNum(Spwd))
            {
                LearnSite.Model.Students model = new LearnSite.Model.Students();
                LearnSite.BLL.Students bll = new LearnSite.BLL.Students();
                int loginm = LearnSite.Common.XmlHelp.LoginMode();//获取登录方式 0表示个人密码方式登录 1表示班级密码方式登录
                if (loginm == 1)
                {
                    if (bll.ExistsLogin(Snum, Spwd))
                    {
                        model = bll.SnumGetModel(Snum);//查询该学号和班级密码的学生是否存在,存在返回实体,不存在返回null
                    }
                    else
                    {
                        model = null;
                    }
                }
                else
                {
                    model = bll.GetStudentModel(Snum, Spwd);//查询该学号密码学生是否存在,存在返回实体,不存在返回null
                }
                System.Threading.Thread.Sleep(500);
                if (model != null)
                {
                    if (LearnSite.Common.CookieHelp.SetStudentCookies(model))//写cookies
                    {
                        DateTime LoginTime = DateTime.Now;
                        string LoginIP = LearnSite.Common.Computer.GetGuestIP();
                        LearnSite.BLL.Signin gbll = new LearnSite.BLL.Signin();
                        gbll.SigninToday(Snum, LoginTime, LoginIP);//签到
                        System.Threading.Thread.Sleep(1000);
                        Response.Redirect("~/Student/myinfo.aspx", false);

                    }
                    else
                    {
                        string msg = "本机cookies设置失效,无法登录!";
                        Labelmsg.Text = msg;
                    }
                }
                else
                {
                    Labelmsg.Text = "用户名或密码错误!";
                    TextBoxuser.Text = "";
                    TextBoxpwd.Text = "";
                }

            }
            else
            {
                Labelmsg.Text = "用户名或密码含有非法字符";
            }
        }
    }
Ejemplo n.º 5
0
    private void ShowSigin()
    {
        int Qgrade = Int32.Parse(DDLgrade.SelectedValue.ToString());
        int Qclass = Int32.Parse(DDLclass.SelectedValue.ToString());

        LearnSite.BLL.Signin sign = new LearnSite.BLL.Signin();
        GVSignin.DataSource = sign.GetSignClass(Qgrade, Qclass);
        GVSignin.DataBind();
    }
Ejemplo n.º 6
0
    protected void BtnExcel_Click(object sender, EventArgs e)
    {
        int sgrade = Int32.Parse(DDLgrade.SelectedValue);
        int sclass = Int32.Parse(DDLclass.SelectedValue);
        int sterm  = Int32.Parse(LearnSite.Common.XmlHelp.GetTerm());

        LearnSite.BLL.Signin sgbll = new LearnSite.BLL.Signin();
        sgbll.SignExcel(sgrade, sclass, sterm);
    }
Ejemplo n.º 7
0
 private void showSign()
 {
     if (LearnSite.Common.CookieHelp.IsStudentLogin())
     {
         string mynum = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString();
         LearnSite.BLL.Signin gbll = new LearnSite.BLL.Signin();
         GVSignin.DataSource = gbll.SignSnumdetail(mynum);
         GVSignin.DataBind();
     }
 }
Ejemplo n.º 8
0
 private void showSign()
 {
     if (LearnSite.Common.CookieHelp.IsStudentLogin())
     {
         string mynum = cook.Snum;
         LearnSite.BLL.Signin gbll = new LearnSite.BLL.Signin();
         GVSignin.DataSource = gbll.SignSnumdetail(mynum);
         GVSignin.DataBind();
     }
 }
Ejemplo n.º 9
0
 private void Showname()
 {
     if (Request.QueryString["Qip"] != null)
     {
         string Qip = Request.QueryString["Qip"].ToString();
         LabelIp.Text = Qip;
         LearnSite.BLL.Signin gbll = new LearnSite.BLL.Signin();
         GridViewworks.DataSource = gbll.GetIpStudents(Qip);
         GridViewworks.DataBind();
     }
 }
Ejemplo n.º 10
0
    private void ShowOnline()
    {
        DateTime today  = DateTime.Now;
        int      Qyear  = today.Year;
        int      Qmonth = today.Month;
        int      Qday   = today.Day;

        LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin();
        DataListonline.DataSource = sg.OnlineToday(cook.Sgrade, cook.Sclass, Qyear, Qmonth, Qday);
        DataListonline.DataBind();
    }
Ejemplo n.º 11
0
    private void ShowOnline()
    {
        DateTime today  = DateTime.Now;
        int      Qyear  = today.Year;
        int      Qmonth = today.Month;
        int      Qday   = today.Day;
        int      Qgrade = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString());
        int      Qclass = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString());

        LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin();
        DataListonline.DataSource = sg.OnlineToday(Qgrade, Qclass, Qyear, Qmonth, Qday);
        DataListonline.DataBind();
    }
Ejemplo n.º 12
0
 protected void Btnattitude_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["Qid"] != null)
     {
         int Qid = Int32.Parse(Request.QueryString["Qid"].ToString());
         int Qattitude = Int32.Parse(RBLattitude.SelectedValue);
         string Qnote = RBLattitude.Items[RBLattitude.SelectedIndex].Text;
         LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin();
         sg.UpdateAttitude(Qid, Qattitude, Qnote);
         System.Threading.Thread.Sleep(1000);
         Response.Redirect("~/Teacher/start.aspx", false);
     }
 }
Ejemplo n.º 13
0
 private void showAttitude()
 {
     if (Request.QueryString["Sg"] != null && Request.QueryString["Ld"] != null && Request.QueryString["Qd"] != null)
     {
         Labelname.Text = Server.UrlDecode(Request.QueryString["Ld"].ToString());
         int Qid = Int32.Parse(Request.QueryString["Qd"].ToString());
         LearnSite.BLL.Signin   sgbll   = new LearnSite.BLL.Signin();
         LearnSite.Model.Signin sgmodel = new LearnSite.Model.Signin();
         sgmodel              = sgbll.GetModel(Qid);
         TextBox2.Text        = sgmodel.Qgroup;
         DDLatt.SelectedValue = sgmodel.Qgscore.ToString();
     }
 }
Ejemplo n.º 14
0
    protected void ButtonClear_Click(object sender, EventArgs e)
    {
        int oldyear = Int32.Parse(DDLyear.SelectedValue);

        LearnSite.BLL.Works wbll = new LearnSite.BLL.Works();
        int wct = wbll.DeleteOldyear(oldyear);//清理作品记录

        LearnSite.BLL.Signin sbll = new LearnSite.BLL.Signin();
        int sct = sbll.DeleteOldyear(oldyear);//清理签到记录

        LearnSite.BLL.Result rbll = new LearnSite.BLL.Result();
        int rct = rbll.DeleteOldyear(oldyear);//清理测验记录

        Labelmsg.Text = "执行结果:清理作品记录" + wct.ToString() + "条、清理签到记录" + sct.ToString() + "条、清理测验记录" + rct.ToString() + "条";
    }
Ejemplo n.º 15
0
 private void ShowNoSign()
 {
     if (Request.QueryString["Sgrade"] != null)
     {
         int Sgrade = Int32.Parse(Request.QueryString["Sgrade"].ToString());
         int Sclass = Int32.Parse(Request.QueryString["Sclass"].ToString());
         int Qyear  = Int32.Parse(Request.QueryString["Qyear"].ToString());
         int Qmonth = Int32.Parse(Request.QueryString["Qmonth"].ToString());
         int Qday   = Int32.Parse(Request.QueryString["Qday"].ToString());
         LearnSite.BLL.Signin sign = new LearnSite.BLL.Signin();
         GVNoSign.DataSource = sign.NoSignclassdetail(Sgrade, Sclass, Qyear, Qmonth, Qday);
         GVNoSign.DataBind();
         Labelnosign.Text = "[" + GVNoSign.Rows.Count.ToString() + "位]";
     }
 }
Ejemplo n.º 16
0
    protected void ButtonClearStudent_Click(object sender, EventArgs e)
    {
        if (CheckBoxDel.Checked)
        {
            string cip = Page.Request.UserHostAddress;            //客户端IP
            string sip = LearnSite.Common.Computer.GetServerIp(); //服务器IP
            if (cip == sip)
            {
                string countstu = TextBoxcount.Text;
                if (countstu != "" && countstu != "0")
                {
                    int sgrade = Int32.Parse(DDLgrade.SelectedValue);
                    int sclass = Int32.Parse(DDLclass.SelectedValue);
                    LearnSite.BLL.Webstudy wbll = new LearnSite.BLL.Webstudy();
                    wbll.DelWebClass(sgrade, sclass);
                    LearnSite.BLL.Students sbll = new LearnSite.BLL.Students();
                    int delcount = sbll.DeleteClassMate(sgrade, sclass);//清空该班级学生
                    Labelmsg.Text = "您请空了" + DDLgrade.SelectedValue + "年级" + DDLclass.SelectedValue + "班所有学生共" + delcount.ToString() + "位!";

                    int syear = sbll.GetYear(sgrade, sclass);
                    LearnSite.BLL.Signin gbll = new LearnSite.BLL.Signin();
                    gbll.DelSignClass(sgrade, sclass, syear);
                    //清空签到
                    LearnSite.BLL.Works kbll = new LearnSite.BLL.Works();
                    kbll.DelClass(sgrade, sclass, syear);
                    //清空作品
                    LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback();
                    fbll.DelClass(sgrade, sclass, syear);
                    //清空调查
                    LearnSite.BLL.TopicReply rbll = new LearnSite.BLL.TopicReply();
                    rbll.DelClass(sgrade, sclass, syear);
                    //清空讨论
                }
                else
                {
                    Labelmsg.Text = "无学生记录可清空!";
                }
            }
            else
            {
                Labelmsg.Text = "此操作只能在服务器上浏览该页面才能执行,谢谢!";
            }
        }
        else
        {
            Labelmsg.Text = "请在确认操作选项上打勾!";
        }
    }
Ejemplo n.º 17
0
 private void ShowSignin()
 {
     if (Request.QueryString["Sgrade"] != null)
     {
         int Sgrade = Int32.Parse(Request.QueryString["Sgrade"].ToString());
         int Sclass = Int32.Parse(Request.QueryString["Sclass"].ToString());
         int Qyear  = Int32.Parse(Request.QueryString["Qyear"].ToString());
         int Qmonth = Int32.Parse(Request.QueryString["Qmonth"].ToString());
         int Qday   = Int32.Parse(Request.QueryString["Qday"].ToString());
         int sort   = RBtnList.SelectedIndex;
         LearnSite.BLL.Signin sign = new LearnSite.BLL.Signin();
         GVSignin.DataSource = sign.SignclassdetailSort(Sgrade, Sclass, Qyear, Qmonth, Qday, sort);
         GVSignin.DataBind();
         Labelsignin.Text = "[" + GVSignin.Rows.Count.ToString() + "位]";
     }
 }
Ejemplo n.º 18
0
    private void ShowNoSigin()
    {
        int Rgrade = Int32.Parse(DDLgrade.SelectedValue);
        int Rclass = Int32.Parse(DDLclass.SelectedValue);

        LearnSite.BLL.Students sbll = new LearnSite.BLL.Students();
        int      Syear  = sbll.GetYear(Rgrade, Rclass);
        DateTime dt     = DateTime.Now;
        int      Qyear  = dt.Year;
        int      Qmonth = dt.Month;
        int      Qday   = dt.Day;

        LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin();
        DLnotline.DataSource = sg.StartNoSignClassTwo(Rgrade, Rclass, Syear, Qyear, Qmonth, Qday);
        DLnotline.DataBind();
        Labelsigno.Text = DLnotline.Items.Count.ToString();
    }
Ejemplo n.º 19
0
    private void showAttitude()
    {
        if (Request.QueryString["Qid"] != null)
        {
            if (Request.QueryString["Qname"] != null)
            {
                Labelname.Text = Server.UrlDecode(Request.QueryString["Qname"].ToString());
            }

            int Qid = Int32.Parse(Request.QueryString["Qid"].ToString());
            LearnSite.BLL.Signin   sgbll   = new LearnSite.BLL.Signin();
            LearnSite.Model.Signin sgmodel = new LearnSite.Model.Signin();
            sgmodel = sgbll.GetModel(Qid);
            int att = sgmodel.Qattitude.Value;
            if (att != 0 && att > -5 && att < 3)
            {
                RBLattitude.SelectedValue = att.ToString();
            }
            TextBox2.Text        = sgmodel.Qnote;
            DDLatt.SelectedValue = att.ToString();
        }
    }
Ejemplo n.º 20
0
    protected void Btnattitude_Click(object sender, EventArgs e)
    {
        string qgroup  = TextBox2.Text.Trim();
        string qgscore = DDLatt.SelectedValue;

        if (qgroup.Length > 2 && Request.QueryString["Sg"] != null && Request.QueryString["Qcid"] != null)
        {
            try
            {
                int    qgscoreto          = Int32.Parse(qgscore);
                string sgroup             = Request.QueryString["Sg"].ToString();
                int    Qcid               = Int32.Parse(Request.QueryString["Qcid"].ToString());
                LearnSite.BLL.Signin gbll = new LearnSite.BLL.Signin();
                int gn = gbll.UpdateSgroup(Int32.Parse(sgroup), qgroup, qgscoreto, Qcid);
                Labelmsg.Text = "成功评价小组表现,当前小组共有" + gn + "位同学!";
            }
            catch
            {
                Labelmsg.Text = "该页面被您修改过,评分值请用数字!<br/>(采用英语输入法数字)";
            }
        }
    }
Ejemplo n.º 21
0
 protected void Btnattitude_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["Qid"] != null && Request.QueryString["Qcid"] != null)
     {
         int Qid  = Int32.Parse(Request.QueryString["Qid"].ToString());
         int Qcid = Int32.Parse(Request.QueryString["Qcid"].ToString());
         try
         {
             int Qattitude = Int32.Parse(DDLatt.SelectedValue);
             if (Qattitude != 0)
             {
                 string Qnote = "";
                 if (TextBox2.Text.Trim() == "" && RBLattitude.SelectedIndex > -1)//如果自定义评语为空,则取选项内容
                 {
                     Qnote = RBLattitude.Items[RBLattitude.SelectedIndex].Text;
                 }
                 else
                 {
                     if (RBLattitude.SelectedIndex > -1)
                     {
                         Qnote = RBLattitude.Items[RBLattitude.SelectedIndex].Text + "..." + TextBox2.Text.Trim();
                     }
                     else
                     {
                         Qnote = TextBox2.Text.Trim();
                     }
                 }
                 LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin();
                 sg.UpdateAttitude(Qid, Qattitude, Qnote, Qcid);//表现评价时记录学案编号cid
                 Labelmsg.Text = "对" + Labelname.Text + "学习表现评价成功!";
             }
         }
         catch
         {
             Labelmsg.Text = "该页面被您修改过,评分值请用数字!<br/>(采用英语输入法数字)";
         }
     }
 }
Ejemplo n.º 22
0
    private void ShowFoot()
    {
        DateTime dt3 = DateTime.Now;
        string   pp  = LearnSite.Common.Computer.MyIp();// Page.Request.UserHostAddress;
        DateTime dt4 = DateTime.Now;

        if (Request.QueryString["mySnum"] != null)
        {
            string mysnum = Request.QueryString["mySnum"].ToString();
            TextBoxuser.Text = mysnum;
            TextBoxpwd.Focus();
            LearnSite.BLL.Signin gbll = new LearnSite.BLL.Signin();
            if (!gbll.IsSameIp(mysnum, pp))
            {
                Labelmsg.Text = "您上次不是从这台电脑登录学习平台?<br/>随意换机会给他人带来不便,请理解!";
            }
        }
        Labelterm.Text = LearnSite.Common.XmlHelp.GetTerm();
        int loginm = LearnSite.Common.XmlHelp.LoginMode();//获取登录方式 0表示个人密码方式登录 1表示班级密码方式登录


        DateTime dt5 = DateTime.Now;

        Labelhostname.Text = GetHostNameMy(pp);
        DateTime dt6 = DateTime.Now;

        Labelip.Text       = pp;
        Labelloadtime.Text = "IP:" + LearnSite.Common.Computer.DatagoneMilliseconds(dt3, dt4) + "毫秒&nbsp;&nbsp;" + "&nbsp;&nbsp;主机名:" + LearnSite.Common.Computer.DatagoneMilliseconds(dt5, dt6) + "毫秒&nbsp;";

        if (loginm == 1)
        {
            Labelversion.Text = "『班级模式』";
        }
        else
        {
            Labelversion.Text = "『个人模式』";
        }
    }
Ejemplo n.º 23
0
    protected void Btnupload_Click(object sender, EventArgs e)
    {
        if (IsValid)
        {
            string Wmid = Request.QueryString["Mid"].ToString();
            if (LearnSite.Common.WordProcess.IsNum(Wmid))
            {
                string Sname = Request.Cookies["StudentCookies"].Values["Sname"].ToString();
                string Syear = Request.Cookies["StudentCookies"].Values["Syear"].ToString();
                string Sgrade = Request.Cookies["StudentCookies"].Values["Sgrade"].ToString();
                string Sclass = Request.Cookies["StudentCookies"].Values["Sclass"].ToString();
                string Wnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString();
                string Wip = Request.Cookies["StudentCookies"].Values["LoginIp"].ToString();
                string LoginTime = Request.Cookies["StudentCookies"].Values["LoginTime"].ToString();
                string Wcid = LabelMcid.Text;
                string Mfiletype = LabelMfiletype.Text;
                string Wmsort = LabelMsort.Text;
                DateTime Wdate = DateTime.Now;
                string iplast = Wip.Substring(Wip.LastIndexOf(".") + 1);

                if (CheckBoxMupload.Checked)//是否可上传
                {
                    string postfilename = this.AttachFile.FileName;
                    int Wlength = Convert.ToInt32(this.AttachFile.ContentLength);
                    if (postfilename != "" && postfilename != null)
                    {
                        if (LearnSite.Common.WorkUpload.CheckType(postfilename, Mfiletype))  //上传类型是否正确
                        {
                            LearnSite.BLL.Works ws = new LearnSite.BLL.Works();
                            string Wid = ws.WorkDone(Wnum, Int32.Parse(Wcid), Int32.Parse(Wmid));//返回空字符表示不存在该记录
                            if (Wid != "")
                            {
                                //重新提交修改作品
                                string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建)
                                string RndTime = (DateTime.Parse(LoginTime)).Minute.ToString();
                                string NewFileName = Server.UrlDecode(Sname) + Wcid + "_" + Wmid + "_" + RndTime + iplast + "." + Mfiletype;
                                string Wurl = MySavePath + "/" + NewFileName;
                                string saveFilename = Server.MapPath(Wurl);
                                try
                                {
                                    this.AttachFile.MoveTo(saveFilename, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);//保存提交作品

                                    ws.UpdateWorkUp(Int32.Parse(Wid), Wurl, NewFileName, Wlength, Wdate,CheckBoxCan.Checked);//更新Wfilename, Wurl,Wlength, Wdate
                                    string ch = "课程活动" + Wmsort + "重新提交作品成功!";
                                    Labelmsg.Text = ch;
                                    LearnSite.Common.WordProcess.Alert(ch, this.Page);
                                }
                                catch (Exception ex)
                                {
                                    throw ex;

                                }
                            }
                            else
                            {
                                //如果作品未提交,提交作品(Wnum, Wcid,Wmid,Wmsort, Wfilename, Wurl,Wlength, Wdate, Wip, Wtime)
                                string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建)
                                string RndTime = (DateTime.Parse(LoginTime)).Minute.ToString();
                                string NewFileName = Server.UrlDecode(Sname) + Wcid + "_" + Wmid + "_" + RndTime + iplast + "." + Mfiletype;
                                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.Wurl = Wurl;
                                wmodel.Wlength = Wlength;
                                wmodel.Wdate = Wdate;
                                wmodel.Wip = Wip;
                                wmodel.Wtime = Wtime;
                                wmodel.Wcan = CheckBoxCan.Checked;
                                string saveFilename = Server.MapPath(Wurl);
                                try
                                {
                                    this.AttachFile.MoveTo(saveFilename, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);//保存提交作品

                                    ws.AddWorkUp(wmodel);//添加作品提交记录
                                    string worknums = ws.HowCidWorks(Int32.Parse(Wcid), Wnum);
                                    if (worknums != "")
                                    {
                                        LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin();
                                        sn.UpdateQwork(Wnum, Int32.Parse(worknums));//更新今天签到表中的作品数量
                                    }
                                    string ch = "课程活动"+Wmsort+"提交作品成功!";
                                    Labelmsg.Text = ch;
                                    LearnSite.Common.WordProcess.Alert(ch, this.Page);
                                    ShowWorked();
                                }
                                catch (Exception ex)
                                {
                                    throw ex;
                                }
                            }
                        }
                        else
                        {
                            Labelmsg.Text = "提交类型错误!";
                            string ch = "提交作品类型错误!";
                            LearnSite.Common.WordProcess.Alert(ch, this.Page);
                        }

                    }

                    else
                    {
                        Labelmsg.Text = "你没有选择提交作品!";
                        string ch = "你没有浏览选择你的作品,请再选择一遍!";
                        LearnSite.Common.WordProcess.Alert(ch, this.Page);
                    }
                }
                else
                {
                    Labelmsg.Text = "本任务无作品!";
                }
            }
        }
    }
Ejemplo n.º 24
0
    private void uploadgroupwork()
    {
        if (Request.Files["Filedata"] != null)
        {
            try
            {
                // Get the data
                HttpPostedFile group_upload = Request.Files["Filedata"];
                string         Gtype        = group_upload.FileName.Substring(group_upload.FileName.LastIndexOf(".") + 1).ToLower();
                string         Gmid         = Request.QueryString["mid"].ToString();
                string         Gnum         = 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(Gmid));

                // string Gextention = mmodel.Mfiletype;
                string Gcid = mmodel.Mcid.ToString();

                //Syear | Sgrade | Sclass | Sid | Sname | Wip | Sterm | LoginTime
                string[] infoarray = info.Split('|');
                string   Ggroup    = infoarray[3];//取组长
                string   Gyear     = infoarray[0];
                string   Ggrade    = infoarray[1];
                string   Gclass    = infoarray[2];
                string   Gip       = infoarray[5];
                string   LoginTime = infoarray[7];
                string   Gterm     = infoarray[6];

                LearnSite.BLL.Signin   sn     = new LearnSite.BLL.Signin();
                LearnSite.Model.Signin qmodel = sn.GetModelm(Gnum);
                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
                {
                    //已交则不更新记录
                }
                try
                {
                    group_upload.SaveAs(saveFilename);//保存提交作品
                    Response.StatusCode = 200;
                    Response.Write(NewFileName);
                }
                catch (Exception ex)
                {
                    Response.StatusCode = 200;
                    Response.Write(ex);
                }
            }
            catch (Exception ex)
            {
                Response.StatusCode = 200;
                Response.Write(ex);
            }
            finally
            {
                Response.End();
            }
        }
    }
Ejemplo n.º 25
0
 private void ShowSignin()
 {
     if (Request.QueryString["Sgrade"] != null)
     {
         int Sgrade =Int32.Parse( Request.QueryString["Sgrade"].ToString());
         int Sclass =Int32.Parse( Request.QueryString["Sclass"].ToString());
         int Qyear =Int32.Parse( Request.QueryString["Qyear"].ToString());
         int Qmonth =Int32.Parse( Request.QueryString["Qmonth"].ToString());
         int Qday =Int32.Parse( Request.QueryString["Qday"].ToString());
         LearnSite.BLL.Signin sign = new LearnSite.BLL.Signin();
         GVSignin.DataSource = sign.Signclassdetail(Sgrade, Sclass, Qyear, Qmonth, Qday);
         GVSignin.AllowPaging = false;
         GVSignin.DataBind();
         Labelsignin.Text ="["+ GVSignin.Rows.Count.ToString() + "位]";
         GVSignin.AllowPaging = true;
         GVSignin.DataBind();
     }
 }
Ejemplo n.º 26
0
 private void ShowSigin()
 {
     int Rgrade = Int32.Parse(DDLgrade.SelectedValue);
     int Rclass = Int32.Parse(DDLclass.SelectedValue);
     DateTime dt = DateTime.Now;
     int Qyear =  dt.Year;
     int Qmonth =  dt.Month;
     int Qday = dt.Day;
     LabelToday.Text = "现在日期:" + dt.ToLongDateString();
     LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin();
     DLonline.DataSource = sg.StartSignClass(Rgrade, Rclass, Qyear, Qmonth, Qday);
     DLonline.DataBind();
     int dcount = DLonline.Items.Count;
     Labelsigin.Text = "&nbsp;  共" + dcount.ToString() + "位 &nbsp;";
 }
Ejemplo n.º 27
0
    /// <summary>
    /// 分开是为了不让课程Cid重取
    /// </summary>
    private void ShowWorks()
    {
        string Hid = Request.Cookies["TeacherCookies"].Values["Hid"].ToString();
        if (Session[Hid+"Setgrade"] != null && Session[Hid+"Setclass"] != null)
        {
            int Sgrade = Int32.Parse(Session[Hid+"Setgrade"].ToString());
            int Sclass = Int32.Parse(Session[Hid+"Setclass"].ToString());
            string myCid = LabelCid.Text;
            if (myCid != "")
            {
                int Wmsort = Int32.Parse(DDLmsort.SelectedValue);
                LearnSite.BLL.Works wbll = new LearnSite.BLL.Works();
                DataListworks.DataSource = wbll.ShowTodayWorks(Sgrade, Sclass, Int32.Parse(myCid), Wmsort);//获得今天本班该活动作品列表
                DataListworks.DataBind();//Wid,Sname,Wurl,Wvote,Wscore,Qwork
                Labelcounts.Text = DataListworks.Items.Count.ToString();

                LearnSite.BLL.Signin sbll = new LearnSite.BLL.Signin();
                DataListNoworks.DataSource = sbll.GetNoWorkStudents(Sgrade, Sclass);//获取今天本班未提交作品的学生列表
                DataListNoworks.DataBind();
            }
        }
    }
Ejemplo n.º 28
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("请选择文件!");
        }
    }
Ejemplo n.º 29
0
        /// <summary>
        /// 返回本课的活动、调查、讨论、表单 汇总表
        /// </summary>
        /// <param name="Cid"></param>
        /// <param name="Sgrade"></param>
        /// <param name="Sclass"></param>
        public DataTable CourseTotals(int Cid, int Sgrade, int Sclass)
        {
            Students  sbll   = new Students();
            DataTable dtstus = sbll.GetStudentsSnumSname(Sgrade, Sclass).Tables[0];//学号和姓名

            if (dtstus.Rows.Count > 0)
            {
                ListMenu  lbll   = new ListMenu();
                DataTable dt     = lbll.GetShowedMenu(Cid).Tables[0];
                int       dcount = dt.Rows.Count;
                if (dcount > 0)
                {
                    Works          wbll = new Works();
                    SurveyFeedback fbll = new SurveyFeedback();
                    TopicReply     rbll = new TopicReply();
                    TxtFormBack    xbll = new TxtFormBack();

                    for (int i = 0; i < dcount; i++)
                    {
                        string Ltype     = dt.Rows[i]["Ltype"].ToString();                   //获取学案项目类型:1活动2调查3讨论4表单
                        int    Lxid      = Convert.ToInt32(dt.Rows[i]["Lxid"].ToString());   //获取对应项目ID编号
                        string Ltitle    = dt.Rows[i]["Ltitle"].ToString().Replace(" ", ""); //获取菜单标题
                        string Ltitlestr = "l" + Ltype + "x" + Lxid.ToString();
                        switch (Ltype)
                        {
                        case "1":    //活动
                        case "5":    //编程
                            DataTable dtms = wbll.getScoreList(Lxid, Sgrade, Sclass);
                            if (dtms.Rows.Count > 0)
                            {
                                dtstus.Columns.Add(Ltitlestr, typeof(int));
                                GetScore(dtstus, Ltitlestr, dtms);
                                dtstus.Columns[Ltitlestr].ColumnName = Ltitle;
                            }
                            dtms.Dispose();
                            break;

                        case "2":    //调查
                            DataTable dtsf = fbll.GetClassScore(Lxid, Sgrade, Sclass);
                            if (dtsf.Rows.Count > 0)
                            {
                                dtstus.Columns.Add(Ltitlestr, typeof(int));
                                GetScore(dtstus, Ltitlestr, dtsf);
                                dtstus.Columns[Ltitlestr].ColumnName = Ltitle;
                            }
                            dtsf.Dispose();
                            break;

                        case "3":    //讨论
                            DataTable dttr = rbll.GetClassListScore(Sgrade, Sclass, Lxid);
                            if (dttr.Rows.Count > 0)
                            {
                                dtstus.Columns.Add(Ltitlestr, typeof(int));
                                GetScore(dtstus, Ltitlestr, dttr);
                                dtstus.Columns[Ltitlestr].ColumnName = Ltitle;
                            }
                            dttr.Dispose();
                            break;

                        case "4":    //表单
                            DataTable dttx = xbll.GetClassTxtFormScore(Sgrade, Sclass, Lxid);
                            if (dttx.Rows.Count > 0)
                            {
                                dtstus.Columns.Add(Ltitlestr, typeof(int));
                                GetScore(dtstus, Ltitlestr, dttx);
                                dtstus.Columns[Ltitlestr].ColumnName = Ltitle;
                            }
                            dttx.Dispose();
                            break;
                        }
                    }
                }
                dt.Dispose();
                //汇总
                int cml = dtstus.Columns.Count;
                if (cml > 2)
                {
                    Signin    gbll  = new Signin();
                    DataTable dtatd = gbll.GetClassListQattitude(Sgrade, Sclass, Cid);
                    if (dtatd.Rows.Count > 0)
                    {
                        string clmatd = "clmattitude";
                        dtstus.Columns.Add(clmatd, typeof(int));
                        GetScore(dtstus, clmatd, dtatd);
                        dtstus.Columns[clmatd].ColumnName = "课堂表现";
                        cml = cml + 1;//新增了课堂表现列
                    }
                    dtstus.Columns.Add("汇总", typeof(float));
                    dtTotal(dtstus, cml);
                }
            }
            dtstus.Columns["Snum"].ColumnName  = "学号";
            dtstus.Columns["Sname"].ColumnName = "姓名";
            return(dtstus);
        }
Ejemplo n.º 30
0
    private void LoginCode()
    {
        string Snum = TextBoxuser.Text.Trim();
        string Spwd = TextBoxpwd.Text.Trim();
        string lbip = Labelip.Text;
        string msg  = "";

        if (Snum != "" && Spwd != "")
        {
            if (LearnSite.Common.WordProcess.IsNum(Snum) && LearnSite.Common.WordProcess.IsEnNum(Spwd))
            {
                LearnSite.Model.Students model = new LearnSite.Model.Students();
                LearnSite.BLL.Students   bll   = new LearnSite.BLL.Students();
                int loginm = LearnSite.Common.XmlHelp.LoginMode();//获取登录方式 0表示个人密码方式登录 1表示班级密码方式登录
                if (loginm == 1)
                {
                    if (bll.ExistsLogin(Snum, Spwd))
                    {
                        model = bll.SnumGetModel(Snum);//查询该学号和班级密码的学生是否存在,存在返回实体,不存在返回null
                    }
                    else
                    {
                        model = null;
                    }
                }
                else
                {
                    if (bll.ExistsLoginSelf(Snum, Spwd))
                    {
                        model = bll.GetStudentModel(Snum, Spwd);//查询该学号密码学生是否存在,存在返回实体,不存在返回null
                    }
                    else
                    {
                        model = null;
                    }
                }

                if (model != null)
                {
                    int    Qgrade = model.Sgrade.Value;
                    int    Qclass = model.Sclass.Value;
                    int    Qsid   = model.Sid;
                    string Qname  = model.Sname;
                    int    Qsyear = model.Syear.Value;
                    int    Qterm  = Int32.Parse(LearnSite.Common.XmlHelp.GetTerm());
                    if (LearnSite.Common.XmlHelp.GetSingleLogin())                                  //如果是单点登录
                    {
                        if (!LearnSite.Common.App.IsLogin(Snum))                                    //如果不在线
                        {
                            if (LearnSite.Common.CookieHelp.SetStudentCookies(model, Labelip.Text)) //写cookies
                            {
                                DateTime             LoginTime = DateTime.Now;
                                LearnSite.BLL.Signin gbll      = new LearnSite.BLL.Signin();
                                gbll.SigninToday(Snum, LoginTime, lbip, Qgrade, Qterm, Qsid, Qname, Qclass, Qsyear); //签到
                                Btnlogin.Enabled = false;
                                LearnSite.Common.App.AppKickUserRemove(Snum);                                        //将踢除列表中的学号去掉(2011-9-20修)
                                LearnSite.Common.App.AppUserAdd(Snum);                                               //给网站全局变量列表中增加该用户
                                System.Threading.Thread.Sleep(200);
                                OpenJump(Qgrade, Qclass);                                                            //跳转选择
                            }
                            else
                            {
                                msg = "请不要换机,否则无法登录!";
                            }
                        }
                        else
                        {
                            msg = "该用户已经在其他电脑登录!<br/>请询问老师或查看当前是否是你自己的学号!";
                        }
                    }
                    else
                    {
                        if (LearnSite.Common.CookieHelp.SetStudentCookies(model, lbip))//写cookies
                        {
                            DateTime             LoginTime = DateTime.Now;
                            LearnSite.BLL.Signin gbll      = new LearnSite.BLL.Signin();
                            gbll.SigninToday(Snum, LoginTime, lbip, Qgrade, Qterm, Qsid, Qname, Qclass, Qsyear);//签到
                            Btnlogin.Enabled = false;
                            System.Threading.Thread.Sleep(200);
                            OpenJump(Qgrade, Qclass);//跳转选择
                        }
                        else
                        {
                            msg = "请不要换机,否则无法登录!";
                        }
                    }
                }
                else
                {
                    string msgstr = "『当前为班级密码模式』";
                    if (loginm == 0)
                    {
                        msgstr = "『当前为个人密码模式』";
                    }
                    msg = "用户名或密码错误!" + msgstr;
                    TextBoxuser.Text = "";
                    TextBoxpwd.Text  = "";
                }
            }
            else
            {
                msg = "用户名或密码含有非法字符,学号必须为数字";
            }
        }
        Labelmsg.Text = msg;
    }
Ejemplo n.º 31
0
    protected void BtnRegister_Click(object sender, EventArgs e)
    {
        string g = DDLgrade.SelectedValue;
        string c = DDLclass.SelectedValue;
        string x = DDLsex.SelectedValue;
        string n = Tsname.Text.Trim();

        if (g.Length > 0 && c.Length > 0 && x.Length > 0 && n.Length > 0 && n.Length < 10)
        {
            if (LearnSite.Common.WordProcess.IsChina(n))
            {
                int Sgrade = Int32.Parse(g);
                int Sclass = Int32.Parse(c);
                LearnSite.BLL.Students stubll = new LearnSite.BLL.Students();
                long NewSnum = stubll.GetMaxSnum(Sgrade, Sclass);
                LearnSite.BLL.DelStudents dbll = new LearnSite.BLL.DelStudents();
                string mySyear = stubll.GetYear(Sgrade);
                int    Syear   = Int32.Parse(mySyear);
                LearnSite.Model.Students student = new LearnSite.Model.Students();
                student.Syear  = Syear;
                student.Sgrade = Sgrade;
                student.Sclass = Sclass;
                student.Sname  = n;
                student.Sex    = DDLsex.SelectedValue;
                string myPwd = LearnSite.Common.WordProcess.GetRandomNumber(3);
                student.Spwd          = myPwd;
                student.Saddress      = "";
                student.Sphone        = "";
                student.Sparents      = "";
                student.Sheadtheacher = "在线注册";
                student.Sscore        = 0;
                student.Sattitude     = 0;
                string Tsnum = dbll.GetNewSnum(NewSnum);//获取删除列表中不存在的新学号
                student.Snum = Tsnum;
                int Sid = stubll.AddStudent(student);
                if (Sid > 1)
                {
                    student.Sid = Sid;//修正注册后cookies中的Sid值  2014-9-28号

                    System.Threading.Thread.Sleep(200);
                    LearnSite.Common.WordProcess.Alert("注册成功,你的学号为" + Tsnum + "密码为" + myPwd + "请牢记!", this.Page);
                    string lbip  = Page.Request.UserHostAddress;
                    int    Qterm = Int32.Parse(LearnSite.Common.XmlHelp.GetTerm());
                    if (LearnSite.Common.CookieHelp.SetStudentCookies(student, lbip))//写cookies
                    {
                        DateTime             LoginTime = DateTime.Now;
                        LearnSite.BLL.Signin gbll      = new LearnSite.BLL.Signin();
                        gbll.SigninToday(Tsnum, LoginTime, lbip, Sgrade, Qterm, Sid, n, Sclass, Syear); //签到
                        System.Threading.Thread.Sleep(200);
                        OpenJump(Sgrade, Sclass);                                                       //跳转选择
                    }
                }
                else
                {
                    labelmsg.Text = "自动申请的学号已被使用,请点击注册继续申请!";
                }
            }
            else
            {
                labelmsg.Text = "注册名必须为中文!";
            }
        }
        else
        {
            labelmsg.Text = "注册失败!<br/>(当前无班级可注册或姓名长度超过限制!)";
        }
    }
Ejemplo n.º 32
0
 private void ShowOnline()
 {
     DateTime today=DateTime.Now;
     int Qyear=today.Year;
     int Qmonth=today.Month;
     int Qday=today.Day;
     int Qgrade=Int32.Parse(Request.Cookies["StudentCookies"].Values["Sgrade"].ToString());
     int Qclass=Int32.Parse(Request.Cookies["StudentCookies"].Values["Sclass"].ToString());
     LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin();
     DataListonline.DataSource = sg.OnlineToday(Qgrade, Qclass, Qyear, Qmonth, Qday);
     DataListonline.DataBind();
 }
Ejemplo n.º 33
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();
            }
        }
    }
Ejemplo n.º 34
0
 private void ShowSigin()
 {
     int Qgrade = Int32.Parse(DDLgrade.SelectedValue.ToString());
     int Qclass = Int32.Parse(DDLclass.SelectedValue.ToString());
     LearnSite.BLL.Signin sign = new LearnSite.BLL.Signin();
     GVSignin.DataSource = sign.GetSignClass(Qgrade, Qclass);
     GVSignin.DataBind();
 }
Ejemplo n.º 35
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("请选择文件!");
        }
    }