public Entity.PicturesItem GetSingleItemPic(int intImageID) { DataRowView drv = sqlHelper.GetTableValue("select * from ImagsWithItems where ImageID=" + intImageID + ""); return(new Entity.PicturesItem( int.Parse(drv["ImageID"].ToString()), int.Parse(drv["ItemID"].ToString()))); }
//public Entity.Admins LoginOn(string Name, string Pass) { // DataRowView drv= helper.GetTableValue("select * from Admins where UName='" + Name + "' and UPass ='******'"); // return new Entity.Admins(int.Parse( // drv["AdminID"].ToString()), // drv["UName"].ToString(), // drv["UPass"].ToString()); //} public Entity.Admins LoginOn(Entity.Admins admin) { DataRowView drv = helper.GetTableValue("select * from Admins where UName='" + admin.getName() + "' and UPass ='******'"); return(new Entity.Admins(int.Parse( drv["AdminID"].ToString()), drv["UName"].ToString(), drv["UPass"].ToString())); }
public Entity.Products GetProductInfo(int intPID) { DataRowView drv = helper.GetTableValue("select * from Products where PID=" + intPID + ""); return (new Entity.Products(intPID, int.Parse(drv["CategoryID"].ToString()), drv["Name"].ToString(), drv["Description"].ToString())); }
public Entity.Items GetSingleItem(int ItemID) { DataRowView drv = helper.GetTableValue("select * from Items where IID=" + ItemID + ""); Entity.Items item = new Entity.Items(); item.setItemID(ItemID); item.setProductID(int.Parse(drv["ProductID"].ToString())); item.setBrandID(int.Parse(drv["BrandID"].ToString())); item.setName(drv["Name"].ToString()); item.setAgoraPrice(drv["AgoraPrice"].ToString()); item.setSeckillPrice(drv["SeckillPrice"].ToString()); item.setMemberPrice(drv["MemberPrice"].ToString()); item.setArea(drv["Area"].ToString()); item.setDetails(drv["Details"].ToString()); item.setVipPrice(drv["VipPrice"].ToString()); item.setDays(drv["Days"].ToString()); item.setHours(drv["Hours"].ToString()); item.setMinutes(drv["Minutes"].ToString()); item.setSeconds(drv["Seconds"].ToString()); item.setIsSecondKill(drv["IsSecondKill"].ToString()); return(item); }
//根据获取指定文章 public Entity.Articles GetArtcleObjByAID(int intAID) { DataRowView drv = helper.GetTableValue("select * from ArticleAll where ArticleID=" + intAID + ""); return(new Entity.Articles( int.Parse(drv["ClassID"].ToString()), int.Parse(drv["ArticleID"].ToString()), drv["ClassName"].ToString(), drv["Title"].ToString(), drv["KeyWords"].ToString(), drv["Description"].ToString(), drv["Contents"].ToString(), drv["PubDate"].ToString(), int.Parse(drv["ViewTimes"].ToString()), drv["Author"].ToString())); }
//判断用户登录状态 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; }
//根据CID获取指定分类信息 public Entity.ItemCategory GetCategoryByCID(int intCID) { DataRowView drv = helper.GetTableValue("select * from Category where CID=" + intCID + ""); return(new Entity.ItemCategory(intCID, drv["CName"].ToString(), drv["Description"].ToString())); }