コード例 #1
0
ファイル: Contact.ascx.cs プロジェクト: trungjc/quanlyhocsinh
        protected void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                ETO.Contact contact = ReceiveHtml();
                ContactBSO contactBSO = new ContactBSO();
                contactBSO.CreateContact(contact);

                ConfigBSO configBSO = new ConfigBSO();
                Config config = configBSO.GetAllConfig(Language.language);

                string strBody = "Thông tin liên hệ tới Website " + config.WebName + " (" + config.WebDomain + "): <br>";
                strBody += "<b>Họ tên  : </b> " + NameContact.Value + "<br>";
                strBody += "<b>Cơ quan công tác : </b> " + Company.Value + "<br>";
                strBody += "<b>Địa chỉ : </b> " + Address.Value + "<br>";
                strBody += "<b>Thành phố : </b> " + City.Value + "<br>";
                strBody += "<b>Điện thoại : </b> " + Telephone.Value + "<br>";
                strBody += "<b>Fax : </b> " + Fax.Value + "<br>";

                strBody += "<b>Email : </b> " + Email.Value + "<br>";
                strBody += "<b>Nội dung Yêu cầu : </b> " + Require.Value + "<br>";

                MailBSO mailBSO = new MailBSO();
                //       mailBSO.EmailFrom = Email.Value;
                mailBSO.EmailFrom = config.Email_from;
                string strObj = "Thông tin liên hệ tới quản trị viên website " + config.WebName + " (" + config.WebDomain + ") - Ngày " + DateTime.Now.ToString("dd:MM:yyyy");
                mailBSO.SendMail(config.Email_to, strObj, strBody);

                Response.Redirect("~/ContactSucceed/Default.aspx");
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }
コード例 #2
0
 private void ViewContact()
 {
     ContactBSO contactBSO = new ContactBSO();
     DataTable table = contactBSO.GetContactAll();
     commonBSO commonBSO = new commonBSO();
     commonBSO.FillToGridView(grvContact, table);
 }
コード例 #3
0
        protected void initControl(int Id)
        {
            if (Id > 0)
            {
                btn_add.Visible = false;
                btn_edit.Visible = true;
                try
                {
                    ContactBSO contactBSO = new ContactBSO();
                    Contact contact = contactBSO.GetContactById(Id);

                    hddContactID.Value = Convert.ToString(contact.ContactID);

                    txtEmail.Text = contact.Email;

                    txtName.Text = contact.Name;
                    txtAddress.Text = contact.Address;
                    txtTel.Text = contact.Tel;
                    txtFax.Text = contact.Fax;

                    txtCity.Text = contact.City;
                    txtCompany.Text = contact.Company;




                    cboDay1.SelectedValue = contact.Date.Day.ToString();
                    cboMonth1.SelectedValue = contact.Date.Month.ToString();
                    cboYear1.SelectedValue = contact.Date.Year.ToString();
                    cboMinutes1.SelectedValue = contact.Date.Minute.ToString();
                    cboHour1.SelectedValue = contact.Date.Hour.ToString();




                    txtRequire.Value = contact.Require;
                    txtAnswer.Text = contact.Answer;
                    if (contact.Sendmail == true)
                    {
                        chkSendMail.Checked = true;
                    }
                    else 
                    {
                        chkSendMail.Checked = false;
                    }


                }
                catch (Exception ex)
                {
                    error.Text = ex.Message.ToString();
                }
            }
            else if (Id == 0)
            {
                btn_add.Visible = true;
                btn_edit.Visible = false;
            }
        }
コード例 #4
0
 protected void grvContact_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     int Id = Convert.ToInt32(e.CommandArgument.ToString());
     string cName = e.CommandName.ToLower();
     switch (cName)
     {
         case "_edit":
             Response.Redirect("~/Admin/editcontact/" + Id + "/Default.aspx");
             break;
         case "_delete":
             ContactBSO contactBSO = new ContactBSO();
             contactBSO.DeleteContact(Id);
             ViewContact();
             break;
     }
 }
コード例 #5
0
        protected void btn_edit_Click(object sender, EventArgs e)
        {

            try
            {
                Contact contact = ReceiveHtml();
                ContactBSO contactBSO = new ContactBSO();
                contactBSO.UpdateContact(contact);
                if (chkSendMail.Checked == true)
                {
                    Check_SendMail(contact);
                }
                error.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "Đặt thuê xe", contact.ContactID);
            }
            catch (Exception ex)
            {
                error.Text = ex.Message.ToString();
            }
        }
コード例 #6
0
 protected void btn_add_Click(object sender, EventArgs e)
 {
     Contact contact = ReceiveHtml();
     try
     {
         ContactBSO contactBSO = new ContactBSO();
         contactBSO.CreateContact(contact);
         if (chkSendMail.Checked == true)
         {
             Check_SendMail(contact);
         }
         error.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);
     }
     catch (Exception ex)
     {
         error.Text = ex.Message.ToString();
     }
 }