Exemplo n.º 1
0
        public IEnumerable <Course> GetAllC()
        {
            ContactDAO    dao        = new ContactDAO();
            List <Course> lesCourses = dao.getAllCourse();

            return(lesCourses.ToList());
        }
        public ActionResult Edit(int id)
        {
            ContactDAO contactDAO = new ContactDAO();
            var        contacting = contactDAO.GetContact(id);

            return(View(contacting));
        }
Exemplo n.º 3
0
        public JsonResult Send(string name, string email, string phone, string address, string message)
        {
            var feedback = new Feedback();

            feedback.Name        = name;
            feedback.Email       = email;
            feedback.CreatedDate = DateTime.Now;
            feedback.Phone       = phone;
            feedback.Address     = address;
            feedback.Content     = message;

            var id = new ContactDAO().Insert(feedback);

            if (id > 0) //nếu có giá trị truyền vào
            {
                return(Json(new
                {
                    status = true
                }));
                //send mail
            }
            else
            {
                return(Json(new
                {
                    status = false
                }));
            }
        }
Exemplo n.º 4
0
        public ActionResult FicheContact(String id)
        {
            ActionResult retour = View();

            if (Session["UserID"] == null)
            {
                retour = RedirectToAction("Login");
            }
            else
            {
                ContactDAO contactDao = new ContactDAO();
                retour = RedirectToAction("AccueilCR", new { id = "Listedescontacts" });

                if (!String.IsNullOrWhiteSpace(id))
                {
                    if (Int32.TryParse(id, out int idContact))
                    {
                        if (contactDao.Read(idContact) != null)
                        {
                            Contact contact = contactDao.Read(idContact);
                            ViewBag.contact = contact;
                            retour          = View();
                        }
                    }
                }
            }
            return(retour);
        }
        // GET: Admin/Contact
        public ActionResult Index(int page = 1, int pagesize = 2)
        {
            ContactDAO contactDAO = new ContactDAO();
            var        list       = contactDAO.ListAll().ToPagedList(page, pagesize);

            return(View(list));
        }
Exemplo n.º 6
0
        public IEnumerable <Licencie> GetAll()
        {
            ContactDAO      dao         = new ContactDAO();
            List <Licencie> lesContacts = dao.getAllLicencie();

            return(lesContacts.ToList());
        }
Exemplo n.º 7
0
        public string UpdateContact(string nom, int id)
        {
            ContactDAO dao = new ContactDAO();

            dao.UpdateLicencie(nom, id);
            return("Mise à jour du contact avec le nom " + nom + " and Id " + id);
        }
Exemplo n.º 8
0
        public string DeleteParticipant(int id)
        {
            ContactDAO dao = new ContactDAO();

            dao.deleteParticipant(id);
            return("Participant supprimé id " + id);
        }
Exemplo n.º 9
0
        public string UpdateParticipant(int id, string nom)
        {
            ContactDAO dao = new ContactDAO();

            dao.updateParticipant(id, nom);
            return("Mise à jour du participant avec le nom " + nom + " et l'id " + id);
        }
Exemplo n.º 10
0
        public Participant GetById(int id)
        {
            ContactDAO  dao = new ContactDAO();
            Participant p   = dao.getParticipantById(id);

            return(p);
        }
Exemplo n.º 11
0
        public IEnumerable <Participant> GetEquipies(int idEquipe)
        {
            ContactDAO         dao             = new ContactDAO();
            List <Participant> lesParticipants = dao.getEquipies(idEquipe);

            return(lesParticipants.ToList());
        }
Exemplo n.º 12
0
        /// <summary>
        /// Chèn vào 1 feedBack của khách
        /// </summary>
        /// <param name="name"></param>
        /// <param name="mobile"></param>
        /// <param name="address"></param>
        /// <param name="email"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public JsonResult Send(string name, string mobile, string address, string email, string content)
        {
            var fb = new Feedback();

            fb.Name        = name;
            fb.Email       = email;
            fb.Phone       = mobile;
            fb.CreatedDate = DateTime.Now;
            fb.Content     = content;
            fb.Address     = address;

            var id = new ContactDAO().InsertFeedBack(fb);

            if (id > 0)
            {
                return(Json(new
                {
                    status = true
                }));
            }
            else
            {
                return(Json(new
                {
                    status = false
                }));
            }
        }
Exemplo n.º 13
0
        public void FindAll(ListBox listBoxUsers, bool isAll, bool isAdm)
        {
            Collection <User>    userS    = UserDAO.FindAll();
            Collection <Contact> contactS = ContactDAO.FindAll();

            foreach (User user in userS)
            {
                Contact currentContact = getContact(contactS, user.ContactId);
                user.Contact = currentContact;
                listBoxUsers.DisplayMember = "Login";

                if (isAll == true)
                {
                    listBoxUsers.Items.Add(user);
                }
                else
                {
                    if (isAdm == false)
                    {
                        if (user.IsAdmin == false)
                        {
                            listBoxUsers.Items.Add(user);
                        }
                    }
                    else
                    {
                        if (user.IsAdmin == true)
                        {
                            listBoxUsers.Items.Add(user);
                        }
                    }
                }
            }
        }
Exemplo n.º 14
0
        public void Update(UserDTO newPacket)
        {
            Validate(newPacket);

            Contact contact = FormateContact(newPacket);
            User    user    = FormateUser(newPacket, contact);

            int ContactIdToDelete = -1;

            if (UserDAO.ReferenceToThisContact(user) > 1)
            {
                ContactDAO.Save(contact);
                user.ContactId = contact.Id;
            }
            else
            {
                ContactIdToDelete = ContactDAO.Update(user);
                user.ContactId    = contact.Id;
            }

            UserDAO.Update(user);
            if (ContactIdToDelete > 0)
            {
                ContactDAO.Delete(ContactIdToDelete);
            }
        }
Exemplo n.º 15
0
        public IEnumerable <Participant> GetAllL()
        {
            ContactDAO         dao             = new ContactDAO();
            List <Participant> lesParticipants = dao.getAllLocalisation();

            return(lesParticipants.ToList());
        }
Exemplo n.º 16
0
        public string UpdateParticipant(int id, string nom, string prenom, string email, string numero, string sexe)
        {
            ContactDAO dao = new ContactDAO();

            dao.updateParticipant(id, nom, prenom, email, numero, sexe);
            return("Mise à jour du participant avec le nom " + nom + " et l'id " + id);
        }
Exemplo n.º 17
0
        public Licencie GetById(long id)
        {
            ContactDAO      dao         = new ContactDAO();
            List <Licencie> lesLicencie = dao.getAllLicencie();

            return(lesLicencie.ElementAt(0));
        }
Exemplo n.º 18
0
        public string AttribuerEquipe(int idParticipant, int idEquipe)
        {
            ContactDAO dao = new ContactDAO();

            dao.attribuerEquipe(idParticipant, idEquipe);
            return("Mise à jour du participant avec l'équipe " + idEquipe);
        }
Exemplo n.º 19
0
        public string DeleteContact(int id)
        {
            ContactDAO dao = new ContactDAO();

            dao.SupprimerLicencie(id);
            return("Contact supprimé id " + id);
        }
Exemplo n.º 20
0
        public ActionResult LienHe(int page = 1, int pagesize = 5)
        {
            var aDao  = new ContactDAO();
            var model = aDao.ListContactAll(page, pagesize);

            return(View(model));
        }
Exemplo n.º 21
0
        // GET: Admin/Contact
        public ActionResult Index(int page = 1, int pagesize = 10)
        {
            var dao   = new ContactDAO();
            var model = dao.ListAllPage(page, pagesize);

            return(View(model));
        }
Exemplo n.º 22
0
        public ActionResult Contact(MESSAGE contact)
        {
            var sessionUser = Session[Common.CommonConstants.USER_SESSION];

            if (ModelState.IsValid)
            {
                string content = System.IO.File.ReadAllText(Server.MapPath("~/Views/Home/MessageEmail.html"));

                content = content.Replace("{{CustomerName}}", contact.Name);
                content = content.Replace("{{Email}}", contact.Email);
                content = content.Replace("{{Title}}", contact.Title);
                content = content.Replace("{{Message}}", contact.Message_Content);

                //var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString();

                //new MailHelper().SendMail(toEmail, contact.Title, content);

                ContactDAO contactDAO = new ContactDAO();

                var result = contactDAO.Insert(contact);

                if (result > 0)
                {
                    return(Json(new { result = true, data = PartialViewToString("ContactForm", new MESSAGE()) }));
                }
                else
                {
                    ModelState.AddModelError("", "Đã xảy ra lỗi, gửi không thành công!");
                }
            }
            return(PartialView("ContactForm", contact));
        }
Exemplo n.º 23
0
        public ActionResult Create(ContactModel model)
        {
            if (ModelState.IsValid)
            {
                var dao     = new ContactDAO();
                var contact = new Contact();
                contact.Email   = model.Email;
                contact.Fax     = model.Fax;
                contact.Phone   = model.Phone;
                contact.Address = model.Address;

                var res = new ContactDAO().Create(contact);
                if (res)
                {
                    SetAlert("Thêm thông tin liên hệ thành công", "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert("Thêm thông tin liên hệ thất bại", "error");
                    return(View());
                }
            }
            else
            {
                ModelState.AddModelError("", "Thông tin không chính xác!.");
            }
            return(View());
        }
Exemplo n.º 24
0
        public Equipe GetById(int id)
        {
            ContactDAO dao = new ContactDAO();
            Equipe     e   = dao.getEquipeById(id);

            return(e);
        }
 public ActionResult Create(Contact contact, string tempstatus)
 {
     if (ModelState.IsValid)
     {
         if (tempstatus == "Kích Hoạt")
         {
             contact.Status = true;
         }
         else
         {
             contact.Status = false;
         }
         ContactDAO contactDAO = new ContactDAO();
         int        check      = contactDAO.Create(contact);
         if (check > 0)
         {
             TempData["msg"] = MessageBox.Show("Create Success");
             RedirectToAction("Create", "Contact");
         }
         else
         {
             ModelState.AddModelError("", "Create fail");
         }
     }
     return(View("Create"));
 }
Exemplo n.º 26
0
        public IEnumerable <Equipe> GetAll()
        {
            ContactDAO    dao             = new ContactDAO();
            List <Equipe> lesParticipants = dao.getAllEquipe();

            return(lesParticipants.ToList());
        }
 public ActionResult Edit(Contact contact, string tempstatus, int id)
 {
     contact.ContactID = id;
     if (ModelState.IsValid)
     {
         ContactDAO contactDAO = new ContactDAO();
         if (tempstatus == "Kích Hoạt")
         {
             contact.Status = true;
         }
         else
         {
             contact.Status = false;
         }
         var check = contactDAO.Edit(contact);
         if (check > 0)
         {
             TempData["msg"] = MessageBox.Show("Edit Thành Công");
             return(RedirectToAction("Index", "Contact"));
         }
         else
         {
             ModelState.AddModelError("", "Edit không thành công");
         }
     }
     return(View());
 }
Exemplo n.º 28
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            ContactDAO adao     = new ContactDAO();
            string     name     = txtName.Text;
            string     dept     = lblDept.Text;
            string     email    = txtEmail.Text;
            string     remarks  = txtRemarks.Text;
            string     id       = Request.QueryString["id"];
            int        id_num   = Convert.ToInt32(id);
            Contact    article  = adao.getContactById(id_num);
            int        id_edit  = article.contact_id;
            DateTime   start    = article.upload_datetime;
            User       u        = article.user;
            string     status   = article.status;
            Contact    toChange = new Contact(id_edit, name, dept.ToLower(), u, start, status, email, remarks);

            adao.updateContact(toChange);

            //set audit
            User currentUser = (User)Session["currentUser"];

            setAudit(currentUser, "contact us", "update", id, "updated contact personnel name: " + name);

            Response.Redirect("manageContactUs.aspx");
        }
Exemplo n.º 29
0
        public JsonResult Send(string name, string email, string title, string detail)
        {
            var contact = new CONTACT
            {
                datebegin = DateTime.Now,
                username  = name,
                email     = email,
                title     = title,
                detail    = detail
            };

            var id = new ContactDAO().InsertContact(contact);

            if (id > 0)
            {
                return(Json(new
                {
                    status = true
                }));
            }
            else
            {
                return(Json(new
                {
                    status = false
                }));
            }
        }
Exemplo n.º 30
0
        public JsonResult SendFeedBack(string name, string phone, string email, string content)
        {
            var feedback = new Feedback
            {
                Name            = name,
                Phone           = phone,
                Email           = email,
                ContentFeedback = content,
                CreateDate      = DateTime.Now
            };

            var id = new ContactDAO().InsertFeedBack(feedback);

            if (id > 0)
            {
                return(Json(new
                {
                    status = true
                }));
            }
            else
            {
                return(Json(new
                {
                    status = false
                }));
            }
        }