Exemplo n.º 1
0
        private void DataGridAgents_MouseUp(object sender, MouseButtonEventArgs e)
        {
            object item = DataGridClients.SelectedItem;

            try
            {
                TBIdClient.Text = (DataGridClients.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text;
                if (!TBIdClient.Text.Equals(""))
                {
                    Client client = ClientC.GetClient(Int16.Parse(TBIdClient.Text));
                    TBIdClient.Text      = client.ID + "";
                    TBNomClient.Text     = client.NOM;
                    TBAdresseClient.Text = client.ADRESSE;
                    TBTelClient.Text     = client.TEL;
                    //TBQuantite.Text = client.Remarque + "";
                    CBEtatClient.IsChecked = client.ETAT;
                    if (!client.ETAT || client.ID == 0)
                    {
                        Afficher_Msg_Erreur("ce CLient n'est pas autorisé de faire des devis.");
                        etatClientDemander = false;
                    }
                }
            }
            catch (Exception exp)
            {
            }
        }
Exemplo n.º 2
0
        static void ObserverPattern()
        {
            Console.WriteLine("-----Observer Pattern-----");

            Server server = new Server();

            ClientA clientA = new ClientA();
            ClientB clientB = new ClientB();
            ClientC clientC = new ClientC();

            server.AddClients(clientA);
            server.AddClients(clientB);

            server.NotifyClient("Good Morning!");

            server.AddClients(clientC);

            server.NotifyClient("Good Afternoon!");

            server.RemoveClient(clientA);

            server.NotifyClient("Good Night!");



            Console.ReadLine();
        }
Exemplo n.º 3
0
        public Guid AddCreditAccount(ClientC person)
        {
            Guid Id = Guid.NewGuid();

            ClientList[ClientList.FindIndex(pers => pers == person)].AllAccounts.Add(new CreditAccount(Id, LimitForCredit, CommisionForCredit));
            return(Id);
        }
Exemplo n.º 4
0
        public Guid AddDepositAccount(ClientC person, double money)
        {
            Guid Id = Guid.NewGuid();

            ClientList[ClientList.FindIndex(pers => pers == person)].AllAccounts.Add(new DepositAccount(Id, LimitForDeposit, money, ProcentForDepositM(money)));
            return(Id);
        }
Exemplo n.º 5
0
        public Guid AddDebetAccount(ClientC person)
        {
            Guid Id = Guid.NewGuid();

            ClientList[ClientList.FindIndex(pers => pers == person)].AllAccounts.Add(new DebetAccount(Id, 0, ProcentOnModForDebet));
            return(Id);
        }
Exemplo n.º 6
0
        private void LoadAllClients()
        {
            List <Client> reader = ClientC.GetAllClient();

            DataGridClients.ItemsSource = null;
            DataGridClients.ItemsSource = reader;
        }
Exemplo n.º 7
0
        private void LoadAllClients(String champ, String texte)
        {
            List <Client> reader = ClientC.GetAllClient(champ, texte);

            DataGridClients.ItemsSource = null;
            DataGridClients.ItemsSource = reader;
        }
Exemplo n.º 8
0
        public void EditClient(Client newC)
        {
            if (newC.Mail == "" || !newC.Mail.Contains("@"))
            {
                throw new Exception("Unavailable Email");
            }
            if (newC.Address == "" || newC.City == "")
            {
                throw new Exception("Unavailable Address");
            }
            if (newC.WorkNum == "")
            {
                throw new Exception("Unavailable Work Phone");
            }
            if (newC.HomeNum == "")
            {
                throw new Exception("Unavailable Home Phone");
            }
            if (newC.MobileNum == "")
            {
                throw new Exception("Unavailable Mobile Phone");
            }
            if (newC.Lname == "" || newC.Fname == "")
            {
                throw new Exception("The Name File Is Missing");
            }
            ClientC c = new ClientC();

            c.UpdateClient(newC);
        }
Exemplo n.º 9
0
        public void approveLoan2(Loans2 l)
        {
            ClientC inter = new ClientC();
            Client  c     = inter.FindClient(l.ClientId);

            c.MiddleProcess = "2app";
            inter.UpdateClient(c);
        }
Exemplo n.º 10
0
        private void TextChangedHandler(object sender, TextChangedEventArgs e)
        {
            ClientC client = new ClientC();
            TextBox tb     = sender as TextBox;

            client.CreateBranch("Root " + tb.Text);
            Temp = tb.Text;
        }
Exemplo n.º 11
0
        private void CompositeCreateHandler(object sender, TextChangedEventArgs e)
        {
            ClientC client = new ClientC();
            TextBox tb     = sender as TextBox;

            client.CreateLeaf(tb.Text);
            client.CreateChild(Temp, tb.Text);
        }
Exemplo n.º 12
0
 public CTransaction(double money, ClientC rec, ClientC send, Guid id1, Guid id2)
 {
     Money       = money;
     recipient   = rec;
     sender      = send;
     recepientID = id1;
     senderID    = id2;
 }
Exemplo n.º 13
0
 public void SpendMoney(Guid Id, ClientC person, double money)
 {
     if (((ClientList.Find(pers => pers == person).TakeAdress() == "") || (ClientList.Find(pers => pers == person).TakePassport() == -1)) && (money > MutnyTipLimit))
     {
         throw new MutnyTipException();
     }
     ClientList[ClientList.FindIndex(pers => pers == person)].AllAccounts.Find(acc => acc.GetID() == Id).SpendMoney(money);
 }
Exemplo n.º 14
0
 public void TransferMoney(Guid Id1, Guid Id2, ClientC person1, ClientC person2, double money)
 {
     if (((ClientList.Find(pers => pers == person1).TakeAdress() == "") || (ClientList.Find(pers => pers == person1).TakePassport() == -1)) && (money > MutnyTipLimit))
     {
         throw new MutnyTipException();
     }
     ClientList[ClientList.FindIndex(pers => pers == person1)].AllAccounts.Find(acc => acc.GetID() == Id1).TransferMoney(money, person2.AllAccounts.Find(acc => acc.GetID() == Id2));
     TransactionList.Add(new CTransaction(money, person1, person2, Id1, Id2));
 }
Exemplo n.º 15
0
        public void AddClient(ClientC person)
        {
            var CheckPerson = ClientList.Find(pers => pers == person);

            if (CheckPerson != null)
            {
                throw new CheckPersonException();
            }
            ClientList.Add(person);
        }
Exemplo n.º 16
0
        public void SendLoans2(Loans2 l)//send to approve
        {
            Loans2C inter = new Loans2C();

            inter.UpdateLoan2(l);
            ClientC inter1 = new ClientC();
            Client  c      = inter1.FindClient(l.ClientId);

            c.MiddleProcess = "2";
            inter1.UpdateClient(c);
        }
Exemplo n.º 17
0
    private static void Main(string[] args)
    {
        var a = new ClientA("Adam", 68);
        var b = new ClientB("Bob", 1.75);
        var c = new ClientC("Cheryl", 54.4, 1.65);

        Console.WriteLine("{0} is {1:0.0} lbs.", a.Name, a.WeightPounds());
        Console.WriteLine("{0} is {1:0.0} inches tall.", b.Name, b.HeightInches());
        Console.WriteLine("{0} is {1:0.0} lbs and {2:0.0} inches.", c.Name, c.WeightPounds(), c.HeightInches());
        Console.ReadLine();
    }
Exemplo n.º 18
0
        public void CreateLoan2(Loans2 l)//create second step when click save
        {
            ClientC inter1 = new ClientC();

            if (inter1.FindClient(l.ClientId).MiddleProcess == "1")
            {
                throw new Exception("The Loan Didn't Approved Yet");
            }
            Loans2C inter = new Loans2C();

            inter.CreateLoan2(l);
        }
Exemplo n.º 19
0
        public void uploadAndCreate(string cid)
        {
            ClientC c      = new ClientC();
            Client  client = c.FindClient(cid);

            client.MiddleProcess = "2";
            c.UpdateClient(client);
            SendEmailC send    = new SendEmailC();
            Client     c1      = c.FindClient(cid);
            UserC      u       = new UserC();
            string     message = "Client: " + c1.Mail + " " + c1.MobileNum + " " + c1.Fname + " " + c1.Lname + "Send he reports";

            send.SendEmailF(u.FindNeedEmail("Manager", cid), "Report Of " + c1.Fname + " " + c1.Lname, message);
        }
Exemplo n.º 20
0
        static void Main(string[] args)
        {
            try
            {
                var bank1   = new Sber();
                var person1 = new ClientC("mikhail", "chesnokov");
                var person2 = new ClientC("mikhail2", "chesnokov");
                person1.AddAdress("fsdf");
                person1.AddPassport(1233);
                bank1.AddClient(person1);
                bank1.AddClient(person2);
                Guid Id1 = bank1.AddCreditAccount(person1);
                Guid Id2 = bank1.AddDebetAccount(person2);
                Guid Id3 = bank1.AddDepositAccount(person2, 200000);
                bank1.AddMoney(Id1, person1, 100);
                bank1.AddMoney(Id2, person2, 150);
                bank1.AddMoney(Id3, person2, 190);
                Console.WriteLine(bank1.TakeMoneyValue(Id1, person1));
                Console.WriteLine(bank1.TakeMoneyValue(Id2, person2));
                Console.WriteLine(bank1.TakeMoneyValue(Id3, person2));
                bank1.SpendMoney(Id2, person2, 12);
                bank1.SpendMoney(Id1, person1, 15);
                //bank1.SpendMoney(Id3, person2, 16);
                Console.WriteLine(bank1.TakeMoneyValue(Id1, person1));
                Console.WriteLine(bank1.TakeMoneyValue(Id2, person2));
                Console.WriteLine(bank1.TakeMoneyValue(Id3, person2));
                bank1.TransferMoney(Id1, Id2, person1, person2, 110);
                Console.WriteLine(bank1.TakeMoneyValue(Id1, person1));
                Console.WriteLine(bank1.TakeMoneyValue(Id2, person2));
                bank1.TransferMoney(Id2, Id1, person2, person1, 20);
                Console.WriteLine(bank1.TakeMoneyValue(Id1, person1));
                Console.WriteLine(bank1.TakeMoneyValue(Id2, person2));
                //-25 - 1 - comission
                bank1.CancelTransaction(new CTransaction(20, person2, person1, Id2, Id1));
                Console.WriteLine(bank1.TakeMoneyValue(Id1, person1));
                Console.WriteLine(bank1.TakeMoneyValue(Id2, person2));
                bank1.AddMoney(Id3, person2, 0);
                Console.WriteLine(bank1.TakeMoneyValue(Id3, person2));

                Console.WriteLine(bank1.TakeMoneyValue(Id3, person2));
                // bank1.SpendMoney(Id3, person2, 14);
                Console.WriteLine("fsdf");
                Console.WriteLine(bank1.TakeMoneyValue(Id2, person2));
                Console.WriteLine(bank1.FoundProcent(Id2, person2, DateTime.Now.AddDays(40)));
            }
            catch (Exception e)
            {
                Error.WriteLine(e.Message);
            }
        }
Exemplo n.º 21
0
        public void addNewReqDoc(ReqDocs r)
        {
            ReqDocsC inter = new ReqDocsC();

            inter.insertDB(r);
            ClientC inter1 = new ClientC();
            Client  c      = inter1.FindClient(r.clientId);

            if (!c.Request)
            {
                c.Request = true;
                inter1.UpdateClient(c);
            }
            inter.insertDB(r);
        }
Exemplo n.º 22
0
        private void CreateBrunchHandler(object sender, TextChangedEventArgs e)
        {
            ClientC client = new ClientC();
            TextBox tb     = sender as TextBox;

            client.CreateBranch(tb.Text);
            if (Temp == null)
            {
                Temp = tb.Text;
            }
            else
            {
                client.CreateChild(Temp, tb.Text);
            }
        }
Exemplo n.º 23
0
        public void CreateLoan1(Loans1 l)
        {
            l.Id = getId();
            while (con.State == ConnectionState.Open)
            {
                System.Threading.Thread.Sleep(500);
            }
            con.Open();
            string       query = "INSERT INTO Loans1 (Id,BusinessName,DBAName,Pcontact,TaxID,SS,Tel,Mail,Street,Own,City,State,Zip,Mstreet,Mcity,Mstate,Mzip,Chose1,DateBE,StateoOI,EmployeesNum,Explains,Chose2,Acompanies,Approved,ClientId,Close) VALUES (@Id,@BusinessName,@DBAName,@Pcontact,@TaxID,@SS,@Tel,@Mail,@Street,@Own,@City,@State,@Zip,@Mstreet,@Mcity,@Mstate,@Mzip,@Chose1,@DateBE,@StateoOI,@EmployeesNum,@Explain,@Chose2,@Acompanies,@Approved,@ClientId,@Close)";
            MySqlCommand cmd   = new MySqlCommand(query, con);

            cmd.Parameters.AddWithValue("@Id", l.Id);
            cmd.Parameters.AddWithValue("@BusinessName", l.BusinessName);
            cmd.Parameters.AddWithValue("@DBAName", l.DBAName);
            cmd.Parameters.AddWithValue("@Pcontact", l.Pcontact);
            cmd.Parameters.AddWithValue("@TaxID", l.TaxID);
            cmd.Parameters.AddWithValue("@SS", l.SS);
            cmd.Parameters.AddWithValue("@Tel", l.Tel);
            cmd.Parameters.AddWithValue("@Mail", l.Mail);
            cmd.Parameters.AddWithValue("@Street", l.Street);
            cmd.Parameters.AddWithValue("@Own", l.Own);
            cmd.Parameters.AddWithValue("@City", l.City);
            cmd.Parameters.AddWithValue("@State", l.State);
            cmd.Parameters.AddWithValue("@Zip", l.Zip);
            cmd.Parameters.AddWithValue("@Mstreet", l.Mstreet);
            cmd.Parameters.AddWithValue("@Mcity", l.Mcity);
            cmd.Parameters.AddWithValue("@Mstate", l.Mstate);
            cmd.Parameters.AddWithValue("@Mzip", l.Mzip);
            cmd.Parameters.AddWithValue("@Chose1", l.Chose1);
            cmd.Parameters.AddWithValue("@DateBE", l.DateBE);
            cmd.Parameters.AddWithValue("@StateoOI", l.StateoOI);
            cmd.Parameters.AddWithValue("@EmployeesNum", l.EmployeesNum);
            cmd.Parameters.AddWithValue("@Explain", l.Explains);
            cmd.Parameters.AddWithValue("@Chose2", l.Chose2);
            cmd.Parameters.AddWithValue("@Acompanies", l.Acompanies);
            cmd.Parameters.AddWithValue("@Approved", l.Approved);
            cmd.Parameters.AddWithValue("@ClientId", l.ClientId);
            cmd.Parameters.AddWithValue("@Close", Convert.ToInt32(l.Close));
            cmd.ExecuteNonQuery();
            con.Close();
            ClientC inter = new ClientC();
            Client  c     = inter.FindClient(l.ClientId);

            c.MiddleProcess = "1";
            inter.UpdateClient(c);
        }
Exemplo n.º 24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void exclusiveShouldWaitForShared()
        public virtual void ExclusiveShouldWaitForShared()
        {
            // When
            ClientA.acquireShared(LockTracer.NONE, NODE, 1L);

            // Then other shared locks are allowed
            ClientC.acquireShared(LockTracer.NONE, NODE, 1L);

            // But exclusive locks should wait
            Future <object> clientBLock = AcquireExclusive(ClientB, LockTracer.NONE, NODE, 1L).callAndAssertWaiting();

            // And when
            ClientA.releaseShared(NODE, 1L);
            ClientC.releaseShared(NODE, 1L);

            // Then this should not block
            AssertNotWaiting(ClientB, clientBLock);
        }
Exemplo n.º 25
0
        void CreatLoans1(Loans1 l)//create a loan
        {
            Loan1Checks(l);
            Loans1C inter = new Loans1C();

            inter.CreateLoan1(l);
            ClientC client = new ClientC();
            Client  c      = client.FindClient(l.ClientId);

            c.MiddleProcess = "1";
            client.UpdateClient(c);
            //send mail to the manager
            #region send mail to employee
            //need to change
            string       managerMail  = "*****@*****.**";
            var          fromAddress  = new MailAddress("*****@*****.**", "Cavalry Associates");
            var          toAddress    = new MailAddress(managerMail, c.Fname + " " + c.Lname + " Ask For Loan");
            const string fromPassword = "******";
            string       subject      = c.Fname + " " + c.Lname + " Ask For Loan";
            string       body         = "<h1> The Client: " + c.Fname + " " + c.Lname + " " + c.Mail + " Ask For A Loan</h1>" +
                                        "<img src=\"https://app.synccos.com/assets/images/cavalry-signin.png\" alt=\"Trulli\" width=\"500\" height=\"333\"></p>";


            var smtp = new SmtpClient
            {
                Host                  = "smtp.gmail.com",
                Port                  = 587,
                EnableSsl             = true,
                DeliveryMethod        = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials           = new NetworkCredential(fromAddress.Address, fromPassword)
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                message.IsBodyHtml = true;
                smtp.Send(message);
            }
            #endregion
        }
Exemplo n.º 26
0
 public void Submit(Loans1 l, string status, string uid)
 {
     if (status == "Client")
     {
         ClientC interc = new ClientC();
         if (interc.FindIfClientHasLoan(l.ClientId))
         {
             //ClientGlobal global = new ClientGlobal();
             UpdateLoan1(FindLoan1ByClient(l.ClientId));
             throw new Exception("The First Stage Has Been Successfully Updated");
         }
         else
         {
             Loans1 l1 = new Loans1(FindLoan1ByClient(l.ClientId));
             l.Id = l1.Id;
             CreatLoans1(l);
             UserC      u       = new UserC();
             SendEmailC send    = new SendEmailC();
             ClientC    c       = new ClientC();
             Client     c1      = c.FindClient(uid);
             string     message = "Client: " + c1.Mail + " " + c1.MobileNum + " " + c1.Fname + " " + c1.Lname + "Want a loan";
             send.SendEmailF(u.FindNeedEmail("Manager", uid), "Ask For Loan" + c1.Fname + " " + c1.Lname, message);
         }
     }
     else
     {
         //status will be the employee id
         UpdateLoan1(FindLoan1ByClient(l.ClientId));
         ClientGlobal global = new ClientGlobal();
         Client       c      = global.FindClient(l.ClientId);
         if (c.MiddleProcess == "1")
         {
             c.MiddleProcess = "1app";
             global.UpdateClient(c);
         }
         SendEmailC send    = new SendEmailC();
         ClientC    clientC = new ClientC();
         Client     c1      = clientC.FindClient(uid);
         string     message = "Hello " + c1.Fname + " " + c1.Lname + "We wanted to let you know that the application approved";
         send.SendEmailF(c1.Mail, "Approved Application", message);
     }
 }
Exemplo n.º 27
0
        public void CreateClient(Client c)
        {
            if (c.Mail == "")
            {
                throw new Exception("The Mail Field Is Empty");
            }
            if (c.Lname == "")
            {
                throw new Exception("The Last Name Field I s Empty");
            }
            if (c.Fname == "")
            {
                throw new Exception("The First Name Field Is Empty");
            }
            if (c.Address == "")
            {
                throw new Exception("The Address Field Is Empty");
            }
            if (c.Suite == "")
            {
                throw new Exception("The Suite Field Is Empty");
            }
            if (c.City == "")
            {
                throw new Exception("The City Field Is Empty");
            }
            if (c.Zip == "")
            {
                throw new Exception("The Zip Field Is Empty");
            }
            if (c.MobileNum == "" && c.HomeNum == "" && c.WorkNum == "")
            {
                throw new Exception("One Of The Phone Numbers Fields Must Be Full");
            }
            UserC u = new UserC();

            u.UpdateUser(new User(c.Mail, "", c.Fname, c.Lname, c.MobileNum));
            ClientC clientC = new ClientC();

            clientC.CreateClient(c);
        }
Exemplo n.º 28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustReleaseWriteLockWaitersOnStop()
        public virtual void MustReleaseWriteLockWaitersOnStop()
        {
            // Given
            ClientA.acquireShared(_tracer, NODE, 1L);
            ClientB.acquireShared(_tracer, NODE, 2L);
            ClientC.acquireShared(_tracer, NODE, 3L);
            AcquireExclusive(ClientB, _tracer, NODE, 1L).callAndAssertWaiting();
            AcquireExclusive(ClientC, _tracer, NODE, 1L).callAndAssertWaiting();

            // When
            ClientC.stop();
            ClientB.stop();
            ClientA.stop();

            // All locks clients should be stopped at this point, and all all locks should be released because none of the
            // clients entered the prepare phase
            LockCountVisitor lockCountVisitor = new LockCountVisitor();

            Locks.accept(lockCountVisitor);
            assertEquals(0, lockCountVisitor.LockCount);
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            ClientC clientC = new ClientC();

            clientC.OpenClient();
            while (true)
            {
                Thread.Sleep(16);
                clientC.SendAll();
                int delay = clientC.GetDelay();
                if (delay > 0)
                {
                    Console.WriteLine("clients " + " : " + delay + " ms");
                }
                clientC.UpdateTime();
                if (clientC.IsConnect() == false)
                {
                    break;
                }
            }
        }
Exemplo n.º 30
0
        public void AddNewRD(string reqDocs, string clientId)
        {
            ReqDocsC      i = new ReqDocsC();
            List <string> l = reqDocs.Split('@').ToList();

            foreach (var v in l)
            {
                if (v != "")
                {
                    i.insertDB(new ReqDocs(clientId, v, ""));
                }
            }
            ClientC inter = new ClientC();
            Client  c     = inter.FindClient(clientId);

            if (!c.Request)
            {
                c.Request = true;
                inter.UpdateClient(c);
            }
        }