Example #1
0
 public void LoadEntity(StuInof stuInof, DataRow row)
 {
     stuInof.id     = Convert.ToInt32(row["id"]);
     stuInof.stuNum = row["stuNum"] != DBNull.Value ? row["stuNum"].ToString() : string.Empty;
     stuInof.stuPwd = row["stuPwd"] != DBNull.Value ? row["stuPwd"].ToString() : string.Empty;
     stuInof.name   = row["name"] != DBNull.Value ? row["name"].ToString() : string.Empty;
 }
Example #2
0
        public ActionResult StuLogin(string stuNum, string stuPwd, string code)
        {
            string     code1      = string.Empty;
            string     data       = "";
            StuInofBll stuInofBll = new StuInofBll();

            if (Session["code"] != null)
            {
                code1 = Session["code"].ToString();
            }
            else
            {
                data = "past";
                return(Json(data));
            }
            if (code == code1)
            {
                if (stuNum != null && stuPwd != null)
                {
                    StuInof stuInof = stuInofBll.GetStuInof(stuNum, stuPwd);
                    Session["stuInof"] = stuInof;
                    if (stuInof != null)
                    {
                        data = "true";
                        return(Json(data));
                    }
                    else
                    {
                        data = "ok";
                        return(Json(data));
                    }
                }
                else
                {
                    data = "no";
                    return(Json(data));
                }
            }
            else
            {
                data = "out";
                return(Json(data));
            }
        }
Example #3
0
        public StuInof GetStuInof(string stuNum, string stuPwd)
        {
            string sql = "select * from StuInof where stuNum=@stuNum and stuPwd=@stuPwd";

            SqlParameter[] pars =
            {
                new SqlParameter("@stuNum", SqlDbType.NVarChar, 20),
                new SqlParameter("@stuPwd", SqlDbType.NVarChar, 20),
            };
            pars[0].Value = stuNum;
            pars[1].Value = stuPwd;
            DataTable da      = StuSqlHelp.GetTable(sql, CommandType.Text, pars);
            StuInof   stuInof = null;

            if (da.Rows.Count > 0)
            {
                stuInof = new StuInof();
                LoadEntity(stuInof, da.Rows[0]);
            }
            return(stuInof);
        }