protected void Page_Load(object sender, EventArgs e) { if (Request.HttpMethod.ToLower() == "post") { if (!string.IsNullOrWhiteSpace(Request.QueryString["action"]) && Request.QueryString["action"] == "logout") { Session["UserInfo"] = null; } string name = Request.Form["username"]; string pwd = Request.Form["passwordmd5"]; string strSql = string.Format("select * from users where username='******' and password = '******';", name, pwd); SqlOper.SqlHelper sqlHelper = new SqlOper.SqlHelper(); Hashtable table = sqlHelper.Select(strSql); if (table.Count > 0) { Session["UserInfo"] = table["username"]; Response.Redirect("Index.aspx"); } else { txtErrorMsg.Text = "账号或密码错误!"; txtErrorMsg.Visible = true; } } }
/// <summary> /// 根据商品ID获取商品信息 /// </summary> /// <param name="id">商品id</param> /// <returns></returns> public Hashtable GetProductById(string id) { string strSql = "select g.id,GoodsName,g.GoodsNo,c.className,Price,Title,GoodsDetail,Photos,Images from goods g inner join goodsclass c on g.classid=c.id where g.id=" + id; SqlOper.SqlHelper sqlOper = new SqlOper.SqlHelper(); Hashtable dt = sqlOper.Select(strSql); return(dt); }
public int GetProductListByClassIDMaxCount(string classID, string searchText) { string w = ""; if (!classID.Equals("0")) { w = " and g.classid=" + classID; } if (!"".Equals(searchText)) { w = " and GoodsName like '%" + searchText + "%' "; } SqlOper.SqlHelper sqlOper = new SqlOper.SqlHelper(); string strSql = "select COUNT(*) as count from goods g inner join goodsclass c on c.id=g.classid where Deleted=0 " + w; string pageCount = Utils.GetConfigByKey("PageCount"); return(Convert.ToInt32(sqlOper.Select(strSql)["count"]) / Convert.ToInt32(pageCount) + 1); }