public void LoadGrade() { listGrade = GradeService.GetAll(); var Lg = from b in listGrade where b.GradeId != 0 select b; GradeBindingSource.DataSource = Lg.ToList(); listGradeByColumn = Lg.ToList(); }
/// <summary> /// 创建年级 /// </summary> /// <param name="name"></param> /// <returns></returns> public static async Task CreateGrade(string name) { using (var gradeSvc = new GradeService()) { var maxOrder = await gradeSvc.GetAll().MaxAsync(m => m.Order); await gradeSvc.CreateAsync(new Grade() { Name = name }); } }
public void GetAll_ShouldCallRepository() { var repository = new Mock <IGradeRepository>(); repository.Setup(x => x.GetAll()) .Returns(new List <Grade>()) .Verifiable(); var service = new GradeService(repository.Object); var result = service.GetAll(); Assert.IsNotNull(result); repository.Verify(x => x.GetAll(), Times.Once); }
private void FrmGrainInvList_Load(object sender, EventArgs e) { firstLoad = true; var giService = new GrainInventoryService(); dgvInventory.DataSource = GrainInventoryService.GetAllGrainInventory(); using (var db = new WTCCeresEntities()) { { var withBlock = cboCustomer; var categories = new List <int>(); categories.Add((int)MdlEnum.CompanyCategory.CUSTOMER); categories.Add((int)MdlEnum.CompanyCategory.CUSTOMER_VENDOR); withBlock.DataSource = CompanyService.GetByCompanyCategoryId(categories, db); withBlock.DisplayMember = "CompanyName"; withBlock.ValueMember = "CompanyId"; } var exclusionList = new List <string>(); exclusionList.Add("RELEASED"); { var withBlock1 = cboUnitNumber; var newUs = new VW_UnitSourceMiniUnit(); newUs.MiniunitNumber = ""; newUs.MiniUnitId = 0; var uslist = MiniUnitService.GetAll(exclusionList, db); uslist.Insert(0, newUs); withBlock1.DataSource = uslist; withBlock1.DisplayMember = "MiniUnitNumber"; withBlock1.ValueMember = "MiniUnitId"; withBlock1.SelectedIndex = -1; } { var withBlock2 = cboCommodity; withBlock2.DataSource = CommodityService.GetAll(db); withBlock2.DisplayMember = "CommodityCode"; withBlock2.ValueMember = "CommodityId"; } { var withBlock3 = cboGrade; withBlock3.DataSource = GradeService.GetAll(db); withBlock3.DisplayMember = "GradeCode"; withBlock3.ValueMember = "GradeId"; } } firstLoad = false; }
/// <summary> /// 所有年级 /// </summary> /// <returns></returns> public static IEnumerable <SelectListItem> getAllGrades() { var grades = new List <SelectListItem> (); var service = new GradeService(); var g = service.GetAll().GetEnumerator(); while (g.MoveNext()) { var sli = new SelectListItem(); sli.Text = g.Current.Name; sli.Value = g.Current.MyId.ToString(); //if (select != null && select.Id == g.Current.Id) // sli.Selected = true; grades.Add(sli); } return(grades); }
/// <summary> /// 年级下移 /// </summary> /// <param name="gradeid"></param> /// <returns></returns> public static async Task GradeDown(Guid gradeid) { using (var gradeSvc = new GradeService()) { var grade = await gradeSvc.GetOne(gradeid); var beforeGrade = await gradeSvc.GetAll (m => m.Order > grade.Order).FirstOrDefaultAsync(); if (beforeGrade == null) { return; } await gradeSvc.ChangeOrder(gradeid, beforeGrade.Order, false); await gradeSvc.ChangeOrder(beforeGrade.Id, grade.Order); } }
/// <summary> /// 升学 /// </summary> /// <param name="clsId"></param> /// <returns></returns> public static async Task LeveUpClass(Guid clsId) { using (var clsSvc = new ClassService()) { var cls = await clsSvc.GetOne(clsId); using (var gradeSvc = new GradeService()) { var grade = await gradeSvc.GetAll(m => m.Order > cls.Grade.Order).FirstOrDefaultAsync(); if (grade == null) { //如果没有年级了,升学 await Gtaduation(clsId); return; } Guid gradeid = grade.Id; await clsSvc.ChangeGrade(clsId, gradeid); } } }
public ActionResult GetGrades() { return(Json(MethodResult <List <GradeTdm> > .Successful(gradeService.GetAll()))); }
private void populateComboBoxes() { firstLoad = true; tbUnits.Text = ""; UnitList.Clear(); dgv.Rows.Clear(); lblPasteUnits.Show(); lblFormat.Show(); using (var db = new WTCCeresEntities()) { { var withBlock = cboCustomer; var categories = new List <int>(); categories.Add((int)MdlEnum.CompanyCategory.CUSTOMER); categories.Add((int)MdlEnum.CompanyCategory.CUSTOMER_VENDOR); withBlock.DataSource = CompanyService.GetByCompanyCategoryId(categories, db); withBlock.DisplayMember = "CompanyName"; withBlock.ValueMember = "CompanyId"; } { var withBlock1 = cboCargoType; withBlock1.DataSource = CargoTypeService.GetAll(db); withBlock1.DisplayMember = "CargoTypeName"; withBlock1.ValueMember = "CargoTypeId"; } // With cboStatus // .DataSource = UnitStatusService.GetAll() // .DisplayMember = "StatusName" // .ValueMember = "UnitStatusId" // End With { var withBlock2 = cboCommodity; withBlock2.DataSource = CommodityService.GetAll(db); withBlock2.DisplayMember = "CommodityName"; withBlock2.ValueMember = "CommodityId"; } { var withBlock3 = cboGrade; withBlock3.DataSource = GradeService.GetAll(db); withBlock3.DisplayMember = "GradeName"; withBlock3.ValueMember = "GradeId"; } { var withBlock4 = cboType; withBlock4.Items.Clear(); withBlock4.Items.Add(""); withBlock4.Items.Add("BOX"); withBlock4.Items.Add("HOPPER"); withBlock4.Items.Add("IMDL"); withBlock4.SelectedItem = ""; } { var withBlock5 = cboWeightUnit; withBlock5.Items.Clear(); withBlock5.Items.Add("KG"); withBlock5.Items.Add("LB"); withBlock5.Items.Add("MT"); withBlock5.SelectedItem = "MT"; } } AllUnits = UnitSourceService.GetByActiveStatus(Conversions.ToBoolean(1)); firstLoad = false; }