public ActionResult AddPackageCate() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 701)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); PackageCateObj packageCateObj = new PackageCateObj(); packageCateObj.CategoryName = vld.Get("categoryName", false, "类别名不可为空!"); packageCateObj.Sort = vld.GetInt("sort"); packageCateObj.ParentID = vld.GetInt("categoryID"); if (vld.HasError) { return(Json(new { success = false, msg = vld.GetError() })); } PackageBLL packageBLL = new PackageBLL(); packageBLL.AddPackageCate(packageCateObj); return(Json(new { success = true })); }
public ActionResult DeleteFriendLink() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1903)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } FriendLinkBLL friendLinkBLL = new FriendLinkBLL(); Validation vld = new Validation(); int id = vld.GetInt("id"); if (id != 0) { FriendLinkObj friendLinkObj = friendLinkBLL.GetFriendLinkByID(id); System.IO.File.Delete(Config.MediaPath + friendLinkObj.Pic); friendLinkBLL.DeleteFriendLink(id); } return(Json(new { success = true })); }
public ActionResult GetComments() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 5)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); string userName = vld.Get("userName"); string product = vld.Get("product"); DateTime dtFrom = vld.GetDateTime("dtFrom"); DateTime dtTo = vld.GetDateTime("dtTo"); int page = vld.GetInt("page", defaultValue: 1); int pageSize = vld.GetInt("pageSize", defaultValue: 1); ProductBLL productBLL = new ProductBLL(); int total; var res = productBLL.GetComments(userName, product, dtFrom, dtTo, page, pageSize, out total); return(Json(new { success = true, data = res, total = total })); }
public ActionResult ModifyServiceMemo() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1103)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation validation = new Validation(); int orderId = validation.GetInt("orderId"); OrderBLL orderBLL = new OrderBLL(); OrderObj orderObj = orderBLL.GetOrderByID(orderId); if (orderObj == null) { return(Json(new { success = false, msg = "该订单不存在" })); } orderObj.ServiceMemo = validation.Get("serviceMemo"); orderBLL.ModifyServiceMemo(orderObj); return(Json(new { success = true })); }
public ActionResult SaveModel() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 4)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); int modelId = vld.GetInt("modelId"); string modelName = vld.Get("modelName", false); string content = vld.Get("content", false); content = HttpUtility.UrlDecode(content, Encoding.UTF8); if (vld.HasError) { return(Json(new { success = false, msg = "请查看是否有未填的项" })); } ProductBLL productBLL = new ProductBLL(); productBLL.SaveModel(modelId, modelName, content); return(Json(new { success = true })); }
public ActionResult AddProductCate() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 301)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation validation = new Validation(); ProductCateObj productCateObj = new ProductCateObj(); productCateObj.CategoryName = validation.Get("categoryName", false, "新闻分类名称不可为空!"); productCateObj.ParentID = validation.GetInt("categoryID"); productCateObj.Sort = validation.GetInt("sort"); if (validation.HasError) { return(Json(new { success = false, msg = "ValidationFailed", errors = validation.GetErrors() })); } ProductBLL productBLL = new ProductBLL(); productBLL.AddProductCate(productCateObj); return(Json(new { success = true })); }
public ActionResult DeleteUser() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1503)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); int userID = vld.GetInt("userID", emptyAble: false, emptyText: "请传入用户组编号!"); if (vld.HasError) { return(Json(new { success = false, msg = vld.GetError() })); } PrivilegeBLL privilegeBLL = new PrivilegeBLL(); privilegeBLL.DeleteUser(userID); return(Json(new { success = true })); }
public ActionResult GetOrders() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 11)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation validation = new Validation(); string receiver = validation.Get("receiver"); int orderId = validation.GetInt("orderId"); string orderCode = validation.Get("orderCode"); DateTime dtFrom = validation.GetDateTime("dtFrom"); DateTime dtTo = validation.GetDateTime("dtTo"); int payStatus = validation.GetInt("payStatus", defaultValue: -1); int status = validation.GetInt("status", defaultValue: -1); int isSurvey = validation.GetInt("isSurvey", defaultValue: -1); int page = validation.GetInt("page", defaultValue: 1); int pageSize = validation.GetInt("pageSize", defaultValue: 10); OrderBLL orderBLL = new OrderBLL(); int total; JsonArray result = orderBLL.GetOrders(0, orderId, orderCode, isSurvey, dtFrom, dtTo, payStatus, status, receiver, page, pageSize, out total); return(Json(new { success = true, total = total, data = result, express = new ExpressBLL().GetExpress() })); }
public ActionResult GetGroupByID() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 14)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); int groupID = vld.GetInt("groupID", emptyAble: false, emptyText: "请传入用户组编号!"); if (vld.HasError) { return(Json(new { success = false, msg = vld.GetError() })); } PrivilegeBLL privilegeBLL = new PrivilegeBLL(); var res = privilegeBLL.GetGroupByID(groupID); return(Json(new { success = true, data = res })); }
public ActionResult ResetPassword() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1302)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } UserBLL userBLL = new UserBLL(); Validation vld = new Validation(); int id = vld.GetInt("id"); var user = userBLL.GetUserByID(id); if (user == null) { return(Json(new { success = false, msg = "该用户不存在" })); } user.Password = Md5.MD5("123456"); userBLL.ModifyUser(user); return(Json(new { success = true })); }
public ActionResult DeleteUser() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1301)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } UserBLL userBLL = new UserBLL(); Validation vld = new Validation(); int id = vld.GetInt("id"); var user = userBLL.GetUserByID(id); if (user == null) { return(Json(new { success = false, msg = "该用户不存在" })); } userBLL.DeleteUser(id); return(Json(new { success = true })); }
public ActionResult GetPM() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 21)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); dynamic result; PM pm = new PM(); int pmID = vld.GetInt("pmID"); if (pmID != 0) { result = pm.GetPM(pmID); return(Json(new { success = true, data = result })); } else { int page = vld.GetInt("page"); int pageSize = vld.GetInt("pageSize"); string userName = vld.Get("userName"); DateTime dtFrom = vld.GetDateTime("dtFrom"); DateTime dtTo = vld.GetDateTime("dtTo"); int total; result = pm.GetPM(page, pageSize, out total, userName: userName, dtFrom: dtFrom, dtTo: dtTo); return(Json(new { success = true, data = result, total = total })); } }
public ActionResult AddNewsCate() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 101)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation validation = new Validation(); NewsCateObj newsCateObj = new NewsCateObj(); newsCateObj.CategoryName = validation.Get("categoryName", false, "新闻分类名称不可为空!"); newsCateObj.ParentID = validation.GetInt("categoryID"); if (validation.HasError) { return(Json(new { success = false, msg = "ValidationFailed", errors = validation.GetErrors() })); } newsCateObj.Sort = DateTime.Now; NewsBLL newsBLL = new NewsBLL(); if (newsBLL.IsNewsCateExists(newsCateObj.ParentID, newsCateObj.CategoryName)) { return(Json(new { success = false, msg = "该类别已存在!" })); } newsBLL.AddNewsCate(newsCateObj); return(Json(new { success = true })); }
public ActionResult ModifyNewsCate() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 102)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation validation = new Validation(); int categoryID = validation.GetInt("categoryID"); NewsBLL newsBLL = new NewsBLL(); NewsCateObj newsCateObj = newsBLL.GetNewsCateByCateID(categoryID); if (newsCateObj != null) { newsCateObj.CategoryName = validation.Get("categoryName", false, "新闻分类名称不可为空!"); if (validation.HasError) { return(Json(new { success = false, msg = "ValidationFailed", errors = validation.GetErrors() })); } newsBLL.ModifyNewsCate(newsCateObj); return(Json(new { success = true })); } else { return(Json(new { success = false, msg = "该类别不存在!" })); } }
public ActionResult DeleteDetail() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1101)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation validation = new Validation(); int orderId = validation.GetInt("orderId"); int detailId = validation.GetInt("detailId"); OrderBLL orderBLL = new OrderBLL(); OrderObj orderObj = orderBLL.GetOrderByID(orderId); if (orderObj == null) { return(Json(new { success = false, msg = "该订单不存在" })); } if (orderObj.Status == 2) { return(Json(new { success = false, msg = "已取消的订单不可修改" })); } orderBLL.DeleteDetail(orderId, detailId); return(Json(new { success = true })); }
public ActionResult DeleteNewsCate() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 103)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation validation = new Validation(); int categoryID = validation.GetInt("categoryID"); if (validation.HasError || categoryID == 0) { return(Json(new { success = false, msg = "参数错误!" })); } NewsBLL newsBLL = new NewsBLL(); bool hasChild = newsBLL.IsNewsCateHasChildren(categoryID); //if (hasChild) // return Json(new { success = false, msg = "该类别包含子类或新闻,无法删除!" }); newsBLL.DeleteNewsCate(categoryID); return(Json(new { success = true })); }
public ActionResult DeleteBuilding() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 803)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); int buildingID = vld.GetInt("id", false, "未传入楼盘ID"); PackageBLL packageBLL = new PackageBLL(); PackageBuildingObj packageBuildingObj = packageBLL.GetBuildingByID(buildingID); if (packageBuildingObj == null) { return(Json(new { success = false, msg = "该楼盘不存在!" })); } if (vld.HasError) { return(Json(new { success = false, msg = vld.GetError() })); } packageBLL.DeleteBuilding(buildingID); return(Json(new { success = true })); }
public ActionResult ModifyPackageCate() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 702)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation validation = new Validation(); int categoryID = validation.GetInt("categoryID"); PackageBLL packageBLL = new PackageBLL(); PackageCateObj packageCateObj = packageBLL.GetPackageCate(categoryID); if (packageCateObj != null) { packageCateObj.CategoryName = validation.Get("categoryName", false, "分类名称不可为空!"); packageCateObj.Sort = validation.GetInt("sort"); if (validation.HasError) { return(Json(new { success = false, msg = validation.GetError() })); } packageBLL.ModifyPackageCate(packageCateObj); return(Json(new { success = true })); } else { return(Json(new { success = false, msg = "该类别不存在!" })); } }
public ActionResult SetSetting() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1801)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); string key = vld.Get("key", false); string val = vld.Get("value", false); if (vld.HasError) { return(Json(new { success = false, msg = "参数错误!" })); } SettingBLL settingBLL = new SettingBLL(); settingBLL.Set(key, val); return(Json(new { success = true })); }
public ActionResult GetUsers() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 15)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); int groupID = vld.GetInt("groupID"); string userName = vld.Get("userName"); int page = vld.GetInt("page"); int pageSize = vld.GetInt("pageSize"); if (vld.HasError) { return(Json(new { success = false, msg = vld.GetError() })); } PrivilegeBLL privilegeBLL = new PrivilegeBLL(); int total; var res = privilegeBLL.GetUsers(userName, groupID, page, pageSize, out total); return(Json(new { success = true, data = res, total = total })); }
public ActionResult OrderModify(int id) { if (!AppData.IsManagerLogin) { return(Redirect("/Manage/Error/1.html")); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1101)) { return(Redirect("/Manage/Error/2.html")); } OrderBLL orderBLL = new OrderBLL(); OrderObj orderObj = orderBLL.GetOrderByID(id); if (orderObj.Status == 2) { return(Content("已取消的订单不可修改!")); } ViewBag.orderInfo = orderObj; if (orderObj.PayStatus == 0) { return(View("OrderModify")); } else { return(View("PayedOrderModify")); } }
public ActionResult GetReturnExchangeList() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 13)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation validation = new Validation(); int page = validation.GetInt("page", defaultValue: 1); int pageSize = validation.GetInt("pageSize", defaultValue: 10); string orderCode = validation.Get("orderCode"); string userName = validation.Get("userName"); DateTime dtFrom = validation.GetDateTime("dtFrom"); DateTime dtTo = validation.GetDateTime("dtTo"); DateTime?addTimeFrom = dtFrom == DateTime.MinValue ? null : (DateTime?)dtFrom; DateTime?addTimeTo = dtFrom == DateTime.MinValue ? null : (DateTime?)dtTo; ExchangeBLL exchangeBLL = new ExchangeBLL(); int total; var data = exchangeBLL.GetExchange(page, pageSize, out total, orderCode: orderCode, userName: userName, addTimeFrom: addTimeFrom, addTimeTo: addTimeTo); return(Json(new { success = true, data = data, total = total })); }
public ActionResult GetUsers() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 13)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); string keywords = vld.Get("keywords"); DateTime regDateFrom = vld.GetDateTime("regDateFrom"); DateTime regDateTo = vld.GetDateTime("regDateTo"); int page = vld.GetInt("page", defaultValue: 1); int pageSize = vld.GetInt("pageSize", defaultValue: 15); UserBLL userBLL = new UserBLL(); int total; JsonArray result = userBLL.GetUsers(UserRoles.Customer, keywords, regDateFrom, regDateTo, page, pageSize, out total); return(Json(new { success = true, data = result })); }
public ActionResult DeletePackage() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 903)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); int packageID = vld.GetInt("id"); PackageBLL packageBLL = new PackageBLL(); PackageObj packageObj = packageBLL.GetPackageByID(packageID); if (packageObj == null) { return(Json(new { success = false, msg = "该套餐不存在" })); } packageBLL.DeletePackage(packageID); return(Json(new { success = true })); }
public ActionResult AddPhotoPoint() { if (!AppData.IsManagerLogin) { return(HandleResult(false, "您未登录后台或会话已过期")); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1001)) { return(HandleResult(false, "您没有执行该操作的权限")); } Validation vld = new Validation(); PhotoPointObj photoPointObj = new PhotoPointObj(); photoPointObj.PhotoID = vld.GetInt("photoID", false, "请传入照片编号"); photoPointObj.X = vld.GetInt("x", false, "请传入照片X坐标"); photoPointObj.Y = vld.GetInt("y", false, "请传入照片Y坐标"); photoPointObj.Name = vld.Get("name", false, "请填写照片名称"); photoPointObj.Cap = vld.Get("cab"); HttpPostedFileBase pic = Request.Files.Count == 0 ? null : Request.Files[0]; if (pic == null || pic.ContentLength == 0) { return(HandleResult(false, "请选择一张照片")); } if (vld.HasError) { return(HandleResult(false, vld.GetError())); } string ext = Path.GetExtension(pic.FileName); if (!Regex.IsMatch(ext, @"^\.(gif|jpg|jpeg|png)$", RegexOptions.IgnoreCase)) { return(HandleResult(false, "上传的图片格式不合要求,请上传gif,png,jpg格式的图片")); } string path = DateTime.Now.ToString("yyyyMMdd"); string dirPath = Config.MediaPath + @"\Package\" + path; if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } string newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff") + ext; string savePath = Path.Combine(dirPath, newFileName); pic.SaveAs(savePath); photoPointObj.Pic = "/Package/" + path + "/" + newFileName; PhotoBLL photoBLL = new PhotoBLL(); photoBLL.AddPhotoPoint(photoPointObj); return(HandleResult(true, photoPointObj.PhotoID.ToString())); }
public ActionResult AddPackageDetail() { if (Request.HttpMethod == "POST") { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 904)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); PackageProdCatesObj packageProdCatesObj = new PackageProdCatesObj(); packageProdCatesObj.PackageID = vld.GetInt("packageID"); packageProdCatesObj.PpcName = vld.Get("name", false, "请填写产品组名称"); string sProducts = vld.Get("products", false, "请至少添加一个产品", regex: @"^\d+(,\d+)*$", regexText: "类别参数错误"); if (vld.HasError) { return(Json(new { success = false, msg = vld.GetError() })); } IList <int> products; if (string.IsNullOrEmpty(sProducts)) { products = null; } else { string[] aCategoryIDs = sProducts.Split(','); products = new List <int>(); for (int i = 0; i < aCategoryIDs.Length; i++) { products.Add(int.Parse(aCategoryIDs[i])); } } packageProdCatesObj.PackageProducts = products; PackageBLL packageBLL = new PackageBLL(); packageBLL.AddPackageProdCate(packageProdCatesObj); return(Json(new { success = true })); } else { if (!AppData.IsManagerLogin) { return(Redirect("/Manage/Error/1.html")); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 904)) { return(Redirect("/Manage/Error/2.html")); } return(View()); } }
public ActionResult ModifyOrder() { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1101)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation validation = new Validation(); int orderId = validation.GetInt("orderId"); OrderBLL orderBLL = new OrderBLL(); OrderObj orderObj = orderBLL.GetOrderByID(orderId); if (orderObj == null) { return(Json(new { success = false, msg = "该订单不存在" })); } if (orderObj.Status == 2) { return(Json(new { success = false, msg = "已取消的订单不可修改" })); } if (orderObj.PayStatus == 0) { orderObj.Address = validation.Get("address", false, "详细地址不可为空"); orderObj.Receiver = validation.Get("receiver", false, "收货人不可为空"); orderObj.Zip = validation.Get("zip"); orderObj.CityID = validation.GetInt("cityId", false, "收货人不可为空"); orderObj.RegionID = validation.GetInt("regionId"); orderObj.Phone = validation.Get("phone"); orderObj.Mobile = validation.Get("mobile"); orderObj.Freight = validation.GetDecimal("freight"); string data = validation.Get("data", false, "", @"^\d+\|\d+(\.\d+){0,1}(,\d+\|\d+(\.\d+){0,1})*$"); if (validation.HasError) { return(Json(new { success = false, msg = "请查看您的填写是否完整,或输入的信息是否有误!", errors = validation.GetErrors() })); } IDictionary <int, decimal> perf = new Dictionary <int, decimal>(); string[] arrData = data.Split(','); string[] nameValue; for (int i = 0; i < arrData.Length; i++) { nameValue = arrData[i].Split('|'); perf.Add(int.Parse(nameValue[0]), decimal.Parse(nameValue[1])); } orderBLL.ModifyOrder(orderObj, perf); } return(Json(new { success = true })); }
public ActionResult SaveAddress(int id) { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1304)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } UserBLL userBLL = new UserBLL(); Validation validation = new Validation(); int addressId = validation.GetInt("addressId"); AddressObj addressObj; if (addressId == 0) { addressObj = new AddressObj(); addressObj.AddressID = addressId; addressObj.UserID = id; } else { addressObj = userBLL.GetAddress(addressId); } addressObj.Receiver = validation.Get("receiver", false, "收货人姓名不可为空!"); addressObj.Address = validation.Get("address", false, "详细地址不可为空!"); addressObj.Zip = validation.Get("zip"); addressObj.Mobile = validation.Get("mobile"); addressObj.Phone = validation.Get("phone"); addressObj.CityID = validation.GetInt("cityId"); addressObj.RegionID = validation.GetInt("regionId"); if (validation.HasError) { return(Json(new { success = false, msg = "参数错误!", errors = validation.GetErrors() })); } if (string.IsNullOrEmpty(addressObj.Phone) && string.IsNullOrEmpty(addressObj.Mobile)) { return(Json(new { success = false, msg = "手机或固话必填一项!" })); } if (addressObj.AddressID == 0) { userBLL.AddAddress(addressObj); } else { userBLL.ModifyAddress(addressObj); } return(Json(new { success = true })); }
public ActionResult ModifyExpress() { if (Request.HttpMethod != "POST") { if (!AppData.IsManagerLogin) { return(Redirect("/Manage/Error/1.html")); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1202)) { return(Redirect("/Manage/Error/2.html")); } Validation vld = new Validation(false); int id = vld.GetInt("id"); ExpressBLL expressBLL = new ExpressBLL(); ExpressObj expressObj = expressBLL.GetExpress(id); ViewBag.id = id; ViewBag.name = expressObj.ExpressName; ViewBag.url = expressObj.ExpressUrl; return(View()); } else { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1202)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } ExpressBLL expressBLL = new ExpressBLL(); Validation vld = new Validation(); int id = vld.GetInt("id"); ExpressObj expressObj = expressBLL.GetExpress(id); expressObj.ExpressName = vld.Get("name", false); expressObj.ExpressUrl = vld.Get("url"); if (vld.HasError) { return(Json(new { success = false, msg = "必须填写快递名称" })); } expressBLL.ModifyExpress(expressObj); return(Json(new { success = true })); } }
public ActionResult SetPrivilege() { if (Request.HttpMethod == "POST") { if (!AppData.IsManagerLogin) { return(Json(new { success = false, msg = "您未登录后台或会话已过期" })); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1404)) { return(Json(new { success = false, msg = "您没有执行该操作的权限" })); } Validation vld = new Validation(); int groupID = vld.GetInt("groupID", emptyAble: false, emptyText: "请传入用户组编号!"); string sPrivileges = vld.Get("privileges", regex: @"^\d+(,\s*\d+)*$", regexText: "传入的权限参数错误"); if (vld.HasError) { return(Json(new { success = false, msg = vld.GetError() })); } IList <int> privilegeIds = new List <int>(); if (!string.IsNullOrEmpty(sPrivileges)) { string[] aPrivileges = sPrivileges.Split(','); for (int i = 0; i < aPrivileges.Length; i++) { string id = aPrivileges[i].Trim(); if (!string.IsNullOrEmpty(id)) { privilegeIds.Add(int.Parse(id)); } } } PrivilegeBLL privilegeBLL = new PrivilegeBLL(); privilegeBLL.SetPrivileges(groupID, privilegeIds); return(Json(new { success = true })); } else { if (!AppData.IsManagerLogin) { return(Redirect("/Manage/Error/1.html")); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 1404)) { return(Redirect("/Manage/Error/2.html")); } return(View()); } }