示例#1
0
        public void AddOrderWithDetails(string email, int totalPrice, List <int> dishesCodes, List <int> dishesQuantities)
        {
            ClientOrder clOrder = new ClientOrder();

            clOrder.OrderState  = "on_Time";
            clOrder.TotalPrice  = totalPrice;
            clOrder.DateHourIn  = DateTime.Now;
            clOrder.ClientEmail = email;

            DAOClient daoClient = new DAOClient();
            DAODish   daoDish   = new DAODish();

            int orderCode = daoClient.AddOrder(clOrder);

            for (int i = 0; i < dishesCodes.Count; i++)
            {
                Dish dish     = daoDish.ChargeDish(dishesCodes[i]);
                int  quantity = dishesQuantities[i];

                OrderDetail orderDetail = new OrderDetail();
                orderDetail.OrderCode    = orderCode;
                orderDetail.DishCode     = dish.DishCode;
                orderDetail.DishPrice    = dish.DishPrice;
                orderDetail.DishQuantity = quantity;
                orderDetail.SubTotal     = dish.DishPrice * quantity;

                daoClient.AddOrderDetail(orderDetail);
            }
        }
示例#2
0
        public string disableStateDish(string email, bool state)
        {
            string    transaction = "The client is already disable";
            DAOClient dc          = new DAOClient();
            Client    cl          = new Client();

            cl.ClientEmail     = email;
            cl.ClientAvailable = state;
            dc.updateStateClient(cl);
            return(transaction);
        }
示例#3
0
        public Boolean registerClient(Client client)
        {
            DAOClient daoclient = new DAOClient();

            if (searchCpf(client.CPF) == null)
            {
                daoclient.save(client);
                return(true);
            }
            return(false);
        }
 /// <summary>
 ///  Recherche la liste des client dont le nom contient les lettres passé en paramètre
 /// </summary>
 /// <param name="search"></param>
 /// <returns></returns>
 public List <Client> Rechercher(string search)
 {
     cdao = new DAOClient();
     try
     {
         return(cdao.GetClientsByName(search));
     }
     catch (Exception ex)
     {
         throw new BLLExceptionsClient("[BLL] Rechercher : \n" + ex.Message, ex);
     }
 }
示例#5
0
        public static bool DeleteAll(string userName)
        {
            List <DTOClient> listClient = DAOClient.getListClient();

            foreach (DTOClient client in listClient)
            {
                if (client.UserName == userName)
                {
                    return(DAOData.DeleteAll(client.IDClient));
                }
            }
            return(false);
        }
        /// <summary>
        /// Mise à jour du client
        /// </summary>
        /// <param name="c"></param>
        /// <returns></returns>
        public int UpdateCLient(Client c)
        {
            cdao = new DAOClient();

            try
            {
                return(cdao.UpdateClient(c));
            }
            catch (Exception ex)
            {
                throw new BLLExceptionsClient("[BLL] UpdateClient : \n" + ex.Message, ex);
            }
        }
示例#7
0
        public void ClientLists()
        {
            DAOClient doc = new DAOClient();

            List <Client> ClientList = new List <Client>();

            ClientList = doc.ClientList();

            foreach (Client client in ClientList)
            {
                BLClient bldCt = new BLClient(client.ClientEmail, client.ClientName, client.ClientPassword, client.ClientAvailable);
                ClientListBL.Add(bldCt);
            }
        }
示例#8
0
        public static Client getClient(long idClient)
        {
            Client      client = null;
            IDataReader reader = DAOClient.get(idClient);

            if (reader.Read())
            {
                client = new Client();
                if (!reader.IsDBNull(0))
                {
                    client.IdClient = (int)reader.GetValue(0);
                }
                if (!reader.IsDBNull(1))
                {
                    client.Nom = (string)reader.GetValue(1);
                }
                if (!reader.IsDBNull(2))
                {
                    client.Prenom = (string)reader.GetValue(2);
                }
                if (!reader.IsDBNull(3))
                {
                    client.DateNaissance = (DateTime)reader.GetValue(3);
                }
                if (!reader.IsDBNull(4))
                {
                    client.Email = (string)reader.GetValue(4);
                }
                if (!reader.IsDBNull(5))
                {
                    client.AdressePrincipale = (string)reader.GetValue(5);
                }
                if (!reader.IsDBNull(6))
                {
                    client.AdresseTemporaire = (string)reader.GetValue(6);
                }
                if (!reader.IsDBNull(7))
                {
                    client.TelFixe = (string)reader.GetValue(7);
                }
                if (!reader.IsDBNull(8))
                {
                    client.TelPortable = (string)reader.GetValue(8);
                }
            }
            reader.Close();
            return(client);
        }
示例#9
0
        public List <BLClient> ChargeClientLists()
        {
            DAOClient doc = new DAOClient();

            List <Client>   ClientList = new List <Client>();
            List <BLClient> ListC      = new List <BLClient>();

            ClientList = doc.ClientList();

            foreach (Client client in ClientList)
            {
                BLClient bldCt = new BLClient(client.ClientEmail, client.ClientName, client.ClientPassword, client.ClientAvailable);
                ListC.Add(bldCt);
            }

            return(ListC);
        }
示例#10
0
        public void AddNewClient()
        {
            DAOClient dc = new DAOClient();

            Client cl = new Client();

            cl.ClientEmail     = ClientEmail;
            cl.ClientName      = ClientName;
            cl.ClientPassword  = ClientPassword;
            cl.ClientAvailable = ClientAvailable;

            Address ad = new Address();

            ad.ClientEmail     = ClientEmail;
            ad.PhysicalAddress = ClientAddress;

            dc.addClient(cl, ad);
        }
        protected void ButtonActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                DAOClient update  = new DAOClient();
                Cliente   cliente = (Cliente)Session["cliente"];

                Cliente cli = new Cliente();
                cli.Id         = cliente.Id;
                cli.Apellido_M = Request.Form["textApellidoMat"].ToString();
                cli.Apellido_P = Request.Form["textApellidoPat"].ToString();
                cli.Nombre     = Request.Form["textNombre"].ToString();
                cli.Correo     = Request.Form["textemail"].ToString();
                cli.Telefono   = Request.Form["Telefono"].ToString();
                //if (!string.IsNullOrEmpty(textcontrasena.Value))
                //    cli.Pass = textcontrasena.Value;
                cli.Fecha_Nacimiento = cliente.Fecha_Nacimiento;
                if (!string.IsNullOrEmpty(Request.Form["Tarjeta"].ToString()))
                {
                    cli.TarjetaChalan = Request.Form["Tarjeta"].ToString();
                }

                bool cambio = update.UpdateCliente(cli);
                if (cambio)
                {
                    cliente.Nombre           = cli.Nombre;
                    cliente.Apellido_M       = cli.Apellido_M;
                    cliente.Apellido_P       = cli.Apellido_P;
                    cliente.Telefono         = cli.Telefono;
                    cliente.Correo           = cli.Correo;
                    cliente.Fecha_Nacimiento = cli.Fecha_Nacimiento;
                    cliente.TarjetaChalan    = cli.TarjetaChalan;
                    Session["cliente"]       = cliente;
                    Response.Redirect("Cuenta.aspx#cuenta");
                }

                else
                {
                    Response.Redirect("Cuenta.aspx#notupdate");
                }
            }
            catch (Exception ex) { string error = ex.Message; }
        }
示例#12
0
        public string UpdateClient(BLClient client)
        {
            string update = "No se pudo realizar la actualización";

            ClientLists();
            DAOClient dc = new DAOClient();

            foreach (BLClient blc in ClientListBL)
            {
                if (blc.ClientEmail == client.ClientEmail)
                {
                    Client cl = new Client();
                    cl.ClientName      = client.ClientName;
                    cl.ClientPassword  = client.ClientPassword;
                    cl.ClientAvailable = client.ClientAvailable;
                    dc.updateClient(cl);
                    update = "Actualización exitosa de cliente";
                    return(update);
                }
            }
            return(update);
        }
示例#13
0
 private void btn_Transferer_Click(object sender, EventArgs e)
 {
     if (txt_Mdp.Text != "" && txt_NomBase.Text != "" && txt_AdresseServeur.Text != "" && txt_Utilisateur.Text != "")
     {
         lbl_erreur.Text = "";
         try
         {
             try
             {
                 DAOClient newConnexion = new DAOClient(txt_AdresseServeur.Text, txt_Port.Text, txt_Utilisateur.Text, txt_Mdp.Text, txt_NomBase.Text);
                 this.cm = new ClientManager(txt_parcourir.Text, newConnexion);
                 this.cm.PushToDataBase();
                 txt_rapport.Text           = this.cm.GetRapport();
                 txt_Mdp.Enabled            = false;
                 txt_NomBase.Enabled        = false;
                 txt_Port.Enabled           = false;
                 txt_AdresseServeur.Enabled = false;
                 txt_MailRapport.Enabled    = true;
                 txt_Utilisateur.Enabled    = false;
                 btn_Ajouter.Enabled        = true;
                 btn_Transferer.Enabled     = false;
                 btn_Supprimer.Enabled      = false;
                 btn_DemRapport.Enabled     = true;
             }
             catch (NpgsqlException ex) {
                 MessageBox.Show("Identifiants de la BDD incorrect", "ERREUR", MessageBoxButtons.OK);
             }
         }
         catch (Exception ex)
         {
             erreurIcone.SetError(txt_parcourir, "Aucun fichier n'a été selectionné !");
         }
     }
     else
     {
         lbl_erreur.Text = "Certains champs n'ont pas été renseigné !";
     }
 }
示例#14
0
        public BLClient GetUserLoginValidation(string email, string password)
        {
            DAOClient da   = new DAOClient();
            BLClient  clBL = new BLClient();
            Client    cl   = new Client();

            cl.ClientEmail    = email;
            cl.ClientPassword = password;

            Client clFound = da.UserLoginValidation(cl);

            if (clFound == null)
            {
                return(null);
            }
            else
            {
                clBL.ClientEmail    = clFound.ClientEmail;
                clBL.ClientPassword = clFound.ClientPassword;

                return(clBL);
            }
        }
示例#15
0
 public static bool Test(string userName)
 {
     return(DAOClient.Test(userName));
 }
示例#16
0
 public static bool Delete(string userName)
 {
     return(DAOClient.Delete(userName));
 }
示例#17
0
 public static bool Update(DTOClient client)
 {
     return(DAOClient.Update(client));
 }
示例#18
0
 public static bool Insert(DTOClient client)
 {
     return(DAOClient.Insert(client));
 }
示例#19
0
 public static List <DTOClient> getListClient()
 {
     return(DAOClient.getListClient());
 }
示例#20
0
 public static DataTable RechercherClients(CritereRechercheClient criteres)
 {
     return(DAOClient.getDataTable(criteres));
 }
示例#21
0
        public string getNameClient(string email)
        {
            DAOClient client = new DAOClient();

            return(client.ChargeClient(email).ClientName.ToString());
        }
示例#22
0
 public ClientManager(string path, DAOClient uneConnexion)
 {
     this.rapport    = new Rapport(path);
     this.lesClients = new List <Client>();
     this.pusher     = uneConnexion;
 }
示例#23
0
        public Client searchCpf(String cpf)
        {
            DAOClient daoclient = new DAOClient();

            return(daoclient.rescueCPF(cpf));
        }
示例#24
0
 public static bool TestLogin(string userName, string passWord)
 {
     return(DAOClient.TestLogin(userName, passWord));
 }
示例#25
0
 public static DTOClient Search(int idClient)
 {
     return(DAOClient.Search(idClient));
 }
示例#26
0
        //this constructor is only to use in the test fase
        public ClientService()
        {
            DAOClient client = new DAOClient();

            client.deleteAll();
        }