protected void Page_PreRender(object sender, EventArgs e) { AppSupplier supplier = AppSupplier.FetchByID(SupplierId); if (supplier != null) { Master.PageTitleHtml = string.Format(CommentsStrings.GetText(@"CommentsSupplierPageTitle"), supplier.BusinessName); } else { Master.PageTitle = CommentsStrings.GetText(@"CommentsPageTitle"); } Master.ActiveMenu = "Comments"; Master.AddClientScriptInclude(@"dgDateManager.js"); }
protected void LoadItems() { if (!HasEditPermission) { dgComments.Columns[dgComments.Columns.Count - 1].Visible = false; } List <Int64> SuppliersIdList = new List <Int64>(); if (SupplierId > 0) { SuppliersIdList.Add(SupplierId); } else if (FillSupplierList().Count > 0) { SuppliersIdList = FillSupplierList(); } List <int> StatusIdList = new List <int>(); if (FillStatusList().Count > 0) { StatusIdList = FillStatusList(); } dgComments.VirtualItemCount = CommentsController.GetAllCommentsUI(SuppliersIdList, StatusIdList).Count; if (dgComments.VirtualItemCount == 0) { phHasItems.Visible = false; phHasNoItems.Visible = true; lblNoItems.Text = CommentsStrings.GetText(@"MessageNoCommentsFound"); } else { phHasItems.Visible = true; phHasNoItems.Visible = false; if (dgComments.PageSize * dgComments.CurrentPageIndex > dgComments.VirtualItemCount) { dgComments.CurrentPageIndex = 0; hfCurrentPageIndex_dgComments.Value = dgComments.CurrentPageIndex.ToString(); } List <CommentUI> items = CommentsController.GetAllCommentsUI(SuppliersIdList, StatusIdList, dgComments.PageSize, dgComments.CurrentPageIndex); BindList(items); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (SupplierId > 0) { lblSearchBusiness.Visible = ddlSuppliers.Visible = false; } else { lblSearchBusiness.Visible = ddlSuppliers.Visible = true; //fill suppliers dropDown if (ddlSuppliers.Items.Count == 0) { List <AppSupplier> suppliers = SupplierController.GetAllSuppliers(); foreach (var item in suppliers) { ddlSuppliers.Items.Add(new ListItem(item.BusinessName, item.SupplierId.ToString())); } } } //fill status dropDown string[] names = Enum.GetNames(typeof(CommentStatus)); Array values = Enum.GetValues(typeof(CommentStatus)); for (int i = 0; i < names.Length; i++) { ddlStatus.Items.Add(new ListItem(CommentsStrings.GetText(names[i]), ((int)values.GetValue(i)).ToString())); } } int CurrentPageIndex = 0; if (!int.TryParse(hfCurrentPageIndex_dgComments.Value, out CurrentPageIndex)) { CurrentPageIndex = 0; } if (CurrentPageIndex < 0) { CurrentPageIndex = 0; } dgComments.CurrentPageIndex = CurrentPageIndex; LoadItems(); }