protected void RepairCardsGridView_PageIndexChanging(Object sender, GridViewPageEventArgs e) { this.repairCardsGrid.PageIndex = e.NewPageIndex; object repairCardsFilterObject = Session[CarServiceConstants.REPAIR_CARDS_FILTER_SESSION_ATTR_NAME]; IQueryable <RepairCard> repairCards; if (repairCardsFilterObject != null) { RepairCardFilter filter = (RepairCardFilter)repairCardsFilterObject; repairCards = FilterRepairCards(filter); } else { repairCards = this.persister.GetRepairCards(); } object sortDirectionObj = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]; object sortExpressionObj = ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR]; if (sortDirectionObj != null && sortExpressionObj != null) { repairCards = SortingUtility.SortRepairCards(repairCards, sortExpressionObj.ToString(), (SortDirection)sortDirectionObj); } BindRepairCardsGrid(repairCards); CarServicePresentationUtility.ClearNotificationMsgList(this.notificationMsgList); CarServicePresentationUtility.HideNotificationMsgList(this.notificationMsgList); }
protected void SparePartsGridView_RowCreated(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { object sortExpressionObj = ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR]; object sortDirectionObj = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]; if (sortExpressionObj != null && sortDirectionObj != null) { SortingUtility.SetSortDirectionImage(this.sparePartsGrid, e.Row, sortExpressionObj.ToString(), ((SortDirection)sortDirectionObj)); } } else if (e.Row.RowType == DataControlRowType.DataRow) { object isApprovedObject = DataBinder.Eval(e.Row.DataItem, "IsActive"); if (isApprovedObject != null) { bool isApproved = (bool)isApprovedObject; if (isApproved == false) { e.Row.CssClass = CarServiceConstants.INACTIVE_CSS_CLASS_NAME; } } } }
protected void RepairCardsGridView_RowCreated(Object sender, GridViewRowEventArgs e) { DataControlRowType rowType = e.Row.RowType; if (rowType == DataControlRowType.Header) { object sortExpressionObj = ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR]; object sortDirectionObj = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]; if (sortExpressionObj != null && sortDirectionObj != null) { SortingUtility.SetSortDirectionImage(this.repairCardsGrid, e.Row, sortExpressionObj.ToString(), ((SortDirection)sortDirectionObj)); } } else if (rowType == DataControlRowType.DataRow) { object userIdObject = DataBinder.Eval(e.Row.DataItem, CarServiceConstants.USER_ID_SORT_EXPRESSION); if (userIdObject != null) { MembershipUser currentUser = Membership.GetUser(); string userId = userIdObject.ToString(); if (string.IsNullOrEmpty(userId) == false && userId.Equals(currentUser.ProviderUserKey.ToString())) { e.Row.CssClass = CarServiceConstants.ACTIVE_CSS_CLASS_NAME; } } } }
protected void RepairCardsGridView_Sorting(object sender, GridViewSortEventArgs e) { SortDirection newSortDirection = SortDirection.Descending; object currentSortDirectionObject = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]; if (currentSortDirectionObject != null) { SortDirection currentSortDirection = (SortDirection)currentSortDirectionObject; newSortDirection = (currentSortDirection.Equals(SortDirection.Ascending)) ? SortDirection.Descending : SortDirection.Ascending; } ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR] = newSortDirection; ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR] = e.SortExpression; object repairCardsFilterObj = Session[CarServiceConstants.REPAIR_CARDS_FILTER_SESSION_ATTR_NAME]; IQueryable <RepairCard> repairCards; if (repairCardsFilterObj != null) { RepairCardFilter filter = (RepairCardFilter)repairCardsFilterObj; repairCards = FilterRepairCards(filter); } else { repairCards = this.persister.GetRepairCards(); } IQueryable <RepairCard> sortedCards = SortingUtility.SortRepairCards(repairCards, e.SortExpression, newSortDirection); BindRepairCardsGrid(sortedCards); }
protected void SparePartsGridView_Sorting(object sender, GridViewSortEventArgs e) { SortDirection sortDirection = SortingUtility.GetSortDirection(ViewState); ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR] = sortDirection; ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR] = e.SortExpression; IQueryable <SparePart> spareParts = this.persister.GetSpareParts(); IQueryable <SparePart> sortedSpareParts = SortingUtility.SortSpareParts(spareParts, e.SortExpression, sortDirection); BindSparePartsGrid(sortedSpareParts); }
protected void CarsGridView_Sorting(object sender, GridViewSortEventArgs e) { SortDirection sortDirection = SortingUtility.GetSortDirection(ViewState); ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR] = sortDirection; ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR] = e.SortExpression; IQueryable <Automobile> automobiles = this.persister.GetAutomobiles(); IQueryable <Automobile> sortedAutomobiles = SortingUtility.SortAutomobiles(automobiles, e.SortExpression, sortDirection); BindAutomobilesGrid(sortedAutomobiles); }
protected void UsersGridView_Sorting(object sender, GridViewSortEventArgs e) { SortDirection sortDirection = SortingUtility.GetSortDirection(ViewState); ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR] = sortDirection; ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR] = e.SortExpression; List <CarServiceUser> users = GetUsers(); IEnumerable <CarServiceUser> sortedUsers = SortingUtility.SortUsers(users, e.SortExpression, sortDirection); BindUsersGrid(sortedUsers); }
protected void CarsGridView_RowCreated(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { object sortExpressionObj = ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR]; object sortDirectionObj = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]; if (sortExpressionObj != null && sortDirectionObj != null) { SortingUtility.SetSortDirectionImage(this.automobilesGrid, e.Row, sortExpressionObj.ToString(), ((SortDirection)sortDirectionObj)); } } }
private void BindRepairCardsGrid() { object sortDirectionObj = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]; object sortExpressionObj = ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR]; IQueryable <RepairCard> repairCards = this.persister.GetRepairCards(); if (sortDirectionObj != null && sortExpressionObj != null) { repairCards = SortingUtility.SortRepairCards(repairCards, sortExpressionObj.ToString(), (SortDirection)sortDirectionObj); } else { ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR] = SortDirection.Ascending; ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR] = CarServiceConstants.REPAIR_CARD_ID_SORT_EXPRESSION; } BindRepairCardsGrid(repairCards); }
private void BindSparePartsGrid() { object sortDirectionObj = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]; object sortExpressionObj = ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR]; IQueryable <SparePart> spareParts = this.persister.GetSpareParts(); IQueryable <SparePart> sortedSpareParts; if (sortDirectionObj != null && sortExpressionObj != null) { sortedSpareParts = SortingUtility.SortSpareParts(spareParts, sortExpressionObj.ToString(), (SortDirection)sortDirectionObj); } else { ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR] = SortDirection.Ascending; ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR] = CarServiceConstants.SPARE_PART_ID_SORT_EXPRESSION; sortedSpareParts = spareParts; } BindSparePartsGrid(sortedSpareParts); }
private void BindAutomobilesGrid() { object sortDirectionObj = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]; object sortExpressionObj = ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR]; IQueryable <Automobile> automobiles = this.persister.GetAutomobiles(); IQueryable <Automobile> sortedAutomobiles; if (sortDirectionObj != null && sortExpressionObj != null) { sortedAutomobiles = SortingUtility.SortAutomobiles(automobiles, sortExpressionObj.ToString(), (SortDirection)sortDirectionObj); } else { ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR] = SortDirection.Ascending; ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR] = CarServiceConstants.AUTOMOBILE_ID_SORT_EXPRESSION; sortedAutomobiles = automobiles; } BindAutomobilesGrid(sortedAutomobiles); }
private void BindUsersGrid() { object sortDirectionObj = ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR]; object sortExpressionObj = ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR]; List <CarServiceUser> users = GetUsers(); IEnumerable <CarServiceUser> sortedUsers; if (sortDirectionObj != null && sortExpressionObj != null) { sortedUsers = SortingUtility.SortUsers(users, sortExpressionObj.ToString(), (SortDirection)sortDirectionObj); } else { ViewState[CarServiceConstants.SORT_DIRECTION_VIEW_STATE_ATTR] = SortDirection.Ascending; ViewState[CarServiceConstants.SORT_EXPRESSION_VIEW_STATE_ATTR] = CarServiceConstants.USER_NAME_SORT_EXPRESSION; sortedUsers = SortingUtility.SortUsers(users, CarServiceConstants.USER_NAME_SORT_EXPRESSION, SortDirection.Ascending); } BindUsersGrid(sortedUsers); }