private void PopulateDataGrid() { // Hide Controls this.dvEmptyContent.Visible = false; this.dvDataContent.Visible = false; this.dvNoSearchResult.Visible = false; // Search text string searchText = this.txtSearch.Text.ToLower().Trim(); // Populate Resolution Profiles ResolutionProfileBO objResolutionProfile = new ResolutionProfileBO(); List <ResolutionProfileBO> lstResolutionProfile = new List <ResolutionProfileBO>(); if ((searchText != string.Empty) && (searchText != "search")) { lstResolutionProfile = (from o in objResolutionProfile.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList <ResolutionProfileBO>() where o.Name.ToLower().Contains(searchText) || (o.Description != null && o.Description.ToLower().Contains(searchText)) select o).ToList(); } else { lstResolutionProfile = objResolutionProfile.SearchObjects().AsQueryable().OrderBy(SortExpression).ToList <ResolutionProfileBO>(); } if (lstResolutionProfile.Count > 0) { this.RadGridResolutionProfile.AllowPaging = (lstResolutionProfile.Count > this.RadGridResolutionProfile.PageSize); this.RadGridResolutionProfile.DataSource = lstResolutionProfile; this.RadGridResolutionProfile.DataBind(); Session["ResolutionProfileDetails"] = lstResolutionProfile; this.dvDataContent.Visible = true; } else if ((searchText != string.Empty && searchText != "search")) { this.lblSerchKey.Text = searchText + ((searchText != string.Empty) ? " - " : string.Empty); this.dvDataContent.Visible = true; this.dvNoSearchResult.Visible = true; } else { this.dvEmptyContent.Visible = true; this.btnAddResolutionProfiles.Visible = false; } //this.lblSerchKey.Text = string.Empty; this.RadGridResolutionProfile.Visible = (lstResolutionProfile.Count > 0); }
/// <summary> /// Process the page data. /// </summary> private void ProcessForm(int queryId, bool isDelete) { try { using (TransactionScope ts = new TransactionScope()) { ResolutionProfileBO objResolutionProfile = new ResolutionProfileBO(this.ObjContext); if (queryId > 0) { objResolutionProfile.ID = queryId; objResolutionProfile.GetObject(); } if (isDelete) { objResolutionProfile.Delete(); } else { objResolutionProfile.Name = this.txtResolutionProfileName.Text; objResolutionProfile.Description = this.txtDescription.Text; if (queryId == 0) { objResolutionProfile.Add(); } } this.ObjContext.SaveChanges(); ts.Complete(); } } catch (Exception ex) { // Log the error //IndicoLogging.log("Error occured while Adding the Item", ex); } }
protected void RadGridResolutionProfile_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = e.Item as GridDataItem; if (item.ItemIndex > -1 && item.DataItem is ResolutionProfileBO) { ResolutionProfileBO objResolutionProfile = (ResolutionProfileBO)item.DataItem; HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit"); linkEdit.Attributes.Add("qid", objResolutionProfile.ID.ToString()); HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete"); linkDelete.Attributes.Add("qid", objResolutionProfile.ID.ToString()); ReturnIntViewBO objReturnInt = new ReturnIntViewBO(); objReturnInt = SettingsBO.ValidateField(0, "VisualLayout", "ResolutionProfile", objResolutionProfile.ID.ToString()); linkDelete.Visible = objReturnInt.RetVal == 1; //linkDelete.Visible = (objResolutionProfile.VisualLayoutsWhereThisIsResolutionProfile.Any()) ? false : true; } } }