/// <summary> /// 输入积分控制下拉框value /// </summary> /// <returns></returns> public string getScore() { string data="";//返回页面的数据 bool into =false;//是否在一个等级里边 try { int score = int.Parse(RequestBase.GetString("score"));//得到页面输入的积分 if (score.ToString() != "")//如果页面输入的是正整数 { List<Model.VipRank> listvip = new BLL.VipRank().GetModelList(" r_Status=0");//得到所有会员等级信息 for (int i = 0; i < listvip.Count; i++) { if (listvip[i].r_Score<=score&&listvip[i].r_UpperScore>=score) //比较如果输入的会员积分在等级里边的一个区间 { data = listvip[i].r_Rank.ToString(); into = true; } } } else { data="error 请输入整数"; } if (into == true) { } else { data = "intofalse"; } } catch (Exception) { data="error"; } return data; }
public ActionResult Save(Model.MemberBase model) { bool result = false; #region 验证用户名是否存在 DataSet isds = new BLL.MemberBase().GetList(" m_UserName='******'"); if (isds.Tables[0].Rows.Count>0) { return Content(DWZUtil.GetResultJson("300", "保存失败,用户名已存在,请修改!!", "", "", "")); } #endregion #region 验证输入的积分是否在会员等级范围之内 DataSet ds = new BLL.VipRank().GetList(1, "r_Status!=2 and r_Status!=1", " r_UpperScore desc"); DataTable dt = ds.Tables[0]; List<Model.VipRank> listviprankall = new BLL.VipRank().DataTableToList(dt);//得到最大等级积分 for (int i = 0; i < listviprankall.Count; i++) { if (model.m_Score > listviprankall[i].r_UpperScore || model.m_Score == null) { return Content(DWZUtil.GetResultJson("300", "保存失败,积分不在此会员等级范围内,请修改!!", "", "", "")); } else { if (model.m_Score != null && model.m_Score.ToString() != "" && Request.Form["addselviprank"] != null) { List<Model.VipRank> listviprank = new BLL.VipRank().GetModelList("r_Status!=2 and r_Status!=1 and r_Rank=" + Request.Form["addselviprank"]); for (int j = 0; j < listviprank.Count; j++) { model.m_Rank = listviprank[j].r_Rank; model.m_ZheK = listviprank[j].r_ZheK; } } else { return Content(DWZUtil.GetResultJson("300", "保存失败,积分为空或数据有误!!", "", "", "")); } } } #endregion try { bool istongguo = false;//积分是否在选中的会员等级范围内 List<Model.VipRank> viprank = new BLL.VipRank().GetModelList("r_Status!=2 and r_Status!=1 and r_Rank=" + Request.Form["addselviprank"]); for (int i = 0; i < viprank.Count; i++) { if (model.m_Score < viprank[i].r_Score || model.m_Score > viprank[i].r_UpperScore) { istongguo = false; } else { istongguo = true; } } if (istongguo) //为true时执行 { model.m_UserType = 1; model.m_Password = Utils.MD5(model.m_Password); result = memberbll.Add(model) > 0 ? true : false; } else { return Content(DWZUtil.GetResultJson("300", "保存失败,积分不在此会员等级范围内,请修改!!", "", "", "")); } if (result) { return Content(DWZUtil.GetResultJson("200", "操作成功!!", "w_会员管理", "", "closeCurrent")); } else { return Content(DWZUtil.GetResultJson("300", "保存失败!!", "", "", "")); } } catch { return Content(DWZUtil.GetResultJson("300", "保存失败!!", "", "", "")); } }
/// <summary> /// 编辑 /// </summary> /// <returns></returns> public ActionResult MemberBaseModify() { int mid = int.Parse(RequestBase.GetString("m_ID")); Model.MemberBase mb = memberbll.GetModel(mid); BLL.VipRank vipbll = new BLL.VipRank(); #region 根据积分得到等级 decimal discount = 1.0M; var vipRanks = vipbll.GetModelList(" r_Status = 0 and r_Score <= " + mb.m_Score); if (vipRanks != null && vipRanks.Any()) { var model= vipRanks.OrderByDescending(m => m.r_Score).FirstOrDefault(); if (model != null) { //discount = model.r_ZheK.Value; List<Model.VipRank> modelVipType = vipbll.GetModelList(" r_Status != 2 and r_Status!=1"); List<SelectListItem> selectType = new List<SelectListItem>(); //selectType = new List<SelectListItem> { new SelectListItem { Text = "请选择", Value = "0" } }; for (int i = 0; i < modelVipType.Count; i++) { selectType.Add(new SelectListItem { Value = modelVipType[i].r_Rank.ToString(), Text = modelVipType[i].r_Name + "---" + modelVipType[i].r_ZheK + "折扣" }); } ViewData["selviprank"] = new SelectList(selectType, "Value", "Text", model.r_Rank); } } #endregion return View(mb); }
/// <summary> /// 添加 /// </summary> /// <returns></returns> public ActionResult MemberBaseEdit() { BLL.VipRank vipbll = new BLL.VipRank(); List<Model.VipRank> modelVipType = vipbll.GetModelList(" r_Status != 2 and r_Status!=1"); List<SelectListItem> selectType = new List<SelectListItem>(); //selectType = new List<SelectListItem> { new SelectListItem { Text = "请选择", Value = "0" } }; for (int i = 0; i < modelVipType.Count; i++) { selectType.Add(new SelectListItem { Value = modelVipType[i].r_Rank.ToString(), Text = modelVipType[i].r_Name + "---" + modelVipType[i].r_ZheK + "折扣" }); } ViewData["addselviprank"] = new SelectList(selectType, "Value", "Text", "请选择"); return View(); }
//订单详情 public ActionResult VipOrderDetail() { int oid = 0; int mid = 0; if (LoginMember != null) { if (!string.IsNullOrEmpty(RequestBase.GetString("oid"))) { oid = int.Parse(RequestBase.GetString("oid")); } mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; //订单信息 ViewBag.orderinfo = obll.GetModel(oid); ViewData["status"] = ViewBag.orderinfo.o_StatusCode; Model.ConsigneeInfoBase conmodel = new Model.ConsigneeInfoBase(); int? cid = obll.GetModel(oid).c_ID; //收货人信息 ViewBag.coninfo = new BLL.ConsigneeInfoBase().GetModel(int.Parse(cid.ToString())); //订单商品明细 var orderskulist = vobll.GetModelList(" m_ID=" + mid + " and o_ID=os_oID and o_Code='" + obll.GetModel(oid).o_Code + "'"); if (orderskulist.Count > 0) { ViewBag.ordersku = orderskulist; string skulist = ""; string countlist = ""; decimal pricecount=0; foreach (var sku in ViewBag.ordersku) { skulist += sku.sku_ID + ","; countlist += sku.os_pCount + ","; pricecount += sku.sku_Price * sku.os_pCount; } skulist = skulist.Substring(0, skulist.Length - 1); countlist = countlist.Substring(0, countlist.Length - 1); ViewData["skulist"] = skulist; ViewData["countlist"] = countlist; ViewData["yuanjia"] = pricecount; } ////支付方式 ViewBag.payfor = new BLL.PaymentBase().GetModel(int.Parse(obll.GetModel(oid).pay_ID.ToString())); //配送方式 ViewBag.stname = new BLL.ShipTypeBase().GetModel(int.Parse(obll.GetModel(oid).st_ID.ToString())); //订单追踪 ViewBag.orderstatus = new BLL.OrderStatusBase().GetModelList(" o_ID=" + oid + " and os_IsDel=0"); //折扣 var member = new BLL.MemberBase().GetModel(mid); if (member != null) { var ranklist = new BLL.VipRank().GetModelList(member.m_Score + " between r_score and r_upperscore "); if (ranklist.Count > 0) { ViewData["zhek"] = ranklist[0].r_ZheK; } } ViewData["maxstatus"] = new BLL.OrderStatusBase().Getmaxstatus(" o_ID=" + oid + " and os_IsDel=0"); return View(); } else { Response.Redirect("/wapLogin/Login"); return View(); } }
public ActionResult OrderBaseStatus() { try { this.ViewData["hfOtype"] = RequestBase.GetString("otype"); string id = RequestBase.GetString("o_ID"); var model = _orderBase.GetModel(Convert.ToInt32(id)); var member = _memberBase.GetModel(model.m_ID.Value); bool ispay = false; bool isjianhuo = false; if (model.o_StatusCode ==1)//已付钱的才能捡货 { ispay = true; } if (model.o_StatusCode == 2)//捡过货,状态为已出库的才能发货 { isjianhuo = true; } using (var scope = new TransactionScope()) { switch (ViewData["hfOtype"].ToString()) { case "select"://捡货 if (model.o_StatusCode.Value >= Model.OrderStatus.商品出库.GetHashCode()) { return Content(DWZUtil.GetResultJson("300", "错误的操作", "", "", "")); } if (ispay) { model.o_StatusCode = Model.OrderStatus.商品出库.GetHashCode(); } else { return Content(DWZUtil.GetResultJson("300", "该订单未付款,不能捡货!!", "", "", "")); } break; case "send"://发货 if (model.o_StatusCode.Value >= Model.OrderStatus.等待收货.GetHashCode() ) { return Content(DWZUtil.GetResultJson("300", "错误的操作!!", "", "", "")); } if (isjianhuo) { model.o_StatusCode = Model.OrderStatus.等待收货.GetHashCode(); } else { return Content(DWZUtil.GetResultJson("300", "该订单未捡货,不能发货!!", "", "", "")); } break; case "complete"://完成 if (model.o_StatusCode.Value >= Model.OrderStatus.交易完成.GetHashCode()) { return Content(DWZUtil.GetResultJson("300", "错误的操作!!", "", "", "")); } // 会员添加积分 member.m_Score = member.m_Score + model.o_Score; var rank = new BLL.VipRank().GetModelList(member.m_Score + " between r_score and r_upperscore"); if (rank.Count > 0) { member.m_Rank = rank[0].r_Rank; member.m_ZheK = rank[0].r_ZheK; } model.o_StatusCode = Model.OrderStatus.交易完成.GetHashCode(); break; } if (_orderBase.Update(model)) { _memberBase.Update(member); scope.Complete(); return Content(DWZUtil.GetAjaxTodoJson("200", "操作成功!!", "", "forward", "", "OrderBox", "")); } } } catch { } return Content(DWZUtil.GetResultJson("300", "操作失败!!", "", "", "")); }