Example #1
0
 public string Load()
 {
     try {
         connection.Open();
         string           sql     = @"SELECT DISTINCT c.ClientId, c.FirstName, c.LastName, c.Email, c.Phone, c.ActivationDate, c.IsActive, Count(cs.IsPaid), cs1.ExpirationDate, c.Note FROM Clients AS c
                     LEFT OUTER JOIN ClientServices AS cs
                     ON c.ClientId = cs.ClientId AND cs.IsPaid = 0
                     LEFT OUTER JOIN ClientServices AS cs1
                     ON c.ClientId = cs1.ClientId
                     GROUP BY c.ClientId, c.FirstName, c.LastName, c.Email, c.Phone, c.ActivationDate, c.IsActive, cs1.ExpirationDate, c.Note
                     ORDER BY cs1.ExpirationDate DESC";
         SqlCommand       command = new SqlCommand(sql, connection);
         SqlDataReader    reader  = command.ExecuteReader();
         List <NewClient> xx      = new List <NewClient>();
         while (reader.Read())
         {
             NewClient x = new NewClient();
             x.clientId          = reader.GetInt32(0);
             x.firstName         = reader.GetValue(1) == DBNull.Value ? "" : reader.GetString(1);
             x.lastName          = reader.GetValue(2) == DBNull.Value ? "" : reader.GetString(2);
             x.email             = reader.GetValue(3) == DBNull.Value ? "" : reader.GetString(3);
             x.phone             = reader.GetValue(4) == DBNull.Value ? "" : reader.GetString(4);
             x.activationDate    = reader.GetDateTime(5);
             x.isActive          = reader.GetValue(6) == DBNull.Value ? 1 : reader.GetInt32(6);
             x.isDebtor          = reader.GetInt32(7) > 0 ? 1 : 0;
             x.expirationService = reader.GetValue(8) == DBNull.Value ? DateTime.UtcNow : reader.GetDateTime(8);
             x.note = reader.GetValue(9) == DBNull.Value ? "" : reader.GetString(9);
             xx.Add(x);
         }
         connection.Close();
         var    distinctUsers = xx.GroupBy(x => x.clientId).Select(x => x.First()).ToList();
         string json          = JsonConvert.SerializeObject(distinctUsers, Formatting.Indented);
         return(json);
     } catch (Exception e) { return("Error: " + e); }
 }
 public ActionResult SubmitNewClient(NewClient newClient)
 {
     if (ModelState.IsValid)
     {
         TempData["NewClient"]      = newClient;
         TempData["ExistingClient"] = null;
         IntelligenceReport checkSubmission = new IntelligenceReport
         {
             Check = new List <Check>()
             {
                 new Check()
                 {
                 },
                 new Check()
                 {
                 }
             }
         };
         return(View("SubmissionStep2", checkSubmission));
     }
     else
     {
         TempData["ErrorResult"] = "Fill in all fields on form before submitting";
         return(View("SubmissionStep1", newClient));
     }
 }
Example #3
0
    IEnumerator TakeSnapshot()
    {
        int webCamHeight = webcam.height;
        int webCamWidth  = webcam.width;
        //int captureCounter = 0;

        /*while (false)
         * {
         *  snap.SetPixels(webcam.GetPixels());
         *  snap.Apply();
         *
         *  System.IO.File.WriteAllBytes(savePath + captureCounter.ToString() + ".jpg", snap.EncodeToJPG());
         *  captureCounter++;
         *  if (captureCounter >= 20) File.Delete(savePath + (captureCounter - 20).ToString() + ".jpg");
         *  yield return new WaitForSeconds(0.05f);
         * }*/
        NewClient client = FindObjectOfType <NewClient>();

        client.StartClient();
        yield return(new WaitForSeconds(1));

        while (true)
        {
            Texture2D snap = new Texture2D(webCamWidth, webCamHeight);
            yield return(new WaitForSeconds(0.1f));

            snap.SetPixels(webcam.GetPixels());
            snap = ScaleTexture(snap, 300, 300);
            snap.Apply();
            byte[] bytes = snap.EncodeToJPG();
            client.Send(bytes);
            Destroy(snap);
        }
    }
Example #4
0
        private void tsiNewCliente_Click(object sender, EventArgs e)
        {
            NewClient n = new NewClient();

            n.ShowDialog();
            c.DashBoardCreation(textBox1);
        }
Example #5
0
        public IHttpActionResult Post(NewClient data)
        {
            using (var context = new DatabaseContext())
            {
                try
                {
                    data.Email = data.Email.Trim().ToLower();

                    var client = new Client()
                    {
                        Name  = data.Name,
                        Email = data.Email
                    };

                    client = context.Clients.Add(client);
                    context.SaveChanges();

                    return(Ok <ClientInfo>(getInfo(client)));
                }
                catch (DbEntityValidationException validationException)
                {
                    return(BadRequest(validationException.EntityValidationErrors.First().ValidationErrors.First().ErrorMessage));
                }
                catch (DbUpdateException e)
                {
                    return(BadRequest($"Email {data.Email} já cadastrado."));
                }
            }
        }
Example #6
0
        public async Task <IActionResult> Add([FromBody] NewClient model)
        {
            var client = await _svc.Add(model);

            Audit(AuditId.ClientState);
            return(Json(client));
        }
Example #7
0
        private void ConnectToServer(IPAddress localaddress, int port)
        {
            try
            {
                obj        = new NewClient();
                obj.client = new TcpClient();
                obj.client.Connect(localaddress, port);
                obj.stream = obj.client.GetStream();
                obj.buffer = new byte[obj.client.ReceiveBufferSize];
                obj.data   = new StringBuilder();
                obj.handle = new EventWaitHandle(false, EventResetMode.AutoReset);
                SetConnectBtn(true);

                while (obj.client.Connected)
                {
                    try
                    {
                        obj.stream.BeginRead(obj.buffer, 0, obj.buffer.Length, new AsyncCallback(Read), null);
                        obj.handle.WaitOne();
                    }
                    catch (Exception e)
                    {
                        WriteToLog(string.Format("Something went wrong: {0}", e.Message));
                    }
                }

                obj.client.Close();
                SetConnectBtn(false);
            }
            catch (Exception e)
            {
                WriteToLog(string.Format("Something went wrong: {0}", e.Message));
            }
        }
Example #8
0
 public string Load()
 {
     try {
         connection.Open();
         SqlCommand       command = new SqlCommand("SELECT ClientId, FirstName, LastName, Email, Phone, BirthDate, IsActive FROM Clients ORDER BY ClientId DESC", connection);
         SqlDataReader    reader  = command.ExecuteReader();
         List <NewClient> clients = new List <NewClient>();
         while (reader.Read())
         {
             NewClient xx = new NewClient()
             {
                 clientId  = reader.GetInt32(0),
                 firstName = reader.GetValue(1) == DBNull.Value ? "" : reader.GetString(1),
                 lastName  = reader.GetValue(2) == DBNull.Value ? "" : reader.GetString(2),
                 email     = reader.GetValue(3) == DBNull.Value ? "" : reader.GetString(3),
                 phone     = reader.GetValue(4) == DBNull.Value ? "" : reader.GetString(4),
                 birthDate = reader.GetDateTime(5),
                 isActive  = reader.GetValue(6) == DBNull.Value ? 1 : reader.GetInt32(6)
             };
             clients.Add(xx);
         }
         connection.Close();
         string json = JsonConvert.SerializeObject(clients, Formatting.Indented);
         return(json);
     } catch (Exception e) { return("Error: " + e); }
 }
Example #9
0
    public string Save(NewClient client)
    {
        if (CheckClient(client) == false)
        {
            return("Član je već registriran.");
        }
        else
        {
            try {
                connection.Open();
                string sql = @"INSERT INTO Clients VALUES  
                       (@FirstName, @LastName, @Email, @Phone, @BirthDate, @IsActive)";

                SqlCommand command = new SqlCommand(sql, connection);
                command.Parameters.Add(new SqlParameter("FirstName", client.firstName));
                command.Parameters.Add(new SqlParameter("LastName", client.lastName));
                command.Parameters.Add(new SqlParameter("Email", client.email));
                command.Parameters.Add(new SqlParameter("Phone", client.phone));
                command.Parameters.Add(new SqlParameter("BirthDate", client.birthDate));
                command.Parameters.Add(new SqlParameter("IsActive", client.isActive));
                command.ExecuteNonQuery();
                connection.Close();
                return("Registracija uspješna.");
            } catch (Exception e) { return("Registracija nije uspjela! (Error: )" + e); }
        }
    }
Example #10
0
        public static void BringClient(this client cs)//חיפוש לקוח קיים והבאת הפרטים שלו לשדות המתאימים
        {
            int cnt = 0;

            connectToServer("127.0.0.1", 8001);
            while (cnt < 2)
            {
                if (cnt == 0)
                {
                    writer.Write("clientId");
                    cnt++;
                }
                else
                {
                    writer.Write(cs.Id_old_client_text.Text);
                    string    old_client = reader.ReadString();
                    NewClient newClient  = JsonConvert.DeserializeObject <NewClient>(old_client);
                    if (newClient.ClientId == null)
                    {
                        MessageBox.Show("מספר תעודת זהות זו אינה נמצאת במערכת... וודא שהמספר נכון ונסה שנית");
                        cnt++;
                    }
                    else
                    {
                        cs.text_id.Text         = newClient.ClientId;
                        cs.PhoneNumberText.Text = newClient.PhoneNumber;
                        cs.text_fName.Text      = newClient.FirstName;
                        cs.text_lName.Text      = newClient.LastName;
                        cnt++;
                    }
                }
            }
            cs.Id_old_client_text.Text   = "";
            cs.SearchClientPanel.Visible = false;
        }
Example #11
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewClient newClient = new NewClient();

            newClient.MdiParent = this;
            newClient.Show();
        }
Example #12
0
 public string Get(string userId, string clientId)
 {
     try {
         NewClient x = new NewClient();
         using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + db.GetDataBasePath(userId, dataBase))) {
             connection.Open();
             string sql = string.Format("SELECT clientId, firstName, lastName, birthDate, gender, phone, email, userId, date, isActive, note FROM clients WHERE clientId = '{0}'", clientId);
             using (SQLiteCommand command = new SQLiteCommand(sql, connection)) {
                 ClientsData c = new ClientsData();
                 using (SQLiteDataReader reader = command.ExecuteReader()) {
                     while (reader.Read())
                     {
                         x.clientId     = reader.GetValue(0) == DBNull.Value ? null : reader.GetString(0);
                         x.firstName    = reader.GetValue(1) == DBNull.Value ? "" : reader.GetString(1);
                         x.lastName     = reader.GetValue(2) == DBNull.Value ? "" : reader.GetString(2);
                         x.birthDate    = reader.GetValue(3) == DBNull.Value ? DateTime.Now.ToString() : reader.GetString(3);
                         x.gender.value = reader.GetValue(4) == DBNull.Value ? 0 : reader.GetInt32(4);
                         x.gender.title = GetGender(x.gender.value).title;
                         x.phone        = reader.GetValue(5) == DBNull.Value ? "" : reader.GetString(5);
                         x.email        = reader.GetValue(6) == DBNull.Value ? "" : reader.GetString(6);
                         x.userId       = reader.GetValue(7) == DBNull.Value ? "" : reader.GetString(7);
                         x.date         = reader.GetValue(8) == DBNull.Value ? DateTime.Today.ToString() : reader.GetString(8);
                         x.isActive     = reader.GetValue(9) == DBNull.Value ? 1 : reader.GetInt32(9);
                         x.note         = reader.GetValue(10) == DBNull.Value ? "" : reader.GetString(10);
                         x.profileImg   = GetProfileImg(userId, x.clientId);
                         x.clientData   = c.GetClientData(userId, clientId, connection);
                     }
                 }
             }
             connection.Close();
         }
         return(JsonConvert.SerializeObject(x, Formatting.None));
     } catch (Exception e) { return("error: " + e); }
 }
Example #13
0
        /// <summary>
        /// Add the NewClient client to the client list
        /// If a client with the same name already exists, connect to it instead with the new tcpClient
        /// </summary>
        public void AddClientToList()
        {
            var client = Clients.FirstOrDefault(x => x.Name == NewClient.Name);

            if (client == null) //there exists no client with the new name, add a new one
            {
                Status = "New client " + NewClient.Name + " connected";
                Clients.Add(NewClient);
                NewClient.fixVisibleCollection();//Fix the visible collection according to the message collection
                SelectedClient = NewClient;
                NewClient.ClientDisconnected += ClientDisconnected;
            }
            else //Client with that name already exists, update the TCP listener and connect
            {
                try
                {
                    Status = "Client already exist in client list, connecting.";
                    NewClient.Conversation = Clients.Single(x => x.Name == NewClient.Name).Conversation;
                    Clients.Remove(Clients.Single(x => x.Name == NewClient.Name));
                    Clients.Add(NewClient);
                    NewClient.fixVisibleCollection();//Fix the vissible collection according the the message collection
                    SelectedClient = NewClient;
                    SelectedClient.Connect();
                }
                catch (InvalidOperationException)
                {
                    MessageBox.Show("Error: There is multiple clients with the same name in the clients list.");
                    return;
                }
            }

            FilterConnections();
        }
Example #14
0
        public async Task <Client> AddClient(NewClient addClient)
        {
            try
            {
                var newClientAddress = new ContactAddress {
                    AddressLine1 = addClient.AddressLine1, AddressLine2 = addClient.AddressLine2, Suburb = addClient.Suburb, State = addClient.State, PostCode = addClient.PostCode, Country = addClient.Country
                };
                var addressJobj = await _addressSyncTable.InsertAsync(JObject.FromObject(newClientAddress));

                var billingAddress = addressJobj.ToObject <ContactAddress>();
                await SyncAddresses();

                var newClient = new Client
                {
                    Name             = addClient.Name,
                    ContactNumber    = addClient.ContactNumber,
                    Email            = addClient.Email,
                    BillingAddress   = billingAddress,
                    BillingAddressId = billingAddress.Id
                };
                var clientJObj = await _clientSyncTable.InsertAsync(JObject.FromObject(newClient));
                await SyncClients();

                return(clientJObj.ToObject <Client>());
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
                string errorMsg = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
                Device.BeginInvokeOnMainThread(async() => await Application.Current.MainPage.DisplayAlert("Error Occured", errorMsg, "OK"));
            }
            return(null);
        }
Example #15
0
    public string GetClientGroupList(string userId, string cids)
    {
        List <NewClient> xx = new List <NewClient>();

        try {
            if (cids.Contains(";"))
            {
                string[] cids_ = cids.Split(';');
                foreach (string id in cids_)
                {
                    using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + db.GetDataBasePath(userId, dataBase))) {
                        connection.Open();
                        string sql = string.Format("SELECT clientId, firstName, lastName, birthDate, gender, phone, email, userId, date, isActive, note, cids FROM clients WHERE clientId = '{0}'", id);
                        using (SQLiteCommand command = new SQLiteCommand(sql, connection)) {
                            ClientsData c = new ClientsData();
                            using (SQLiteDataReader reader = command.ExecuteReader()) {
                                while (reader.Read())
                                {
                                    NewClient x = GetData(reader, userId, true, connection);
                                    Users     U = new Users();
                                    x.userGroupId = U.GetUserGroupId(x.userId);
                                    xx.Add(x);
                                }
                            }
                        }
                    }
                }
            }
            return(JsonConvert.SerializeObject(xx, Formatting.None));
        } catch (Exception e) {
            L.SendErrorLog(e, cids, userId, "Clients", "GetClientGroupList");
            return(JsonConvert.SerializeObject(xx, Formatting.None));
        }
    }
Example #16
0
    public string UpdateClient(string userId, NewClient x)
    {
        SaveResponse r = new SaveResponse();

        try {
            using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + db.GetDataBasePath(userId, dataBase))) {
                connection.Open();
                string sql = string.Format(@"UPDATE clients SET
                                        firstName = '{0}', lastName = '{1}', birthDate = '{2}', gender = '{3}', phone = '{4}', email = '{5}'
                                        WHERE clientId = '{6}'"
                                           , x.firstName, x.lastName, x.birthDate, x.gender.value, x.phone, x.email, x.clientId);
                using (SQLiteCommand command = new SQLiteCommand(sql, connection)) {
                    using (SQLiteTransaction transaction = connection.BeginTransaction()) {
                        command.ExecuteNonQuery();
                        transaction.Commit();
                    }
                }
            }
            r.data      = x;
            r.msg       = "saved";
            r.isSuccess = true;
            return(JsonConvert.SerializeObject(r, Formatting.None));
        } catch (Exception e) {
            r.data      = null;
            r.msg       = e.Message;
            r.isSuccess = false;
            L.SendErrorLog(e, x.clientId, userId, "Clients", "UpdateClient");
            return(JsonConvert.SerializeObject(r, Formatting.None));
        }
    }
Example #17
0
    public string Get(string userId, string clientId)
    {
        NewClient x = new NewClient();

        //db.AddColumn(userId, db.GetDataBasePath(userId, dataBase), db.clients, "cids", "VARCHAR(200)");  //new column in cids tbl.
        try {
            using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + db.GetDataBasePath(userId, dataBase))) {
                connection.Open();
                string sql = string.Format("SELECT clientId, firstName, lastName, birthDate, gender, phone, email, userId, date, isActive, note, cids FROM clients WHERE clientId = '{0}'", clientId);
                using (SQLiteCommand command = new SQLiteCommand(sql, connection)) {
                    ClientsData c = new ClientsData();
                    using (SQLiteDataReader reader = command.ExecuteReader()) {
                        while (reader.Read())
                        {
                            x = GetData(reader, userId, true, connection);
                        }
                    }
                }
            }
            Users U = new Users();
            x.userGroupId = U.GetUserGroupId(x.userId);
            return(JsonConvert.SerializeObject(x, Formatting.None));
        } catch (Exception e) {
            L.SendErrorLog(e, clientId, userId, "Clients", "Get");
            return(JsonConvert.SerializeObject(x, Formatting.None));
        }
    }
Example #18
0
    public string Init()
    {
        NewClient x = new NewClient();

        x.clientId     = null;
        x.firstName    = "";
        x.lastName     = "";
        x.birthDate    = DateTime.UtcNow.ToString();
        x.gender.value = 0;
        x.gender.title = GetGenderTitle(x.gender.value);
        x.phone        = "";
        x.email        = "";
        x.userId       = null;
        x.userGroupId  = null;
        x.date         = DateTime.UtcNow.ToString();
        x.isActive     = 1;
        x.note         = null;
        x.profileImg   = null;
        x.isSelected   = false;
        x.cids         = null;
        x.allergens    = null;
        x.clientData   = new ClientsData.NewClientData();
        x.calculation  = new Calculations.NewCalculation();
        x.clientGroup  = new List <NewClient>();
        x.nsClient     = new NSClients.NewNSClient();
        return(JsonConvert.SerializeObject(x, Formatting.None));
    }
Example #19
0
 private bool Check(string userId, NewClient x)
 {
     try {
         int count = 0;
         using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + db.GetDataBasePath(userId, dataBase))) {
             connection.Open();
             string sql = string.Format(@"SELECT COUNT([rowid]) FROM clients WHERE TRIM(LOWER(firstName)) = '{0}' AND TRIM(LOWER(lastName)) = '{1}'", x.firstName.Trim().ToLower(), x.lastName.Trim().ToLower());
             using (SQLiteCommand command = new SQLiteCommand(sql, connection)) {
                 using (SQLiteDataReader reader = command.ExecuteReader()) {
                     while (reader.Read())
                     {
                         count = reader.GetInt32(0);
                     }
                 }
             }
             connection.Close();
         }
         if (count == 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     } catch (Exception e) { return(false); }
 }
Example #20
0
    protected bool CheckClient(NewClient client)
    {
        try {
            string        firstName  = "";
            string        lastName   = "";
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString);
            connection.Open();
            SqlCommand command = new SqlCommand(
                "SELECT FirstName, LastName FROM Clients WHERE FirstName = @FirstName AND LastName = @LastName ", connection);

            command.Parameters.Add(new SqlParameter("FirstName", client.firstName));
            command.Parameters.Add(new SqlParameter("LastName", client.lastName));
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                firstName = reader.GetString(0);
                lastName  = reader.GetString(1);
            }
            connection.Close();
            if (client.firstName == firstName && client.lastName == lastName)
            {
                return(false);
            }
            return(true);
        } catch (Exception e) { return(false); }
    }
Example #21
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (addButtonVerification())
            {
                if (Session["List"] == null)
                {
                    records = new List <NewClient>();
                }
                else
                {
                    records = (List <NewClient>)Session["List"];
                }

                NewClient aClient = new NewClient();
                aClient.strName     = txtName.Text;
                aClient.strEmail    = txtEmail.Text;
                aClient.strMobileNo = txtPhoneNumber.Text;
                aClient.strAddress  = txtAddress.Text;
                records.Add(aClient);

                dgv.DataSource = records;
                dgv.DataBind();

                if (Session["List"] != null)
                {
                    btnCreateChallan.Visible = true;
                }

                clearData();
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please fill Name and Mobile No fields.')", true);
            }
        }
Example #22
0
 public string Save(Users.NewUser user, NewClient x, string lang)
 {
     try {
         db.CreateDataBase(user.userGroupId, db.clients);
         db.AddColumn(user.userGroupId, db.GetDataBasePath(user.userGroupId, dataBase), db.clients, "note");  //new column in clients tbl.
         SaveResponse r = new SaveResponse();
         if (x.clientId == null && Check(user.userGroupId, x) == false)
         {
             r.data    = null;
             r.message = t.Tran("client is already registered", lang);
             return(JsonConvert.SerializeObject(r, Formatting.None));
         }
         else
         {
             if (x.clientId == null)
             {
                 //************TODO***************
                 int clientsLimit = MonthlyLimitOfClients(user.userType);
                 if (NumberOfClientsPerMonth(user.userGroupId) > clientsLimit)
                 {
                     r.data    = null;
                     r.message = string.Format("{0} {1}.", t.Tran("client was not saved. the maximum number of clients in one month is", lang), clientsLimit);
                     return(JsonConvert.SerializeObject(r, Formatting.None));
                 }
                 else
                 {
                     x.clientId = Convert.ToString(Guid.NewGuid());
                 }
             }
             using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + db.GetDataBasePath(user.userGroupId, dataBase))) {
                 connection.Open();
                 string sql = @"INSERT OR REPLACE INTO clients VALUES
                         (@clientId, @firstName, @lastName, @birthDate, @gender, @phone, @email, @userId, @date, @isActive, @note)";
                 using (SQLiteCommand command = new SQLiteCommand(sql, connection)) {
                     using (SQLiteTransaction transaction = connection.BeginTransaction()) {
                         command.Parameters.Add(new SQLiteParameter("clientId", x.clientId));
                         command.Parameters.Add(new SQLiteParameter("firstName", x.firstName));
                         command.Parameters.Add(new SQLiteParameter("lastName", x.lastName));
                         command.Parameters.Add(new SQLiteParameter("birthDate", x.birthDate));
                         command.Parameters.Add(new SQLiteParameter("gender", x.gender.value));
                         command.Parameters.Add(new SQLiteParameter("phone", x.phone));
                         command.Parameters.Add(new SQLiteParameter("email", x.email));
                         command.Parameters.Add(new SQLiteParameter("userId", x.userId));
                         command.Parameters.Add(new SQLiteParameter("date", x.date));
                         command.Parameters.Add(new SQLiteParameter("isActive", x.isActive));
                         command.Parameters.Add(new SQLiteParameter("note", x.note));
                         command.ExecuteNonQuery();
                         transaction.Commit();
                     }
                 }
                 connection.Close();
             }
             r.data = x;
             r.data.gender.title = GetGenderTitle(r.data.gender.value);
             r.message           = null;
             return(JsonConvert.SerializeObject(r, Formatting.None));
         }
     } catch (Exception e) { return(e.Message); }
 }
Example #23
0
 public NewClientViewModel(INavigationManager navigationManager, IClientManager clientManager)
     : base(navigationManager)
 {
     ClientManager = clientManager;
     Client        = new NewClient();
     isVisible     = true;
     Title         = "New Client";
 }
Example #24
0
 private void Edit_Click(object sender, RoutedEventArgs e)
 {
     if (lb.SelectedItem != null)
     {
         NewClient win = new NewClient(lb.SelectedItem as DB.Kunde);
         win.Show();
     }
 }
Example #25
0
 private void BroadcastNewUserToClients(NewClient msg)
 {
     var newClientMessage = new ClientTracking.ClientConnected(new ConnectedClient(msg.Id, msg.Username, msg.Status));
     foreach (var client in _clients.Values)
     {
         client.ClientsHandler.Tell(newClientMessage);
     }
 }
Example #26
0
 public ClientController(IUnitOfWork uow,
                         ClientHandler handler,
                         IClientRepository clientRepository,
                         NewClient newClient)
     : base(uow)
 {
     _handler          = handler;
     _clientRepository = clientRepository;
     _newClient        = newClient;
 }
Example #27
0
            /// <summary>
            /// Start up the TCP server
            /// </summary>
            /// <param name="newClient">Delegate to call when a new client has been accepted</param>
            /// <returns>Returns a reference to the listener</returns>
            public void ConnectToServerAsync(NewClient newClient, string hostname, Int32 port)
            {
                //#region Sockets server
                TcpClient theClient = new TcpClient();

                NewClientCallback = newClient;

                theClient.BeginConnect(hostname, port, OnServerAccepted, theClient);
                //#endregion
            }
        static public NewClient testClient()
        {
            var update = new NewClient {
                Name = "TEST__Charlie",
            };

            update.Address.PhoneNumber = "Withheld";
            update.Address.Email       = "*****@*****.**";
            return(update);
        } // testClient
Example #29
0
        async public Task <IActionResult> OnGetAsync()
        {
            if (_clientDb != null)
            {
                this.Clients = await _clientDb.GetAllClients();

                Input = new NewClient();
            }

            return(Page());
        }
        public IHttpActionResult PostClient(NewClient newClient)
        {
            if (!ModelState.IsValid)
                return BadRequest(ModelState);

            Client client = repo_.AddNewClient(newClient);
            client = repo_.AddClientNote(client.Id, NewNote.ClientCreated());
            if (!String.IsNullOrWhiteSpace(newClient.Referrer))
              client = repo_.AddClientNote(client.Id, new NewNote("Referred by " + newClient.Referrer));

            return Ok(client);
        } // PostClient
Example #31
0
            /// <summary>
            /// Start up the TCP server
            /// </summary>
            /// <param name="newClient">Delegate to call when a new client has been accepted</param>
            /// <returns>Returns a reference to the listener</returns>
            public TcpListener Start_TCP_Server(NewClient newClient)
            {
                //#region Sockets server
                TcpListener listener = new TcpListener(new IPEndPoint(IPAddress.Any, Port));

                NewClientCallback = newClient;

                listener.Start();
                listener.BeginAcceptTcpClient(OnClientAccepted, listener);

                return(listener);
                //#endregion
            }
Example #32
0
        private IActorRef StartHeartbeatMonitorForNewClient(NewClient msg)
        {
            var prop = Context.DI().Props<HeartbeatMonitorActor>();
            var monitor = Context.ActorOf(prop, msg.Id.ToString());
            monitor.Tell(new HeartbeatMonitorActor.AssignClient(msg.Id, msg.Status));

            return monitor;
        }
Example #33
0
        private void NewClientConnection(NewClient msg)
        {
            if (!_clients.ContainsKey(msg.Id))
            {
                BroadcastNewUserToClients(msg);

                //Register new client
                _clients.Add(msg.Id,
                    new ClientData(msg.Id, msg.Username, msg.Status, msg.ClientsHandler));

                var monitor = StartHeartbeatMonitorForNewClient(msg);
                _monitors.Add(msg.Id, monitor);

                IEnumerable<ConnectedClient> clients = GetConnectedClientList();
                Sender.Tell(new ConnectionMessages.ConnectionResponse(Self, monitor, clients, MessageHandler));

                MessageHandler.Tell(new MessagingActor.AddUser(msg.Id, new User(msg.Username, msg.MessageHandler)));
            }
        }