Ejemplo n.º 1
0
 public ClientObject(Socket tcpClient, ServerObject serverObject)
 {
     clientDataset = new ClientDataset();
     serializer    = new Serializer();
     client        = tcpClient;
     server        = serverObject;
 }
Ejemplo n.º 2
0
        public void SendMessageToPrivateRoom(ChatMessage chatMessage, Socket SenderclientSocket)
        {
            byte[]        newMessage        = serializer.MakeSerialize(chatMessage);
            ClientDataset findClientDataset = clientDatasets.Find(с => с.clientInfo.Id == chatMessage.ReceiverId);

            findClientDataset.clientObject.client.Send(newMessage);
        }
Ejemplo n.º 3
0
        public ClientDataset GetCustomers(string companyType)
        {
            //Get customer list
            ClientDataset         customers = new ClientDataset();
            TrackingServiceClient client    = null;

            try {
                customers.ClientTable.AddClientTableRow(ID_ARGIX, "", "Argix Logistics Inc.", companyType, "");

                client = new TrackingServiceClient();
                DataSet ds = client.GetCustomers();
                client.Close();

                if (ds != null && ds.Tables["ClientTable"] != null)
                {
                    ClientDataset _customers = new ClientDataset();
                    _customers.Merge(ds);
                    customers.Merge(_customers.ClientTable.Select("CompanyType='" + companyType + "'", "CompanyName ASC"));
                }
                customers.AcceptChanges();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message, te); }
            catch (FaultException <TrackingFault> tfe) { client.Abort(); throw new ApplicationException(tfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message, fe); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message, ce); }
            return(customers);
        }
Ejemplo n.º 4
0
        public ClientDataset GetClientsList(bool activeOnly)
        {
            //Get a list of clients
            ClientDataset clients = null;

            try {
                string filter = "DivisionNumber='01'";
                if (activeOnly)
                {
                    if (filter.Length > 0)
                    {
                        filter += " AND ";
                    }
                    filter += "Status = 'A'";
                }
                clients = new ClientDataset();
                DataSet ds = FillDataset(USP_CLIENTS, TBL_CLIENTS, new object[] { });
                if (ds.Tables[TBL_CLIENTS].Rows.Count > 0)
                {
                    ClientDataset _clients = new ClientDataset();
                    _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);
        }
Ejemplo n.º 5
0
        protected internal void AddConnection(ClientDataset clientDataset)
        {
            СlientSignInOutMessage(clientDataset.clientInfo.Name, clientDataset.clientInfo.Id, 1);
            clientDatasets.Add(clientDataset);
            Console.WriteLine("AddConnection");
            ClientsListMessage clientsListMessage = CreateClientListMessage(clientDataset.clientInfo.Id);

            clientDataset.clientObject.client.Send(serializer.MakeSerialize(clientsListMessage));
        }
Ejemplo n.º 6
0
        public void RemoveConnection(int id)
        {
            ClientDataset client = clientDatasets.FirstOrDefault(c => c.clientInfo.Id == id);

            if (client.clientObject != null)
            {
                clientDatasets.Remove(client);
            }
        }
Ejemplo n.º 7
0
        public ServerObject()
        {
            id             = 1;
            serializer     = new Serializer();
            clientDatasets = new List <ClientDataset>();
            ClientDataset chatDataset = new ClientDataset();

            chatDataset.clientInfo.Name = "General chat";
            chatDataset.clientInfo.Id   = 0;
            clientDatasets.Add(chatDataset);
        }
Ejemplo n.º 8
0
        public ClientDataset GetClientsForVendor(string vendorID)
        {
            //
            ClientDataset clients = new ClientDataset();
            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);
        }
Ejemplo n.º 9
0
    /// <summary>Retuen a list of clients that provide load tenders.</summary>
    public ClientDataset GetClients()
    {
        //Return a list of load tender clients
        ClientDataset clients = null;

        try {
            clients = new ClientDataset();
            clients.ReadXml(Request.MapPath(CLIENT_LIST));
            clients.ClientTable.AcceptChanges();
        }
        catch (Exception ex) { throw new ApplicationException(ex.Message); }
        return(clients);
    }
Ejemplo n.º 10
0
        public ClientDataset 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
            ClientDataset 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 ClientDataset();
                DataSet ds = FillDataset(USP_CLIENTS, TBL_CLIENTS, new object[] { });
                if (ds.Tables[TBL_CLIENTS].Rows.Count > 0)
                {
                    ClientDataset _clients = new ClientDataset();
                    _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);
        }
Ejemplo n.º 11
0
        public ClientDataset GetSecureClients(bool activeOnly)
        {
            //Load a list of client selections
            ClientDataset clients = null;

            try {
                clients = new ClientDataset();
                clients.ClientTable.AddClientTableRow("", "", "All", "", "");
                ClientDataset _clients = GetClients(null, "01", activeOnly);
                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);
        }
Ejemplo n.º 12
0
        public ClientDataset GetClientsForVendor(string vendorID)
        {
            //
            ClientDataset clients = new ClientDataset();

            try {
                DataSet ds = new DataService().FillDataset(SQL_CONNID, USP_CLIENTSFORVENDOR, TBL_CLIENTS, new object[] { vendorID });
                if (ds.Tables[TBL_CLIENTS].Rows.Count > 0)
                {
                    clients.Merge(ds.Tables[TBL_CLIENTS].Select("", "ClientName ASC"));
                }
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(clients);
        }
Ejemplo n.º 13
0
        public ClientDataset GetSecureClients(bool activeOnly)
        {
            //Load a list of client selections
            ClientDataset clients = null;

            try {
                clients = new ClientDataset();
                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", "", "");
                    ClientDataset _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(ex.Message, ex); }
            return(clients);
        }
Ejemplo n.º 14
0
        public ClientDataset GetClients()
        {
            //Get clients
            ClientDataset    clients = new ClientDataset();
            CRMServiceClient client  = null;

            try {
                client = new CRMServiceClient();
                DataSet ds = client.GetClients(null);
                client.Close();

                if (ds.Tables["ClientTable"] != null && ds.Tables["ClientTable"].Rows.Count > 0)
                {
                    clients.Merge(ds.Tables["ClientTable"].Select("", "CompanyName ASC"));
                }
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(clients);
        }
Ejemplo n.º 15
0
        public ClientDataset GetClients(string vendorID)
        {
            //Return a list of clients filtered by vendorID (vendorID=null returns all Argix clients)
            ClientDataset         clients = new ClientDataset();
            TrackingServiceClient client  = null;

            try {
                client = new TrackingServiceClient();
                DataSet ds = client.GetClients(vendorID);
                if (ds != null)
                {
                    clients.Merge(ds);
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message, te); }
            catch (FaultException <TrackingFault> tfe) { client.Abort(); throw new ApplicationException(tfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message, fe); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message, ce); }
            return(clients);
        }
Ejemplo n.º 16
0
        //Interface
        public ClientDataset GetClients(string number, string division, bool activeOnly)
        {
            //Get a list of clients filtered for a specific division
            ClientDataset 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 ClientDataset();
                DataSet ds = new DataService().FillDataset(SQL_CONNID, USP_CLIENTS, TBL_CLIENTS, new object[] { });
                if (ds.Tables[TBL_CLIENTS].Rows.Count > 0)
                {
                    ClientDataset _clients = new ClientDataset();
                    _clients.Merge(ds);
                    clients.Merge(_clients.ClientTable.Select(filter, "ClientNumber ASC, DivisionNumber ASC"));
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(clients);
        }
Ejemplo n.º 17
0
        public ClientDataset GetClients()
        {
            //Get a list of clients
            ClientDataset clients = new ClientDataset();

            //If user is:
            // Vendor: get list of all it's clients
            // Client: no need to get client's list - fill the drop-down with client's name
            //  Argix: get list of all clients
            MembershipServices membership = new MembershipServices();
            ProfileCommon      profile    = membership.MemberProfile;

            if (profile.ClientVendorID == TrackingGateway.ID_ARGIX || membership.IsAdmin)
            {
                clients.Merge(GetClients(null));
            }
            else
            {
                if (profile.Type.ToLower() == "vendor")
                {
                    clients.Merge(GetClients(profile.ClientVendorID));
                }
                else
                {
                    //Get the single client from login profile OR get all clients that have same ARNumber
                    ClientDataset _clients = GetClients(null);
                    ClientDataset.ClientTableRow _client = (ClientDataset.ClientTableRow)_clients.ClientTable.Select("ClientID='" + profile.ClientVendorID + "'")[0];
                    if (this.mMatchClientByARNumber.Contains(_client.ARNumber))
                    {
                        clients.Merge(_clients.ClientTable.Select("ARNumber='" + _client.ARNumber + "'"));
                    }
                    else
                    {
                        clients.ClientTable.AddClientTableRow(profile.ClientVendorID, "", profile.Company, "", "");
                    }
                }
            }
            return(clients);
        }