private void LoadItemData() { MatrixPackage clsMatrixPackage = new MatrixPackage(); try { DataClass clsData = new DataClass(); System.Data.DataTable dt = clsData.DataReaderToDataTable(clsMatrixPackage.List(mItemDetails.VariationsMatrixID, "a.PackageID", SortOption.Ascending)); clsMatrixPackage.CommitAndDispose(); dt.TableName = "tblMatrixPackage"; dgItems.DataSource = dt; dgItems.Select(0); dgItems.CurrentRowIndex = 0; } catch (Exception ex) { clsMatrixPackage.CommitAndDispose(); MessageBox.Show(ex.Message, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadItemData() { try { DataClass clsData = new DataClass(); MatrixPackage clsMatrixPackage = new MatrixPackage(); System.Data.DataTable dt = clsData.DataReaderToDataTable(clsMatrixPackage.List(mItemDetails.VariationsMatrixID, "a.PackageID", SortOption.Ascending)); clsMatrixPackage.CommitAndDispose(); lstItems.Items.Clear(); int iImgCtr = 0; foreach (System.Data.DataRow dr in dt.Rows) { if (mboIsPriceInq) { lstItems.Items.Add(dr["PackageID"].ToString(), "[" + dr["Price"].ToString() + "]" + Environment.NewLine + dr["Quantity"].ToString() + " " + dr["UnitCode"].ToString() + " - " + dr["Description"].ToString(), iImgCtr); } else { lstItems.Items.Add(dr["PackageID"].ToString(), dr["Quantity"].ToString() + " " + dr["UnitCode"].ToString() + " - " + dr["Description"].ToString(), iImgCtr); } if (iImgCtr == 7) { iImgCtr = 0; } else { iImgCtr++; } } try { lstItems.Items[0].Selected = true; } catch { } } catch (Exception ex) { MessageBox.Show(ex.Message, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadList() { MatrixPackage clsMatrixPackage = new MatrixPackage(); DataClass clsDataClass = new DataClass(); string SortField = "PackageID"; if (Request.QueryString["sortfield"] != null) { SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); } SortOption sortoption = SortOption.Ascending; if (Request.QueryString["sortoption"] != null) { sortoption = (SortOption)Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); } if (Request.QueryString["Search"] == null) { PageData.DataSource = clsMatrixPackage.ListAsDataTable(Convert.ToInt64(lblMatrixID.Text), SortField, sortoption).DefaultView; } else { PageData.DataSource = clsDataClass.DataReaderToDataTable(clsMatrixPackage.List(Convert.ToInt64(lblMatrixID.Text), SortField, sortoption)).DefaultView; } clsMatrixPackage.CommitAndDispose(); int iPageSize = Convert.ToInt16(Session["PageSize"]); PageData.AllowPaging = true; PageData.PageSize = iPageSize; try { PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1; lstItem.DataSource = PageData; lstItem.DataBind(); } catch { PageData.CurrentPageIndex = 1; lstItem.DataSource = PageData; lstItem.DataBind(); } cboCurrentPage.Items.Clear(); for (int i = 0; i < PageData.PageCount; i++) { int iValue = i + 1; cboCurrentPage.Items.Add(new ListItem(iValue.ToString(), iValue.ToString())); if (PageData.CurrentPageIndex == i) { cboCurrentPage.Items[i].Selected = true; } else { cboCurrentPage.Items[i].Selected = false; } } lblDataCount.Text = " of " + " " + PageData.PageCount; }