protected void ShowDiv() { try { DataSet dt = new DataSet(); DataTable DT = new DataTable(); DataTable DT1 = new DataTable(); DataTable DTOD = new DataTable(); string OpDate = LI.GetAccOpenDate(Session["BRCD"].ToString(), CustNo.Trim().ToString(), Prod.Trim().ToString(), AccNo.Trim().ToString()); dt = GetLoanStatDetails(OpDate.ToString(), Session["EntryDate"].ToString(), Prod, AccNo, Session["BRCD"].ToString()); if (dt.Tables[0].Rows.Count > 0) { GridRecords.DataSource = dt; GridRecords.DataBind(); txtCustId.Text = dt.Tables[0].Rows[0]["CustNO"].ToString(); txtBranchCode.Text = Session["BRCD"].ToString(); txtAccId.Text = dt.Tables[0].Rows[0]["ACCNO"].ToString(); //txtAddress.Text = dt.Tables[0].Rows[0]["BR_Add1"].ToString(); txtAcName.Text = dt.Tables[0].Rows[0]["CustName"].ToString(); GLcode.Text = Prod; txtCity.Text = dt.Tables[0].Rows[0]["City"].ToString() + "-" + dt.Tables[0].Rows[0]["PINCODE"].ToString(); txtLD.Text = dt.Tables[0].Rows[0]["LASTINTDATE1"].ToString(); txtED.Text = dt.Tables[0].Rows[0]["EDATE1"].ToString(); txtCustAddress.Text = dt.Tables[0].Rows[0]["FLAT_ROOMNO"].ToString(); txtSD.Text = dt.Tables[0].Rows[0]["SANSSIONDATE"].ToString(); DT = LI.FetchNomineeDetails(dt.Tables[0].Rows[0]["CustNO"].ToString(), Prod.ToString(), Session["BRCD"].ToString()); if (DT.Rows.Count > 0) { GridGurantor.DataSource = DT; GridGurantor.DataBind(); //txtNomiee.Text = DT.Rows[0]["Nominee"].ToString(); } DT1 = LI.FetchLoanDetails(dt.Tables[0].Rows[0]["CustNO"].ToString(), dt.Tables[0].Rows[0]["ACCNO"].ToString(), Session["BRCD"].ToString(), Prod); if (DT1.Rows.Count > 0) { txtIRate.Text = DT1.Rows[0]["INTRate"].ToString() + "%"; txtlimit.Text = DT1.Rows[0]["LIMIT"].ToString(); } DTOD = LI.FetchOpeningDate(dt.Tables[0].Rows[0]["CustNO"].ToString(), dt.Tables[0].Rows[0]["ACCNO"].ToString(), Session["BRCD"].ToString(), Prod); if (DTOD.Rows.Count > 0) { txtPh.Text = DTOD.Rows[0]["Mobile"].ToString(); } ScriptManager.RegisterStartupScript(this, this.GetType(), "ModalView", "<script>$('.bs-example-modal-lg').modal('show');</script>", false); } else { lblMessage.Text = "Details Not Found For This Account Number...!!"; ModalPopup.Show(this.Page); } } catch (Exception Ex) { ExceptionLogging.SendErrorToText(Ex); } }
/// <summary> /// sorts the grid /// </summary> /// <param name="sortField"></param> public void SortIt(string sortField) { ApplicationController.DoOnAsyncThread(() => { //just copy all into a new list (sorting as go), clear the collection then add each sorted item if (GridRecords.Any()) { var newList = new List <GridRowViewModel>(); foreach (var item in GridRecords) { var value1 = item.GetFieldViewModel(sortField).ValueObject; if (value1 == null) { newList.Insert(0, item); continue; } foreach (var item2 in newList) { var value2 = item2.GetFieldViewModel(sortField).ValueObject; if (value2 == null) { continue; } else if (!(value1 is Enum) && value1 is IComparable) { if (((IComparable)value1).CompareTo(value2) < 0) { newList.Insert(newList.IndexOf(item2), item); break; } else { continue; } } var sortString1 = value1.ToString(); var sortString2 = value2.ToString(); if (value1 is Enum) { sortString1 = ((Enum)value1).GetDisplayString(); } if (value2 is Enum) { sortString2 = ((Enum)value2).GetDisplayString(); } if (String.Compare(sortString1, sortString2, StringComparison.Ordinal) < 0) { newList.Insert(newList.IndexOf(item2), item); break; } } if (!newList.Contains(item)) { newList.Add(item); } } //just a check for already sorted ascending the sort descending if (LastSortField != sortField) { LastSortAscending = true; } else { if (LastSortAscending) { newList.Reverse(); } LastSortAscending = !LastSortAscending; } LastSortField = sortField; if (HasPaging) { CurrentPage = 1; } else { //used in code behind when displaying loading SortCount = newList.Count; Thread.Sleep(50); ApplicationController.DoOnMainThread(() => { GridRecords.Clear(); foreach (var item in newList) { GridRecords.Add(item); } }); } } }); }