コード例 #1
0
 protected void btnOK_OnClick(object sender, EventArgs e)
 {
     if (YeAdministrator.Password != DESUtil.Encrypt(tbxOldPwd.Text))
     {
         WebUtil.Alert("您输入的当期登录密码不正确!");
         tbxOldPwd.Focus();
     }
     else
     {
         var newPwd = DESUtil.Encrypt(tbxNewPwd1.Text.Trim());
         if (AdministratorBll.ChangePassword(YeAdministratorId, newPwd))
         {
             AdministratorBll.AddAdminLog(new Ye_AdminLog()
             {
                 AdminID     = YeAdministratorId,
                 LogTypeName = LogType.修改密码.ToString(),
                 CreateTime  = DateTime.Now
             });
             WebUtil.Alert("密码修改成功!");
             YeAdministrator.Password = newPwd;
         }
         else
         {
             WebUtil.Alert("密码修改失败!");
         }
     }
 }
コード例 #2
0
ファイル: UserLogin.aspx.cs プロジェクト: 836146482/ABC
        /// <summary>
        /// 登录页面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnLogin_OnClick(object sender, EventArgs e)
        {
            var user = UserBll.Login(tbxUserName.Text.Trim(), DESUtil.Encrypt(tbxPwd.Text.Trim()));

            if (user == null)
            {
                WebUtil.Alert("Email,mobile or password is incorrect!");
            }
            else
            {
                UserBll.UpdateUserLastLoginTime(user.UserID);
                if (Request.Cookies["location"] == null)
                {
                    var cookie = new HttpCookie("location", user.Address);
                    cookie.Expires = DateTime.MaxValue;
                    Response.Cookies.Add(cookie);
                }
                else
                {
                    Response.Cookies["location"].Value = user.Address;
                }
                if (Request.Cookies["username"] == null)
                {
                    var cookie = new HttpCookie("username", user.UserName);
                    cookie.Expires = DateTime.MaxValue;
                    Response.Cookies.Add(cookie);
                }
                else
                {
                    Response.Cookies["username"].Value = user.UserName;
                }
                Session["YeUser"] = user;
                Response.Redirect("Home.aspx");//登录后跳转
            }
        }
コード例 #3
0
 protected void btnSave_OnClick(object sender, EventArgs e)
 {
     if (ddl.SelectedValue == YeAdministratorId.ToString())
     {
         WebUtil.Alert("您无法修改自身的权限!");
     }
     else
     {
         var list = new List <int>();
         for (int i = 1; i < 12; i++)
         {
             var c = this.FindControl("cbx" + i.ToString()) as CheckBox;
             if (c.Checked)
             {
                 list.Add(i);
             }
         }
         if (AdministratorBll.UpdateAdminPower(YeAdministratorId, list))
         {
             AdministratorBll.AddAdminLog(new Ye_AdminLog()
             {
                 AdminID     = YeAdministratorId,
                 LogTypeName = LogType.修改权限.ToString(),
                 CreateTime  = DateTime.Now
             });
             WebUtil.AlertAndRedirect("权限更新成功!", "");
         }
     }
 }
コード例 #4
0
ファイル: Login.aspx.cs プロジェクト: 836146482/ABC
        protected void btnLogin_OnClick(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbxAccount.Text))
            {
                WebUtil.Alert("用户名不能为空!");
                return;
            }
            if (string.IsNullOrWhiteSpace(tbxPassword.Text))
            {
                WebUtil.Alert("密码不能为空!");
                return;
            }
            var admin = AdministratorBll.Login(tbxAccount.Text.Trim(), DESUtil.Encrypt(tbxPassword.Text));

            if (admin != null)
            {
                AdministratorBll.AddAdminLog(new Ye_AdminLog()
                {
                    AdminID     = admin.AdministratorID,
                    LogTypeName = LogType.登录系统.ToString(),
                    CreateTime  = DateTime.Now
                });
                Session["YeAdministratorId"] = admin.AdministratorID;
                Cache["YeAdministrator"]     = admin;
                Response.Redirect("~/YellEatAdmin/Default.aspx", true);
            }
            else
            {
                WebUtil.AlertAndRedirect("用户名或密码不正确!", "Login.aspx");
            }
        }
コード例 #5
0
        protected void btnLogin_OnClick(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbxAccount.Text))
            {
                WebUtil.Alert("用户名不能为空!");
                return;
            }
            if (string.IsNullOrWhiteSpace(tbxPassword.Text))
            {
                WebUtil.Alert("密码不能为空!");
                return;
            }
            var shop = ShopBll.Login(tbxAccount.Text.Trim(), DESUtil.Encrypt(tbxPassword.Text));

            if (shop != null)
            {
                Session["YeShopId"] = shop.ShopID;
                Cache["Ye_Shop"]    = shop;
                Response.Redirect("Default.aspx", true);
            }
            else
            {
                WebUtil.AlertAndRedirect("用户名或密码不正确!", "Login.aspx");
            }
        }
コード例 #6
0
        protected void btnAdd_OnClick(object sender, EventArgs e)
        {
            var addrs = UserBll.GetUserAddressesByUserId(YeUser.UserID);

            if (addrs.Count == 3)
            {
                WebUtil.Alert("You have got 3 Addresses!It\\'s Limited.", this);
                return;
            }
            if (UserBll.AddUserAddress(new Ye_UserAddress()
            {
                UserID = YeUser.UserID,
                Address = tbxAddress.Text,
                Zip = "",
                AptSuite = "",
                Receiver = tbxReceiver.Text,
                Mobile = tbxMobile.Text,
                IsDefault = addrs.Count == 0
            }))
            {
                WebUtil.AlertAndRedirect("Success", "UserAddressList.aspx");
            }
            else
            {
                WebUtil.AlertAndRedirect("Sorry,something wrong happens.", "UserAddressList.aspx");
            }
        }
コード例 #7
0
 protected void btnAddUnit_OnClick(object sender, EventArgs e)
 {
     if (Units.SingleOrDefault(p => p.UnitName == tbxAddUnit.Text.Trim()) != null)
     {
         WebUtil.Alert("该税金已存在", this.Page);
         return;
     }
     else
     {
         if (ProductBll.AddUnit(new Ye_Unit()
         {
             UnitName = tbxAddUnit.Text.Trim(),
             UnitPoint = Convert.ToDecimal(tbxAddPoint.Text)
         }))
         {
             Units = ProductBll.GetUnits().ToList();
             BindData(0);
         }
         else
         {
             WebUtil.Alert("添加税金失败", this.Page);
             return;
         }
     }
 }
コード例 #8
0
ファイル: UserLogin.aspx.cs プロジェクト: 836146482/ABC
 protected void btnSendEmail_OnClick(object sender, EventArgs e)
 {
     try
     {
         var user = UserBll.GetPasswordByEmail(tbxEmail.Text.Trim());
         if (user == null)
         {
             WebUtil.Alert("Email doesn't exist.");
             return;
         }
         var host          = SysConfig.Instance.EmailHost;
         var emailPassword = DESUtil.Decrypt(SysConfig.Instance.EmailPassword);
         var email         = SysConfig.Instance.Email;
         var client        = new SmtpClient(host);
         client.UseDefaultCredentials = false;
         client.Credentials           = new NetworkCredential(email, emailPassword);
         client.DeliveryMethod        = SmtpDeliveryMethod.Network;
         var addressFrom = new MailAddress(email, "");
         var addressTo   = new MailAddress(tbxEmail.Text.Trim(), "Get Password");
         var message     = new MailMessage(addressFrom, addressTo);
         message.Subject      = "Get Password";
         message.Body         = "Dear Sir or Madam,it's from Yelleat.Your password is '" + DESUtil.Decrypt(user.Password) + "' .Keep it please.";
         message.Sender       = new MailAddress(email);
         message.BodyEncoding = System.Text.Encoding.UTF8;
         message.IsBodyHtml   = true;
         client.Send(message);
         WebUtil.Alert("Email is sent Successfully.");
     }
     catch
     {
         WebUtil.Alert("Email is sent failed", this.Page);
     }
 }
コード例 #9
0
 protected void btnOK_OnClick(object sender, EventArgs e)
 {
     if (AdministratorBll.GetAdministrators().SingleOrDefault(a => a.Account == tbxAccount.Text) != null)
     {
         WebUtil.Alert("该用户名已存在!");
         return;
     }
     else
     {
         if (AdministratorBll.AddAdministrator(new Ye_Administrator()
         {
             Account = tbxAccount.Text.Trim(),
             Password = DESUtil.Encrypt(tbxPwd1.Text.Trim()),
             CreateTime = DateTime.Now,
             LastLoginTime = DateTime.Now
         }))
         {
             AdministratorBll.AddAdminLog(new Ye_AdminLog()
             {
                 AdminID     = YeAdministratorId,
                 LogTypeName = LogType.添加管理员.ToString(),
                 CreateTime  = DateTime.Now
             });
             WebUtil.AlertAndReload("成功添加管理员!");
         }
         else
         {
             WebUtil.Alert("创建新管理员时出错!");
         }
     }
 }
コード例 #10
0
 protected void img_okgo_OnClick(object sender, ImageClickEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(tbxAdd.Text))
     {
         WebUtil.Alert("请输入您所在的地址!");
     }
     //TODO:搜索位置
     Response.Redirect("ShopList.aspx?location=" + Server.HtmlEncode(tbxAdd.Text), true);
 }
コード例 #11
0
ファイル: UpdateProduct.aspx.cs プロジェクト: 836146482/ABC
        protected void btnOk_OnClick(object sender, EventArgs e)
        {
            int productId = Convert.ToInt32(Request.QueryString["id"]);

            if (ProductBll.GetProducts().Count(p => p.ShopID == YeShopId && p.ProductNo == tbxProductNO.Text.Trim() && p.ProductID != productId) > 0)
            {
                WebUtil.Alert("菜单编号重复,请重新填写菜单编号!");
                return;
            }
            var product = new Ye_Product()
            {
                ProductID     = productId,
                ProductDesc   = tbxProductDesc.Text,
                Price         = Convert.ToDecimal(tbxPrice.Text),
                ShopID        = YeShopId,
                ProductName   = tbxProductName.Text,
                ProductNo     = tbxProductNO.Text,
                ProductTypeID = Convert.ToInt32(ddlProductTypes.SelectedValue),
                UnitId        = Convert.ToInt32(ddlUnits.SelectedValue),
                CreateDate    = DateTime.Now,
            };

            if (!fupProductImage.HasFile)
            {
                product.ProductImage = imgProductImage.ImageUrl;
            }
            else
            {
                var    oldImage = Server.MapPath(product.ProductImage);
                string str      = string.Empty;
                if (WebUtil.UploadImage(fupProductImage, "../upload/", new[] { ".gif", ".jpg", ".png", ".jpeg" }, out str))
                {
                    product.ProductImage = "/upload/" + str;
                    try
                    {
                        File.Delete(oldImage);
                    }
                    catch
                    {
                    }
                }
                else
                {
                    WebUtil.Alert("餐馆 Logo 图片格式不被支持!");
                    return;
                }
            }
            if (ProductBll.UpdateProduct(product))
            {
                WebUtil.Alert("菜单修改成功!");
            }
            else
            {
                WebUtil.Alert("菜单修改失败!");
            }
        }
コード例 #12
0
        //protected void btnSendSMS_OnClick(object sender, EventArgs e)
        //{

        //}
        protected void btnRegister_OnClick(object sender, EventArgs e)
        {
            var user = new Ye_User()
            {
                Address       = tbxAddress.Text.Trim(),
                UserName      = tbxName.Text.Trim(),
                Zip           = tbxZip.Text.Trim(),
                AptSuite      = tbxAptSuite.Text.Trim(),
                Mobile        = tbxPhone.Text.Trim(),
                Password      = DESUtil.Encrypt(tbxPassword.Text.Trim()),
                Email         = tbxEmail.Text.Trim(),
                FaceBookID    = "",
                QQ            = "",
                WxID          = "",
                Status        = 0,
                LastLoginTime = DateTime.Now,
                RegisterTime  = DateTime.Now
            };

            if (UserBll.GetUsers().SingleOrDefault(u => u.UserName == user.UserName) != null)
            {
                WebUtil.Alert("The username is used,please change a new username.");//当前用户已经存在!请使用其他用户名注册!
                return;
            }
            if (UserBll.AddUser(user))
            {
                Session["YeUser"] = UserBll.Login(user.UserName, user.Password);
                if (Request.Cookies["location"] == null)
                {
                    var cookie = new HttpCookie("location", user.Address);
                    cookie.Expires = DateTime.MaxValue;
                    Response.Cookies.Add(cookie);
                }
                else
                {
                    Response.Cookies["location"].Value = user.Address;
                }
                if (Request.Cookies["username"] == null)
                {
                    var cookie = new HttpCookie("username", user.UserName);
                    cookie.Expires = DateTime.MaxValue;
                    Response.Cookies.Add(cookie);
                }
                else
                {
                    Request.Cookies["username"].Value = user.UserName;
                }
                WebUtil.AlertAndRedirect("Register successfully", "Home.aspx");
            }
            else
            {
                WebUtil.Alert("Failed to register.");
            }
        }
コード例 #13
0
ファイル: sjProductList.aspx.cs プロジェクト: 836146482/ABC
        protected void rpt_OnItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var id = Convert.ToInt32(e.CommandArgument.ToString());

            switch (e.CommandName)
            {
            case "del":
            {
                if (ProductBll.CheckProduct(id))           //菜单出现在订单中,进行下架处理
                {
                    if (ProductBll.SetProductSaleState(id, false))
                    {
                        WebUtil.Alert("菜单成功删除!", this);
                        pager1.CurrentPagerIndex = 0;
                        BindData();
                    }
                    else
                    {
                        WebUtil.Alert("菜单删除失败!", this);
                    }
                }
                else                                        //菜单没出现在订单中,进行删除处理
                {
                    if (ProductBll.DeleteProduct(id))
                    {
                        WebUtil.Alert("菜单成功删除!", this);
                        pager1.CurrentPagerIndex = 0;
                        BindData();
                    }
                    else
                    {
                        WebUtil.Alert("菜单删除失败!", this);
                    }
                }
                break;
            }

            case "xj":
            {
                if (ProductBll.SetProductSaleState(id, false))
                {
                    WebUtil.Alert("菜单下架成功!", this);
                    pager1.CurrentPagerIndex = 0;
                    BindData();
                }
                else
                {
                    WebUtil.Alert("菜单下架失败!", this);
                }
                break;
            }
            }
        }
コード例 #14
0
ファイル: xjProductList.aspx.cs プロジェクト: 836146482/ABC
        protected void rpt_OnItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var id = Convert.ToInt32(e.CommandArgument.ToString());

            switch (e.CommandName)
            {
            case "del":
            {
                if (ProductBll.CheckProduct(id))                //菜单出现在订单中
                {
                    List <int> lisOrderId = OrderBll.GetOrderIDsByProductId(id);
                    foreach (int orderId in lisOrderId)
                    {
                        OrderBll.ShopDeleteOrder(orderId);
                    }
                    //ProductBll.DeleteProduct(id);
                    WebUtil.Alert("菜单删除成功!", this);
                    pager1.CurrentPagerIndex = 0;
                    BindData();
                }
                else
                {
                    if (ProductBll.DeleteProduct(id))
                    {
                        WebUtil.Alert("菜单成功删除!", this);
                        pager1.CurrentPagerIndex = 0;
                        BindData();
                    }
                    else
                    {
                        WebUtil.Alert("菜单删除失败!", this);
                    }
                }
                break;
            }

            case "sj":
            {
                if (ProductBll.SetProductSaleState(id, true))
                {
                    WebUtil.Alert("菜单上架成功!", this);
                    pager1.CurrentPagerIndex = 0;
                    BindData();
                }
                else
                {
                    WebUtil.Alert("菜单上架失败!", this);
                }
                break;
            }
            }
        }
コード例 #15
0
ファイル: AddFeedback.aspx.cs プロジェクト: 836146482/ABC
 protected void btnOK_OnClick(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(tbxFeedbackContent.Text))
     {
         if (ShopBll.AddShopFeedback(YeShopId, tbxFeedbackContent.Text))
         {
             WebUtil.AlertAndRedirect("感谢您的意见反馈,请耐心等待我们的回复!", "FeedbackList.aspx");
         }
         else
         {
             WebUtil.Alert("提交意见反馈时出错");
         }
     }
 }
コード例 #16
0
ファイル: AddProduct.aspx.cs プロジェクト: 836146482/ABC
        protected void btnOk_OnClick(object sender, EventArgs e)
        {
            if (ProductBll.GetProducts().Count(p => p.ShopID == YeShopId && p.ProductNo == tbxProductNO.Text.Trim()) > 0)
            {
                WebUtil.Alert("菜单编号重复,请重新填写菜单编号!");
                return;
            }
            var product = new Ye_Product()
            {
                ProductDesc   = tbxProductDesc.Text,
                Price         = Convert.ToDecimal(tbxPrice.Text),
                ShopID        = YeShopId,
                ProductName   = tbxProductName.Text,
                ProductNo     = tbxProductNO.Text,
                ProductTypeID = Convert.ToInt32(ddlProductTypes.SelectedValue),
                UnitId        = Convert.ToInt32(ddlUnits.SelectedValue),
                CreateDate    = DateTime.Now,
            };
            var fileName = string.Empty;

            if (!fupProductImage.HasFile)
            {
                WebUtil.Alert("请上传产品图片!");
                return;
            }
            else if (fupProductImage.FileBytes.Length > 1024 * 5120)
            {
                WebUtil.Alert("菜单图片不能超过 5 M!");
                return;
            }
            if (WebUtil.UploadImage(fupProductImage, "../upload/", new [] { ".png", ".jpeg", ".jpg" }, out fileName))
            {
                product.ProductImage = "/upload/" + fileName;
            }
            else
            {
                WebUtil.Alert("上传图片失败,请重试。支持 jpg、png 格式!");
                return;
            }

            if (ProductBll.AddProduct(product))
            {
                WebUtil.AlertAndReload("添加菜单成功!");
            }
            else
            {
                WebUtil.AlertAndReload("添加菜单失败!");
            }
        }
コード例 #17
0
        protected void btnUpdate_OnClick(object sender, EventArgs e)
        {
            var id = Convert.ToInt32(hfUpdateTypeId.Value);

            if (ProductBll.UpdateProductType(id, tbxProductType2.Text.Trim()))
            {
                WebUtil.Alert("菜单修改添加成功");
                YeProductTypes.First(p => p.ProductTypeID == id).ProductTypeName = tbxProductType2.Text.Trim();
                BindData();
            }
            else
            {
                WebUtil.Alert("菜单分类修改失败");
            }
        }
コード例 #18
0
 protected void btnOK_OnClick(object sender, EventArgs e)
 {
     if (ShopBll.HandleShopFeedback(Convert.ToInt32(Request.QueryString["id"]), tbxFeedbackAnswer.Text))
     {
         AdministratorBll.AddAdminLog(new Ye_AdminLog()
         {
             AdminID     = YeAdministratorId,
             LogTypeName = LogType.餐馆管理.ToString(),
             CreateTime  = DateTime.Now
         });
         WebUtil.AlertAndRedirect("反馈处理已提交保存!", "ShopFeedbackList.aspx");
     }
     else
     {
         WebUtil.Alert("反馈意见保存失败!");
     }
 }
コード例 #19
0
ファイル: ShopTypeList.aspx.cs プロジェクト: 836146482/ABC
 protected void rpt_OnItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "del")
     {
         var typeId = Convert.ToInt32(e.CommandArgument.ToString());
         if (ShopBll.DeleteShopType(typeId))
         {
             WebUtil.Alert("删除成功", this.Page);
             ShopTypes = ShopBll.GetShopTypes();
             pager1.CurrentPagerIndex = 0;
             BindData();
         }
         else
         {
             WebUtil.Alert("删除失败!", this.Page);
         }
     }
 }
コード例 #20
0
 protected void rpt_OnItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         switch (e.CommandName)
         {
         case "del":
         {
             if (ProductBll.DeleteProductTypeAndProducts(Convert.ToInt32(e.CommandArgument)))
             {
                 WebUtil.Alert("成功删除菜单分类", this.Page);
                 YeProductTypes           = ProductBll.GetProductTypesByShopId(YeShopId);
                 pager1.CurrentPagerIndex = 0;
                 BindData();
             }
             break;
         }
         }
     }
 }
コード例 #21
0
 //生成订单并跳转
 protected void rpt_OnItemCommand(object source, RepeaterCommandEventArgs e)
 {
     switch (e.CommandName)
     {
     case "order":
     {
         var rpt        = e.Item.FindControl("rptProduct") as Repeater;
         var shopId     = e.CommandArgument.ToString();
         var cookieName = "shop_" + shopId;
         var lblList    = new Dictionary <string, string>();//产品Id和数量键值对
         rpt.Controls.OfType <RepeaterItem>().ToList().ForEach(rItem =>
             {
                 if (rItem.ItemType == ListItemType.Item || rItem.ItemType == ListItemType.AlternatingItem)
                 {
                     lblList.Add((rItem.FindControl("lblAmount") as Label).Attributes["data-pid"], (rItem.FindControl("hfAmount") as HiddenField).Value);
                 }
             });
         var length = Request.Cookies[cookieName].Values.Keys.Count;
         int p_num  = 0;
         for (int i = 0; i < length; i++)
         {
             var httpCookie = Request.Cookies[cookieName];
             if (httpCookie != null)
             {
                 var    key    = Request.Cookies[cookieName].Values.Keys[i];
                 string tmpStr = Request.Cookies[cookieName].Values[key];
                 int    tmpInt = Convert.ToInt32(tmpStr);
                 p_num += tmpInt;
                 httpCookie.Values[key] = lblList.Single(p => p.Key == key).Value;
             }
         }
         if (p_num <= 0)
         {
             WebUtil.Alert("数量必须大于0");
             return;
         }
         Response.Redirect("UserSubmitOrder.aspx?shopid=" + shopId);
         break;
     }
     }
 }
コード例 #22
0
 protected void btnUpdateUnit_OnClick(object sender, EventArgs e)
 {
     if (Units.SingleOrDefault(p => p.UnitName == tbxAddUnit.Text.Trim()) != null)
     {
         WebUtil.Alert("该税金已存在", this.Page);
         return;
     }
     else
     {
         if (ProductBll.UpdateUnit(Convert.ToInt32(hf.Value), tbxUpdateUnit.Text.Trim(), Convert.ToDecimal(tbxUpdatePoint.Text.Trim())))
         {
             Units = ProductBll.GetUnits().ToList();
             BindData(0);
         }
         else
         {
             WebUtil.Alert("修改餐馆类型失败", this.Page);
             return;
         }
     }
 }
コード例 #23
0
 protected void rpt_OnItemCommand(object source, RepeaterCommandEventArgs e)
 {
     switch (e.CommandName)
     {
     case "del":
     {
         var id     = Convert.ToInt32(e.CommandArgument);
         var coupon = ShopCouponBll.GetShopCoupons().Single(p => p.CouponID == id);
         if (coupon.BeginDate < DateTime.Now && coupon.EndDate > DateTime.Now)
         {
             WebUtil.Alert("该优惠券尚处于有效期内,无法删除。若要删除,请联系 YellEat 管理员!", this);
         }
         if (ShopCouponBll.DeleteShopCoupon(id))
         {
             pager1.CurrentPagerIndex = 0;
             BindData();
         }
         break;
     }
     }
 }
コード例 #24
0
 protected void btnOk_OnClick(object sender, EventArgs e)
 {
     if (YeProductTypes.Exists(p => p.ProductTypeName == tbxProductType.Text.Trim()))
     {
         WebUtil.Alert(string.Format("已在名为“{0}”的菜单分类", tbxProductType.Text), this);
     }
     else
     {
         if (ProductBll.AddProductType(YeShopId, tbxProductType.Text))
         {
             WebUtil.Alert("菜单分类添加成功!", this.Page);
             YeProductTypes           = ProductBll.GetProductTypesByShopId(YeShopId);
             pager1.CurrentPagerIndex = 0;
             BindData();
         }
         else
         {
             WebUtil.Alert("菜单分类添加失败!", this.Page);
         }
     }
 }
コード例 #25
0
ファイル: Register.aspx.cs プロジェクト: 836146482/ABC
        protected void btnRegister_OnClick(object sender, EventArgs e)
        {
            var shop = new Ye_Shop()
            {
                ShopAccount        = tbxUserName.Text.Trim(),
                ShopPassword       = DESUtil.Encrypt(tbxUserPwd.Text.Trim()),
                RegisterTime       = DateTime.Now,
                LastLoginTime      = DateTime.Now,
                ShopName           = tbxShopName.Text,
                ShopAddress        = tbxAddr.Text,
                ShopMobile         = tbxShopMobile.Text,
                ShopEmail          = tbxShopEmail.Text,
                ShopFax            = tbxShopFax.Text,
                ShopZip            = tbxShopZip.Text,
                ShopDesc           = "",
                ShopLogoImg        = "",
                ShopMainImg        = "",
                ShopQQ             = "",
                ShopQRCodeImg      = "",
                Longitude          = 0,
                Latitude           = 0,
                DeliveryTime       = "",
                DeliveryMinPrice   = 0,
                RecommendLevel     = 0,
                IsChecked          = false,
                OpeningBeginMinute = 0,
                OpeningEndMinute   = 0,
                Rank   = 3,
                Clicks = 0,
            };

            if (ShopBll.AddShop(shop))
            {
                WebUtil.AlertAndRedirect("您的餐馆已成功注册,请耐心等待审核!", "Login.aspx");
            }
            else
            {
                WebUtil.Alert("餐馆注册失败!");
            }
        }
コード例 #26
0
ファイル: ChangePassword.aspx.cs プロジェクト: 836146482/ABC
 protected void btnOK_OnClick(object sender, EventArgs e)
 {
     if (YeShop.ShopPassword != DESUtil.Encrypt(tbxOldPwd.Text))
     {
         WebUtil.Alert("您输入的当期登录密码不正确!");
         tbxOldPwd.Focus();
         return;
     }
     else
     {
         var newPwd = DESUtil.Encrypt(tbxNewPwd1.Text.Trim());
         if (ShopBll.ChangePassword(YeShopId, newPwd))
         {
             WebUtil.Alert("密码修改成功!");
             YeShop.ShopPassword = newPwd;
         }
         else
         {
             WebUtil.Alert("密码修改失败!");
         }
     }
 }
コード例 #27
0
ファイル: ShopTypeList.aspx.cs プロジェクト: 836146482/ABC
 protected void btnAddShopType_OnClick(object sender, EventArgs e)
 {
     if (ShopTypes.SingleOrDefault(p => p.ShopTypeName == tbxAddShopType.Text.Trim()) != null)
     {
         WebUtil.Alert("该餐馆类型已存在", this.Page);
         return;
     }
     else
     {
         if (ShopBll.AddShopType(tbxAddShopType.Text.Trim()))
         {
             ShopTypes = ShopBll.GetShopTypes();
             pager1.CurrentPagerIndex = 0;
             BindData();
         }
         else
         {
             WebUtil.Alert("添加餐馆类型已存在", this.Page);
             return;
         }
     }
 }
コード例 #28
0
ファイル: ShopTypeList.aspx.cs プロジェクト: 836146482/ABC
 //更新餐馆
 protected void btnUpdateShopType_OnClick(object sender, EventArgs e)
 {
     if (ShopTypes.SingleOrDefault(p => p.ShopTypeName == tbxUpdateShopType.Text.Trim()) != null)
     {
         WebUtil.Alert("该餐馆类型已存在", this.Page);
         return;
     }
     else
     {
         if (ShopBll.UpdateShopType(Convert.ToInt32(hf.Value), tbxUpdateShopType.Text.Trim()))
         {
             ShopTypes = ShopBll.GetShopTypes();
             pager1.CurrentPagerIndex = 0;
             BindData();
         }
         else
         {
             WebUtil.Alert("修改餐馆类型失败", this.Page);
             return;
         }
     }
 }
コード例 #29
0
ファイル: AddShopCoupon.aspx.cs プロジェクト: 836146482/ABC
 protected void btnOK_OnClick(object sender, EventArgs e)
 {
     if (Convert.ToDateTime(tbxBeginDate.Text) > Convert.ToDateTime(tbxEndDate.Text))
     {
         WebUtil.Alert("优惠结束日期必须在优惠开始日期之后");
         return;
     }
     if (ShopCouponBll.AddShopCoupon(new Ye_ShopCoupon()
     {
         ShopID = YeShopId,
         CouponCode = tbxCouponCode.Text,
         BeginDate = Convert.ToDateTime(tbxBeginDate.Text),
         EndDate = Convert.ToDateTime(tbxEndDate.Text),
         UnitCost = Convert.ToDecimal(tbxUnitCost.Text),
         CouponContent = ""
     }))
     {
         WebUtil.AlertAndRedirect("添加优惠券成功!", "ShopCouponList.aspx");
     }
     else
     {
         WebUtil.Alert("优惠券添加失败!");
     }
 }
コード例 #30
0
ファイル: UserRegister.aspx.cs プロジェクト: 836146482/ABC
        protected void imgBtn_OnClick(object sender, ImageClickEventArgs e)
        {
            var user = new Ye_User()
            {
                Address  = tbxAddress.Text.Trim(),
                UserName = tbxFirstName.Text.Trim() + " " + tbxLastName.Text.Trim(),
                //Zip =  tbxZip.Text.Trim(),
                //Aptsuite = tbxAptSuite.Text.Trim(),
                Mobile        = tbxMobile.Text.Trim(),
                Password      = DESUtil.Encrypt(tbxPwd1.Text.Trim()),
                Email         = tbxEmail.Text.Trim(),
                FaceBookID    = "",
                QQ            = "",
                WxID          = "",
                Status        = 0,
                Zip           = "",
                AptSuite      = "",
                LastLoginTime = DateTime.Now,
                RegisterTime  = DateTime.Now
            };

            if (UserBll.GetUsers().SingleOrDefault(u => u.UserName == user.UserName) != null)
            {
                WebUtil.Alert("当前用户已经存在!请使用其他用户名注册!");
                return;
            }
            if (UserBll.AddUser(user))
            {
                Session["YeUser"] = UserBll.Login(user.UserName, user.Password);
                Response.Redirect("Home.aspx");
            }
            else
            {
                WebUtil.Alert("注册失败!");
            }
        }