示例#1
0
        public ActionResult RechargeCash()
        {
            int cardid = NullHelper.Convert<int>(Request["id"],0);
            if(cardid>0)
            {
                IClubCardMgm cardMgm = new ClubCardMgm();
                var card = cardMgm.GetClubCardByID(cardid);
                IClubCardTypeMgm ctypeMgm = new ClubCardTypeMgm();
                var ctype = ctypeMgm.GetCardTypeByID(card.ClubCardTypeID);
                ViewData["name"] = card.CustName;
                ViewData["cno"] = card.ClubCardNo;
                ViewData["ctype"] = card.ClubCardTypeName;
                ViewData["discount"] = ctype.PayDiscount;
            }
            else
            {
                ViewData["name"] = "";
                ViewData["cno"] = "";
                ViewData["ctype"] = "";
                ViewData["discount"] = "";
            }

            //recharge.
            return View();
        }
示例#2
0
        public JsonResult EditeClubCardTypeModel()
        {
            IClubCardTypeMgm ctmgm = new ClubCardTypeMgm();

            int ctid = NullHelper.Convert<int>(Request["id"],0);
            string ctypename = NullHelper.Convert<string>(Request["ctype"], null);
            decimal cdis = NullHelper.Convert<decimal>(Request["cdiscount"], 0M);
            decimal pdis = NullHelper.Convert<decimal>(Request["pkgdiscount"], 0M);
            var cardtype = new ClubCardTypeMgm().GetCardTypeByID(ctid);
            if (cardtype == null)
                cardtype = new ClubCardTypeVO();
            cardtype.CardTypeName = ctypename;
            cardtype.PackageDiscount = pdis;
            cardtype.PayDiscount = cdis;
            var data = GetValidata(cardtype);
            if(data.Success)
            {
                if(ctid>0)
                {
                    try
                    {
                        cardtype.LastModifiedDate = DateTime.Now;
                        cardtype.LastModifierID = Emp.UserName;
                        data.Success = ctmgm.EditCardType(cardtype);
                        if(data.Success)
                        {
                            data.Message = "会员卡类型更新成功";
                        }
                        else
                        {
                            data.Message = "会员卡类型更新失败";
                        }

                    }
                    catch (Exception ex)
                    {
                        data.Success = false;
                        data.Message = "会员卡类型更新失败";
                        data.Error = ex.ToString();
                    }
                }
                else
                {
                    data.Success = false;
                    data.Message = "当前会员卡类型不能修改";
                }

            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }
示例#3
0
 public JsonResult DeleteClubCardTypeModel(int id)
 {
     IClubCardTypeMgm ctmgm = new ClubCardTypeMgm();
     ReturnedData data = new ReturnedData();
     try
     {
         ctmgm.DelCardType(id);
         data.Success = true;
         data.Message = "删除成功";
     }
     catch(Exception ex)
     {
         data.Success = false;
         data.Message = "删除失败,该会员卡类型有会员卡存在";
     }
     return Json(data,JsonRequestBehavior.AllowGet);
 }
示例#4
0
文件: UnitTest1.cs 项目: WISD/WisdCar
        public void TestMethod1()
        {
            //VO to PO
            Mapper.CreateMap<ClubCardTypeVO, ClubCardTypePO>();
            ClubCardTypeMgm clubMgm = new ClubCardTypeMgm();
            ClubCardTypeVO clubCardTypeVO = new ClubCardTypeVO();
            clubCardTypeVO.CardTypeName = "Gold";
            clubCardTypeVO.ClubCardTypeID = 1;
            clubCardTypeVO.CreatedDate = DateTime.Now;
            clubCardTypeVO.CreatorID = "001";
            clubCardTypeVO.LastModifiedDate = DateTime.Now;
            clubCardTypeVO.LastModifierID = "002";
            clubCardTypeVO.LogicalStatus = 1;
            clubCardTypeVO.Operation = "add";
            clubCardTypeVO.PackageDiscount = 0.5M;
            clubCardTypeVO.PayDiscount = 0.5M;

            clubMgm.AddCardType(clubCardTypeVO);
        }
示例#5
0
        public JsonResult AddClubCardTypeModel()
        {
            IClubCardTypeMgm ctmgm = new ClubCardTypeMgm();

            string ctypename = NullHelper.Convert<string>(Request["ctype"], null);
            decimal cdis = NullHelper.Convert<decimal>(Request["cdiscount"], 0M);
            decimal pdis = NullHelper.Convert<decimal>(Request["pkgdiscount"], 0M);

            ClubCardTypeVO cardtype = new ClubCardTypeVO()
            {
                CardTypeName=ctypename,
                PackageDiscount=pdis,
                PayDiscount=cdis,
                CreatedDate=DateTime.Now,
                CreatorID=Emp.UserName,
                LastModifierID=Emp.UserName,
                LastModifiedDate=DateTime.Now
            };
            var data = GetValidata(cardtype);
            if (data.Success)
            {
                try
                {
                    ctmgm.AddCardType(cardtype);
                    data.Success = true;
                    data.Message = "会员卡类型添加成功";
                }
                catch (Exception ex)
                {
                    data.Success = false;
                    data.Message = "会员卡类型添加失败";
                    data.Error = ex.ToString();
                }
            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }
示例#6
0
        private List<SelectListItem> GetClubCardType(List<SelectListItem>ddllist,params object[]where)
        {
            IClubCardTypeMgm ctmgm = new ClubCardTypeMgm();
            List<ClubCardTypeVO> list = ctmgm.GetAllCardType();
            if (list.Count>0)
            {

                list.ForEach(ct =>
                {
                    if (ddllist.Count == 0)
                    {
                        ddllist.Add(new SelectListItem() { Text = ct.CardTypeName, Value = ct.ClubCardTypeID.ToString(), Selected = true });
                    }
                    else
                    {
                        ddllist.Add(new SelectListItem() { Text = ct.CardTypeName, Value = ct.ClubCardTypeID.ToString() });
                    }
                });
            }
            return ddllist;
        }
示例#7
0
 public JsonResult GetClubCardTypeModel(int id)
 {
     IClubCardTypeMgm ctmgm = new ClubCardTypeMgm();
     ReturnedData data = new ReturnedData();
     try
     {
         var ctype = ctmgm.GetCardTypeByID(id);
         if(ctype!=null)
         {
             data.Success = true;
             data.Data = ctype;
         }
         else
         {
             data.Success = false;
             data.Message = "当前没有该会员类型记录";
         }
     }
     catch (Exception ex)
     {
         data.Success = false;
         data.Message = "网络异常";
     }
     return Json(data, JsonRequestBehavior.AllowGet);
 }
示例#8
0
        /// <summary>
        /// 获取所有的会员卡类型
        /// </summary>
        /// <returns></returns>
        public JsonResult GetAllClubCardType()
        {
            List<ClubCardTypeVO> result = new List<ClubCardTypeVO>();

            try
            {
                //BizMocker mocker = new BizMocker();
                //result = mocker.GetAllCardType();
                IClubCardTypeMgm ctypMgm = new ClubCardTypeMgm();
                result = ctypMgm.GetAllCardType();
                foreach (var item in result)
                {
                    item.DT_RowId = item.ClubCardTypeID.ToString();
                    item.Operation = "<a href='javascript:void(0)' onclick='ClubCardType.Edit("
                        + item.DT_RowId + ")'><i class='fa fa-pencil'></i> 编辑</a>  | <a href='javascript:void(0)' onclick='ClubCardType.Del("
                        + item.DT_RowId + ")'><i class='fa fa-times'></i> 删除</a>";
                    item.PayDiscountDesc = ConvertDiscount(item.PayDiscount);
                    item.PackageDiscountDesc = ConvertDiscount(item.PackageDiscount);
                }
            }
            catch (Exception ex)
            {
                LogHandler.Error(ex.Message.ToString());
            }

            return Json(result, JsonRequestBehavior.AllowGet);
        }
示例#9
0
        public JsonResult GetCludCardList()
        {
            DatatablesResult<ClubCardVO> result = new DatatablesResult<ClubCardVO>();
            try{
                int start = NullHelper.Convert<int>(Request[Constants.PAGE_START], 0);
                int length = NullHelper.Convert<int>(Request[Constants.PAGE_LENGTH], 10);
                int draw = NullHelper.Convert<int>(Request[Constants.REQ_DRAW], 1);
                string sortOrder = NullHelper.Convert<string>(Request[Constants.SORT_ORDER], "asc");
                int sortIdx = NullHelper.Convert<int>(Request[Constants.SORT_IDX], 0);
                string columnKey = string.Format(Constants.SORT_NAME, sortIdx);
                string sortName = NullHelper.Convert<string>(Request[columnKey], "ClubcardNO");

                string cardno = NullHelper.Convert<string>(Request["ClubcardNO"], "");
                int cardtype = NullHelper.Convert<int>(Request["ClubcardType"], -1);
                string custName = NullHelper.Convert<string>(Request["CustomerName"], "");
                string mobileNo = NullHelper.Convert<string>(Request["MobileNo"], "");
                int cardstatus = NullHelper.Convert<int>(Request["CardStatus"], -1);
                string storename = NullHelper.Convert<string>(Request["SaleCardStore"], "");

                if(sortName=="MobileNo"||sortName=="CardStatusDesc")
                {
                    sortName="ClubcardNO";
                }

                ClubCardTypeMgm clucardbMgm = new ClubCardTypeMgm();
                ClubCardTypeVO clubcardtype = clucardbMgm.GetCardTypeByID(cardtype);
                IClubCardMgm clubcardMgm = new ClubCardMgm();

                ClubCardQueryEntity filter = new ClubCardQueryEntity()
                {
                    Start = start, Length = length, SortOrder= sortOrder,SortName=sortName, ClubCardNo = cardno,
                    ClubCardTypeID = cardtype,ClubCardTypeName ="", MobileNo=mobileNo, Name=custName,
                    StoreName = storename,CardStatus = cardstatus
                };

                var list = clubcardMgm.GetClubCards(filter);

                int recordsTotal = clubcardMgm.GetClubCardRecordCount(filter);
                list.ForEach(i => i.MobileNo = new CustomerMgm().GetCustomerByID(i.CustomerID).MobileNO);
                foreach (var item in list)
                {
                    item.DT_RowId = item.ClubCardID.ToString();

                    switch(item.CardStatus)
                    {
                        case (int)ClubCardStatus.OpenCard: item.CardStatusDesc = "已开卡";
                            break;
                        case (int)ClubCardStatus.Froze: item.CardStatusDesc = "已冻结";
                            break;
                        case (int)ClubCardStatus.ReportLoss: item.CardStatusDesc = "已挂失";
                            break;
                        case (int)ClubCardStatus.LogOff: item.CardStatusDesc = "已注销";
                            break;
                        case (int)ClubCardStatus.Expire: item.CardStatusDesc = "已过期";
                            break;
                    }
                    item.Operation = " <div class='btn-group'><button onclick='ClubCard.Operation("
                        + item.DT_RowId + ")' class='btn blue dropdown-toggle' type='button' data-toggle='dropdown'>操作 <i class='fa fa-angle-down'></i></button> <ul class='dropdown-menu pull-right' role='menu'><li><a href='" + @Url.Action("ClubCardDetails", "ClubCard") + "?type=card&id=" + item.DT_RowId + "'>查看</a></li><li><a href='#'>套餐余额</a></li><li><a href='" + @Url.Action("ResetPassword", "ClubCard") + "?id=" + item.DT_RowId + "'>修改密码</a></li><li class='divider'></li><li><a href='" + @Url.Action("SetCardStatus", "ClubCard") + "?id=" + item.DT_RowId + "'>挂失/冻结</a></li>{0}<li><a href='" + @Url.Action("Index", "Recharge") + "?id=" + item.DT_RowId + "'>会员充值</a></li> <li><a href=''>会员消费</a></li><li><a href=''>已完结套餐查询</a></li></ul></div>";
                    string strChangeno = "<li><a href='javascript:;' onclick='alert(\"该会员卡不处于挂失状态,不能补办会员卡\")' >补办会员卡</a></li>";
                    if (item.CardStatus == 1)
                    {

                        strChangeno = "<li><a href='" + @Url.Action("ChangeCardNo", "ClubCard") + "?id=" + item.DT_RowId + "'>补办会员卡</a></li>";
                    }
                    item.Operation = string.Format(item.Operation, strChangeno);
                }

                result.draw = draw;
                result.recordsTotal = recordsTotal;
                result.recordsFiltered = recordsTotal;
                result.data = list;
             }
            catch (Exception ex)
            {
                result.data = new List<ClubCardVO>();
                LogHandler.Error(ex.Message.ToString());
                result.error = ex.ToString();
            }

            return Json(result, JsonRequestBehavior.AllowGet);
        }