/// <summary> /// 编辑体验券 /// </summary> /// <param name="loginId">登录标识</param> /// <param name="ex">体验券</param> /// <returns>ResultDesc</returns> public ErrType EditExperience(string loginId, ExperienceInformation ex) { try { Experience exp = new Experience(); exp.Id = ex.Id; exp.Name = ex.Name; exp.Type = ex.Type; exp.Annount = ex.Annount; exp.Rceharge = ex.Rceharge; exp.Num = ex.Num; exp.StartDate = ex.StartDate; exp.EndDate = ex.EndDate; exp.CreatID = ex.CreatID; exp.Effective = ex.Effective == 0 ? 1 : 0; exp.EffectiveTime = ex.EffectiveTime; ResultDesc desc = ManagerService.EditExperience(loginId, exp); if (desc.Result) return GeneralErr.Success; else return GeneralErr.Error; } catch (Exception e) { return GeneralErr.Error; } }
/// <summary> /// 编辑体验券 /// </summary> /// <param name="ex">体验券</param> /// <returns>ResultDesc</returns> public void EditExperience(ExperienceInformation ex) { ExperienceWindow win = new ExperienceWindow() { Owner = Application.Current.MainWindow, CurExperienceInformation = ex, StartDate=ex.StartDate, EndDate=ex.EndDate, EffectiveTime=ex.EffectiveTime }; if (win.ShowDialog() == true) { if (win.CurExperienceInformation != null) { if (win.CurExperienceInformation.Name == "开户送券") win.CurExperienceInformation.Type = 1; else win.CurExperienceInformation.Type = 2; } win.CurExperienceInformation.StartDate = win.StartDate; win.CurExperienceInformation.EndDate = new DateTime(win.EndDate.Year, win.EndDate.Month, win.EndDate.Day, 23, 59, 59); win.CurExperienceInformation.EffectiveTime = new DateTime(win.EffectiveTime.Year, win.EffectiveTime.Month, win.EffectiveTime.Day, 23, 59, 59); ErrType err = _businessService.EditExperience(_loginID, win.CurExperienceInformation); if (err.Err != ERR.SUCCESS) MessageBox.Show("保存体验券失败!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Error); else MessageBox.Show("保存体验券成功!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Information); } }
/// <summary> /// 获取体验券信息 /// </summary> /// <param name="loginId">登录标识</param> /// <param name="type">类型</param> /// <param name="isEffciive">是否启用</param> /// <param name="endTime">到期时间</param> /// <param name="list">ObservableCollection<ExperienceInformation></param> /// <returns>ErrType</returns> public ErrType GetExperienceInfo(string loginId, int type, int isEffciive, DateTime? endTime, ref ObservableCollection<ExperienceInformation> list) { try { if (list == null) { list = new ObservableCollection<ExperienceInformation>(); } list.Clear(); ExperienceInfo rst = ManagerService.GetExperienceInfo(loginId, type, isEffciive, endTime); if (rst.Result == false) return GeneralErr.Error; foreach (Experience ex in rst.ExperienceList) { ExperienceInformation exp = new ExperienceInformation(); exp.Id = ex.Id; exp.Name = ex.Name; exp.Type = ex.Type; exp.Annount = ex.Annount; exp.Rceharge = ex.Rceharge; exp.Num = ex.Num; exp.StartDate = ex.StartDate; exp.EndDate = ex.EndDate; exp.CreatID = ex.CreatID; exp.Effective = ex.Effective == 0 ? 1 : 0; exp.EffectiveTime = ex.EffectiveTime; list.Add(exp); } return GeneralErr.Success; } catch (TimeoutException te) { FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message); return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException); } catch (Exception ex) { FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, ex.Message); return new ErrType(ERR.EXEPTION, ErrorText.QueryError); } }