Beispiel #1
0
        /// <summary>
        /// 客户修改提交
        /// </summary>
        /// <param name="customerandcar"></param>
        /// <returns></returns>
        public JsonResult CustomerEdiSub(CustomerAndCar customerandcar)
        {
            ICustomerMgm customerMgm = new CustomerMgm();

            CustomerVO customer = new CustomerVO()
            {
                CustomerID = customerandcar.Customerid,
                Name = customerandcar.Name,
                Sex = customerandcar.Sex,
                ICNo = customerandcar.ICNo,
                Birthday = customerandcar.Birthday,
                LastModifiedDate = DateTime.Now,
                CreatorID = Emp.UserName,
                LastModifierID = Emp.UserName,
                MobileNO = customerandcar.MobileNo
            };

            CarVO car = new CarVO()
            {
                CarID = customerandcar.Carid,
                CustomerID = customerandcar.Customerid,
                CarNo = customerandcar.Carno,
                Brand = customerandcar.Brand,
                CarModel = customerandcar.Carmodel,
                Capacity = customerandcar.Capacity,
                Color = customerandcar.Color,
                FrameNo = customerandcar.FrameNo,
                EngineNo = customerandcar.EngineNo,
                MaintainKM = customerandcar.Maintainkm,
                InsureDate = customerandcar.Insuredate,
                ASDate = customerandcar.Asdate,
                LastModifiedDate = DateTime.Now,
                CreatorID = Emp.UserName,
                LastModifierID = Emp.UserName,
            };

            ReturnedData data = new ReturnedData();
            try
            {
                var result = customerMgm.EditCustomer(customer, car);
                if(result)
                {
                    data.Message = "客户修改成功";
                    data.Success = true;
                }
                else
                {
                    data.Success = false;
                    data.Message = "客户修改失败";
                }

            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "客户修改失败";
                data.Error = ex.ToString();

            }

            return Json(data, JsonRequestBehavior.AllowGet);
        }
Beispiel #2
0
        /// <summary>
        /// 添加会员卡
        /// </summary>
        /// <param name="clubcard"></param>
        /// <returns></returns>
        public ReturnedData CustomerCardAddSub(ClubCardVO clubcard)
        {
            IClubCardMgm clubCardMgm = new ClubCardMgm();
            clubcard.CreatedDate = DateTime.Now;
            clubcard.LastModifiedDate = DateTime.Now;
            clubcard.SalesTime = DateTime.Now;
            clubcard.ExpireDate = clubcard.SalesTime.AddYears(2);
            clubcard.CreatorID = Emp.UserName;
            clubcard.LastModifierID = Emp.UserName;
            clubcard.ClubCardTypeName = new ClubCardTypeMgm().GetCardTypeByID(clubcard.ClubCardTypeID).CardTypeName;

            clubcard.ClubCardPwd = "123456";
            //clubcard.OpenCardStore = Emp.StroeName;
            //clubcard.SalesMan = Emp.Name;//存疑
            ReturnedData data = new ReturnedData();
            try
            {
                clubCardMgm.AddClubCard(clubcard);
                ICustomerMgm cusMgm = new CustomerMgm();
                var cust = cusMgm.GetCustomerByID(clubcard.CustomerID);
                cust.CardFlag = 1;
                cusMgm.EditCustomer(cust);
                data.Message = "开卡成功";
                data.Success = true;
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "开卡失败";
                data.Error = ex.ToString();

            }

            return data;
        }