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()); }
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 !"; }