示例#1
0
    /// <summary>
    /// 教师平台
    /// </summary>
    private void LoginCode()
    {
        string aaaastr = "teacherlogintime";
        string Hname   = Textname.Text.Trim();
        string Hpwd    = Textpwd.Text.Trim();

        if (Hname != "" && Hpwd != "")
        {
            LearnSite.Model.Teacher Tmodel = new LearnSite.Model.Teacher();
            LearnSite.BLL.Teacher   Tbll   = new LearnSite.BLL.Teacher();
            Tmodel = Tbll.GetTeacherModel(Hname, Hpwd);
            if (Tmodel != null)
            {
                cookieJump(Tmodel, aaaastr);//登录cookie设置和跳转
            }

            else
            {
                Labelmsg.Text = "用户名或密码错误!";
                Textname.Text = "";
                Textpwd.Text  = "";
            }
        }
        else
        {
            Labelmsg.Text = "输入不能为空!";
        }
    }
示例#2
0
    /// <summary>
    /// 登录cookie设置和跳转
    /// </summary>
    /// <param name="Tmodel"></param>
    /// <param name="aaaastr"></param>
    private void cookieJump(LearnSite.Model.Teacher Tmodel, string aaaastr)
    {
        bool hpermiss = Tmodel.Hpermiss;

        if (LearnSite.Common.CookieHelp.SetTMCookies(Tmodel, hpermiss))
        {
            System.Threading.Thread.Sleep(200);//设置cookies后,延时200毫秒
            if (Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname] != null)
            {
                string Hid = Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname].Values["Hid"].ToString();
                Session[Hid + aaaastr] = DateTime.Now.ToString();
                Response.Redirect("~/Teacher/infomation.aspx", false);
            }
            else
            {
                if (Request.Cookies[LearnSite.Common.CookieHelp.mngCookieNname] != null)
                {
                    Response.Redirect("~/Manager/index.aspx", false);
                }
                else
                {
                    string msg = "本机cookies设置失效,无法登录!";
                    Labelmsg.Text = msg;
                }
            }
        }
    }
示例#3
0
 protected void Btnedit_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["Hid"] != null)
     {
         int Hid = Int32.Parse(Request.QueryString["Hid"].ToString());
         string Hname = Texthname.Text.Trim();
         string Hpwd = Texthpwd.Text.Trim();
         bool Hpermiss = Ckhpermiss.Checked;
         string Hnote = Texthnote.Text.Trim();
         if (Hname != "" && Hpwd != "")
         {
             LearnSite.Model.Teacher teacher = new LearnSite.Model.Teacher();
             teacher.Hid = Hid;
             teacher.Hname = Hname;
             teacher.Hpwd = Hpwd;
             teacher.Hpermiss = Hpermiss;
             teacher.Hnote = Hnote;
             LearnSite.BLL.Teacher bll = new LearnSite.BLL.Teacher();
             bll.Update(teacher);
             System.Threading.Thread.Sleep(1000);
             Response.Redirect("~/Manager/teacher.aspx", false);
         }
         else
         {
             Labelmsg.Text = "请输入姓名和密码!";
         }
     }
 }
示例#4
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<LearnSite.Model.Teacher> DataTableToList(DataTable dt)
 {
     List<LearnSite.Model.Teacher> modelList = new List<LearnSite.Model.Teacher>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         LearnSite.Model.Teacher model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new LearnSite.Model.Teacher();
             if(dt.Rows[n]["Hid"].ToString()!="")
             {
                 model.Hid=int.Parse(dt.Rows[n]["Hid"].ToString());
             }
             model.Hname=dt.Rows[n]["Hname"].ToString();
             model.Hpwd=dt.Rows[n]["Hpwd"].ToString();
             if(dt.Rows[n]["Hpermiss"].ToString()!="")
             {
                 if((dt.Rows[n]["Hpermiss"].ToString()=="1")||(dt.Rows[n]["Hpermiss"].ToString().ToLower()=="true"))
                 {
                 model.Hpermiss=true;
                 }
                 else
                 {
                     model.Hpermiss=false;
                 }
             }
             model.Hnote=dt.Rows[n]["Hnote"].ToString();
             modelList.Add(model);
         }
     }
     return modelList;
 }
示例#5
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LearnSite.Model.Teacher> DataTableToList(DataTable dt)
        {
            List <LearnSite.Model.Teacher> modelList = new List <LearnSite.Model.Teacher>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LearnSite.Model.Teacher model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LearnSite.Model.Teacher();
                    if (dt.Rows[n]["Hid"].ToString() != "")
                    {
                        model.Hid = int.Parse(dt.Rows[n]["Hid"].ToString());
                    }
                    model.Hname = dt.Rows[n]["Hname"].ToString();
                    model.Hpwd  = dt.Rows[n]["Hpwd"].ToString();
                    if (dt.Rows[n]["Hpermiss"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Hpermiss"].ToString() == "1") || (dt.Rows[n]["Hpermiss"].ToString().ToLower() == "true"))
                        {
                            model.Hpermiss = true;
                        }
                        else
                        {
                            model.Hpermiss = false;
                        }
                    }
                    model.Hnote = dt.Rows[n]["Hnote"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#6
0
    private void Teacheradd()
    {
        string Hname    = Texthname.Text.Trim();
        string Hnick    = Texthnick.Text.Trim();
        string Hpwd     = Texthpwd.Text.Trim();
        bool   Hpermiss = Ckhpermiss.Checked;
        string Hnote    = Texthnote.Text.Trim();

        if (Hname != "" && Hpwd != "" && Hnick != "")
        {
            LearnSite.Model.Teacher teacher = new LearnSite.Model.Teacher();
            teacher.Hname    = Hname;
            teacher.Hpwd     = Hpwd;
            teacher.Hpermiss = Hpermiss;
            teacher.Hnote    = Hnote;
            teacher.Hnick    = Hnick;
            LearnSite.BLL.Teacher bll = new LearnSite.BLL.Teacher();
            if (bll.ExistsHname(Hname))
            {
                Labelmsg.Text = "账号已经存在,请更换!";
            }
            else
            {
                bll.Add(teacher);
                System.Threading.Thread.Sleep(200);
                Response.Redirect("~/Manager/teacher.aspx", false);
            }
        }
        else
        {
            Labelmsg.Text = "请输入账号、昵称和密码!";
        }
    }
示例#7
0
 protected void Btnedit_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["Hid"] != null)
     {
         int    Hid      = Int32.Parse(Request.QueryString["Hid"].ToString());
         string Hname    = Texthname.Text.Trim();
         string Hnick    = Texthnick.Text.Trim();
         string Hpwd     = Texthpwd.Text.Trim();
         bool   Hpermiss = Ckhpermiss.Checked;
         string Hnote    = Texthnote.Text.Trim();
         if (Hname != "" && Hpwd != "" && Hnote != "" && Hnick != "")
         {
             LearnSite.Model.Teacher tmodel = new LearnSite.Model.Teacher();
             tmodel.Hid      = Hid;
             tmodel.Hname    = Hname;
             tmodel.Hpwd     = Hpwd;
             tmodel.Hpermiss = Hpermiss;
             tmodel.Hnote    = Hnote;
             tmodel.Hnick    = Hnick;
             tmodel.Hpath    = "";
             LearnSite.BLL.Teacher bll = new LearnSite.BLL.Teacher();
             bll.Update(tmodel);
             System.Threading.Thread.Sleep(200);
             Response.Redirect("~/Manager/teacher.aspx", true);
         }
         else
         {
             Labelmsg.Text = "请输入姓名、密码和备注!";
         }
     }
 }
示例#8
0
 private void ShowTeacher()
 {
     if (Request.QueryString["Hid"] != null)
     {
         int Hid = Int32.Parse(Request.QueryString["Hid"].ToString());
         LearnSite.Model.Teacher teacher = new LearnSite.Model.Teacher();
         LearnSite.BLL.Teacher bll = new LearnSite.BLL.Teacher();
         teacher = bll.GetModel(Hid);
         Texthname.Text = teacher.Hname;
         Texthpwd.Text = teacher.Hpwd;
         Ckhpermiss.Checked = teacher.Hpermiss;
         Texthnote.Text = teacher.Hnote;
     }
 }
示例#9
0
 private void ShowTeacher()
 {
     if (Request.QueryString["Hid"] != null)
     {
         int Hid = Int32.Parse(Request.QueryString["Hid"].ToString());
         LearnSite.Model.Teacher teacher = new LearnSite.Model.Teacher();
         LearnSite.BLL.Teacher   bll     = new LearnSite.BLL.Teacher();
         teacher            = bll.GetModel(Hid);
         Texthname.Text     = teacher.Hname;
         Texthpwd.Text      = teacher.Hpwd;
         Ckhpermiss.Checked = teacher.Hpermiss;
         Texthnote.Text     = teacher.Hnote;
         Texthnick.Text     = teacher.Hnick;
     }
 }
示例#10
0
 private void Teacheradd()
 {
     string Hname = Texthname.Text.Trim();
     string Hpwd = Texthpwd.Text.Trim();
     bool Hpermiss = Ckhpermiss.Checked;
     string Hnote = Texthnote.Text.Trim();
     if (Hname != "" && Hpwd != "")
     {
         LearnSite.Model.Teacher teacher = new LearnSite.Model.Teacher();
         teacher.Hname = Hname;
         teacher.Hpwd = Hpwd;
         teacher.Hpermiss = Hpermiss;
         teacher.Hnote = Hnote;
         LearnSite.BLL.Teacher bll = new LearnSite.BLL.Teacher();
         bll.Add(teacher);
         System.Threading.Thread.Sleep(1000);
         Response.Redirect("~/Manager/teacher.aspx", false);
     }
     else
     {
         Labelmsg.Text = "请输入姓名和密码!";
     }
 }
示例#11
0
    protected void Btnlogin_Click(object sender, EventArgs e)
    {
        string Hname = Textname.Text.Trim();
        string Hpwd = Textpwd.Text.Trim();
        if (Hname != "" && Hpwd != "")
        {
                LearnSite.Model.Teacher Tmodel = new LearnSite.Model.Teacher();
                LearnSite.BLL.Teacher Tbll = new LearnSite.BLL.Teacher();
                Tmodel = Tbll.GetTeacherModel(Hname, Hpwd);
                if (Tmodel != null)
                {
                    if (LearnSite.Common.CookieHelp.SetTeacherCookies(Tmodel))
                    {
                        System.Threading.Thread.Sleep(500);
                        if (Request.Cookies["TeacherCookies"] != null)
                        {
                            string Hid = Request.Cookies["TeacherCookies"].Values["Hid"].ToString();
                            Session[Hid + "teacherlogintime"] = DateTime.Now.ToString();
                        }
                        Response.Redirect("~/Teacher/infomation.aspx", false);
                    }
                    else
                    {
                        string msg = "本机cookies设置失效,无法登录!";
                        Labelmsg.Text = msg;
                    }
                }

                else
                {
                    Labelmsg.Text = "用户名或密码错误!";
                    Textname.Text = "";
                    Textpwd.Text = "";
                }
        }
    }
示例#12
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LearnSite.Model.Teacher model)
 {
     dal.Update(model);
 }
示例#13
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LearnSite.Model.Teacher model)
 {
     return(dal.Add(model));
 }