Exemplo n.º 1
0
        public List <DtoOwnCashVoucher> GetOwnCashVoucher(PagingObject paging, int studentId, StudentCashVoucherStatusEnum status)
        {
            CashVoucherBll cashVoucherBll = new CashVoucherBll();

            if (status == StudentCashVoucherStatusEnum.未使用)
            {
                //检查是否有过期的现金券
                cashVoucherBll.StudentCashVoucherRepository.UpdateExpiredStatusByStudentId(studentId);
            }
            return(cashVoucherBll.StudentCashVoucherRepository.GetPagingOwnCashVoucher(paging, studentId, (int)status));
        }
Exemplo n.º 2
0
        private Dictionary <string, decimal> GetVoucherDicForUserCourse(List <DtoSimpleCourse> simpleCourses, DtoCourseSelectCondition condition)
        {
            CashVoucherBll voucherBll = new CashVoucherBll();
            List <DtoVoucherForUserCourse> vouchers   = voucherBll.GetBestVoucherForUserCourse(simpleCourses, condition.StudentId, condition.SchoolId);
            Dictionary <string, decimal>   voucherDic = new Dictionary <string, decimal>();

            foreach (DtoVoucherForUserCourse voucher in vouchers)
            {
                voucherDic[voucher.CourseId + "_" + voucher.VoucherType] = voucher.Amount;
            }

            return(voucherDic);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="register"></param>
        public int Register(DtoStudentRegister register)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    int studentId = AddStudent(register.Name, register.Grade, register.Phone, register.Source, register.OperatorId);

                    AddStudentPassport(studentId, register.PassportType, register.Phone, register.Password);

                    int studentLoginId = AddStudentLogin(studentId);

                    AddSumStudent(studentLoginId);

                    //查询学生可领取的注册券
                    CashVoucherBll cashVoucherBll     = new CashVoucherBll();
                    var            studentCashVoucher = cashVoucherBll.GetAvailableRegisterVoucher(studentId);
                    //领取注册券
                    foreach (var item in studentCashVoucher)
                    {
                        var studentCashVoucher1 = cashVoucherBll.TakeStudentCashVoucher(studentId, item.Ycv_Id, VoucherGotTypeEnum.注册领取, 0);
                    }
                    if (studentCashVoucher != null && studentCashVoucher.Count > 0)
                    {
                        WebHelper.WriteCookie("CashVoucher", "CashVoucher");
                    }

                    scope.Complete();

                    return(studentId);
                }
                catch (Exception ex)
                {
                    RollbackTran();
                    throw ex;
                }
            }
        }