public ClientDS GetClientsList(bool activeOnly) { //Get a list of clients ClientDS clients = null; try { string filter = "DivisionNumber='01'"; if (activeOnly) { if (filter.Length > 0) { filter += " AND "; } filter += "Status = 'A'"; } clients = new ClientDS(); DataSet ds = FillDataset(USP_CLIENTS, TBL_CLIENTS, new object[] { }); if (ds.Tables[TBL_CLIENTS].Rows.Count > 0) { ClientDS _clients = new ClientDS(); _clients.Merge(ds); clients.Merge(_clients.ClientTable.Select(filter, "ClientName ASC")); } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected exception creating client list.", ex); } return(clients); }
public ClientDS GetSecureClients(bool activeOnly) { //Load a list of client selections ClientDS clients = null; try { clients = new ClientDS(); bool isAdmin = false; ProfileCommon profile = null; string clientVendorID = "000"; MembershipUser user = Membership.GetUser(); if (user != null) { //Internal\external member logged in isAdmin = Roles.IsUserInRole(user.UserName, "administrators"); profile = new ProfileCommon().GetProfile(user.UserName); if (profile != null) { clientVendorID = profile.ClientVendorID; } } if (isAdmin || clientVendorID == "000") { //Internal user- get list of all clients clients.ClientTable.AddClientTableRow("", "", "All", "", ""); ClientDS _clients = GetClients(null, "01", activeOnly); clients.Merge(_clients.ClientTable.Select("", "ClientName ASC")); } else { //Client- list this client only; Vendor: list all of it's clients if (profile.Type.ToLower() == "vendor") { clients.Merge(GetClientsForVendor(profile.ClientVendorID)); } else { clients.ClientTable.AddClientTableRow(profile.ClientVendorID, "", profile.Company, "", ""); } } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected exception creating client list.", ex); } return(clients); }
public ClientDS GetClientsForVendor(string vendorID) { // ClientDS clients = new ClientDS(); DataSet ds = FillDataset("[uspRptClientGetListForVendor]", TBL_CLIENTS, new object[] { vendorID }); if (ds.Tables[TBL_CLIENTS].Rows.Count > 0) { clients.Merge(ds.Tables[TBL_CLIENTS].Select("", "ClientName ASC")); } return(clients); }
public ClientDS GetClients(string number, string division, bool activeOnly) { //Get a list of clients filtered for a specific client or division or both //Added logic that checks for division 00 as switch to null TerminalCode for TimePeriodCartonCompare report ClientDS clients = null; try { string filter = ""; bool nullTerminalCode = division == "00"; if (number != null && number.Length > 0) { filter = "ClientNumber='" + number + "'"; } if (division != null && division.Length > 0) { if (filter.Length > 0) { filter += " AND "; } filter += "DivisionNumber='" + (division == "00" ? "01" : division) + "'"; } if (activeOnly) { if (filter.Length > 0) { filter += " AND "; } filter += "Status = 'A'"; } clients = new ClientDS(); DataSet ds = FillDataset(USP_CLIENTS, TBL_CLIENTS, new object[] { }); if (ds.Tables[TBL_CLIENTS].Rows.Count > 0) { ClientDS _clients = new ClientDS(); _clients.Merge(ds); clients.Merge(_clients.ClientTable.Select(filter, "ClientNumber ASC, DivisionNumber ASC")); } if (nullTerminalCode) { for (int i = 0; i < clients.ClientTable.Rows.Count; i++) { clients.ClientTable[i].TerminalCode = ""; } } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected exception creating client list.", ex); } return(clients); }
public ClientDS GetClients() { //Get a list of clients filtered for a specific division ClientDS clients = null; try { clients = new ClientDS(); DataSet ds = fillDataset(USP_CLIENTS, TBL_CLIENTS, new object[] { }); if (ds.Tables[TBL_CLIENTS].Rows.Count > 0) { ClientDS _clients = new ClientDS(); _clients.Merge(ds); clients.Merge(_clients.ClientTable.Select("", "ClientName ASC")); } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected exception creating client list.", ex); } return(clients); }
public ClientDS GetClients(string number, string division, bool activeOnly) { //Get a list of clients filtered for a specific division ClientDS clients = null; try { string filter = ""; if (number != null && number.Length > 0) { filter = "ClientNumber='" + number + "'"; } if (division != null && division.Length > 0) { if (filter.Length > 0) { filter += " AND "; } filter += "DivisionNumber='" + division + "'"; } if (activeOnly) { if (filter.Length > 0) { filter += " AND "; } filter += "Status = 'A'"; } clients = new ClientDS(); DataSet ds = FillDataset(USP_CLIENTS, TBL_CLIENTS, new object[] { }); if (ds.Tables[TBL_CLIENTS].Rows.Count > 0) { ClientDS _clients = new ClientDS(); _clients.Merge(ds); clients.Merge(_clients.ClientTable.Select(filter, "ClientNumber ASC, DivisionNumber ASC")); } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected exception creating client list.", ex); } return(clients); }