Esempio n. 1
0
        //判断用户登录状态
        public myLoginState CheckUser(string strUser, string strPass)
        {
            string strSql = "select  UID,Name,Pass,Email,Phone,Tel,Address,IP,VIP.VName,VImg from [User],VIP  where Name='" + strUser + "' and Pass='******' and VIP.VID=[User].VID";

            //string strSql = "select  Name,Pass  from [User]  where Name='" + strUser + "' and Pass='******'";
            if (sqlHelper.GetdataSet(strSql).Tables[0].Rows.Count > 0)
            {
                //int intUID, string strName, string strPass, string strEmail, string strPhone, string strTel, string strAddress, string strIP


                DataRowView drv = sqlHelper.GetTableValue(strSql);
                userInfo = new Entity.UserInfo(int.Parse(drv["UID"].ToString()), drv["Name"].ToString(), drv["Pass"].ToString(), drv["Email"].ToString(), drv["Phone"].ToString(), drv["Tel"].ToString(), drv["Address"].ToString(), drv["IP"].ToString());

                System.Web.HttpCookie cookie1 = new System.Web.HttpCookie("UserInfo");
                cookie1.Values.Add("UID", drv["UID"].ToString());
                cookie1.Values.Add("name", drv["Name"].ToString());
                cookie1.Values.Add("pass", drv["Pass"].ToString());
                cookie1.Values.Add("vipImg", drv["VImg"].ToString());
                cookie1.Expires.AddHours(12);
                System.Web.HttpContext.Current.Response.AppendCookie(cookie1);

                return(myLoginState.LOGINSUSCCESS);
            }
            else
            {
                return(myLoginState.LOGINFAILED);
            }
            /*或者*/
            //SqlDataReader dr = sqlHelper.GetDataReader(strSql);
            //if (dr.HasRows)
            //{
            //    userInfo = new Entity.UserInfo( dr[1].ToString(), dr[2].ToString(), dr[3].ToString(), dr[4].ToString(), dr[5].ToString(), dr[6].ToString(),dr[7].ToString());
            //    return myLoginState.LOGINSUSCCESS;
            //}
            //else
            //    return myLoginState.LOGINFAILED;
        }
 public DataSet GetBrands()
 {
     return(helper.GetdataSet("select * from Brand"));
 }
 public DataSet GetProduct()
 {
     return(helper.GetdataSet("select * from Products"));
 }
 //获取列表
 public DataSet GetCategory()
 {
     return(helper.GetdataSet("select * from Category"));
 }
 public DataSet getLastTenLogLogin()
 {
     return(helper.GetdataSet("select top 10 LLogID,LUserID,LLocationX,LLocationY,LDate,LisHidden from  LoginLog"));
 }
 public DataSet getLastTenLogView()
 {
     return(helper.GetdataSet("select top 10 VLogID,VItemID,VUserID,VLocationX,VLocationY,VDate,VisHidden from  ViewLogs"));
 }
 //public bool LoginOnCheck(string Name, string Pass) {
 //   return helper.GetdataSet("select * from  Admins where UName='"
 //       + Name + "' and UPass ='******'").Tables[0].Rows.Count > 0;
 //}
 public bool LoginOnCheck(Entity.Admins admin)
 {
     return(helper.GetdataSet("select * from  Admins where UName='"
                              + admin.getName() + "' and UPass ='******'").Tables[0].Rows.Count > 0);
 }
 //获取文章分类
 public DataSet GetDataSetArticleClass()
 {
     return(helper.GetdataSet("select ClassID,ClassName from ArticleClass"));
 }
Esempio n. 9
0
 //获取最新图片
 public DataSet LatestPic()
 {
     return(sqlHelper.GetdataSet("select top 1 * from Images order by ImageID desc"));
 }
Esempio n. 10
0
 /**
  *不带图片
  * ProductID,ItemID,VipPrice,MemberPrice,Details,Minutes
  * Seconds,Area,AgoraPrice,SeckillPrice,Days
  * Hours,CategoryID,PName,PID,CName,ItemName,BrandName,Fresh,IsSecondKill
  */
 public DataSet GetItemByAllWithNoImg()
 {
     return(helper.GetdataSet("select * from ItemsAllWithNoImg"));
 }
 //获取指定人所有的商品的总数(包括已付款和未付款)
 public int GetCounts(int intUID)
 {
     return(helper.GetdataSet("select CarID,ItemID,UserID,IsPay,Visible,Count,AddDate,IID,ProductID,BrandID,Name,AgoraPrice,MemberPrice,VipPrice,SeckillPrice,Area,Details,ViewTimes,BuyTimes,IsSecondKill,LimitTime,Count from MyCar,Items where UserID=" + intUID + " and IsPay='false' and IID=ItemID  and Visible='true' ").Tables[0].Rows.Count);
 }