Esempio n. 1
0
        //lấy thông tin contacts theo id
        public InforContact InfoContact(string idContacts)
        {
            db = new GDUDataConnectionsDataContext();
            InforContact infoContact = new InforContact();

            infoContact = db.InforContacts.Single(p => p.ID == idContacts);
            return(infoContact);
        }
Esempio n. 2
0
        //insert contacts
        public void InsertContacts(InforContact contacts)
        {
            db = new GDUDataConnectionsDataContext();
            InforContact cts = new InforContact();

            cts           = db.InforContacts.Single(p => p.ID == contacts.ID);
            cts.Email     = contacts.Email;
            cts.Pass      = contacts.Pass;
            cts.Subject   = contacts.Subject;
            cts.Message   = contacts.Message;
            cts.InfoOther = contacts.InfoOther;
            db.SubmitChanges();
        }
Esempio n. 3
0
        public void SendMaillToAdmin()
        {
            InforContact inforContact = new InforContact();

            inforContact = contactService.InfoContact("6");
            string fromEmail = inforContact.Email;
            string toEmail   = txtEmail.Text.Trim();
            string subEmail  = inforContact.Subject;
            string InforAd   = "----------------------------------------------------" + "\n" + txtTenAdmin.Text + " - " + lblIDAdmin.Text + "\n" + "----------------------------------------------------";
            string messEmail = inforContact.Message + "\n " + InforAd + "\n" + inforContact.InfoOther;

            sendMessageController.SendMailAddAdmin(fromEmail, toEmail, subEmail, messEmail);
        }
        //gửi mã xác nhận đến admin
        public void SendVerificationCodeToAdmin()
        {
            CreateVerificationCode();
            InforContact contacts = new InforContact();

            contacts = contactService.InfoContact("5");
            string fromEmail = contacts.Email;
            string toEmail   = _email;
            string subEmail  = contacts.Subject;
            string messEmail = contacts.Message + "\n";
            string code      = "-------------------" + "\n" + _VerificationCode + "\n" + "-------------------" + "\n" + contacts.InfoOther;

            sendMessage.SendVerificationCode(fromEmail, toEmail, subEmail, messEmail + code);
        }
        public void SendMaillAddSinhVienSuccessfully()
        {
            InforContact contacts = new InforContact();

            contacts = contactService.InfoContact("1");
            string from    = contacts.Email;
            string to      = _email;
            string subject = contacts.Subject;
            string InfoSV  = "---------------------------------------------------------" + "\n" + _Id + " - " + _name + "\n" + "---------------------------------------------------------" + "\n--------------------------------------------------------------------------------------";
            string message = contacts.Message + "\n" + InfoSV + "\n" + contacts.InfoOther;

            sendMessage.SendMaillAddSinhVien(from, to, subject, message);
            _countSendMaill++;
        }
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (checkDataContacts())
     {
         InforContact contacts = new InforContact();
         MessageBox.Show(cboChonContacts.SelectedValue.ToString());
         contacts.ID        = cboChonContacts.SelectedValue.ToString().Trim();
         contacts.Email     = txtEmailContacts.Text;
         contacts.Pass      = txtPassContacts.Text;
         contacts.Subject   = rtxtTitle.Text;
         contacts.Message   = rtxtMessage.Text;
         contacts.InfoOther = rtxtInforOther.Text;
         contactService.InsertContacts(contacts);
         MessageBox.Show("Update successful </> !!!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        //maill service - gửi mail thông báo giảng viên tài khoảng đã được kích hoạt
        public void SendMailAddGiangVienSuccessfully()
        {
            //send maill
            InforContact contacts = new InforContact();

            contacts = contactService.InfoContact("3");
            string fromEmail = contacts.Email;
            string toEmail   = txtEmailGV.Text.Trim();
            string subEmail  = contacts.Subject;
            string InfoGV    = "---------------------------------------------------------" + "\n" + txtTenGV.Text + " - " + lblMaGV_GV.Text + "\n" + "---------------------------------------------------------";
            string messEmail = contacts.Message + "\n" + InfoGV + "\n" + contacts.InfoOther;

            // MessageBox.Show("from: "+ fromEmail);
            //MessageBox.Show("to: " + toEmail);
            //MessageBox.Show("sub: " + subEmail);
            //MessageBox.Show("mess: " + messEmail);
            sendMessage.SendMaillAddGiangVien(fromEmail, toEmail, subEmail, messEmail);
        }
        //maill service - gửi mail thông báo thông tin giảng viên đã được cập nhật
        public void SendMailUpdateGiangVienSuccessfully()
        {
            //gửi mail thông báo cập nhật thành công
            //
            string other    = "Thông Tin Giảng viên đã được cập nhật:";
            string maGV     = "-Mã SV: " + lblMaGV_GV.Text;
            string emailGV  = "-Email: " + txtEmailGV.Text;
            string nameGV   = "-Tên GV: " + txtTenGV.Text;
            string namSinh  = "-Năm Sinh: " + dtpNamSinh_GV.Text.Trim();
            string trinhDo  = "-Trình Độ: " + cboTrinhDo.SelectedItem.ToString().Trim();
            string sdtGV    = "-SĐT: " + txtSDT.Text;
            string dcGV     = "-Địa Chỉ: " + rtxtDiaChi_GV.Text;
            string startDay = "-Start Day: " + dtpBatDauCongViec_GV.Text.Trim();
            //
            InforContact contacts = new InforContact();

            contacts = contactService.InfoContact("4");
            string from    = contacts.Email;
            string to      = txtEmailGV.Text;
            string subject = contacts.Subject;
            string message = other + "\n" + maGV + "\n" + nameGV + "\n" + namSinh + "\n" + sdtGV + "\n" + emailGV + "\n" + trinhDo + "\n" + dcGV + "\n" + startDay + "\n" + contacts.InfoOther;

            sendMessage.SendMaillUpdateGiangVien(from, to, subject, message);
        }
        private void cboChonContacts_SelectedIndexChanged(object sender, EventArgs e)
        {
            string id = cboChonContacts.SelectedValue.ToString();

            switch (id)
            {
            case "1":
            {
                InforContact InfoContacts = new InforContact();
                InfoContacts          = contactService.InfoContact(cboChonContacts.SelectedValue.ToString());
                txtEmailContacts.Text = InfoContacts.Email;
                txtPassContacts.Text  = InfoContacts.Pass;
                rtxtTitle.Text        = InfoContacts.Subject;
                rtxtMessage.Text      = InfoContacts.Message;
                rtxtInforOther.Text   = InfoContacts.InfoOther;
                break;
            }

            case "2":
            {
                InforContact InfoContacts = new InforContact();
                InfoContacts          = contactService.InfoContact(cboChonContacts.SelectedValue.ToString());
                txtEmailContacts.Text = InfoContacts.Email;
                txtPassContacts.Text  = InfoContacts.Pass;
                rtxtTitle.Text        = InfoContacts.Subject;
                rtxtMessage.Text      = InfoContacts.Message;
                rtxtInforOther.Text   = InfoContacts.InfoOther;
                break;
            }

            case "3":
            {
                InforContact InfoContacts = new InforContact();
                InfoContacts          = contactService.InfoContact(cboChonContacts.SelectedValue.ToString());
                txtEmailContacts.Text = InfoContacts.Email;
                txtPassContacts.Text  = InfoContacts.Pass;
                rtxtTitle.Text        = InfoContacts.Subject;
                rtxtMessage.Text      = InfoContacts.Message;
                rtxtInforOther.Text   = InfoContacts.InfoOther;
                break;
            }

            case "4":
            {
                InforContact InfoContacts = new InforContact();
                InfoContacts          = contactService.InfoContact(cboChonContacts.SelectedValue.ToString());
                txtEmailContacts.Text = InfoContacts.Email;
                txtPassContacts.Text  = InfoContacts.Pass;
                rtxtTitle.Text        = InfoContacts.Subject;
                rtxtMessage.Text      = InfoContacts.Message;
                rtxtInforOther.Text   = InfoContacts.InfoOther;
                break;
            }

            case "5":
            {
                InforContact InfoContacts = new InforContact();
                InfoContacts          = contactService.InfoContact(cboChonContacts.SelectedValue.ToString());
                txtEmailContacts.Text = InfoContacts.Email;
                txtPassContacts.Text  = InfoContacts.Pass;
                rtxtTitle.Text        = InfoContacts.Subject;
                rtxtMessage.Text      = InfoContacts.Message;
                rtxtInforOther.Text   = InfoContacts.InfoOther;
                break;
            }

            case "6":
            {
                InforContact InfoContacts = new InforContact();
                InfoContacts          = contactService.InfoContact(cboChonContacts.SelectedValue.ToString());
                txtEmailContacts.Text = InfoContacts.Email;
                txtPassContacts.Text  = InfoContacts.Pass;
                rtxtTitle.Text        = InfoContacts.Subject;
                rtxtMessage.Text      = InfoContacts.Message;
                rtxtInforOther.Text   = InfoContacts.InfoOther;
                break;
            }

            default: LoadContacts(); break;
            }
        }
 public void InsertContacts(InforContact contacts)
 {
     contactsIdao.InsertContacts(contacts);
 }