protected void btnResend_Click(object sender, EventArgs e) { _sms_EMAIL_DB_Entities = new SMS_EMAIL_DB_Entities(); var smsId = long.Parse(hdnFldSMSId.Value); sms = _sms_EMAIL_DB_Entities.tbl_Emails_SMS.Where(x => x.Id == smsId).First(); var phone = sms.Mobile_Number; var message = sms.Text; var sms_code = SmsSender.Send(phone, message); var sms_code_decode = StringHelper.ConvertResponseCode(sms_code); sms.SMS_Code = sms_code; sms.SMS_Code_Decode = sms_code_decode; sms.SMS_Sent_At = DateTime.Now; _sms_EMAIL_DB_Entities.SaveChanges(); tEvent = new tbl_Events { Created_At = DateTime.Now, Code = sms_code, Status = sms_code_decode, Email_Sms_Id = sms.Id }; _sms_EMAIL_DB_Entities.AddTotbl_Events(tEvent); _sms_EMAIL_DB_Entities.SaveChanges(); Session["NoticeMessage"] = "Please check SMS status !"; Response.Redirect("Details.aspx?id=" + smsId.ToString()); }
protected void btnSend_Click(object sender, EventArgs e) { _sms_EMAIL_DB_Entities = new SMS_EMAIL_DB_Entities(); var currentUserId = CurrentUser.Id(); var email = new tbl_Emails_SMS { Claim_Number = txtClaimNumber.Text, Policy_Number = txtPolicyNumber.Text, TP_Name = txtTpName.Text, Email = txtEmail.Text, Text = txtText.Text, Type = "Email", User_Id = currentUserId, Created_At = DateTime.Now, Mobile_Number = txtMobile.Text, Email_Subject = txtSubject.Text, TP_ID = txtTPID.Text, SMS_Sent_At = DateTime.Now }; _sms_EMAIL_DB_Entities.AddTotbl_Emails_SMS(email); _sms_EMAIL_DB_Entities.SaveChanges(); Session["NoticeMessage"] = "Successfully send an email !"; Mailer.SendMailMessage(txtEmail.Text.ToString().Trim(), "", "", txtSubject.Text.ToString().Trim(), txtText.Text.ToString().Trim()); Response.Redirect("Index.aspx"); }
void sendSMS(string phoneNumber) { var message = txtText.Text.ToString().Trim(); var unicode = rblSMSLanguage.SelectedValue == "English" ? "E" : "U"; _responseXml = SmsSender.Send(phoneNumber, message); GetSmsCodeAndDescription(_responseXml); var sms_code_decode = StringHelper.ConvertTamyozResponseCode(_smsCode); var currentUserId = CurrentUser.Id(); email = new tbl_Emails_SMS { Claim_Number = txtClaimNumber.Text, Policy_Number = txtPolicyNumber.Text, TP_Name = txtTpName.Text, Email = txtEmail.Text, Mobile_Number = phoneNumber, Text = message, //Text = tpl.Text, Type = "SMS", SMS_Code = _smsCode, SMS_Code_Decode = sms_code_decode, SMS_Code_Decode_Arabic = _smsDescription, //SMS_Language = tpl.Language, SMS_Language = rblSMSLanguage.SelectedValue, User_Id = currentUserId, Created_At = DateTime.Now, SMS_Sent_At = DateTime.Now, TP_ID = txtTPID.Text, Template_Id = id }; _sms_EMAIL_DB_Entities.AddTotbl_Emails_SMS(email); _sms_EMAIL_DB_Entities.SaveChanges(); tEvent = new tbl_Events { Created_At = DateTime.Now, Code = _smsCode, Status = sms_code_decode, Email_Sms_Id = email.Id }; _sms_EMAIL_DB_Entities.AddTotbl_Events(tEvent); _sms_EMAIL_DB_Entities.SaveChanges(); Session["NoticeMessage"] = "Please check SMS status !"; }
protected void Page_Load(object sender, EventArgs e) { _sms_EMAIL_DB_Entities = new SMS_EMAIL_DB_Entities(); var emailId = long.Parse(Request.QueryString["id"]); if (CurrentUser.Role() == "Admin") { email = _sms_EMAIL_DB_Entities.tbl_Emails_SMS.Where(x => x.Id == emailId).First(); } else { var currentUserId = CurrentUser.Id(); email = _sms_EMAIL_DB_Entities.tbl_Emails_SMS.Where(x => x.Id == emailId).Where(x => x.User_Id == currentUserId).FirstOrDefault(); if (email == null) { Response.Redirect("NotAuthorized.aspx"); return; } } }
protected void Page_Load(object sender, EventArgs e) { _sms_EMAIL_DB_Entities = new SMS_EMAIL_DB_Entities(); var smsId = long.Parse(Request.QueryString["id"]); if (CurrentUser.Role() == "Admin") { sms = _sms_EMAIL_DB_Entities.tbl_Emails_SMS.Where(x => x.Id == smsId).First(); } else { var currentUserId = CurrentUser.Id(); sms = _sms_EMAIL_DB_Entities.tbl_Emails_SMS.Where(x => x.Id == smsId).Where(x => x.User_Id == currentUserId).FirstOrDefault(); if (sms == null) { Response.Redirect("NotAuthorized.aspx"); return; } } hdnFldSMSId.Value = smsId.ToString(); btnResend.Visible = sms.SMS_Code_Decode != "Success"; gvEvents.DataSource = sms.tbl_Events; gvEvents.DataBind(); }