public Response SaveWaitPay(CoachStudentMoneyNotPay obj, User currentUser) { Response rsp = new Response(); //生成 待支付订单 var vipUse = new VipUse(); vipUse.Id = Ext.NewId(); vipUse.MasterType = MasterType.STUDENTPAY.Id; vipUse.MasterId = obj.Id; vipUse.CityId = obj.CityId; vipUse.VenueId = ""; vipUse.CostTypeId = CostType.COACHCOST.Id; vipUse.TotalAmount = obj.ThenMoney; vipUse.Discount = 1; vipUse.Amount = obj.ThenMoney * vipUse.Discount; vipUse.PayState = PayState.PAY.Id;//待支付 vipUse.IsOwnCreate = true; if (obj.CourseTypeId == CoachDic.BigCourse) { vipUse.Remark = "购买大课" + obj.Amount + "课时"; } else if (obj.CourseTypeId == CoachDic.PrivateCourse) { vipUse.Remark = "购买私教" + obj.Amount + "课时"; } vipUse.UserId = currentUser.Id; vipUse.CreatorId = currentUser.Id; vipUse.CreateDate = DateTime.Now; rsp.Tag = VipHelper.SaveVipUse(vipUse); rsp.IsSuccess = true; return(rsp); }
public string SaveFrequentStudent(CoachStudentMoneyNotPay moneyObj, string currentUserId) { //先查询此联系人是否存在 var objFrequentStudent = CoachHelper.Instance.GetFrequentStudent(currentUserId, moneyObj.StudentMobile, ""); string FrequentStudentId; if (objFrequentStudent == null) { //不存在才添加此常用学员 CoachFrequentStudent obj = new CoachFrequentStudent(); obj.Name = moneyObj.StudentName; obj.Mobile = moneyObj.StudentMobile; obj.CreatorId = currentUserId; List <EntityBase> entites = new List <EntityBase>(); entites.Add(obj); obj.RowState = RowState.Added; obj.TrySetNewEntity(); FrequentStudentId = obj.Id; var result = DbContext.GetInstance().Execute(CommandHelper.CreateSave(entites)); if (result.IsSuccess == false) { throw new Exception("保存常用学员失败"); } } else { FrequentStudentId = objFrequentStudent.Id; } return(FrequentStudentId); }