public void LoadWeightVersionData(string classVersionId, int pageIndex, int pageSize, string searchValue = null, PagingModel <WeightVersionModel> pagingModel = null) { pagingModel = pagingModel ?? _weightService.GetAllWeightByClassId(classVersionId, pageIndex, pageSize, searchValue); WeightVersions = pagingModel; BindingData(pagingModel.Data); _weightVersionTotal = pagingModel.Total; _weightVersionNumberPage = (int)Math.Ceiling(new decimal(_weightVersionTotal / pageSize)); var temp = _weightVersionTotal % pageSize; if (temp > 0) { _weightVersionNumberPage++; } WeightNumber.Text = _weightVersionTotal.ToString(); WeightVersionPageNumber.Text = _weightVersionNumberPage > 0 ? $@"{ pageIndex} / {_weightVersionNumberPage}" : @"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(); }