Пример #1
0
        public JsonResult AddConsumeItem()
        {
            string itemName = NullHelper.Convert<string>(Request["citemName"], "");
            decimal itemPrice = NullHelper.Convert<decimal>(Request["citemPrice"], 0M);

            ConsumeItemVO conItem = new ConsumeItemVO();
            conItem.ItemName = itemName;
            conItem.ItemPrice = itemPrice;
            conItem.LastModifiedDate = DateTime.Now;
            conItem.LastModifierID = Emp.UserName;
            conItem.CreatedDate = DateTime.Now;
            conItem.CreatorID = Emp.UserName;

            ReturnedData data = new ReturnedData();
            IConsumeItemMgm conMgm = new ConsumeItemMgm();
            try
            {
                conMgm.AddConsumeItem(conItem);
                data.Success = true;
                data.Message = "消费项目添加成功";
                LogHandler.Info("员工" + Emp.UserName + "添加一条消费项目,项目名:"+itemName );
            }
            catch(Exception ex)
            {
                data.Success = false;
                data.Message = "消费项目添加失败";
                LogHandler.Error("添加消费项目出现错误:" + (ex.Message.ToString()));
                data.Error = ex.ToString();
            }
            return Json(data,JsonRequestBehavior.AllowGet);
        }
Пример #2
0
 public JsonResult SubNocardConsume()
 {
     ReturnedData data = new ReturnedData();
     try
     {
         int payType = NullHelper.Convert<int>(Request["payType"], -1);
         int custID = NullHelper.Convert<int>(Request["custID"], -1);
         string consItem = NullHelper.Convert<string>(Request["data"], "");
         var comlist= JsonSerializer(consItem);
         var cust = new CustomerMgm().GetCustomerByID(custID);
         var conlist= GetConsumeList(comlist, cust, ConsumeType.NoCard,(PayType)payType);
         ConsumeMgm conMgm = new ConsumeMgm();
         string serNo = conMgm.ConsumeForNoCard(conlist);
         data.Success = true;
         data.Message = serNo + "|" + conlist.FirstOrDefault().CreatedDate.ToString("yyyy/MM/dd HH:mm:ss");
     }
     catch(Exception ex)
     {
         data.Success = false;
         data.Message = "出现错误,请联系维护人员";
         LogHandler.Error(ex.Message.ToString());
         data.Error = ex.ToString();
     }
     return Json(data,JsonRequestBehavior.AllowGet);
 }
Пример #3
0
        public JsonResult ChangeCardNoSub(int id, string CardNo)
        {
            IClubCardMgm cardMgm = new ClubCardMgm();

            ReturnedData data = new ReturnedData();
            try
            {
                ClubCardVO card = cardMgm.GetClubCardByID(id);
                if (card.CardStatus == 1)
                {
                    cardMgm.UpdateClubCardNo(id, CardNo);
                    data.Success = true;
                    data.Message = "会员卡补卡成功";
                }
                else
                {
                    data.Success = false;
                    data.Message = "该会员卡不处于挂失状态,不需要补卡";
                }

            }
            catch (Exception ex)
            {
                LogHandler.Error(ex.ToString());
                data.Success = false;
                data.Message = "会员卡补卡成功";
            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #4
0
        /// <summary>
        /// 添加客户提交
        /// </summary>
        /// <param name="cusandcar"></param>
        /// <returns></returns>
        public JsonResult AddCustomerSub(CustomerAndCar cusandcar)
        {
            ICustomerMgm customerMgm = new CustomerMgm();
            ICarMgm carMgm = new CarMgm();
            CustomerVO customer = new CustomerVO()
            {

                Name = cusandcar.Name,
                Sex = cusandcar.Sex,
                ICNo = cusandcar.ICNo,
                Birthday = cusandcar.Birthday,
                MobileNO = cusandcar.MobileNo,
                CreatorID = Emp.UserName,
                LastModifierID = Emp.UserName,
                CreatedDate = DateTime.Now,
                LastModifiedDate = DateTime.Now,
            };

            CarVO car = new CarVO()
            {

                CarNo = cusandcar.Carno,
                Brand = cusandcar.Brand,
                CarModel = cusandcar.Carmodel,
                Capacity = cusandcar.Capacity,
                Color = cusandcar.Color,
                FrameNo = cusandcar.FrameNo,
                EngineNo = cusandcar.EngineNo,
                MaintainKM = cusandcar.Maintainkm,
                InsureDate = cusandcar.Insuredate,
                ASDate = cusandcar.Asdate,
                CreatorID = Emp.UserName,
                LastModifierID = Emp.UserName,
                CreatedDate = DateTime.Now,
                LastModifiedDate = DateTime.Now,

            };

            ReturnedData data = new ReturnedData();
            try
            {
                car.CustomerID = customerMgm.AddAllCustomer(customer, car);
                //carMgm.AddCar(car);
                data.Message = "客户添加成功";
                data.Success = true;
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "客户添加失败";
                data.Error = ex.ToString();

            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #5
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);
 }
Пример #6
0
 public JsonResult DeletePackage(int id)
 {
     ReturnedData data = new ReturnedData();
     PackageMgm pkgMgm = new PackageMgm();
     try
     {
         pkgMgm.DelPackage(id);
         data.Success = true;
         data.Message = "套餐基本信息删除成功";
         LogHandler.Info("用户:" + Emp.UserName + "于 " + DateTime.Now.ToString() + " 删除套餐基本信息,项目id:" + id);
     }
     catch(Exception ex)
     {
         data.Success = false;
         data.Message = "套餐基础信息删除失败,请先删除该套餐下的消费项目后再尝试";
         data.Error = ex.ToString();
         LogHandler.Error("套餐基本信息删除错误:" + ex.Message.ToString());
     }
     return Json(data, JsonRequestBehavior.AllowGet);
 }
Пример #7
0
 public JsonResult DeleteConsumeItem(int id)
 {
     IConsumeItemMgm conMgm = new ConsumeItemMgm();
     ReturnedData data = new ReturnedData();
     try
     {
         conMgm.DelConsumeItem(id);
         data.Success = true;
         data.Message = "消费项目删除成功";
         LogHandler.Info("员工"+Emp.UserName+"删除一条消费项目,项目id:"+id);
     }
     catch(Exception ex)
     {
         data.Success = false;
         data.Message = "消费项目删除失败";
         LogHandler.Error("删除消费项目出现错误:" + (ex.Message.ToString()));
         data.Error = ex.ToString();
     }
     return Json(data,JsonRequestBehavior.AllowGet);
 }
Пример #8
0
 public JsonResult DeletePkgItem(int id,string pkgName,string itemName)
 {
     PkgItemsMgm pkgItMgm = new PkgItemsMgm();
     ReturnedData data = new ReturnedData();
     try
     {
         pkgItMgm.DelPkgItem(id);
         data.Success = true;
         data.Message = "套餐项目删除成功";
         LogHandler.Info("用户:" + Emp.UserName + "于 " + DateTime.Now.ToString() + " 为套餐:" + pkgName + " 删除消费项目:" + itemName);
     }
     catch(Exception ex)
     {
         data.Success = false;
         data.Message = "套餐项目删除失败";
         data.Error = ex.ToString();
         LogHandler.Error(ex.Message.ToString());
     }
     return Json(data, JsonRequestBehavior.AllowGet);
 }
Пример #9
0
        public JsonResult EditConsumeItem()
        {
            ReturnedData data = new ReturnedData();
            IConsumeItemMgm conMgm = new ConsumeItemMgm();
            try
            {
                int id = NullHelper.Convert<int>(Request["id"], 0);
                string itemName = NullHelper.Convert<string>(Request["citemName"], "");
                decimal itemPrice = NullHelper.Convert<decimal>(Request["citemPrice"], 0M);

                var result = conMgm.GetConsumeItemByID(id);
                if (result != null)
                {
                    result.ItemName = itemName;
                    result.ItemPrice = itemPrice;
                    result.LastModifierID = Emp.UserName;
                    result.LastModifiedDate = DateTime.Now;
                    conMgm.EditConsumeItem(result);
                    data.Success = true;
                    data.Message = "消费项目修改成功";
                    LogHandler.Info("员工" + Emp.UserName + "修改一条消费项目,项目id:" + id);
                }
                else
                {
                    data.Success = false;
                    data.Message = "该消费项目不存在";
                }

            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "消费项目修改失败";
                data.Error = ex.ToString();
                LogHandler.Error("修改消费项目出现错误:" + (ex.Message.ToString()));
                throw;
            }
            return Json(data,JsonRequestBehavior.AllowGet);
        }
Пример #10
0
        public JsonResult GetCustomerModel(string phoneNo)
        {
            ReturnedData data = new ReturnedData();
            CustomerMgm custMgm = new CustomerMgm();
            try
            {
                var cust = custMgm.GetCustomerByMobileNo(phoneNo);
                if(cust!=null&&cust.CustomerID>0)
                {
                    data.Success = true;
                    data.Data = cust;
                //    if(cust.CardFlag==(int)CardFlag.OpenCard)
                //    {

                //    }
                //    else
                //    {
                //        data.Success = false;
                //        data.Message = "该客户为会员,请使用会员消费功能";
                //    }
                }
                else
                {
                    data.Success = false;
                    data.Message = "没有相关客户信息";
                }
            }
            catch(Exception ex)
            {
                data.Success = true;
                data.Message = "出现错误,请联系维护人员";
                data.Error = ex.ToString();
                LogHandler.Error(ex.Message.ToString());
            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #11
0
        public JsonResult AddPkgItem()
        {
            ReturnedData data = new ReturnedData();

            try
            {
                int pkItemId = NullHelper.Convert<int>(Request["pkItemId"], 0);
                int pkgid = NullHelper.Convert<int>(Request["pkgId"], 0);
                int conNum = NullHelper.Convert<int>(Request["conNum"], 0);
                string pkgName = NullHelper.Convert<string>(Request["pkgName"], "");
                string itemName = NullHelper.Convert<string>(Request["itemName"], "");

                PkgItemsMgm pkgItMgm = new PkgItemsMgm();
                PkgItemVO pkgItem = new PkgItemVO();
                pkgItem.ItemID = pkItemId;
                pkgItem.PackageID = pkgid;
                pkgItem.ConsumeCount = conNum;
                pkgItem.CreatedDate = DateTime.Now;
                pkgItem.CreatorID = Emp.UserName;
                pkgItem.LastModifiedDate = DateTime.Now;
                pkgItem.LastModifierID = Emp.UserName;
                pkgItem.ItemName = itemName;

                pkgItMgm.AddPkgItem(pkgItem);
                data.Success = true;
                data.Message = "套餐消费项目添加成功";
                LogHandler.Info("用户:" + Emp.UserName + "于 " + DateTime.Now.ToString() + " 为套餐:"+pkgName+" 添加消费项目:"+itemName);
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "套餐消费项目添加失败";
                data.Error = ex.ToString();
                LogHandler.Error(ex.Message.ToString());
            }
            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #12
0
        public JsonResult GetRechargeLogList()
        {
            ReturnedData data = new ReturnedData();
            try
            {
                string custName = NullHelper.Convert<string>(Request["Name"], "");
                string cardNo = NullHelper.Convert<string>(Request["CardNo"], "");
                string reStroe = NullHelper.Convert<string>(Request["Dore"], "");
                string beginDate = NullHelper.Convert<string>(Request["from"], null);
                string endDate = NullHelper.Convert<string>(Request["to"], null);
                string creator = NullHelper.Convert<string>(Request["Operator"], "");

                RechargeMgm recMgm = new RechargeMgm();
                RechargeLogQueryEntity entity = new RechargeLogQueryEntity()
                {
                    CustName=custName,
                    Creator=creator,
                    ClubCardNO=cardNo,
                    StoreID=reStroe,
                    StartDate=string.IsNullOrEmpty(beginDate)?null:(DateTime?)Convert.ToDateTime(beginDate),
                    EndDate = string.IsNullOrEmpty(endDate)? null : (DateTime?)Convert.ToDateTime(endDate)
                };

                var list = recMgm.GetRechargeCashLog(entity);
                data.Success = true;
                data.Data = list;
            }
            catch(Exception ex)
            {
                data.Success = false;
                data.Message = "出现错误,请联系维护人员";
                LogHandler.Error(ex.Message.ToString());
                data.Error = ex.ToString();
            }
            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #13
0
        public JsonResult LoginSub(EmployeePO emp)
        {
            IEmployeeMgm empMgm = new EmployeeMgm();

            ReturnedData data = new ReturnedData();
            EmployeePO empdb = new EmployeePO();
            try
            {
                string spwd;
                var result = empMgm.Login(emp,out empdb);
                if(result==null)
                {
                    data.Success = true;
                    if(empdb!=null)
                    {
                        SetLoginUser(empdb);
                    }

                }
                else
                {
                    data.Success = false;

                }
                data.Message = result;

            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "出现错误,请联系维护人员";
                data.Error = ex.ToString();

            }
            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #14
0
        public JsonResult GetPkgItems()
        {
            ReturnedData data = new ReturnedData();
            try
            {
                int pkgId = NullHelper.Convert<int>(Request["id"], -1);
                PkgItemsMgm pkgMgm = new PkgItemsMgm();
                PackageMgm pkMgm = new PackageMgm();

                var pkg = pkMgm.GetPackageByID(pkgId);
                var pkgitem = pkgMgm.GetItemsByPkgID(pkgId);
                data.Success = true;
                data.Message = pkg.TotalPrice.ToString();
                data.Data = pkgitem;
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "系统错误,请联系维护人员";
                data.Error = ex.ToString();
                LogHandler.Error(ex.Message.ToString());
            }
            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #15
0
        public JsonResult ResetPwdsub(string oldpwd,string password)
        {
            IEmployeeMgm empMgm = new EmployeeMgm();

            ReturnedData data = new ReturnedData();
            try
            {
                var emp = Session["loginUser"] as EmployeeViewModel;
                bool boolresult;
                string spwd;
                var emppo = new EmployeePO()
                {
                    EmployeeID=emp.UserId,
                    EmployeeNo=emp.UserName,
                    Reserved1=emp.UserPassword,
                    StoreID=emp.StoreId,
                    Name=emp.Name
                };
                var result = empMgm.ChangePassword(emppo,oldpwd,password,out boolresult,out spwd);
                data.Success = boolresult;
                data.Message = result;
                if (boolresult)
                {
                    emppo.Reserved1 = spwd;
                    SetLoginUser(emppo);
                }
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "出现错误,请联系维护人员";
                data.Error = ex.ToString();

            }
            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #16
0
        public JsonResult SearchCustomerAndCard()
        {
            string mobileno = NullHelper.Convert<string>(Request["MobileNo"], "");
            string cardNo = NullHelper.Convert<string>(Request["CardNo"], "");
            ReturnedData data = new ReturnedData();
            if(!string.IsNullOrEmpty(mobileno)||!string.IsNullOrEmpty(cardNo))
            {
                ICustomerMgm custMgm = new CustomerMgm();
                IClubCardMgm cardMgm = new ClubCardMgm();
                //有缺陷
                if(!string.IsNullOrEmpty(mobileno))
                {
                    CustomerVO cust = custMgm.GetCustomerByMobileNo(mobileno);
                    if(cust!=null)
                    {
                        ClubCardVO card = cardMgm.GetClubCardByCustID(cust.CustomerID);
                        data.Data = GetCusAndCardModel(card, cust);
                        data.Success = true;
                    }
                    else
                    {
                        data.Success = false;
                        data.Message = "当前手机号无用户";
                    }

                }
                else if(!string.IsNullOrEmpty(cardNo))
                {
                    ClubCardVO card = cardMgm.GetClubCardByCardNo(cardNo);
                    if(card!=null)
                    {
                        CustomerVO cust = custMgm.GetCustomerByID(card.CustomerID);
                        data.Data = GetCusAndCardModel(card, cust);
                        data.Success = true;
                    }
                    else
                    {
                        data.Success = false;
                        data.Message = "当前会员卡号无用户";
                    }
                }
            }
            else
            {
                data.Success = false;
                data.Message = "请输入会员卡号或用户手机号码";
            }
            return Json(data,JsonRequestBehavior.AllowGet);
        }
Пример #17
0
        public JsonResult RechargePkgSub()
        {
            ReturnedData data = new ReturnedData();
            try
            {
                string cardNo = NullHelper.Convert<string>(Request["cardNo"], null);
                int pkgId = NullHelper.Convert<int>(Request["pkgId"], -1);
                decimal disCount = NullHelper.Convert<decimal>(Request["disCount"], 0M);
                decimal rechAmount = NullHelper.Convert<decimal>(Request["rechAmount"], 0M);
                decimal pkgPrice = NullHelper.Convert<decimal>(Request["pkgPrice"], 0M);
                IClubCardMgm cardMgm = new ClubCardMgm();
                RechargeMgm rechMgm = new RechargeMgm();

                var card = cardMgm.GetClubCardByCardNo(cardNo);
                RechargeVO recharge = new RechargeVO();
                recharge.ClubCardID = card.ClubCardID;
                recharge.ClubCardNo = card.ClubCardNo;
                recharge.ActualRechargeAmount = rechAmount;
                recharge.CustID = card.CustomerID;
                recharge.CustName = card.CustName;
                recharge.DiscountRate = disCount;
                recharge.Reserved1 = card.ClubCardTypeName;

                recharge.PlatformRechargeAmount = pkgPrice;
                recharge.RechargeDate = DateTime.Now;
                recharge.RechargeStore = Emp.StroeName;
                recharge.OriginalStore = card.OpenCardStore;
                recharge.PayType = (int)PayType.Cash;
                recharge.LastModifierID = Emp.UserName;
                recharge.LastModifiedDate = DateTime.Now;
                recharge.CreatedDate = DateTime.Now;
                recharge.CreatorID = Emp.UserName;
                recharge.DiscountInfo = "会员套餐折扣";
                recharge.ClubCardPackageID =pkgId.ToString();
                recharge.RechargeType = (int)RechargeType.ClubPackage;
                recharge.RechargeSerialNo = SerialNoGenerator.GenRechargeSerialNo(Emp.StoreId);
                recharge.SalesMan = card.SalesMan;

                var reMes= rechMgm.RechargePkg(recharge);
                if (reMes == 1)
                {
                    Session.Add("rehPkg", recharge);
                    data.Success = true;
                    data.Message = "套餐购买成功";
                }
                else
                {
                    data.Success = false;
                    data.Message = "套餐购买失败";
                }

            }
            catch(Exception ex)
            {
                data.Success = false;
                data.Message = "系统错误,请联系维护人员";
                data.Error = ex.ToString();
                LogHandler.Error(ex.Message.ToString());
            }
            return Json(data,JsonRequestBehavior.AllowGet);
        }
Пример #18
0
        public JsonResult ReceveFiles()
        {
            ReturnedData data = new ReturnedData();
            var cusMgm = new CustomerMgm();
            //excel.
            try
            {
                cusMgm.ImprotDataTosql(Request.Files["file"].InputStream, Emp.UserName);
                data.Success = true;
                data.Message = "客户数据导入成功";
            }
            catch(Exception ex)
            {
                data.Success = false;
                data.Message = ex.ToString();
            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #19
0
        /// <summary>
        /// 修改会员卡
        /// </summary>
        /// <param name="customer"></param>
        /// <returns></returns>
        private ReturnedData CustomerCardEdiSub(ClubCardVO clubcard)
        {
            IClubCardMgm cusmgm = new ClubCardMgm();
            ReturnedData data = new ReturnedData();
            try
            {
                clubcard.LastModifiedDate = DateTime.Now;
                clubcard.ClubCardTypeName = new ClubCardTypeMgm().GetCardTypeByID(clubcard.ClubCardTypeID).CardTypeName;
                clubcard.LastModifierID = Emp.UserName;
                cusmgm.Update(clubcard);
                data.Message = "会员信息修改成功";
                data.Success = true;
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "会员信息修改失败";
                data.Error = ex.ToString();

            }

            return data;
        }
Пример #20
0
 public JsonResult GetCardPkgItemDetail()
 {
     ReturnedData data = new ReturnedData();
     try
     {
         int id = NullHelper.Convert<int>(Request["itemId"], -1);
         ClubCardMgm cardMgm = new ClubCardMgm();
         var item = cardMgm.GetClubCardPkgDetailByID(id);
         if (item != null && item.ItemID > 0)
         {
             data.Success = true;
             data.Data = item;
         }
         else
         {
             data.Success = false;
             data.Message = "该消费项目不存在";
         }
     }
     catch(Exception ex)
     {
         data.Success = false;
         data.Message = "出现错误,请联系维护人员";
         data.Error = ex.ToString();
         LogHandler.Error(ex.Message.ToString());
     }
     return Json(data, JsonRequestBehavior.AllowGet);
 }
Пример #21
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);
 }
Пример #22
0
        public JsonResult CheckCardPassword()
        {
            ReturnedData data = new ReturnedData();
            try
            {
                string cardNo = NullHelper.Convert<string>(Request["cardNo"], "");
                string pwd = NullHelper.Convert<string>(Request["pwd"], "");

                ClubCardMgm cardMgm = new ClubCardMgm();
                var card = cardMgm.GetClubCardByCardNo(cardNo);
                int erroNum = 0;
                if (!string.IsNullOrEmpty(card.Reserved1))
                {
                    erroNum = NullHelper.Convert<int>(card.Reserved1, 0);
                }

                if (erroNum < 3 && card.CardStatus == (int)ClubCardStatus.OpenCard)
                {
                    var result = cardMgm.CheckPwd(card.ClubCardID, pwd);
                    if (!result)
                    {
                        card.Reserved1 = (erroNum + 1).ToString();
                        if (erroNum == 2)
                        {
                            card.CardStatus = (int)ClubCardStatus.Froze;
                            card.Reserved1 = "0";
                            data.Message = "密码输入错误三次,会员卡被冻结";
                        }
                        else
                        {
                            data.Message = "密码输入错误,还剩" + (2 - erroNum) + "次机会";
                        }
                        cardMgm.Update(card);
                        data.Success = false;

                    }
                    else
                    {
                        if (erroNum > 0)
                        {
                            card.Reserved1 = "0";
                            cardMgm.Update(card);
                        }
                        data.Success = true;
                        data.Message = "密码验证成功";

                    }
                }
                else
                {
                    data.Success = false;
                    data.Message = "当前会员卡不能正常使用,请联系管理员";
                }

            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "出现错误,请联系维护人员";
                LogHandler.Error(ex.Message.ToString());
                data.Error = ex.ToString();
            }
            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #23
0
 public JsonResult SumCardPkgConsumeItems()
 {
     ReturnedData data = new ReturnedData();
     try
     {
         string cardNo = NullHelper.Convert<string>(Request["cardNo"], "");
         string itemData = NullHelper.Convert<string>(Request["itemData"], "");
         if (!string.IsNullOrEmpty(itemData))
         {
             List<ConsumePkgViewModel> list = JsonSerializerPkg(itemData, ConsumeType.ClubPackage);
             ClubCardMgm cardMgm = new ClubCardMgm();
             var card = cardMgm.GetClubCardByCardNo(cardNo);
             var conlist = GetConsumeList(list, card, ConsumeType.ClubPackage);
             ConsumeMgm conMgm = new ConsumeMgm();
             var consSerNo = conMgm.ConsumePkg(conlist);
             data.Success = true;
             LogHandler.Info(Emp.UserName + "添加会员套餐消费,时间:" + DateTime.Now);
             data.Message = consSerNo + "|" + conlist.FirstOrDefault().CreatedDate.ToString("yyyy/MM/dd HH:mm:ss");
             data.Data = cardMgm.GetDetailByClubCardPkgID(list[0].PkgId);
         }
     }
     catch (Exception ex)
     {
         data.Success = false;
         data.Message = "出现错误,请联系维护人员";
         data.Error = ex.ToString();
         LogHandler.Error(ex.Message.ToString());
     }
     return Json(data, JsonRequestBehavior.AllowGet);
 }
Пример #24
0
        public JsonResult SumCardCarshConsumeItems()
        {
            ReturnedData data = new ReturnedData();
            try
            {
                string cardNo = NullHelper.Convert<string>(Request["cardNo"], "");
                string itemData = NullHelper.Convert<string>(Request["itemData"], "");
                //[{\"itemid\":\"12\",\"itemName\":\"喷漆\",\"itemSum\":\"1\",\"itemSubPrice\":\"150\"}]
                //JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                //List<ComsumeItemViewModel> list = (List<ComsumeItemViewModel>)jsonSerializer.Deserialize(itemData,typeof(ComsumeItemViewModel));

                if (!string.IsNullOrEmpty(itemData))
                {
                    List<ComsumeItemViewModel> list = JsonSerializer(itemData,ConsumeType.ClubCash);
                    ClubCardMgm cardMgm = new ClubCardMgm();
                    var card = cardMgm.GetClubCardByCardNo(cardNo);
                    var conlist = GetConsumeList(list, card, ConsumeType.ClubCash);
                    ConsumeMgm conMgm = new ConsumeMgm();
                    var consSerNo = conMgm.ConsumeCash(conlist);
                    data.Success = true;
                    LogHandler.Info(Emp.UserName + "添加会员现金消费,时间:" + DateTime.Now);
                    data.Message = consSerNo + "|" + conlist.FirstOrDefault().CreatedDate.ToString("yyyy/MM/dd HH:mm:ss");
                    data.Data = cardMgm.GetBalanceByClubCardID(card.ClubCardID);
                }

            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "会员现金消费过程出现异常,请联系维护人员";
                data.Error = ex.ToString();
                LogHandler.Error(ex.Message.ToString());
            }
            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #25
0
        /// <summary>
        /// 删除客户
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult DeleteCustomer(int id)
        {
            ICustomerMgm cusmgm = new CustomerMgm();
            ICarMgm carmgm = new CarMgm();
            ReturnedData data = new ReturnedData();
            try
            {
                cusmgm.DelCustomer(id);
                data.Message = "客户删除成功";
                data.Success = true;
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "客户删除失败";
                data.Error = ex.ToString();

            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #26
0
 /// <summary>
 /// 获取会员卡套餐消费项目
 /// </summary>
 /// <returns></returns>
 public JsonResult GetCardPkgItemList()
 {
     ReturnedData data = new ReturnedData();
     try
     {
         string cardPkgId = NullHelper.Convert<string>(Request["cardPkgId"],"-1");
         ClubCardMgm cardMgm = new ClubCardMgm();
         var result = cardMgm.GetDetailByClubCardPkgID(cardPkgId);
         List<SelectListItem> itemList = new List<SelectListItem>();
         result = result.SkipWhile(i => i.RemainCount == 0).ToList();
         if(result!=null&&result.Count>0)
         {
             result.ForEach(item => {
                 if (item.RemainCount > 0)
                 {
                     if (itemList.Count <= 0)
                         itemList.Add(new SelectListItem() { Text = item.ItemName, Value = item.PackageDetailID.ToString(), Selected = true });
                     else
                         itemList.Add(new SelectListItem() { Text = item.ItemName, Value = item.PackageDetailID.ToString() });
                 }
             });
         }
         else
         {
             itemList.Add(new SelectListItem() { Text = "套餐无可用项目", Value = "-1", Selected = true });
         }
         data.Success = true;
         data.Data = itemList;
     }
     catch(Exception ex)
     {
         LogHandler.Error(ex.Message.ToString());
         data.Success = false;
         data.Message = "出现错误,请联系维护人员";
         data.Error = ex.ToString();
     }
     return Json(data, JsonRequestBehavior.AllowGet);
 }
Пример #27
0
        public JsonResult RechargeCashSub()
        {
            ReturnedData data = new ReturnedData();

            try
            {
                string cardno = NullHelper.Convert<string>(Request["cno"], "");
                decimal rechargeAmount = NullHelper.Convert<decimal>(Request["rechargeAcc"], 0M);
                decimal rechargeDiscount = NullHelper.Convert<decimal>(Request["discount"], 0M);
                IClubCardMgm cardMgm = new ClubCardMgm();

                var card = cardMgm.GetClubCardByCardNo(cardno);
                RechargeVO recharge = new RechargeVO();
                recharge.ClubCardID = card.ClubCardID;
                recharge.ClubCardNo = card.ClubCardNo;
                recharge.ActualRechargeAmount = rechargeAmount;
                recharge.CustID = card.CustomerID;
                recharge.CustName = card.CustName;
                recharge.DiscountRate = rechargeDiscount;
                if (rechargeDiscount == 0)
                {
                    rechargeDiscount = 1;
                }
                recharge.PlatformRechargeAmount =Math.Round(rechargeAmount/ rechargeDiscount,2);
                recharge.RechargeDate = DateTime.Now;
                recharge.RechargeStore = Emp.StroeName;
                recharge.OriginalStore = card.OpenCardStore;
                recharge.PayType = (int)PayType.Cash;
                recharge.LastModifierID = Emp.UserName;
                recharge.LastModifiedDate = DateTime.Now;
                recharge.CreatedDate = DateTime.Now;
                recharge.CreatorID = Emp.UserName;
                recharge.DiscountInfo = "会员现金折扣";
                recharge.ClubCardPackageID = "";
                recharge.RechargeType = (int)RechargeType.ClubCash;
                recharge.RechargeSerialNo = SerialNoGenerator.GenRechargeSerialNo(Emp.StoreId);
                recharge.SalesMan = card.SalesMan;

                IRechargeMgm rechargeMgm = new RechargeMgm();
                rechargeMgm.RechargeCash(recharge);
                data.Success = true;
                Session.Add("recharge", recharge);
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Error = ex.ToString();
                data.Message = "充值失败";

            }

            return Json(data,JsonRequestBehavior.AllowGet);
        }
Пример #28
0
 public ReturnedData GetValidata(ClubCardTypeVO ctype)
 {
     ReturnedData data = new ReturnedData();
     if(string.IsNullOrEmpty(ctype.CardTypeName))
     {
         data.Success = false;
         data.Message = "请输入会员卡类型";
     }
     else if(ctype.PayDiscount<0||ctype.PayDiscount>=1)
     {
         data.Success = false;
         data.Message = "充值折扣输入错误";
     }
     else if(ctype.PackageDiscount<0||ctype.PackageDiscount>=1)
     {
         data.Success = false;
         data.Message = "套餐折扣输入错误";
     }
     else
     {
         data.Success = true;
     }
     return data;
 }
Пример #29
0
        /// <summary>
        /// 获取会员卡所有套餐
        /// </summary>
        /// <returns></returns>
        public JsonResult GetCardPkgList()
        {
            ReturnedData data = new ReturnedData();
            try
            {
                int cardId = NullHelper.Convert<int>(Request["cardId"], 0);

                var list = GetddlList(DDLlist.CardPkg,false, null, null, cardId);
                data.Success = true;
                data.Data = list;
            }
            catch (Exception ex)
            {
                LogHandler.Error(ex.Message.ToString());
                data.Success = false;
                data.Message = "出现错误,请联系维护人员";
                data.Error = ex.ToString();
            }
            return Json(data, JsonRequestBehavior.AllowGet);
        }
Пример #30
0
        /// <summary>
        /// 汽车修改提交
        /// </summary>
        /// <param name="car"></param>
        /// <returns></returns>
        public JsonResult CarEdiSub(CarVO car)
        {
            ICarMgm carMgm = new CarMgm();
            ReturnedData data = new ReturnedData();
            try
            {

                car.LastModifierID = Emp.UserName;

                car.LastModifiedDate = DateTime.Now;
                carMgm.EditCar(car);
                data.Message = "车辆信息修改成功";
                data.Success = true;
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "车辆信息修改失败";
                data.Error = ex.ToString();

            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }