예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public static ClientDS GetClients()
        {
            //Create a list of load tender clients
            ClientDS clients = null;

            try {
                clients = new ClientDS();
                clients.ClientTable.AddClientTableRow("012", "01", "L'OCCITANE", "05", "A");
                clients.ClientTable.AddClientTableRow("014", "01", "MELVITA", "05", "A");
                clients.ClientTable.AddClientTableRow("025", "01", "PRATT RETAIL SPECIALTIES", "05", "A");
                clients.ClientTable.AcceptChanges();
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message); }
            return(clients);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }