//这个页面需要刷新两次 #region 单个菜单详细页面 public String GetSingleMenu(IList <Menu> siglemenu, String useraccount) { BLL.BLLmenu bll = new BLL.BLLmenu(); BLLuser blluser = new BLLuser(); String keyword = ""; String menunumber = ""; string retstr = ""; //IList<Menu> siglemenu = bll.GetSingleMenu(val); foreach (Menu menu in siglemenu) { keyword = menu.KeyWord; menunumber = menu.MenuNumber; int r1 = blluser.Collectcount(useraccount, menunumber); //判断是否已收藏 retstr += " <div class='item product-layout product-list'>"; retstr += " <div class='product-thumb'>"; retstr += " <div class='image product-imageblock'> <a href='#'> <img data-name='product_image' src='" + menu.CoverImg + "' alt='iPod Classic' title='iPod Classic' class='img-responsive'> "; retstr += " <img src='" + menu.CoverImg + "' alt='iPod Classic' title='iPod Classic' class='img-responsive'> </a> </div>"; retstr += " <div class='caption product-detail text-left'>"; retstr += " <h6 data-name='product_name' class='product-name'><a href='#' title='Casual Shirt With Ruffle Hem'>" + menu.menuname + "</a></h6>"; retstr += " <div class='rating'> <span class='fa fa-stack'><i class='fa fa-star-o fa-stack-1x'></i><i class='fa fa-star fa-stack-1x'></i></span>"; retstr += " <span class='fa fa-stack'><i class='fa fa-star-o fa-stack-1x'></i><i class='fa fa-star fa-stack-1x'></i></span> "; retstr += " <span class='fa fa-stack'><i class='fa fa-star-o fa-stack-1x'></i><i class='fa fa-star fa-stack-1x'></i></span> "; retstr += " <span class='fa fa-stack'><i class='fa fa-star-o fa-stack-1x'></i><i class='fa fa-star fa-stack-1x'></i></span> "; retstr += " <span class='fa fa-stack'><i class='fa fa-star-o fa-stack-1x'></i><i class='fa fa-star fa-stack-x'></i></span> </div>"; retstr += " <span class='price' id='scl'><span class='amount'><span class='currencySymbol'>已有</span>" + menu.Collection + " 人收藏</span> </span>"; retstr += " <p class='product-desc mt_20'>" + menu.Introduces + "</p>"; retstr += " <div class='wdcc'>"; retstr += " <div class='wdc1'>"; retstr += " <div class='wdc2'> 2</div>"; retstr += " <div class='wdc3'>3</div>"; retstr += " <div class='wdc3'>4</div>"; retstr += " <div class='wdc2'> 2</div>"; retstr += " <div class='wdc3'>3</div>"; retstr += " <div class='wdc3'>4</div>"; //onclick='Ingredient('" + +"')' retstr += " <div > <a href='ingredients.html?val=" + menu.MainIngredient + " '>" + menu.MainIngredient + "的更多做法</a></div>"; retstr += " </div>"; //retstr += " <div class='days'></div>"; // retstr += " <div class='hours'></div>"; // retstr += " <div class='minutes'></div>"; // retstr += " <div class='seconds'></div>"; retstr += " </div>"; retstr += " <div class='button-group text-center wdbb'>"; retstr += " <div id='sc'>"; if (r1 == 0) { retstr += " <div class='wishlist '><a href='#' onclick='shoucang(" + menu.Collection + ")'><span>wishlist</span></a></div>"; } else { retstr += " <div class='dislike' ><a href='#' onclick='shoucangdel(" + menu.Collection + ")'><span>wishlist</span></a></div>"; } retstr += " </div>"; retstr += " <div class='quickview'><a href='#'><span>Quick View</span></a></div>"; retstr += " <div class='compare'><a href='#'><span>Compare</span></a></div>"; retstr += " <div class='add-to-cart'><a href='#'><span>Add to cart</span></a></div>"; retstr += " </div>"; retstr += " </div>"; retstr += " </div>"; retstr += " </div>"; } IList <Menu> menus = bll.GetSimilarMenu(keyword, menunumber); foreach (Menu menu in menus) { retstr += " <div class='item product-layout product-list'>"; retstr += " <div class='product-thumb'>"; retstr += " <div class='image product-imageblock'> <a href='#'> <img data-name='product_image' src='" + menu.CoverImg + "' alt='iPod Classic' title='iPod Classic' class='img-responsive'> "; retstr += " <img src='" + menu.CoverImg + "' alt='iPod Classic' title='iPod Classic' class='img-responsive'> </a> </div>"; retstr += " <div class='caption product-detail text-left'>"; retstr += " <h6 data-name='product_name' class='product-name'><a href='#' title='Casual Shirt With Ruffle Hem'>" + menu.menuname + "</a></h6>"; retstr += " <div class='rating'> <span class='fa fa-stack'><i class='fa fa-star-o fa-stack-1x'></i><i class='fa fa-star fa-stack-1x'></i></span>"; retstr += " <span class='fa fa-stack'><i class='fa fa-star-o fa-stack-1x'></i><i class='fa fa-star fa-stack-1x'></i></span> "; retstr += " <span class='fa fa-stack'><i class='fa fa-star-o fa-stack-1x'></i><i class='fa fa-star fa-stack-1x'></i></span> "; retstr += " <span class='fa fa-stack'><i class='fa fa-star-o fa-stack-1x'></i><i class='fa fa-star fa-stack-1x'></i></span> "; retstr += " <span class='fa fa-stack'><i class='fa fa-star-o fa-stack-1x'></i><i class='fa fa-star fa-stack-x'></i></span> </div>"; retstr += " <span class='price'><span class='amount'><span class='currencySymbol'>$</span>70.00</span>"; retstr += " </span>"; retstr += " <p class='product-desc mt_20'> " + menu.Introduces + "</p>"; retstr += " <div class='wdcc'>"; retstr += " <div class='wdc1'>"; retstr += " <div class='wdc2'> 2</div>"; retstr += " <div class='wdc3'>3</div>"; retstr += " <div class='wdc3'>4</div>"; retstr += " <div class='wdc2'> 2</div>"; retstr += " <div class='wdc3'>3</div>"; retstr += " <div class='wdc3'>4</div>"; retstr += " </div>"; //retstr += " <div class='days'></div>"; //retstr += " <div class='hours'></div>"; //retstr += " <div class='minutes'></div>"; //retstr += " <div class='seconds'></div>"; retstr += " </div>"; retstr += " <div class='button-group text-center wdbb'>"; retstr += " <div class='wishlist'><a href='#'><span>wishlist</span></a></div>"; retstr += " <div class='quickview'><a href='#'><span>Quick View</span></a></div>"; retstr += " <div class='compare'><a href='#'><span>Compare</span></a></div>"; retstr += " <div class='add-to-cart'><a href='#'><span>Add to cart</span></a></div>"; retstr += " </div>"; retstr += " </div>"; retstr += " </div>"; retstr += " </div>"; } return(retstr); }
public String createPageImage(string menunumber, string usernumber, string tableflag) { BLLuser blluser = new BLLuser(); string retstr = ""; if (tableflag == "User") { IList <UserProductions> menu = blluser.GetUserSingleProduction(usernumber, menunumber); retstr += " <div class='menuImg'>"; retstr += " <img src='" + menu[0].FoodImg + "' />"; retstr += " </div>"; retstr += " <div class='jibenjs'>"; retstr += " </div>"; retstr += " <div class='jieshao'>"; retstr += " <h1>菜品介绍</h1>"; retstr += " <div class='menujieshao'>" + menu[0].FoodIntroduce + "</div>"; retstr += " <h1>需要材料</h1>"; retstr += " <ul class='shicai'>"; String cl = menu[0].FoodMatrials; String[] ingredient = cl.Split('/'); for (int i = 0; i < ingredient.Length; i++) { retstr += " <li>" + ingredient[i].ToString() + "</li>"; } retstr += " </ul>"; retstr += " </div>"; } else { BLL.BLLmenu bll = new BLL.BLLmenu(); IList <Menu> menus = bll.GetMenudetail(menunumber); int r1 = blluser.Collectcount(usernumber, menunumber);//判断是否已收藏 //retstr += " <div class='data'>"; foreach (Menu menu in menus) { IList <User> user = bll.GetUserinfo(menu.ProducerNumber, "NotAll"); //String img = menu.CoverImg; retstr += " <div class='menuImg'>"; retstr += " <img src='" + menu.CoverImg + "' />"; retstr += " </div>"; retstr += " <div class='jibenjs'>"; retstr += " <div class='line1'> <h3 >" + menu.menuname + "</h3><div id='scl'> <p class='scl'> 收藏量:" + menu.Collection + "</p></div></div>"; retstr += " <div class='line2'><p class='zzname'> 作者:" + user[0].UserName + "</p>"; retstr += " <div class='zzimg'>"; retstr += " <img src='" + user[0].UserImg + "' />"; retstr += " </div>"; retstr += " </div>"; if (r1 == 0) { retstr += " <div id='sc'> <div class='line3' onclick='shoucang(" + menu.Collection + ")'>点击收藏</div> </div>"; } else { retstr += " <div id='sc'> <div class='line3' onclick='shoucangdel(" + menu.Collection + ")'>取消收藏</div> </div> "; } retstr += " </div>"; retstr += " <div class='jiesha'>"; retstr += " <h1>菜品介绍</h1>"; retstr += " <div class='menujieshao'>" + menu.Introduces + "</div>"; retstr += " <h1>需要材料</h1>"; retstr += " <ul class='shicai'>"; String cl = menu.ingredients; String[] ingredient = cl.Split('/'); for (int i = 0; i < ingredient.Length; i++) { retstr += " <li>" + ingredient[i].ToString() + "</li>"; } retstr += " </ul>"; retstr += " </div>"; } // retstr += " </div>"; } return(retstr); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); BLL.BLLuser bll = new BLL.BLLuser(); myoperateClass ex = new myoperateClass(); CreateHtml HtmlCreate = new CreateHtml(); #region 退出登录 if (Convert.ToString(context.Request.QueryString["type"]) == "logout")//退出登录 { //string strret = mycommonClassobj.createListImage("http://" + context.Request.Url.Authority.ToString()); //context.Response.Write(strret); context.Session.RemoveAll(); return; } #endregion #region 判断是否登录 if (Convert.ToString(context.Request.QueryString["type"]) == "islogin")//判断是否登录 { //string strret = mycommonClassobj.createListImage("http://" + context.Request.Url.Authority.ToString()); //context.Response.Write(strret); String username = ""; String result = ""; if (context.Session["username"] != null) { username = (context.Session["username"]).ToString(); result = username; } if (username == "") { result = "未登录"; } context.Response.Write(result); return; } #endregion #region 判断用户是否已存在 if (context.Request.QueryString["type"] == "checkusername") { string username = context.Request.QueryString["username"]; BLL.BLLuser bll = new BLL.BLLuser(); int r1 = bll.GetUserCount(username, "UserName"); if (r1 == 0) { context.Response.Write("fail"); } else { context.Response.Write("success"); } } #endregion #region 判断账号 if (context.Request.QueryString["type"] == "checkAccount") { string account = context.Request.QueryString["account"]; BLL.BLLuser bll = new BLL.BLLuser(); int r1 = bll.GetUserCount(account, "Account"); if (r1 == 0) { context.Response.Write("fail"); } else { context.Response.Write("success"); } } #endregion #region 用户登录 if (context.Request.QueryString["type"] == "login") { string username = context.Request.QueryString["username"]; string password = context.Request.QueryString["password"]; BLL.BLLuser bll = new BLL.BLLuser(); IList <User> user = bll.Userlogin(username, password); if (user.Count() == 0) { context.Response.Write("fail"); } else { foreach (User userinfo in user) { context.Session["username"] = userinfo.UserName.ToString(); context.Session["useraccount"] = userinfo.Account.ToString(); context.Session["userimg"] = userinfo.UserImg.ToString(); // context.Session["userimg"] =userinfo.UserImg.ToString(); // HttpContext.Current.Session["username"] = a; } context.Response.Write("success"); } } #endregion #region 用户注册 if (Convert.ToString(context.Request.QueryString["type"]) == "register") { string username = Convert.ToString(context.Request.QueryString["username"]); string Pword = Convert.ToString(context.Request.QueryString["password"]); BLLuser blluser = new BLLuser(); String Account = ""; int i = 0; String p = ""; string[] s1 = { "a", "_", "-", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; //字符列表 Random rand = new Random(); //实例化rand for (int k = 0; k < 3; k++) { i = rand.Next(0, 28); Account += s1[i]; p += i.ToString(); } Account += p; int r = blluser.UserRegister(username, Pword, Account); if (r == 0) { context.Response.Write("fail"); return; } else { context.Response.Write(Account); return; } } #endregion #region 收藏菜谱 if (Convert.ToString(context.Request.QueryString["type"]) == "Collect") { String flag = "notok"; // string MenuNumber = Convert.ToString(context.Request.QueryString["menunumber"]); String useraccount = (context.Session["useraccount"]).ToString(); String menunumber = (context.Session["MenuNumber"]).ToString(); //string Collection = Convert.ToString(context.Request.QueryString["Collection"]); string Collection = (context.Session["CollectionNumber"]).ToString(); int collection = int.Parse(Collection); string strret = ""; string sclx = "菜单收藏";//收藏类型 collection++; Collection = collection.ToString(); BLLuser blluser = new BLLuser(); int r = blluser.Collect(sclx, useraccount, menunumber, Collection);//收藏菜单 if (r > 0) { flag = "ok"; } context.Response.Write(flag); return; } #endregion #region 取消收藏菜谱 #endregion #region 获取用户历史足迹 if (Convert.ToString(context.Request.QueryString["type"]) == "getHistoricalRecord") { String strret = ""; String Account = (context.Session["useraccount"]).ToString(); IList <usernotices> Lists = bll.getHistoricalRecord(Account); strret = ex.getHistoricalRecordimage(Lists); context.Response.Write(strret); return; } #endregion #region 获取用户新的提示 if (Convert.ToString(context.Request.QueryString["type"]) == "getNewNotice") { String strret = ""; String Account = (context.Session["useraccount"]).ToString(); IList <usernotices> Lists = bll.getNewNotice(Account); strret = ex.getNewNoticeimage(Lists); context.Response.Write(strret); return; } #endregion #region 获取用户收藏的菜谱 if (Convert.ToString(context.Request.QueryString["type"]) == "GetUserMenuCollection") { String strret = ""; String Account = (context.Session["useraccount"]).ToString(); int Size = 10; string sclx = "菜单收藏";//收藏类型 // BLLmenu bllmenu = new BLLmenu(); IList <UserCollections> Lists = bll.GetUserMenuCollection(Account, Size); if (Lists.Count() != 0) { strret = HtmlCreate.CreateUserMenuCollectionImage(Lists); } context.Response.Write(strret); return; } #endregion #region 获取用户关注的用户 if (Convert.ToString(context.Request.QueryString["type"]) == "GetUserPersonFollow") { String strret = ""; String Account = (context.Session["useraccount"]).ToString(); int Size = 10; string sclx = "菜单收藏";//收藏类型 IList <UserCollections> Lists = bll.GetUserPersonFollow(Account, Size); if (Lists.Count() != 0) { strret = HtmlCreate.CreateUserPersonFollowImage(Lists); } context.Response.Write(strret); return; } #endregion #region 获取用户制作的菜谱 if (Convert.ToString(context.Request.QueryString["type"]) == "GetUserProduction") { String strret = ""; String Account = (context.Session["useraccount"]).ToString(); int Size = 10; IList <UserProductions> Lists = bll.GetUserProduction(Account, Size); strret = HtmlCreate.CreateUserProductionImage(Lists); context.Response.Write(strret); return; } #endregion #region 获取陌生用户列表 if (Convert.ToString(context.Request.QueryString["type"]) == "getStrangerList") { String strret = ""; String Account = (context.Session["useraccount"]).ToString(); IList <usernotices> Lists = bll.getNewNotice(Account); strret = ex.getStrangerListimage(Lists); context.Response.Write(strret); return; } #endregion #region 旧的收藏 if (Convert.ToString(context.Request.QueryString["type"]) == "Collect")//得到新秀菜谱列表 { //string strret = mycommonClassobj.createListImage("http://" + context.Request.Url.Authority.ToString()); //context.Response.Write(strret); string MenuNumber = Convert.ToString(context.Request.QueryString["menunumber"]); string UserNumber = Convert.ToString(context.Request.QueryString["usernumber"]); string Collection = Convert.ToString(context.Request.QueryString["Collection"]); int collection = int.Parse(Collection); string strret = ""; //string CollectionNumber= BLLuser blluser = new BLLuser(); string sclx = "菜单收藏"; //收藏类型 int r1 = blluser.Collectcount(UserNumber, MenuNumber); //判断是否已收藏 if (r1 == 0) { collection++; Collection = collection.ToString(); int r = blluser.Collect(sclx, UserNumber, MenuNumber, Collection);//收藏菜单 if (r > 0) { strret = "<p class='scl'> 收藏量:" + Collection + "</p>"; context.Response.Write(strret); return; } } else { collection--; Collection = collection.ToString(); int r = blluser.CollectDel(UserNumber, MenuNumber, Collection);//取消收藏菜单 if (r > 0) { strret = "<p class='scl'> 收藏量:" + Collection + "</p>"; } context.Response.Write(strret); return; } } #endregion #region//用户制作菜品 if (Convert.ToString(context.Request.QueryString["type"]) == "FoodProduction") { string foodname = Convert.ToString(context.Request.QueryString["foodname"]); string UserNumber = Convert.ToString(context.Request.QueryString["usernumber"]); string foodmaterials = Convert.ToString(context.Request.QueryString["foodmaterials"]); string foodtype = Convert.ToString(context.Request.QueryString["foodtype"]); string foodintroduce = Convert.ToString(context.Request.QueryString["foodintroduce"]); BLLuser blluser = new BLLuser(); int number = blluser.GetUserFoodProductionCount(UserNumber); string foodnumber = "1" + UserNumber + number.ToString(); int r = blluser.FoodProduction(foodintroduce, foodmaterials, foodname, foodtype, UserNumber, foodnumber); if (r == 0) { context.Response.Write("fail"); return; } else { context.Response.Write("success"); return; } //string foodpicture = Convert.ToString(context.Request.QueryString["foodmaterials"]); } #endregion #region //查看用户制作菜品 if (Convert.ToString(context.Request.QueryString["type"]) == "getUserMenu") { int Size = Convert.ToInt32(Convert.ToString(context.Request.QueryString["Size"])); string MenuNumber = Convert.ToString(context.Request.QueryString["MenuNumber"]); //string UserNumber = Convert.ToString(context.Request.QueryString["UserNumber"]); //string UserAccout = (context.Session["useraccount"]).ToString(); string UserNumber = "1001"; if (MenuNumber == "") { myoperateClass ex = new myoperateClass(); String strret = ex.createUserProductionImage(UserNumber, Size); context.Response.Write(strret); return; } else { BLLuser blluser = new BLLuser(); IList <UserProductions> menus = blluser.GetUserSingleProduction(UserNumber, MenuNumber); string retstr = "<script>"; retstr += " var foodname = document.getElementById('name');"; retstr += " var foodmaterials = document.getElementById('sc');"; retstr += " var foodintroduce = document.getElementById('introduce');"; retstr += " var foodtype = document.getElementById('type');"; // retstr += " var foodname = document.getElementById('foodnumber')"; // var foodpicture = result; retstr += "foodname.value = '" + menus[0].FoodName + "';"; retstr += "foodmaterials.value = '" + menus[0].FoodMatrials + "';"; retstr += "foodtype.value = '" + menus[0].FoodType + "';"; retstr += "foodintroduce.value = '" + menus[0].FoodIntroduce + "';"; // retstr += "foodnumber.value = '" + menus[0].UserFoodNumber+ "'"; retstr += "</script>"; context.Response.Write(retstr); return; } //string foodpicture = Convert.ToString(context.Request.QueryString["foodmaterials"]); } #endregion #region //用户编辑已有菜品 if (Convert.ToString(context.Request.QueryString["type"]) == " UserProductionedit") { string foodname = Convert.ToString(context.Request.QueryString["foodname"]); string UserNumber = Convert.ToString(context.Request.QueryString["usernumber"]); string foodmaterials = Convert.ToString(context.Request.QueryString["foodmaterials"]); string foodtype = Convert.ToString(context.Request.QueryString["foodtype"]); string foodintroduce = Convert.ToString(context.Request.QueryString["foodintroduce"]); string foodnumber = Convert.ToString(context.Request.QueryString["foodnumber"]); // string foodimg = Convert.ToString(context.Request.QueryString["usernumber"]); string foodimg = ""; BLLuser blluser = new BLLuser(); int r = blluser.FoodProductionedit(foodintroduce, foodmaterials, foodname, foodtype, UserNumber, foodnumber, foodimg); String strret = ""; context.Response.Write(strret); return; //string foodpicture = Convert.ToString(context.Request.QueryString["foodmaterials"]); } #endregion #region//删除作品 if (Convert.ToString(context.Request.QueryString["type"]) == "UserProductiondel") { string userfoodnumber = Convert.ToString(context.Request.QueryString["userfoodnumber"]); BLLuser blluser = new BLLuser(); int r = blluser.UserProductionDel(userfoodnumber); if (r == 0) { } else { context.Response.Write("yes"); return; } } #endregion }