/// <summary>加载会员消费记录。</summary> private void LoadMemberPayList() { List <Pays> lstPays = new Pays().SelectList("", this._strMemberId, this.cboDate.Year, this.cboDate.Month, 0, null, null); this.dgvPays.AutoGenerateColumns = false; this.dgvPays.Rows.Clear(); decimal dSum = 0; //合计 decimal dBalance = 0; //余额消费 decimal dCash = 0; //现金消费 foreach (Pays objPay in lstPays) { if (objPay.Status == 1) { dSum += objPay.Money; if (objPay.PayType == 1) { dBalance += objPay.Money; } else { dCash += objPay.Money; } } this.dgvPays.Rows.Add(new object[] { objPay.PayID, objPay.Money, objPay.PayContent, objPay.PayDate, objPay.PayTypeText, objPay.Remark }); } this.lblSum.Text = "消费合计:¥" + dSum.ToString("f2"); this.lblPayBalance.Text = "余额消费:¥" + dBalance.ToString("f2"); this.lblCash.Text = "现金消费:¥" + dCash.ToString("f2"); }
private void dgvPays_MouseDown(object sender, MouseEventArgs e) { DataGridView.HitTestInfo rows = this.dgvPays.HitTest(e.X, e.Y); if (e.Button == MouseButtons.Right) { if (rows.RowIndex > -1 && rows.ColumnIndex > -1) { //定位 this.dgvPays.ClearSelection(); this.dgvPays.Rows[rows.RowIndex].Selected = true; this.dgvPays.CurrentCell = this.dgvPays.Rows[rows.RowIndex].Cells[rows.ColumnIndex]; string strPayId = this.dgvPays.CurrentRow.Cells[0].Value.ToString(); Pays objPay = new Pays(strPayId); if (objPay.Status == 0) { this.cmnuPays_Delete.Enabled = true; this.cmnuPays_OK.Enabled = true; } else { this.cmnuPays_Delete.Enabled = false; this.cmnuPays_OK.Enabled = false; } this.cmnuPays_Remark.Enabled = true; } else { this.cmnuPays_Delete.Enabled = false; this.cmnuPays_OK.Enabled = false; this.cmnuPays_Remark.Enabled = false; } } }
private async void list_selected(object sender, EventArgs e) { ListView vl = (ListView)sender; part = (Pays)vl.SelectedItem; await Navigation.PushModalAsync(new MyPage_Ville()); }
public void UpdatePaysDetached(Pays e) { Pays existing = this.DataContext.Pays.Find(e.idPays); ((IObjectContextAdapter)DataContext).ObjectContext.Detach(existing); this.DataContext.Entry(e).State = EntityState.Modified; }
/// <summary>保存消费单据,</summary> private string Save_Click() { Pays objPay = new Pays(); if (this.ValidateData()) { objPay.PayID = this.txtCode.Text.Trim(); objPay.MemberId = this.txtClient.Text.Trim(); if (objPay.MemberId == "") { objPay.MemberId = "0"; } objPay.EmpID1 = int.Parse(this.cboEmp1.SelectedValue.ToString()); objPay.EmpID2 = int.Parse(this.cboEmp2.SelectedValue.ToString()); objPay.EmpID3 = int.Parse(this.cboEmp3.SelectedValue.ToString()); objPay.Money = this.numMoney.Value; objPay.Remark = this.txtRemark.Text.Trim(); objPay.PayDate = DateTime.Parse(this.dtpPayDate.Value.Date.ToShortDateString() + " " + DateTime.Now.ToLongTimeString()); if (objPay.InsertPay() > 0)//新增消费单据 { foreach (PayDetail objDetail in StaticValue.g_lstTempPayDetails) { objDetail.PayID = objPay.PayID; objDetail.InsertDetail(); } } return(objPay.PayID); } return(""); }
public void SupprimerPays(Pays pays, Employe employe) { operationBLO = new OperationBLO(); paysBLO.Remove(pays); operationBLO.AjouterOperation(TypeOperation.Suppression, employe, new Client("Indefini"), new CompteClient("Indefini"), 0, "toto tata"); }
/// <summary> /// Ecrit les nombres de 0 à 999 /// </summary> /// <param name="Nombre">Nombre à écrire</param> /// <param name="LePays">Pays d'utilisation, pour spécificitées régionnales</param> /// <param name="RegleDuCent">pour 400 cent prend un s alors que pour 400 000 ou 0.400 non </param> private static string Ecrit3Chiffres(int Nombre, Pays LePays, bool RegleDuCent) { if (Nombre == 100) { return("cent"); } if (Nombre < 100) { return(Ecrire2Chiffres(Nombre, LePays)); } int centaine = Nombre / 100; int reste = Nombre % 100; if (reste == 0) { if (RegleDuCent)//Cent prend un s quand il est multiplié et non suivi d'un nombre, comme le cas de 100 est déjà traité on est face à un multiple { return(jusqueSeize[centaine] + " cents"); } else { return(jusqueSeize[centaine] + " cent");// par contre s'il est suivi de mille, millions, millièmes etc... pas de s } } if (centaine == 1) { return("cent " + Ecrire2Chiffres(reste, LePays));//on ne dit pas un cent X, mais cent X } return(jusqueSeize[centaine] + " cent " + Ecrire2Chiffres(reste, LePays)); }
/// <summary>加载员工业绩</summary> private void LoadPaysForEmployee() { int iYear = int.Parse(this.cboYear.Text); int iMonth = int.Parse(this.cboMonth.Text); List <Pays> lstPays = new Pays().SelectListForEmployee(this.m_iEmpId, iYear, iMonth); this.dgvPays.AutoGenerateColumns = false; this.dgvPays.Rows.Clear(); decimal dMoney = 0; //decimal dBonus = 0; foreach (Pays objPay in lstPays) { dMoney += objPay.Money; this.dgvPays.Rows.Add(new object[] { objPay.PayID, objPay.PayContent, objPay.Money, objPay.PayDate, objPay.Remark }); } this.lblSum.Text = "本月总业绩:¥" + dMoney.ToString("f2"); //if (this.m_objEmployee.Post.Mode == 1)//提成 //{ // dBonus = dMoney * decimal.Parse(this.m_objEmployee.Post.Bonus); //} //else if (this.m_objEmployee.Post.Mode == 2)//手工费 //{ } //dBonus = Math.Round(dBonus); //this.lblBonus.Text = "本月业绩提成:¥" + dBonus.ToString("f2"); }
public int CreerAssociation(string libelle, string nom, int idMission, int idPays, out string msgerr) { int nbAjout = 0; msgerr = ""; Mission uneMission = new Mission(idMission); Pays unPays = new Pays(idPays); Association uneAssociation = new Association(libelle, nom, uneMission, unPays); try { nbAjout = AssociationDAO.GetInstance().AjoutAssociation(uneAssociation); } catch (SqlException err) { msgerr = "ERREUR requête SQL : " + err.Message; } catch (Exception err) { msgerr = "ERREUR GRAVE : " + err.Message; } return(nbAjout); }
private void frmPays_Remark_Load(object sender, EventArgs e) { Pays objPay = new Pays(this._strPayId); this.lblPayID.Text = this._strPayId; this.txtRemark.Text = objPay.Remark; }
public async Task Get_WhenCalledWithId_ReturnOkResult_PaysAsync() { // Arrange Pays tunisie = new Pays { Id = 219, Code = 788, Alpha2 = "TN", Alpha3 = "TUN", NomEN = "Tunisia", NomFR = "Tunisie" }; MockRepository .Setup(r => r.GetAsync(tunisie.Id)).Returns(Task.FromResult(tunisie.Clone() as Pays)); MockDistributedCache .Setup(r => r.GetAsync($"{PaysController.DC_PAYS}-{tunisie.Id.ToString()}", CancellationToken.None)).Returns(Task.FromResult(null as byte[])); var controller = new PaysController(MockRepository.Object, Mapper, MockMemoryCache.Object, MockDistributedCache.Object, MockLogger.Object); // Act var result = await controller.GetPays(tunisie.Id); // Assert var actionResult = result as ActionResult <PaysModel>; Assert.IsNotNull(actionResult); Assert.IsAssignableFrom(typeof(ActionResult <PaysModel>), actionResult); Assert.That(actionResult.Value, Is.EqualTo(Mapper.Map <PaysModel>(tunisie.Clone()))); }
private void frmPays_Modify_Load(object sender, EventArgs e) { this.LoadAllEmployee(); this._objPay = new Pays(this._strPayId); this.txtCode.Text = this._objPay.PayID; if (this._objPay.MemberId != "0")//获取会员信息 { this.txtClient.Text = this._objPay.MemberId; StaticValue.g_dBonus = this._objPay.Member.Card.Discount;//获取该会员消费折扣 } this.cboEmp1.SelectedValue = this._objPay.EmpID1; this.cboEmp2.SelectedValue = this._objPay.EmpID2; this.cboEmp3.SelectedValue = this._objPay.EmpID3; this.txtRemark.Text = this._objPay.Remark; this.dtpPayDate.Value = this._objPay.PayDate; if (this._objPay.Status == 1) { this.Text += " - 已结算"; this.txtClient.ReadOnly = true; this.txtClient.BackColor = Color.White; this.btnAdd.Enabled = false; this.btnDelete.Enabled = false; this.cmnuDetails_Bonus.Enabled = false; this.btnOk.Visible = false; } StaticValue.g_lstTempPayDetails.AddRange(this._objPay.PayDetails); this.LoadPayDetails(); }
public async Task <IActionResult> Delete(int id) { if (ModelState.IsValid) { try { Pays _pays = _unitOfWork.Pays.GetSingleOrDefault(e => e.Id == id); if (_pays != null) { _unitOfWork.Pays.Remove(_pays); await _unitOfWork.SaveChangesAsync(); return(Ok("OK")); } else { return(BadRequest()); } } catch (Exception ex) { return(BadRequest(ex.Data)); } } else { return(BadRequest(ModelState)); } }
public List <Pays> List_Pays() { List <Pays> list_Pays = new List <Pays>(); using (SqlConnection connection = new SqlConnection(connectionString)) { string sqlQuery = "Select * from dbo.Pays"; SqlCommand command = new SqlCommand(sqlQuery, connection); connection.Open(); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { Pays pays = new Pays(); pays.Id = reader.GetInt32(0); pays.Nom = reader.GetString(1); list_Pays.Add(pays); } } return(list_Pays); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nom")] Pays pays) { if (id != pays.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pays); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaysExists(pays.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } _localization.ApplyTranslate(pays); return(View(pays)); }
private void button3_Click(object sender, EventArgs e) { string URL_SERVICE = "http://user23.2isa.org/Service1.svc"; RestClient client = new RestClient(URL_SERVICE); // METHODE 3 - Page 12 sur 20 - Doc Pays pays = null; string nom = listBox4.Text; listBox3.Items.Clear(); var request = new RestRequest("Pays/{nom}", Method.GET); request.AddParameter("nom", nom, ParameterType.UrlSegment); var response = client.Execute <Pays>(request); if (response.ResponseStatus == ResponseStatus.Completed) { pays = response.Data; listBox3.Items.Add(pays.Nom); listBox3.Items.Add(pays.Capitale); listBox3.Items.Add(pays.NbHabitants); listBox5.Items.Add(pays.Nom); listBox5.Items.Add(pays.Capitale); listBox5.Items.Add(pays.NbHabitants); bindingSource1.DataSource = pays; dataGridView1.DataSource = bindingSource1; } }
public ActionResult Create([Bind(Include = "PaysID,Pays_nom")] Pays pays, HttpPostedFileBase upload) { if (ModelState.IsValid) { if (upload != null && upload.ContentLength > 0) { var drapeau = new File { FileName = System.IO.Path.GetFileName(upload.FileName), FileType = FileType.Drapeau, ContentType = upload.ContentType }; using (var reader = new System.IO.BinaryReader(upload.InputStream)) { drapeau.Content = reader.ReadBytes(upload.ContentLength); } pays.Files = new List <File> { drapeau }; } db.Pays.Add(pays); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pays)); }
public void AjouterClient(string nomComplet, DateTime?dateNaissance, string lieuNaissance, StatutSexe?sexe, string numeroCNI, string numeroTelephone1, string numeroTelephone2, Pays pays, Ville ville, string adresse, string photoProfil, string profession, TypeCompte typeCompte, TypeAppartenantCompteEpargne?typeAppartenantCompteEpargne, string nomStructure, Employe employe, int nombreMois, double montant) { operationBLO = new OperationBLO(); fichierStockeBLO = new FichierStockeBLO(); compteClientBLO = new CompteClientBLO(); Client client = new Client(CodeClient, nomComplet, dateNaissance, lieuNaissance, sexe, numeroCNI, numeroTelephone1, numeroTelephone2, pays, ville, adresse, photoProfil, DateTime.Now, profession, StatutClient.Desactivé); clientBLO.Add(client); compteClientBLO.AjouterCompteClient(client, typeCompte, typeAppartenantCompteEpargne, nomStructure, nombreMois, montant, employe); operationBLO.AjouterOperation(TypeOperation.Ajout, employe, client, compteClientBLO.RechercherUnCompte(compteClientBLO.CodeCompteClient(typeCompte, typeAppartenantCompteEpargne)), 0, "toto tata"); if (photoProfil != string.Empty) { fichierStockeBLO.AjouterFichierStocke($"Photo du client {CodeClient}", photoProfil, client, new Garantie(0), StatutStockage.Image_des_clients, employe); } new IdentifiantBLO().AddIdClient(); }
public void EditerClient(Client client, string nomComplet, DateTime dateNaissance, string lieuNaissance, StatutSexe sexe, string numeroCNI, string numeroTelephone1, string numeroTelephone2, Pays pays, Ville ville, string adresse, string photoProfil, string profession, Employe employe) { operationBLO = new OperationBLO(); fichierStockeBLO = new FichierStockeBLO(); int index = clientBLO.IndexOf(client); string fileName = client.PhotoProfil; client.NomComplet = nomComplet; client.DateNaissance = dateNaissance; client.LieuNaissance = lieuNaissance; client.Sexe = sexe; client.NumeroCNI = numeroCNI; client.NumeroTelephone1 = numeroTelephone1; client.NumeroTelephone2 = numeroTelephone2; client.Pays = pays; client.Ville = ville; client.Adresse = adresse; client.PhotoProfil = photoProfil; client.Profession = profession; if (photoProfil != fileName) { fichierStockeBLO.AjouterFichierStocke($"Photo du client {client.CodeClient}", photoProfil, client, new Garantie(0), StatutStockage.Image_des_clients, employe); } clientBLO[index] = client; operationBLO.AjouterOperation(TypeOperation.Ajout, employe, client, new CompteClient("Indefini"), 0, "toto tata"); }
public async Task <IActionResult> PutPays(int id, Pays pays) { if (id != pays.Id) { return(BadRequest()); } _context.Entry(pays).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaysExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Pays> > PostPays(Pays pays) { _context.Pays.Add(pays); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPays", new { id = pays.Id }, pays)); }
public void UpdatePays(Pays unPays) { Dictionary <string, string> values = new Dictionary <string, string>(); values["Nom"] = "'" + unPays.Nom.Replace("'", "\\'") + "'"; mydbal.Update("pays", values, "Id = " + unPays.Id); }
public IActionResult ManagePOST(Pays pays) { if (ModelState.IsValid) { Pays newPays = new Pays { IdPays = (pays.IdPays != 0) ? pays.IdPays : 0, Nom = pays.Nom }; if (pays.IdPays != 0) { _paysRepository.Update(pays); } else { _paysRepository.Add(newPays); } return(RedirectToAction(nameof(PaysController.Index), "Pays", new { area = "Administration" })); } else { return(this.View(nameof(PaysController.Manage), pays)); } }
public Fromage SelectById(int id) { DataRow rowFromage = this.thedbal.SelectById("fromage", id); Pays myPays = this.theDaoPays.SelectById((int)rowFromage["pays_origine_id"]); return(new Fromage((int)rowFromage["id"], (string)rowFromage["name"], (DateTime)rowFromage["creation"], myPays, (string)rowFromage["image"])); }
public List <Association> GetAssociation() { //Declaration des variables de travail int id; string nom; string mission; string pays; string libelle; Association uneAssociation; Mission uneMission; Pays unPays; //On recupere l'objet responsable de la connection a la base SqlConnection cnx = Connexion.GetObjConnexion(); //On cree la collection lesClients qui vas contenir toute les caracteristique des cleints enregistrer dans la base de donnée List <Association> lesAssos = new List <Association>(); //On cree l'objet de type SqlCommand qui vas contenir la requete SQL permettant d'obtenir toutes les caracteristiques de tous les client string sql; sql = "spCnsAssociation"; SqlCommand maCommande = new SqlCommand(sql, cnx); maCommande.CommandText = sql; //On execute la requette dataReader SqlDataReader monLecteur; monLecteur = maCommande.ExecuteReader(); //Pour chaque enregistrement du dateReader on cree les eregistrements while (monLecteur.Read()) { id = (int)monLecteur["idAssociation"]; libelle = (string)monLecteur["libelleAssociation"]; nom = (string)monLecteur["nomResponsable"]; int idMission = (int)monLecteur["idPays"]; mission = (string)monLecteur["libelleMission"]; int idPays = (int)monLecteur["idMission"]; pays = (string)monLecteur["nomPaysFr"]; uneMission = new Mission(idMission, mission); unPays = new Pays(idPays, pays); uneAssociation = new Association(id, libelle, nom, uneMission, unPays); lesAssos.Add(uneAssociation); } monLecteur.Close(); //On ferme la connection Connexion.CloseConnexion(); //On retourne la collection return(lesAssos); }
public ActionResult DeleteConfirmed(int id) { Pays pays = db.Pays.Find(id); db.Pays.Remove(pays); db.SaveChanges(); return(RedirectToAction("Index")); }
public IHttpActionResult Post(Pays pays) { JourneyAgencyDb db = new JourneyAgencyDb(); db.Pays.Add(pays); db.SaveChanges(); return(Ok()); }
public void InsertPays(Pays unPays) { Dictionary <string, string> values = new Dictionary <string, string>(); values["id"] = unPays.Id.ToString(); values["nom"] = "'" + unPays.Nom.Replace("'", "\\'") + "'"; mydbal.Insert("pays", values); }
public static PaysModel PaysToPaysModel(Pays pm) { return(new PaysModel() { IdPays = pm.IdPays, Libelle = pm.Libelle }); }
public Fromage SelectByName(string name) { string search = "name = '" + name + "'"; DataTable tableFromage = this.thedbal.SelectByField("fromage", search); Pays myPays = this.theDaoPays.SelectById((int)tableFromage.Rows[0]["pays_origine_id"]); return(new Fromage((int)tableFromage.Rows[0]["id"], (string)tableFromage.Rows[0]["name"], (DateTime)tableFromage.Rows[0]["creation"], myPays, (string)tableFromage.Rows[0]["image"])); }
/// <summary> /// Met à jour l'état en bas pour l'utilisateur /// </summary> /// <param name="typeEtat">texte : "Filtrage", "Ajout", "Modification", "Suppression", "Look", "" ("" = Chargement)</param> /// <param name="dao">un objet Commande_Fournisseur soit pour l'ajouter au listing, soit pour afficher qui a été modifié ou supprimé</param> public void MiseAJourEtat(string typeEtat, Pays lib) { //Je racalcul le nombre max d'élements this.recalculMax(); //En fonction de l'libion, j'affiche le message if (typeEtat == "Filtrage") { ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "filtrage des pays terminé : " + this.mesPays.Count() + " / " + this.max; } else if (typeEtat == "Ajout") { //J'ajoute la commande_fournisseur dans le linsting this.mesPays.Add(lib); //Je racalcul le nombre max d'élements après l'ajout this.recalculMax(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un pays dénommé '" + lib.Libelle + "' effectué avec succès. Nombre d'élements : " + this.mesPays.Count() + " / " + this.max; } else if (typeEtat == "Modification") { //Je raffraichis mon datagrid this._DataGridMain.Items.Refresh(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Modification d'un pays dénommé : '" + lib.Libelle + "' effectuée avec succès. Nombre d'élements : " + this.mesPays.Count() + " / " + this.max; } else if (typeEtat == "Suppression") { //Je supprime de mon listing l'élément supprimé this.mesPays.Remove(lib); //Je racalcul le nombre max d'élements après la suppression this.recalculMax(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Suppression d'un pays dénommé : '" + lib.Libelle + "' effectuée avec succès. Nombre d'élements : " + this.mesPays.Count() + " / " + this.max; } else if (typeEtat == "Look") { } else { ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Chargement des pays terminé : " + this.mesPays.Count() + " / " + this.max; } //Je retri les données dans le sens par défaut this.triDatas(); //J'arrete la progressbar ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = false; }
/// <summary> /// Ajoute une nouvelle civilité à la liste à l'aide d'une nouvelle fenêtre /// </summary> public Pays Add() { //Affichage du message "ajout en cours" ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = true; ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un pays en cours ..."; //Initialisation de la fenêtre PaysWindow paysWindow = new PaysWindow(); //Création de l'objet temporaire Pays tmp = new Pays(); //Mise de l'objet temporaire dans le datacontext paysWindow.DataContext = tmp; //booléen nullable vrai ou faux ou null bool? dialogResult = paysWindow.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value == true) { //Si j'appuie sur le bouton Ok, je renvoi l'objet banque se trouvant dans le datacontext de la fenêtre return (Pays)paysWindow.DataContext; } else { try { //On détache la commande ((App)App.Current).mySitaffEntities.Detach((Pays)paysWindow.DataContext); } catch (Exception) { } //Si j'appuie sur le bouton annuler, je préviens que j'annule mon ajout ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = false; this.recalculMax(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un pays annulé : " + this.mesPays.Count() + " / " + this.max; return null; } }