public void LoadClassVersionData(int pageIndex, int pageSize, string searchValue = null, PagingModel <ClassVersionModel> pagingModel = null) { pagingModel = pagingModel ?? _classVersionService.GetAllClassVersion(pageIndex, pageSize, searchValue); ClassVersions = pagingModel; BindingData(pagingModel.Data); _classVersionTotal = pagingModel.Total; _classVersionNumberPage = (int)Math.Ceiling(new decimal(_classVersionNumberPage / pageSize)); var temp = _classVersionTotal % pageSize; if (temp > 0) { _classVersionNumberPage++; } ClassVersionNumber.Text = _classVersionTotal.ToString(); ClassVersionPageNumber.Text = _classVersionNumberPage > 0 ? $@"{ pageIndex} / {_classVersionNumberPage}" : @"0 / 0"; }
private void WeightBtn_Click(object sender, EventArgs e) { var waitForm = new WaitFormFunc(); waitForm.Show(this); var classVersionData = _classVersionService.GetAllClassVersion(PagingConstant.PageIndex, PagingConstant.PageSize); var firstClass = classVersionData?.Data?.FirstOrDefault(); PagingModel <WeightVersionModel> weightVersion = null; if (firstClass != null) { weightVersion = _weightService.GetAllWeightByClassId(firstClass.Id, PagingConstant.PageIndex, PagingConstant.PageSize); } Version.Instance.ClassVersions = classVersionData; Version.Instance.WeightVersions = weightVersion; Version.Instance.LoadClassVersionData(PagingConstant.PageIndex, PagingConstant.PageSize, pagingModel: classVersionData); Version.Instance.LoadWeightVersionData(firstClass?.Id, PagingConstant.PageIndex, PagingConstant.PageSize, pagingModel: weightVersion); ShowContainer("Model Management", Version.Instance); waitForm.Close(); }