Exemplo n.º 1
0
    private void ShowWorks()
    {
        if (Request.QueryString["Snum"] != null)
        {
            string Snum = Request.QueryString["Snum"].ToString();
            LearnSite.Model.Students smodel = new LearnSite.Model.Students();
            LearnSite.BLL.Students   sbll   = new LearnSite.BLL.Students();
            smodel = sbll.SnumGetModel(Snum);
            LearnSite.BLL.Works ws = new LearnSite.BLL.Works();
            DataTable           dt = ws.ShowMyAllWorks(Snum);
            GridViewworks.DataSource = dt;
            GridViewworks.DataBind();
            int count = dt.Rows.Count;
            LabelSname.Text = smodel.Sname + "同学的作品库(" + count.ToString() + ")";
            this.Page.Title = LearnSite.Common.CookieHelp.SetMainPageTitle() + " " + LabelSname.Text;

            if (count > 0)
            {
                msg = "";
                for (int i = 0; i < count; i++)
                {
                    int    score    = Int32.Parse(dt.Rows[i]["Wscore"].ToString()) + Int32.Parse(dt.Rows[i]["Wscore"].ToString());
                    string scorestr = score.ToString();
                    string jsondata = "[" + i.ToString() + ", " + scorestr + "],";
                    msg += jsondata;
                }
                msg = msg.TrimEnd(',');
            }
        }
    }
Exemplo n.º 2
0
    protected void BtnsEdit_Click(object sender, EventArgs e)
    {
        if (Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname] != null)
        {
            int Sid = Int32.Parse(Request.QueryString["Sid"].ToString());
            LearnSite.Model.Students student = new LearnSite.Model.Students();
            student.Sid           = Sid;
            student.Syear         = Int32.Parse(Tsyear.Text.Trim());
            student.Sgrade        = Int32.Parse(DDLgrade.SelectedValue);
            student.Sclass        = Int32.Parse(DDLclass.SelectedValue);
            student.Sname         = Tsname.Text.Trim();
            student.Sex           = DDLsex.SelectedValue;
            student.Spwd          = Tspwd.Text.Trim();
            student.Saddress      = Tsaddress.Text.Trim();
            student.Sphone        = Tsphone.Text.Trim();
            student.Sparents      = Tsparents.Text.Trim();
            student.Sheadtheacher = Tsheadtheacher.Text.Trim();
            LearnSite.BLL.Students stubll = new LearnSite.BLL.Students();
            stubll.Update(student);
            Btnsedit.Text = "修改成功";

            System.Threading.Thread.Sleep(1000);
            string url = "~/Teacher/studentshow.aspx?Sid=" + Sid;
            Response.Redirect(url, false);
        }
    }
Exemplo n.º 3
0
    private void ShowStudent()
    {
        int Sid = Int32.Parse(Request.QueryString["Sid"].ToString());

        LearnSite.Model.Students student = new LearnSite.Model.Students();
        LearnSite.BLL.Students   stubll  = new LearnSite.BLL.Students();
        student                = stubll.GetModel(Sid);
        Tsnum.Text             = student.Snum;
        Tsyear.Text            = student.Syear.ToString();
        DDLgrade.SelectedValue = student.Sgrade.ToString();
        myClass(student.Sgrade.Value);//2014-10-28修改 因为初始化的年级获取的班级数不足,所以要获取
        DDLclass.SelectedValue = student.Sclass.ToString();
        Tsname.Text            = student.Sname;
        Tspwd.Text             = student.Spwd;
        DDLsex.SelectedValue   = student.Sex;
        Tsaddress.Text         = student.Saddress;
        Tsphone.Text           = student.Sphone;
        Tsparents.Text         = student.Sparents;
        Tsheadtheacher.Text    = student.Sheadtheacher;
        Tsscore.Text           = student.Sscore.ToString();
        Tsattitude.Text        = student.Sattitude.ToString();
        string Hid = Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname].Values["Hid"].ToString();

        Session[Hid + "grade"] = DDLgrade.SelectedValue;
        Session[Hid + "class"] = DDLclass.SelectedValue;
    }
Exemplo n.º 4
0
    protected void LinkBtnDel_Click(object sender, EventArgs e)
    {
        int Sid = Int32.Parse(Request.QueryString["Sid"].ToString());

        LearnSite.BLL.Students stu = new LearnSite.BLL.Students();
        //将删除的学生添加到删除列表中,以便将来恢复
        LearnSite.Model.Students smodel = new LearnSite.Model.Students();
        smodel = stu.GetModel(Sid);//获取要删除的学生实体
        LearnSite.Model.DelStudents dmodel = new LearnSite.Model.DelStudents();
        dmodel.Daddress      = smodel.Saddress;
        dmodel.Dclass        = smodel.Sclass;
        dmodel.Dgrade        = smodel.Sgrade;
        dmodel.Dheadtheacher = smodel.Sheadtheacher;
        dmodel.Dname         = smodel.Sname;
        dmodel.Dnum          = smodel.Snum;
        dmodel.Dparents      = smodel.Sparents;
        dmodel.Dphone        = smodel.Sphone;
        dmodel.Dsex          = smodel.Sex;
        dmodel.Dyear         = smodel.Syear;
        LearnSite.BLL.DelStudents dbll = new LearnSite.BLL.DelStudents();
        dbll.Add(dmodel); //在学生删除表增加该学生

        stu.Delete(Sid);  //学生表中删除该学生
        System.Threading.Thread.Sleep(500);
        string url = "~/Teacher/student.aspx?Sgrade=" + Request.QueryString["Sgrade"].ToString() + "&&Sclass=" + Request.QueryString["Sclass"].ToString();

        Response.Redirect(url, false);
    }
Exemplo n.º 5
0
    private void ShowWorks()
    {
        if (Request.QueryString["Snum"] != null)
        {
            string Snum = Request.QueryString["Snum"].ToString();
            HlkCircle.NavigateUrl = "~/Teacher/stuworkcircle.aspx?Snum=" + Snum;
            LearnSite.Model.Students smodel = new LearnSite.Model.Students();
            LearnSite.BLL.Students   sbll   = new LearnSite.BLL.Students();
            smodel           = sbll.SnumGetModel(Snum);
            LabelSnum.Text   = Snum;
            LabelSname.Text  = smodel.Sname;
            LabelWscore.Text = smodel.Sscore.ToString();
            int wgrade = smodel.Sgrade.Value;
            if (Request.QueryString["Sgrade"] != null)
            {
                wgrade = Int32.Parse(Request.QueryString["Sgrade"].ToString());
            }
            int wterm = Int32.Parse(LearnSite.Common.XmlHelp.GetTerm());
            if (Request.QueryString["Sterm"] != null)
            {
                wterm = Int32.Parse(Request.QueryString["Sterm"].ToString());
            }

            LearnSite.BLL.Works ws = new LearnSite.BLL.Works();
            GridViewworks.DataSource = ws.ShowThisTermWorks(Snum, wgrade, wterm);
            GridViewworks.DataBind();
        }
    }
Exemplo n.º 6
0
 protected void BtnsEdit_Click(object sender, EventArgs e)
 {
     if (Request.Cookies["TeacherCookies"] != null)
     {
         int Sid = Int32.Parse(Request.QueryString["Sid"].ToString());
         LearnSite.Model.Students student = new LearnSite.Model.Students();
         student.Sid = Sid;
         student.Syear = Int32.Parse(Tsyear.Text.Trim());
         student.Sgrade = Int32.Parse(DDLgrade.SelectedValue);
         student.Sclass = Int32.Parse(DDLclass.SelectedValue);
         student.Sname = Tsname.Text.Trim();
         student.Sex = Tsex.Text.Trim();
         student.Spwd = Tspwd.Text.Trim();
         student.Saddress = Tsaddress.Text.Trim();
         student.Sphone = Tsphone.Text.Trim();
         student.Sparents = Tsparents.Text.Trim();
         student.Sheadtheacher = Tsheadtheacher.Text.Trim();
         LearnSite.BLL.Students stubll = new LearnSite.BLL.Students();
         stubll.Update(student);
         Btnsedit.Text = "修改成功";
         string Hid = Request.Cookies["TeacherCookies"].Values["Hid"].ToString();
         if (DDLclass.SelectedValue != Session[Hid + "class"].ToString())
         {
             //如果转班,再生成ftp目录,并修改ftp账号中的 Access和HomeDir值(传递Syear,Sclass,Snum)
             int Snum = Int32.Parse(Tsnum.Text);
             LearnSite.Ftp.Disk.CreateOneDir(Int32.Parse(Tsyear.Text.Trim()), Int32.Parse(DDLclass.SelectedValue), Snum);
             LearnSite.Ftp.Reg.RegEditFtp(Tsnum.Text, Tsyear.Text.Trim(), DDLclass.SelectedValue);
         }
         System.Threading.Thread.Sleep(1000);
         string url = "~/Teacher/studentshow.aspx?Sid=" + Sid;
         Response.Redirect(url, false);
     }
 }
Exemplo n.º 7
0
 protected void BtnsEdit_Click(object sender, EventArgs e)
 {
     if (Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname] != null)
     {
         int Sid = Int32.Parse(Request.QueryString["Sid"].ToString());
         LearnSite.Model.Students student = new LearnSite.Model.Students();
         student.Sid           = Sid;
         student.Syear         = Int32.Parse(Tsyear.Text.Trim());
         student.Sgrade        = Int32.Parse(DDLgrade.SelectedValue);
         student.Sclass        = Int32.Parse(DDLclass.SelectedValue);
         student.Sname         = Tsname.Text.Trim();
         student.Sex           = DDLsex.SelectedValue;
         student.Spwd          = Tspwd.Text.Trim();
         student.Saddress      = Tsaddress.Text.Trim();
         student.Sphone        = Tsphone.Text.Trim();
         student.Sparents      = Tsparents.Text.Trim();
         student.Sheadtheacher = Tsheadtheacher.Text.Trim();
         LearnSite.BLL.Students stubll = new LearnSite.BLL.Students();
         stubll.Update(student);
         Btnsedit.Text = "修改成功";
         string Hid = Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname].Values["Hid"].ToString();
         if (DDLclass.SelectedValue != Session[Hid + "class"].ToString())
         {
             //如果转班,再生成ftp目录,并修改ftp账号中的 Access和HomeDir值(传递Syear,Sclass,Snum)
             LearnSite.Ftp.Disk.CreateOneDir(Tsyear.Text.Trim(), DDLclass.SelectedValue, Tsnum.Text);
             LearnSite.Ftp.Reg.RegEditFtp(Tsnum.Text, Tsyear.Text.Trim(), DDLclass.SelectedValue);
         }
         System.Threading.Thread.Sleep(1000);
         string url = "~/Teacher/studentshow.aspx?Sid=" + Sid;
         Response.Redirect(url, false);
     }
 }
Exemplo n.º 8
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 = "用户名或密码含有非法字符";
            }
        }
    }
Exemplo n.º 9
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<LearnSite.Model.Students> DataTableToList(DataTable dt)
 {
     List<LearnSite.Model.Students> modelList = new List<LearnSite.Model.Students>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         LearnSite.Model.Students model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new LearnSite.Model.Students();
             if(dt.Rows[n]["Sid"].ToString()!="")
             {
                 model.Sid=int.Parse(dt.Rows[n]["Sid"].ToString());
             }
             model.Snum=dt.Rows[n]["Snum"].ToString();
             if (dt.Rows[n]["Syear"].ToString() != "")
             {
                 model.Syear = int.Parse(dt.Rows[n]["Syear"].ToString());
             }
             if(dt.Rows[n]["Sgrade"].ToString()!="")
             {
                 model.Sgrade=int.Parse(dt.Rows[n]["Sgrade"].ToString());
             }
             if(dt.Rows[n]["Sclass"].ToString()!="")
             {
                 model.Sclass=int.Parse(dt.Rows[n]["Sclass"].ToString());
             }
             model.Sname=dt.Rows[n]["Sname"].ToString();
             model.Spwd=dt.Rows[n]["Spwd"].ToString();
             model.Sex=dt.Rows[n]["Sex"].ToString();
             model.Saddress=dt.Rows[n]["Saddress"].ToString();
             model.Sphone=dt.Rows[n]["Sphone"].ToString();
             model.Sparents=dt.Rows[n]["Sparents"].ToString();
             model.Sheadtheacher=dt.Rows[n]["Sheadtheacher"].ToString();
             if(dt.Rows[n]["Sscore"].ToString()!="")
             {
                 model.Sscore=int.Parse(dt.Rows[n]["Sscore"].ToString());
             }
             if (dt.Rows[n]["Squiz"].ToString() != "")
             {
                 model.Squiz = int.Parse(dt.Rows[n]["Squiz"].ToString());
             }
             if(dt.Rows[n]["Sattitude"].ToString()!="")
             {
                 model.Sattitude=int.Parse(dt.Rows[n]["Sattitude"].ToString());
             }
             model.Sape=dt.Rows[n]["Sape"].ToString();
             modelList.Add(model);
         }
     }
     return modelList;
 }
Exemplo n.º 10
0
    private void ReadWork()
    {
        if (Request.QueryString["Snum"] != null)
        {
            string Snum = Request.QueryString["Snum"].ToString();
            LearnSite.Model.Students smodel = new LearnSite.Model.Students();
            LearnSite.BLL.Students   sbll   = new LearnSite.BLL.Students();
            smodel           = sbll.SnumGetModel(Snum);
            LabelSnum.Text   = Snum;
            LabelSname.Text  = smodel.Sname;
            LabelWscore.Text = smodel.Sscore.ToString();
            int wgrade = smodel.Sgrade.Value;
            if (Request.QueryString["Sgrade"] != null)
            {
                wgrade = Int32.Parse(Request.QueryString["Sgrade"].ToString());
            }
            int wterm = Int32.Parse(LearnSite.Common.XmlHelp.GetTerm());
            if (Request.QueryString["Sterm"] != null)
            {
                wterm = Int32.Parse(Request.QueryString["Sterm"].ToString());
            }

            LearnSite.BLL.Works ws = new LearnSite.BLL.Works();
            DDLstore.DataSource     = ws.ShowThisTermWorksCircle(Snum, wgrade, wterm);
            DDLstore.DataTextField  = "Mtitle";
            DDLstore.DataValueField = "Wurl";
            DDLstore.DataBind();
            int curindex = Int32.Parse(lbcurindex.Text);
            if (DDLstore.Items.Count > 0)
            {
                int allindex = DDLstore.Items.Count - 1;
                if (curindex == allindex)
                {
                    lbcurindex.Text = "0";
                }
                if (curindex < allindex)
                {
                    DDLstore.SelectedIndex = curindex;
                }
            }
        }
    }
Exemplo n.º 11
0
    /// <summary>
    /// Snum,Syear,Sgrade,Sclass,Sname,Spwd,Sex,Saddress,Sphone,Sparents,Sheadtheacher,Sscore,Sattitude
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Btnadd_Click(object sender, EventArgs e)
    {
        string snum = Tsnum.Text;

        if (Tsname.Text != "" && LearnSite.Common.WordProcess.IsNum(snum))
        {
            LearnSite.BLL.Students stubll = new LearnSite.BLL.Students();
            if (!stubll.ExistsSnum(snum))
            {
                LearnSite.Model.Students student = new LearnSite.Model.Students();
                student.Snum          = snum;
                student.Syear         = Int32.Parse(DDLyear.SelectedValue);
                student.Sgrade        = Int32.Parse(DDLgrade.SelectedValue);
                student.Sclass        = Int32.Parse(DDLclass.SelectedValue);
                student.Sname         = Tsname.Text.Trim();
                student.Sex           = DDLsex.SelectedValue;
                student.Spwd          = Tspwd.Text;
                student.Saddress      = Tsaddress.Text.Trim();
                student.Sphone        = Tsphone.Text.Trim();
                student.Sparents      = Tsparents.Text.Trim();
                student.Sheadtheacher = Tsheadtheacher.Text.Trim();
                student.Sscore        = 0;
                student.Sattitude     = 0;
                int NewSid = stubll.AddStudent(student);

                System.Threading.Thread.Sleep(500);
                string url = "~/Teacher/studentshow.aspx?Sid=" + NewSid.ToString();
                Response.Redirect(url, false);
            }
            else
            {
                Labelmsg.Text = "该学号已经存在,请重新填写学号!";
            }
        }
        else
        {
            Labelmsg.Text = "姓名、入学年份不能为空!";
        }
    }
Exemplo n.º 12
0
    protected void GVStudent_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string getDid = e.CommandArgument.ToString();

        LearnSite.BLL.DelStudents dbll = new LearnSite.BLL.DelStudents();
        if (e.CommandName.Equals("Revive"))
        {
            LearnSite.Model.DelStudents dmodel = new LearnSite.Model.DelStudents();
            dmodel = dbll.GetModel(Int32.Parse(getDid));//获取该删除学生实体

            LearnSite.Model.Students student = new LearnSite.Model.Students();
            string Snum = dmodel.Dnum;
            student.Snum          = Snum;
            student.Syear         = dmodel.Dyear;
            student.Sgrade        = dmodel.Dgrade;
            student.Sclass        = dmodel.Dclass;
            student.Sname         = dmodel.Dname;
            student.Sex           = dmodel.Dsex;
            student.Spwd          = "12345";
            student.Saddress      = dmodel.Daddress;
            student.Sphone        = dmodel.Dphone;
            student.Sparents      = dmodel.Dparents;
            student.Sheadtheacher = dmodel.Dheadtheacher;
            student.Sscore        = 0;
            student.Sattitude     = 0;
            LearnSite.BLL.Students stubll = new LearnSite.BLL.Students();
            int newSid = stubll.AddStudent(student); //恢复该学生
            dbll.Delete(Int32.Parse(getDid));        //在删除列表中去除该学生
            System.Threading.Thread.Sleep(200);
            LearnSite.DBUtility.DbHelperSQL.UpdateStudentNewSid(Snum, newSid);
            showDelstudents();
        }
        if (e.CommandName.Equals("Del"))
        {
            dbll.Delete(Int32.Parse(getDid));//永久删除该学生账号
            showDelstudents();
            LearnSite.Common.WordProcess.Alert("永久删除该学生账号后,请不要重用这个学生学号以防作品等数据关联。因为作品等关联学号并未作删除!", this.Page);
        }
    }
Exemplo n.º 13
0
    /// <summary>
    /// Snum,Syear,Sgrade,Sclass,Sname,Spwd,Sex,Saddress,Sphone,Sparents,Sheadtheacher,Sscore,Sattitude
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Btnadd_Click(object sender, EventArgs e)
    {
        if (Tsname.Text != "")
        {
            LearnSite.Model.Students student = new LearnSite.Model.Students();
            student.Snum = Tsnum.Text;
            student.Syear = Int32.Parse(DDLyear.SelectedValue);
            student.Sgrade = Int32.Parse(DDLgrade.SelectedValue);
            student.Sclass = Int32.Parse(DDLclass.SelectedValue);
            student.Sname = Tsname.Text.Trim();
            student.Sex = DDLsex.SelectedValue;
            student.Spwd = Tspwd.Text;
            student.Saddress = Tsaddress.Text.Trim();
            student.Sphone = Tsphone.Text.Trim();
            student.Sparents = Tsparents.Text.Trim();
            student.Sheadtheacher = Tsheadtheacher.Text.Trim();
            student.Sscore = 0;
            student.Sattitude = 0;
            LearnSite.BLL.Students stubll = new LearnSite.BLL.Students();
            int NewSid = stubll.AddStudent(student);
            Labelmsg.Text = "添加成功";
            //创建ftp目录,添加到Webstudy,添加ftp账号
            int Snum = Int32.Parse(Tsnum.Text);
            LearnSite.Ftp.Disk.CreateOneDir(Int32.Parse(DDLyear.SelectedValue), Int32.Parse(DDLclass.SelectedValue), Snum);
            LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy();
            ws.AddOne(Tsnum.Text, Tspwd.Text);
            LearnSite.Ftp.Reg.RegsaveFtp(Tsnum.Text, Tspwd.Text, DDLyear.SelectedValue, DDLclass.SelectedValue);

            System.Threading.Thread.Sleep(1000);
            string url = "~/Teacher/studentshow.aspx?Sid=" + NewSid.ToString();
            Response.Redirect(url, false);
        }
        else
        {
            Labelmsg.Text = "姓名、入学年份不能为空!";
        }
    }
Exemplo n.º 14
0
 /// <summary>
 /// 增加一位学生
 /// </summary>
 public int AddStudent(LearnSite.Model.Students model)
 {
     return(dal.AddStudent(model));
 }
Exemplo n.º 15
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LearnSite.Model.Students> DataTableToList(DataTable dt)
        {
            List <LearnSite.Model.Students> modelList = new List <LearnSite.Model.Students>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LearnSite.Model.Students model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LearnSite.Model.Students();
                    if (dt.Rows[n]["Sid"].ToString() != "")
                    {
                        model.Sid = int.Parse(dt.Rows[n]["Sid"].ToString());
                    }
                    model.Snum = dt.Rows[n]["Snum"].ToString();
                    if (dt.Rows[n]["Syear"].ToString() != "")
                    {
                        model.Syear = int.Parse(dt.Rows[n]["Syear"].ToString());
                    }
                    if (dt.Rows[n]["Sgrade"].ToString() != "")
                    {
                        model.Sgrade = int.Parse(dt.Rows[n]["Sgrade"].ToString());
                    }
                    if (dt.Rows[n]["Sclass"].ToString() != "")
                    {
                        model.Sclass = int.Parse(dt.Rows[n]["Sclass"].ToString());
                    }
                    model.Sname         = dt.Rows[n]["Sname"].ToString();
                    model.Spwd          = dt.Rows[n]["Spwd"].ToString();
                    model.Sex           = dt.Rows[n]["Sex"].ToString();
                    model.Saddress      = dt.Rows[n]["Saddress"].ToString();
                    model.Sphone        = dt.Rows[n]["Sphone"].ToString();
                    model.Sparents      = dt.Rows[n]["Sparents"].ToString();
                    model.Sheadtheacher = dt.Rows[n]["Sheadtheacher"].ToString();
                    if (dt.Rows[n]["Sscore"].ToString() != "")
                    {
                        model.Sscore = int.Parse(dt.Rows[n]["Sscore"].ToString());
                    }
                    if (dt.Rows[n]["Squiz"].ToString() != "")
                    {
                        model.Squiz = int.Parse(dt.Rows[n]["Squiz"].ToString());
                    }
                    if (dt.Rows[n]["Sattitude"].ToString() != "")
                    {
                        model.Sattitude = int.Parse(dt.Rows[n]["Sattitude"].ToString());
                    }
                    model.Sape = dt.Rows[n]["Sape"].ToString();
                    if (dt.Rows[n]["Swscore"].ToString() != "")
                    {
                        model.Swscore = int.Parse(dt.Rows[n]["Swscore"].ToString());
                    }
                    if (dt.Rows[n]["Stscore"].ToString() != "")
                    {
                        model.Stscore = int.Parse(dt.Rows[n]["Stscore"].ToString());
                    }
                    if (dt.Rows[n]["Sallscore"].ToString() != "")
                    {
                        model.Sallscore = int.Parse(dt.Rows[n]["Sallscore"].ToString());
                    }
                    if (dt.Rows[n]["Spscore"].ToString() != "")
                    {
                        model.Spscore = int.Parse(dt.Rows[n]["Spscore"].ToString());
                    }
                    if (dt.Rows[n]["Sgroup"].ToString() != "")
                    {
                        model.Sgroup = int.Parse(dt.Rows[n]["Sgroup"].ToString());
                    }
                    if (dt.Rows[n]["Sleader"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Sleader"].ToString() == "1") || (dt.Rows[n]["Sleader"].ToString().ToLower() == "true"))
                        {
                            model.Sleader = true;
                        }
                        else
                        {
                            model.Sleader = false;
                        }
                    }
                    if (dt.Rows[n]["Svote"].ToString() != "")
                    {
                        model.Svote = int.Parse(dt.Rows[n]["Svote"].ToString());
                    }
                    if (dt.Rows[n]["Sgscore"].ToString() != "")
                    {
                        model.Sgscore = int.Parse(dt.Rows[n]["Sgscore"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 16
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LearnSite.Model.Students model)
 {
     dal.Update(model);
 }
Exemplo n.º 17
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/>(当前无班级可注册或姓名长度超过限制!)";
        }
    }
Exemplo n.º 18
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;
    }
Exemplo n.º 19
0
 private void ShowStudent()
 {
     int Sid =Int32.Parse( Request.QueryString["Sid"].ToString());
     LearnSite.Model.Students student = new LearnSite.Model.Students();
     LearnSite.BLL.Students stubll = new LearnSite.BLL.Students();
     student = stubll.GetModel(Sid);
     Tsnum.Text = student.Snum;
     Tsyear.Text = student.Syear.ToString();
     DDLgrade.SelectedValue = student.Sgrade.ToString();;
     DDLclass.SelectedValue = student.Sclass.ToString();
     Tsname.Text = student.Sname;
     Tspwd.Text = student.Spwd;
     Tsex.Text = student.Sex;
     Tsaddress.Text = student.Saddress;
     Tsphone.Text = student.Sphone;
     Tsparents.Text = student.Sparents;
     Tsheadtheacher.Text = student.Sheadtheacher;
     Tsscore.Text = student.Sscore.ToString();
     Tsattitude.Text = student.Sattitude.ToString();
     string Hid = Request.Cookies["TeacherCookies"].Values["Hid"].ToString();
     Session[Hid+"grade"] = DDLgrade.SelectedValue;
     Session[Hid+"class"] = DDLclass.SelectedValue;
 }