Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #### AdherentService fel proejt service
- public class AdherentService:Service<adherent>, IAdherentService
- {
- static IDataBaseFactory Factory = new DataBaseFactory();
- static IUnitOfWork unitOfWork = new UnitOfWork(Factory);
- public AdherentService() : base(unitOfWork)
- {
- }
- #### IAdherentService interface fel projet service
- public interface IAdherentService : IService<adherent>
- {
- }
- ### tji mabad lel controlleur
- par exemple andi ena
- public class SignUpMoraleController : Controller
- ndeclari el service w n'instancih fel constructeur
- IAdherentService adherentService;
- public SignUpPhysiqueController()
- {
- adherentService = new AdherentService();
- }
- // POST: SignUpPhysique/Create
- [HttpPost]
- public ActionResult Create(AdherentPhysiqueVM adherentPhysiqueVM, HttpPostedFileBase file, HttpPostedFileBase file2)
- {
- adherent adh = new adherent()
- { adresse= adherentPhysiqueVM.adresse,
- categorieAbonnement = adherentPhysiqueVM.categorieAbonnement,
- cin = adherentPhysiqueVM.cin,
- codePostal= adherentPhysiqueVM.codePostal,
- DTYPE="AdhPhysique",
- email= adherentPhysiqueVM.email,
- lieuNaissance= adherentPhysiqueVM.lieuNaissance,
- solde=0,
- rib= adherentPhysiqueVM.rib,
- nbPoints=0,
- dateAdhesion= DateTime.Now,
- dateDerniereCotisation = DateTime.Now,
- etatCompte =(int)EtatCompte.NonConfirme,
- telephone= adherentPhysiqueVM.telephone,
- ville= adherentPhysiqueVM.ville,
- dateNaissance= adherentPhysiqueVM.dateNaissance,
- etatAdherent=(int)EA.Vivant,
- etatCivil= adherentPhysiqueVM.etatCivil,
- nationalite= adherentPhysiqueVM.nationalite,
- nbEnfants= adherentPhysiqueVM.nbEnfants,
- nom= adherentPhysiqueVM.nom,
- prenom= adherentPhysiqueVM.prenom,
- pseudonyme= adherentPhysiqueVM.pseudonyme,
- motDePasse = encryptedPassword(adherentPhysiqueVM.motDePasse),
- idAdherent =HibernateSequenceManager.getCurrentHibernateSequence()
- };
- if (file != null && file.ContentLength > 0 && file2 != null && file2.ContentLength > 0)
- {
- var fileName = Path.GetFileName(file.FileName);
- var fileName2 = Path.GetFileName(file2.FileName);
- string location = "C:\\wamp64\\www\\OTDAV\\";
- //create a folder
- DirectoryInfo di = Directory.CreateDirectory(location + adh.cin);
- //store the file
- file.SaveAs(location + adh.cin + "\\" + file.FileName);
- file2.SaveAs(location + adh.cin + "\\" + file2.FileName);
- }
- adh.copieCin = adh.cin + "/"+ file.FileName;
- adh.photoProfil = adh.cin + "/" + file2.FileName;
- adherentService.Add(adh);
- adherentService.Commit();
- HibernateSequenceManager.incrementHibernateSequence();
- return View();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement