private async void BtnAcceptChanges_Click(object sender, RoutedEventArgs e) { try { ClientVM client = (ClientVM)dgShowClients.SelectedItem; string str = txtNumber.Text; string str2 = txtName.Text; string str3 = txtEmail.Text; if (str != null && str.Trim().Length == 10) { str = string.Format("+38{0}({1}){2}-{3}-{4}", str.Substring(0, 1), str.Substring(1, 2), str.Substring(3, 3), str.Substring(6, 2), str.Substring(8, 2)); } txtNumber.Text = str; txtName.Text = str2; txtEmail.Text = str3; ClientApiService service = new ClientApiService(); await service.UpdateAsync(new ClientVM { Id = client.Id, Name = txtName.Text, Phone = txtNumber.Text, Email = txtEmail.Text }); FillDG(); txtNumber.Text = ""; txtName.Text = ""; txtEmail.Text = ""; lblPhoneError.Foreground = System.Windows.Media.Brushes.White; lblNameError.Foreground = System.Windows.Media.Brushes.White; lblEmailError.Foreground = System.Windows.Media.Brushes.White; lblPhotoError.Foreground = System.Windows.Media.Brushes.White; } catch (WebException wex) { ShowException(wex); } }
public static bool IsLoginLibre(string value) { List <string> _listeLogin = new List <string>(); ClientApiService clientApi = ClientApiService.GetLoadBalancer(); _listeLogin = clientApi.GetAll().Select(p => p.clientLogin).ToList(); bool test = true; if (value != null) { string login = value.ToString(); if (_listeLogin.Count() > 0) { for (int i = 0; i < _listeLogin.Count(); i++) { if (_listeLogin[i].ToLower() == login.ToLower()) { test = false; i = _listeLogin.Count() + 1; } } } else { test = true; } } else { test = false; } return(test); }
public SelectClientWindow(OrderVM order) { InitializeComponent(); _order = order; servise = new ClientApiService(); FillDG(); }
public Client AddClientApiService() { Api = new ClientApiService(Logger, Convert, Network, new TerminateErrorHandleStrategy(Logger)); AddCommon(); return(this); }
private async void BtnFindClient_Click(object sender, RoutedEventArgs e) { ClientApiService service = new ClientApiService(); client = await service.GetClientsAsync(new ClientVM { Email = txtEmail.Text, Name = txtName.Text, Phone = txtNumber.Text }); dgShowClients.ItemsSource = client; }
public ActionResult EditClient(int id) { if (Utils.Client != null) { ClientApiService clientApi = ClientApiService.GetLoadBalancer(); return(View(clientApi.GetOne(id).GetClientASP().GetEditClient())); } else { return(RedirectToAction("Accueil", "Home", new { area = "" })); } }
public ActionResult Inscription(FormCreateClient createClient) { if (Verif.IsLoginValid(createClient.clientLogin) && Verif.IsMajeur(createClient.clientDateNaissance)) { ClientApiService clientApiService = ClientApiService.GetLoadBalancer(); clientApiService.Create(createClient.GetClientAspFromFormClient().GetClientDalAPI()); return(RedirectToAction("Connection")); } else { ViewBag.Messages = "Login ou date de naissance pas valide"; return(View(createClient)); } }
private async void BtnFindClient_Click(object sender, RoutedEventArgs e) { var url = ConfigurationManager.AppSettings["siteURL"]; ClientApiService service = new ClientApiService(); client = await service.GetClientsAsync(new ClientVM { Email = txtEmail.Text, Name = txtName.Text, Phone = txtNumber.Text }); foreach (var item in client) { item.Image = url + "/" + item.Image; } dgShowClients.ItemsSource = client; }
private void BtnDeleteClient_Click(object sender, RoutedEventArgs e) { ClientVM client = (ClientVM)dgShowClients.SelectedItem; MessageBoxResult result = MessageBox.Show("Ви впевнені,що хочете видалити клієнта " + client.Name + "?", "Видалення", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { ClientApiService service = new ClientApiService(); service.Delete(new ClientDeleteVM { Id = client.Id }); FillDG(); } }
public ActionResult DeleteClient(int id) { if (Utils.Client != null) { ClientApiService clientApi = ClientApiService.GetLoadBalancer(); clientApi.Delete(id); Session.Clear(); Session.Abandon(); return(RedirectToAction("Accueil", "Home", new { area = "" })); } else { return(RedirectToAction("Index")); } }
private async void BtnAddClient_Click(object sender, RoutedEventArgs e) { try { lblPhoneError.Foreground = System.Windows.Media.Brushes.White; lblNameError.Foreground = System.Windows.Media.Brushes.White; lblEmailError.Foreground = System.Windows.Media.Brushes.White; lblPhotoError.Foreground = System.Windows.Media.Brushes.White; lblPhoneError.Content = ""; lblNameError.Content = ""; lblEmailError.Content = ""; string str = txtNumber.Text; string str2 = txtName.Text; string str3 = txtEmail.Text; if (str != null && str.Trim().Length == 10) { str = string.Format("+38{0}({1}){2}-{3}-{4}", str.Substring(0, 1), str.Substring(1, 2), str.Substring(3, 3), str.Substring(6, 2), str.Substring(8, 2)); } txtNumber.Text = str; txtName.Text = str2; txtEmail.Text = str3; ClientApiService service = new ClientApiService(); await service.CreateAsync(new ClientAddVM { Name = txtName.Text, Phone = txtNumber.Text, Image = main_base64Image, Email = txtEmail.Text, UniqueName = Guid.NewGuid().ToString() }); FillDG(); PhotoClient = null; txtNumber.Text = ""; txtName.Text = ""; txtEmail.Text = ""; lblPhoneError.Content = ""; lblPhotoError.Content = ""; lblNameError.Content = ""; lblEmailError.Content = ""; lblPhoneError.Foreground = System.Windows.Media.Brushes.White; lblPhotoError.Foreground = System.Windows.Media.Brushes.White; lblNameError.Foreground = System.Windows.Media.Brushes.White; lblEmailError.Foreground = System.Windows.Media.Brushes.White; } catch (WebException wex) { ShowException(wex); } }
public ActionResult Connection(string login, string pwd) { ClientApiService clientApi = ClientApiService.GetLoadBalancer(); int?id = clientApi.Connection(login, pwd); if (id != null) { ClientASP client = clientApi.GetOne((int)id).GetClientASP(); //Session["test4"] = client.clientLogin; Utils.Client = client; string test = Utils.Client.clientLogin; //string test2 = (string)Session["test4"]; return(RedirectToAction("Index", "Client/Client")); } else { ViewBag.Messages = "Login ou mot de passe non valide"; return(View()); } }
public ActionResult EditClient(EditClient clientASP) { if (Utils.Client != null) { if (Verif.IsLoginValid(clientASP.clientLogin)) { ClientApiService clientApi = ClientApiService.GetLoadBalancer(); clientApi.Update(clientASP.GetCommandeASPFromEditClient().GetClientDalAPI()); Utils.Client.clientLogin = clientASP.clientLogin; return(RedirectToAction("Index")); } else { ViewBag.Messages = "Login non valide"; return(View(clientASP)); } } else { return(RedirectToAction("Accueil", "Home", new { area = "" })); } }
public ShowClients() { InitializeComponent(); servise = new ClientApiService(); FillDG(); }
public SelectClientWindow() { InitializeComponent(); servise = new ClientApiService(); FillDG(); }
public IsPasPrisAttribute(): base("login déjà utilsé") { ClientApiService clientApi = ClientApiService.GetLoadBalancer(); _listeLogin=clientApi.GetAll().Select(p => p.clientLogin).ToList(); }
public RestApiService(Uri baseUri) { _baseUri = baseUri; clientService = new ClientApiService(_baseUri); }