private async void CheckControl_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { ConsultantCheckModel selectCheckMoney = gvMoney.SelectedItem as ConsultantCheckModel; IAsyncProxy <IConsultantService> consultantServiceProxy = await Task.Run(() => ServiceHelper.GetConsultantService()); bool res = await consultantServiceProxy.CallAsync(t => t.CheckMonthMoney(this.consultantId, selectCheckMoney.month, selectCheckMoney.money, GlobalObjects.currentLoginUser)); if (res == true) { await DialogManager.ShowMessageAsync(this, UIResources.MsgInfo, "会籍顾问" + this.ConsultantName + "的" + selectCheckMoney.month + "月费用结算成功!", MessageDialogStyle.Affirmative, null); } await this.GetMoney(); }
public IList <ConsultantCheckModel> GetCheckMonthMoney(int id) { IList <ConsultantCheckModel> consultantCheckModelList = new List <ConsultantCheckModel>(); try { //根据助教id获取所有未结算上课记录,并计算所有课时需要结算金额总和 Repository <class_record_detail> recordDal = _unitOfWork.GetRepository <class_record_detail>(); IEnumerable <class_record_detail> records = recordDal.Find(r => r.consultants_id == id && r.is_checked == false && r.attendance_status == 1006).Entities.OrderBy(cr => cr.class_record.class_schedule.real_date); string month = ""; foreach (class_record_detail cr in records) { if (!month.Equals(cr.class_record.class_schedule.real_date.ToString("yyyyMM"))) { //当前处理月份为新月份,需要增加对象 ConsultantCheckModel ccm = new ConsultantCheckModel(); ccm.month = cr.class_record.class_schedule.real_date.ToString("yyyyMM"); ccm.id = id; ccm.studentNum = 0; consultantCheckModelList.Add(ccm); month = ccm.month; } consultantCheckModelList.Last().money += (cr.class_record.actual_amount.Value / cr.class_record.student_number) * cr.consultant_check_rate.Value; consultantCheckModelList.Last().studentNum += 1; } return(consultantCheckModelList); } catch (RepositoryException rex) { string msg = rex.Message; string reason = rex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } catch (Exception ex) { string msg = ex.Message; string reason = ex.StackTrace; throw new FaultException <LCFault> (new LCFault(msg), reason); } }