public ActionResult LoginSubmit(Merchant_info merchant_info) { string code = Session["code"]!=null?Session["code"].ToString():""; if (code == merchant_info.guid) { using (db = new HotelDBContent()) { Merchant_info mer = (from m in db.Merchant_infos where m.mobliephone == merchant_info.tel &&m.status==true select m).SingleOrDefault(); if (mer != null) { // new help.HotelInfoHelp().Md5(merchant_info.password); // if (mer.password == merchant_info.password) if (mer.password == new help.HotelInfoHelp().Md5(merchant_info.password)) { string limit = string.Empty; Session["menu"] = new help.HotelInfoHelp().GetLimit(mer, out limit); Session["limit"] = limit; Session["limitHotelId"] = mer.limitHotelId; Session["userName"] = mer.name; Session["uid"] = mer.mobliephone; Session.Remove("code"); return RedirectToAction("index", "home"); } else { ViewBag.LoginInfo = "用户名或者密码错误"; } } else { ViewBag.LoginInfo = "用户名或者密码错误"; } } }else ViewBag.LoginInfo = "验证码错误,请输入正确的验证码"; Session.Remove("code"); ViewBag.userName = merchant_info.tel; ViewBag.pass = merchant_info.password; return View("signLogin");; }
/// <summary> /// 读取酒店,用户,菜单数据 /// </summary> /// <param name="listMer"></param> /// <param name="listMenu"></param> /// <param name="listHotel"></param> public void getMemberInfo(out List<Merchant_info> listMer,out List<SasMenu> listMenu,out List<hotel_info> listHotel) { List<Merchant_info> List_Mer=new List<Merchant_info>(); List<SasMenu> list_Menu=new List<SasMenu>();List<hotel_info> list_hotel=new List<hotel_info>(); string uId=new help.HotelInfoHelp().getUId(); string sqlMer = string.Format("select name,tel,limitName,limithotelName,id,limit,admin from merchant_info where operator_id='{0}' or tel='{0}'", uId), sqlHotel = string.Format("select hotel_Id,h_name_cn from hotel_info where u_id='{0}'", uId), sqlmenu = string.Format("select id,title,controlename from sasMenu where id!=10 and id!=1", uId); using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand(sqlHotel + ";" + sqlMer+";"+sqlmenu, conn)) { using (SqlDataReader dr = cmd.ExecuteReader()) { while (dr.Read())//读取所有酒店信息 { // decimal price = Convert.ToDecimal(dr[6]); list_hotel.Add(new hotel_info() { hotel_id=Convert.ToInt32(dr[0]),h_name_cn=dr[1].ToString() }); } dr.NextResult(); while (dr.Read()) //读取用户 { List_Mer.Add(new Merchant_info() { name = dr[0].ToString(), tel = dr[1].ToString(), limitName = dr[2].ToString(), limitHotelName = dr[3].ToString(), id = Convert.ToInt32(dr[4]), limit =dr[5].ToString(),admin=Convert.ToInt32(dr[6])==1?true:false}); } dr.NextResult(); while (dr.Read()) //读取菜单 { list_Menu.Add(new SasMenu() {id=Convert.ToInt32(dr[0]), title=dr[1].ToString(),controleName =dr[2].ToString() }); } } } } listMer = List_Mer; listMenu = list_Menu; listHotel = list_hotel; }