New rgistaion page
using BusinessEntities;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace KenCommerceWeb.PublicWebsites
{
public partial class Registerpage : System.Web.UI.Page
{
HttpClient client = new HttpClient();
List<Master_Login_User> Login_UserList = null;
public List<Master_Login_User> gETMaster_Login_User = new List<Master_Login_User>();
Master_Login_User Login_UserEntity = new Master_Login_User();
protected void Page_Load(object sender, EventArgs e)
{
var appsurl = ConfigurationManager.AppSettings["APIPath"].ToString();
client.BaseAddress = new Uri(appsurl);
if (!IsPostBack)
{
//btnVerifay.Visible = true;
//imgverify.Visible = false;
clear();
}
}
private List<Master_Login_User> GetLogin_User()
{
HttpResponseMessage Login_User = client.GetAsync("api/User").Result;
if (Login_User.IsSuccessStatusCode)
{
Login_UserList = Login_User.Content.ReadAsAsync<List<Master_Login_User>>().Result;
return Login_UserList.ToList();
}
else
{
return null;
}
}
protected void clear()
{
txtEmail.Text = "";
txtName.Text = "";
txtPassword.Text = "";
txtConfirmPassword.Text = "";
TxtMobileNo.Text = "";
Image1Email.Visible = false;
imgverify.Visible = false;
//btnVerifay.Visible = true;
//btnVerifay.Enabled = false;
EmailVerifyBtn.Visible = true;
//TxtMobileNo.Enabled = false;
}
protected string isKartSession()
{
if (Session["PLACE ORDER"] != null && Session["PLACE ORDER"].ToString() == "PLACE ORDER")
{
return "~/Order/AddCartList.aspx";
}
else if (Session["BUY NOW"] != null && Session["BUY NOW"].ToString() == "BUY NOW")
{
return "~/PublicWebsites/Add2Cart.aspx";
}
else
{
return "";
}
}
protected void btn_submit_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
// SendMail();
var data = GetLogin_User().Where(a => a.Login_EmailId == txtEmail.Text).FirstOrDefault();
if (data == null)
{
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
//if (RadRadioButtonList1.SelectedValue == "Seller")
//{
// Login_UserEntity.Login_User_Type = "Seller";
//}
//else
//{
// Login_UserEntity.Login_User_Type = "Customer";
//}
if (RadRadioButtonList1.SelectedValue == "Customer")
{
Login_UserEntity.Login_User_Type = RadRadioButtonList1.SelectedValue.ToString();
Login_UserEntity.Login_EmailId = txtEmail.Text;
Login_UserEntity.Login_Username = txtName.Text;
Login_UserEntity.Login_Password = txtPassword.Text;
Login_UserEntity.InsertedOn = DateTime.Now;
Login_UserEntity.Login_MobileNo = TxtMobileNo.Text;
Login_UserEntity.InsertedBy = 0;
//Login_UserEntity.LastModifiedOn = ;
//Login_UserEntity.LastModifiedBy =
Login_UserEntity.IsActive = true;
Login_UserEntity.IsDelete = false;
HttpResponseMessage content = client.PostAsJsonAsync("api/User", Login_UserEntity).Result;
if (content.IsSuccessStatusCode)
{
clear();
string LoginUID = content.Content.ReadAsStringAsync().Result;
Session["Loginuserid"] = LoginUID;
HttpResponseMessage Login_User = client.GetAsync("api/User").Result;
if (Login_User.IsSuccessStatusCode)
{
Login_UserList = Login_User.Content.ReadAsAsync<List<Master_Login_User>>().Result;
var result = (from a in Login_UserList
where a.Login_User_ID == Convert.ToInt32(Session["Loginuserid"])
select new
{
a.Login_EmailId,
a.Login_Password,
a.Login_User_Type,
a.Login_Username,
a.Login_User_ID
}).ToList();
if (result.ToList().Count() > 0)
{
Session["Loginuserid"] = result.ToList()[0].Login_User_ID;
Session["UserName"] = result.ToList()[0].Login_Username;
Session["UserType"] = result.ToList()[0].Login_User_Type;
Session["UserMailId"] = result.ToList()[0].Login_EmailId;
Session["Status"] = "FirstTime";
if (isKartSession() == "")
{
Response.Redirect("~/PublicWebsites/Default.aspx", false);
}
else
{
Response.Redirect(isKartSession());
}
}
}
// Session["Loginuserid"] != null && Session["UserName"] != null && Session["UserType"] != null && Session["UserMailId"] != null && Session["UserMailId"] != null && Session["Loged"] != null
//Session["Loginuserid"] = login.Login_User_ID.ToString();
//Response.Redirect("~/RegistationPage.aspx");
//Response.Redirect("~/DolnaWebsite/Default.aspx");
}
}
if (RadRadioButtonList1.SelectedValue == "Artist")
{
Login_UserEntity.Login_User_Type = RadRadioButtonList1.SelectedValue.ToString();
Login_UserEntity.Login_EmailId = txtEmail.Text;
Login_UserEntity.Login_Username = txtName.Text;
Login_UserEntity.Login_Password = txtPassword.Text;
Login_UserEntity.InsertedOn = DateTime.Now;
Login_UserEntity.Login_MobileNo = TxtMobileNo.Text;
Login_UserEntity.InsertedBy = 0;
Login_UserEntity.IsActive = true;
Login_UserEntity.IsDelete = false;
HttpResponseMessage content = client.PostAsJsonAsync("api/User", Login_UserEntity).Result;
if (content.IsSuccessStatusCode)
{
string LoginUID = content.Content.ReadAsStringAsync().Result;
HttpResponseMessage Login_User = client.GetAsync("api/User").Result;
if (Login_User.IsSuccessStatusCode)
{
Login_UserList = Login_User.Content.ReadAsAsync<List<Master_Login_User>>().Result;
var result = (from a in Login_UserList
where a.Login_User_ID == Convert.ToInt32(LoginUID)
select new
{
a.Login_EmailId,
a.Login_Password,
a.Login_User_Type,
a.Login_Username,
a.Login_User_ID
}).ToList();
if (result.ToList().Count() > 0)
{
Session["Loginuserid"] = result.ToList()[0].Login_User_ID;
Session["UserName"] = result.ToList()[0].Login_Username;
Session["UserType"] = result.ToList()[0].Login_User_Type;
Session["UserMailId"] = result.ToList()[0].Login_EmailId;
Session["Status"] = "FirstTime";
clear();
if (isKartSession() == "")
{
Response.Redirect("~/Supplier/Default.aspx");
}
else
{
Response.Redirect(isKartSession());
}
}
}
}
}
if (RadRadioButtonList1.SelectedValue == "Gallerist")
{
Login_UserEntity.Login_User_Type = RadRadioButtonList1.SelectedValue.ToString();
Login_UserEntity.Login_EmailId = txtEmail.Text;
Login_UserEntity.Login_Username = txtName.Text;
Login_UserEntity.Login_Password = txtPassword.Text;
Login_UserEntity.InsertedOn = DateTime.Now;
Login_UserEntity.Login_MobileNo = TxtMobileNo.Text;
Login_UserEntity.InsertedBy = 0;
Login_UserEntity.IsActive = true;
Login_UserEntity.IsDelete = false;
HttpResponseMessage content = client.PostAsJsonAsync("api/User", Login_UserEntity).Result;
if (content.IsSuccessStatusCode)
{
string LoginUID = content.Content.ReadAsStringAsync().Result;
HttpResponseMessage Login_User = client.GetAsync("api/User").Result;
if (Login_User.IsSuccessStatusCode)
{
Login_UserList = Login_User.Content.ReadAsAsync<List<Master_Login_User>>().Result;
var result = (from a in Login_UserList
where a.Login_User_ID == Convert.ToInt32(LoginUID)
select new
{
a.Login_EmailId,
a.Login_Password,
a.Login_User_Type,
a.Login_Username,
a.Login_User_ID
}).ToList();
if (result.ToList().Count() > 0)
{
Session["Loginuserid"] = result.ToList()[0].Login_User_ID;
Session["UserName"] = result.ToList()[0].Login_Username;
Session["UserType"] = result.ToList()[0].Login_User_Type;
Session["UserMailId"] = result.ToList()[0].Login_EmailId;
Session["Status"] = "FirstTime";
clear();
if (isKartSession() == "")
{
Response.Redirect("~/Supplier/Default.aspx");
}
else
{
Response.Redirect(isKartSession());
}
}
}
}
}
}
else
{
clear();
// Response.Redirect("~/DolnaWebsite/Registerpage.aspx");
Notification.Text = "Already exsit!";
Notification.Show();
}
}
}
protected void btn_reset_Click(object sender, EventArgs e)
{
clear();
}
protected void btnimg_Click(object sender, EventArgs e)
{
//Image imgverify = (Image)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("imgverify");
//Panel pnlotp = (Panel)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("pnlotp");
//TextBox txtotp = (TextBox)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("txtotp");
//Label lblmsg = (Label)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("lblmsg");
string sessonOtp = Session["OTP"].ToString();
if (txtotp.Text == sessonOtp)
{
// btnVerifay.Visible = false;
imgverify.Visible = true;
pnlotp.Visible = false;
btn_submit.Enabled = true;
}
else
{
lblmsg.Text = "Enter a valid OTP";
}
}
#region Otp Method
public class SendSMS
{
#region -- Class For Sending SMS --
public static bool Mobile(string MobileNo, string Message)
{
//where the SMS Gateway is running
string ozSURL = "http://bhashsms.com/api/sendmsg.php";
//username for successful login
string ozUser = HttpUtility.UrlEncode("eea");
//user's password
string ozPassw = "Swash@2017";
//type of message
string ozSender = "deee";
//who will get the message
string ozRecipients = HttpUtility.UrlEncode(MobileNo);
//body of message
string ozMessageData = HttpUtility.UrlEncode("One Time Password For Dolna Site Registration is : " + Message); //body of message
//priority of message
string ozPriority = "ndnd";
//type of message
string ozStype = "normal";
string createdURL = ozSURL +
"?user=" + ozUser +
"&pass=" + ozPassw +
"&sender=" + ozSender +
"&phone=" + ozRecipients +
"&text=" + ozMessageData +
"&priority=" + ozPriority +
"&stype=" + ozStype;
try
{
//Create the request and send data to the SMS Gateway Server by HTTP connection
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(createdURL);
//Get response from the SMS Gateway Server and read the answer
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
myResp.Close();
return true;
}
catch (Exception)
{
//if sending request or getting response is not successful the SMS Gateway Server may do not run
return false;
}
}
#endregion
}
private string GeneratePassword(int PasswordLength)
{
#region -- Generating The OTP Password --
string OTP = null;
try
{
// This OTP Code Created By Mr. Satyabrata Behera
string _allowedChars = "0123456789";
Random randNum = new Random();
char[] chars = new char[PasswordLength];
int allowedCharCount = _allowedChars.Length;
for (int i = 0; i < PasswordLength; i++)
{
chars[i] = _allowedChars[(int)((_allowedChars.Length) * randNum.NextDouble())];
}
return new string(chars);
}
catch (Exception Exc)
{
// lblErrorMsg.Text = "Application Error : " + Exc.Message;
return OTP;
}
#endregion
}
#endregion
//protected void btnVerifay_Click(object sender, EventArgs e)
//{
// string OTP = GeneratePassword(5);
// string message = "One Time Password is " + OTP;
// // TextBox txtmobile = (TextBox)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("txtmobile");
// // Panel pnlotp = (Panel)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("pnlotp");
// SendSMS.Mobile(TxtMobileNo.Text, message);
// //SendMail(message);
// Session["OTP"] = OTP;
// // btnVerifay.Visible = false;
// if (Session["OTP"] != "")
// {
// //imgverify.Visible = false;
// pnlotp.Visible = true;
// }
//}
#region MailIntegration
private void SendMail( string otpmsg)
{
string Froms = "satyabrata@kencloud.co.in";
string Tos = txtEmail.Text.Trim();
string UserName = string.Empty;
string url = string.Empty;
MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress(Tos, txtName.Text.Trim()));
msg.From = new MailAddress(Froms, "Dolna");
msg.Subject = "Dolna Testing Mail Azure Web App Email using smtp.office365.com";
#region BodySetup
url = "http://kencommerce.azurewebsites.net/DolnaWebsite/Default.aspx";
//string body = "<html><body><img src='https://swasherpstorageaccount.blob.core.windows.net/dolnastaging412a6577-8b12-4d7b-a8c9-7b911f36a4a1/dolnastaging412a6577-8b12-4d7b-a8c9-7b911f36a4a1image/2e35cb67-c088-468b-857d-59092e6c2b6e-.png'/></body></html>";
string body = "";
body += "Hi, " + txtName.Text.Trim();
body += "<br /><br />Thank you, for Dolna Registration.";
// body += "<br /><br />This is your One Time Password : " + TemporayUseOtp + " use this OTP to complete your registration ";
body += "<br /><br />To Complete Your Registration and verify your email please use the following link";
// body += "<br/>Here Is Your Existing Password : <br/>" + Password + "";
// body += "<br /><a href=\"" + callbackUrl + "\" class='btn btn-default' >Click Here</a>";
body += "<br /><a href=\"" + url + "\" class='btn btn-default' >Activate your account</a>";
//body += "<br /><b>OR</b>";
body += "<br />"+otpmsg+"</b>";
//body += "<br /><br />If you cannot click on the link alternatively copy and paste in to your browser";
body += "<br /><br /> Best Wishes,";
body += "<br />SBackend Team";
body += "<html><body><img src='https://swasherpstorageaccount.blob.core.windows.net/dolnastaging412a6577-8b12-4d7b-a8c9-7b911f36a4a1/dolnastaging412a6577-8b12-4d7b-a8c9-7b911f36a4a1image/2e35cb67-c088-468b-857d-59092e6c2b6e-.png'/></body></html>";
body += "<br />---------------------------------------------------------------------------";
body += "<br /><b>This is a Auto generated message please donot reply back to this</b>";
#endregion
msg.Body = body; //"Test message using smtp.office365.com on Azure from a Web App";
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("satyabrata@kencloud.co.in", "chuma@1234");
client.Port = 587;
client.Host = "smtp.office365.com";
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
try
{
client.Send(msg);
// statusLabel.Text = "Message Sent Succesfully";
}
catch (Exception ex)
{
// statusLabel.Text = ex.ToString();
}
}
#endregion
protected void EmailVerifyBtn_Click(object sender, EventArgs e)
{
string OTP = GeneratePassword(5);
string message = "One Time Password is " + OTP;
SendMail(message);
Session["OTP2"] = OTP;
// btnVerifay.Visible = false;
if (Session["OTP2"] != "")
{
EmailVerifyBtn.Text = "Resend";
pnlotpEmail.Visible = true;
}
}
protected void btnimg3_Click(object sender, EventArgs e)
{
string sessonOtp = Session["OTP2"].ToString();
if (txtotp1.Text == sessonOtp)
{
EmailVerifyBtn.Visible = false;
Image1Email.Visible = true;
pnlotpEmail.Visible = false;
//btnVerifay.Enabled = true;
TxtMobileNo.Enabled = true;
btn_submit.Enabled = true;
}
else
{
lblmsgEmail.Text = "Enter a valid OTP";
}
}
}
}
===========================
<%@ Page Title="" Language="C#" MasterPageFile="~/PublicWebsites/MainMaster.Master" AutoEventWireup="true" CodeBehind="Registerpage.aspx.cs" Inherits="KenCommerceWeb.PublicWebsites.Registerpage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style>
.textSize {
font-size: 13px !important;
}
.Base {
display: inline;
font: 14px/18px "segoe ui",arial,sans-serif;
height: 20px;
overflow: hidden;
text-align: center;
vertical-align: middle;
width: 121px;
color: #fff;
/*border: 1px solid #333;*/
}
.t-container {
background: rgba(134, 133, 130, 0.3) !important;
}
.RadInput_Bootstrap .riEmpty, .RadInput_Empty_Bootstrap {
color: rgba(85,85,85,0.8) !important;
font-style: initial !important;
font-size: 13px !important;
font-family: inherit !important;
}
.RadButton.RadRadioButton span.rbText.rbToggleRadioChecked, .RadButton.RadRadioButton span.rbText.rbToggleRadio, .RadButton.RadCheckBox span.rbText.rbToggleCheckbox, .RadButton.RadCheckBox span.rbText.rbToggleCheckboxChecked {
display: inline-block;
position: relative;
padding-left: 1.71428571em;
font-size: 15px;
font-family: inherit !important;
}
.RadLabel_Bootstrap {
color: #333;
font-family: inherit !important;
}
.t-container {
padding-left: 15px;
padding-right: 15px;
padding-top: 30px !important;
}
.RadButton .rbText {
line-height: 1.35714286em;
vertical-align: top;
/* font-family: inherit; */
font-size: 15px !important;
}
.L0 {
border: 0 none;
}
.L1 {
background-color: #ff3933;
}
.L2 {
background-color: #ff6633;
}
.L3 {
background-color: #ff3399;
}
.L4 {
background-color: #cccc33;
}
.L5 {
background-color: #33cc00;
}
.RadUpload .ruFakeInput {
height: 2em !important;
}
.RadUpload .ruBrowse {
height: 2em !important;
}
.borderStyle {
border: 1px solid #ffffff !important;
padding: 15px;
border-style: groove !important;
background-color: #dbdbda !important;
}
/*.borderStyle {
border: 1px solid #ffffff !important;
padding: 15px !important;
border-style: groove
}*/
.RadButton_Bootstrap.rbButton, .RadButton_Bootstrap.RadButton.rbButton.rbDisabled, .RadButton_Bootstrap .rbSplitPart {
background-color: #a94442 !important;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px !important;
}
/*.riPassIndicator .riContentWrapper{
max-width: 23% !important;
}
}*/
.RadButton .rbText {
line-height: 1.35714286em;
vertical-align: top;
font-size: 11px !important;
}
.t-col-10 {
width: 79.33333% !important;
}
RadRadioButtonList RadRadioButtonList_Bootstrap rbHorizontalList {
padding-left: 25px !important;
}
</style>
<style>
.RadButton_Bootstrap.rbButton {
padding: 3px 12px !important;
}
</style>
<script>
function numberOnly(sender, eventArgs) {
var k = eventArgs.get_keyCode()
if (!(k >= 48 && k <= 57)) {
eventArgs.set_cancel(true);
}
}
function isNumberKey(evt) {
debugger;
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode != 47 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
else
return true;
}
function Spacevalidation(evt) {
debugger;
if (evt.which == 32)
return false;
}
function BlockScript(evts) {
if (evts.which == 60 || evts.which == 62)
return false;
}
</script>
<script type="text/javascript">
function pageLoad() {
Pass = $find("<%=txtPassword.ClientID %>");
Repass = $find("<%=txtConfirmPassword.ClientID %>");
}
checkPasswordMatch = function () {
debugger
var text1 = Pass.get_textBoxValue();
var text2 = Repass.get_textBoxValue();
if (text2 == "") {
$get("PasswordRepeatedIndicator").innerHTML = " ";
$get("PasswordRepeatedIndicator").className = "Base L0";
}
else if (text1 == text2) {
$get("PasswordRepeatedIndicator").innerHTML = "Matched";
$get("PasswordRepeatedIndicator").className = "Base L5";
}
else {
$get("PasswordRepeatedIndicator").innerHTML = "Not Matched";
$get("PasswordRepeatedIndicator").className = "Base L1";
}
}
</script>
<style>
.riStrengthBarL1 {
font-size: 14px;
}
</style>
<link rel="stylesheet" href="<%#ResolveUrl("~")%>/common/css/login.css" />
<link rel="stylesheet" href="<%#ResolveUrl("~")%>/DolnaWebsite/css/Custom.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<div class="container" style="margin-top: 130px;">
<div class="row">
<div class="col-md-12">
<div class="comment-box2">
<img alt="" src="<%#ResolveUrl("~")%>/DolnaWebsite/images/og.gif" />
<div class="comment-content">
<h2 class="h2s">Register
<span style="float: right;" class="st_sharethis" st_processed="yes">
<span style="text-decoration: none; color: rgb(0, 0, 0); display: inline-block; cursor: pointer; padding-left: 0px; padding-right: 0px; width: 16px;" class="stButton">
<span class="chicklets sharethis"> </span>
</span>
</span>
</h2>
<hr style="margin-top: 5px; margin-bottom: 5px; border: 0; border-top: 1px solid #000000;" />
<p><%--New User Registration, User Will Register in This Page--%></p>
</div>
</div>
</div>
</div>
</div>
<telerik:RadNotification RenderMode="Lightweight" ID="Notification" runat="server" Position="TopCenter"
AutoCloseDelay="2000" Width="350" Height="110" Title="Users Page" TitleIcon="none" LoadContentOn="EveryShow">
</telerik:RadNotification>
<%-- <telerik:RadAjaxManagerProxy ID="panel" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="btn_submit">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadPageLayout1" LoadingPanelID="RadAjaxLoadingPanel1"/>
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="btnimg">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadPageLayout1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="btnVerifay">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadPageLayout1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>--%>
<asp:UpdateProgress ID="updateProgress" runat="server" AssociatedUpdatePanelID="updpnl">
<ProgressTemplate>
<div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7;">
<asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/common/images/Icons/loading.gif" AlternateText="Loading ..." ToolTip="Loading ..." Style="padding: 10px; position: fixed; top: 45%; left: 50%;" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<%-- <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">--%>
<asp:UpdatePanel ID="updpnl" runat="server">
<ContentTemplate>
<telerik:RadPageLayout runat="server" ID="RadPageLayout1" GridType="Fluid" Width="50%" CssClass="borderStyle">
<Rows>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<telerik:RadRadioButtonList runat="server" Font-Size="13px" ID="RadRadioButtonList1" AutoPostBack="false" Direction="Horizontal" Width="100%">
<Items>
<telerik:ButtonListItem Text="Artist" Value="Artist" />
<telerik:ButtonListItem Text="Gallerist" Value="Gallerist" />
<telerik:ButtonListItem Text="Art Lover" Value="Customer" Selected="true" />
</Items>
</telerik:RadRadioButtonList>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="10px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
<telerik:RadLabel runat="server" CssClass="textSize">Name:</telerik:RadLabel>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1"
ControlToValidate="txtName" ForeColor="Red" ErrorMessage="*" ValidationGroup="Registration"></asp:RequiredFieldValidator>
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<telerik:RadTextBox ID="txtName" runat="server" MaxLength="35" Font-Size="Smaller" Width="95%" Height="28px" EmptyMessage="Enter Your name"></telerik:RadTextBox>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="10px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
<telerik:RadLabel runat="server" CssClass="textSize">Email (User Id):</telerik:RadLabel>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ControlToValidate="txtEmail"
ForeColor="Red" ErrorMessage="*" ValidationGroup="Registration"></asp:RequiredFieldValidator>
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<telerik:RadTextBox ID="txtEmail" runat="server" Font-Size="Smaller" Width="55%" Height="28px" EmptyMessage="Enter a Valid Email Id"></telerik:RadTextBox>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ControlToValidate="txtEmail"
ForeColor="Red" ErrorMessage="*" ValidationGroup="Registra"></asp:RequiredFieldValidator>
<asp:Button ID="EmailVerifyBtn" runat="server" Text="Email Verification" ValidationGroup="Registra" OnClick="EmailVerifyBtn_Click" Style="background-color: #a94442; color: white; font-size: 14px; font-family: inherit; padding: 4px 6px; border-radius: 6px;" />
<asp:Image runat="server" ImageUrl="~/DolnaWebsite/images/dc6okxERi.png" ID="Image1Email" Width="25px" Visible="false" />
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="2">
<asp:RegularExpressionValidator ID="RegularExpressioddddnValidator3" runat="server" ValidationGroup="Registra" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="txtEmail" ErrorMessage="Invalid!" ForeColor="Red"></asp:RegularExpressionValidator>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<asp:Panel ID="pnlotpEmail" runat="server" Visible="false" Style="margin-left: -4px">
<asp:Label runat="server" ID="Label6r" AssociatedControlID="txtotp1" ForeColor="Red"> </asp:Label>
<telerik:RadTextBox ID="txtotp1" runat="server" Width="200px" Height="28px" Font-Size="13px" EmptyMessage="Enter OTP"></telerik:RadTextBox>
<asp:Label runat="server" ID="lblmsgEmail" ForeColor="Red" Text=""> </asp:Label>
<asp:Button ID="btnimg3" runat="server" Text="Verify" CausesValidation="false" Style="background-color: #337ab7; color: white; font-size: 14px; font-family: inherit; width: 61px; border-radius: 16px;"
OnClick="btnimg3_Click" />
</asp:Panel>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="10px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
<telerik:RadLabel runat="server" CssClass="textSize">Mobile No :</telerik:RadLabel>
<%-- <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ControlToValidate="txtEmail"
ForeColor="Red" ErrorMessage="*" ValidationGroup="Registration"></asp:RequiredFieldValidator>--%>
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<%-- <telerik:RadButton ID="txtMobileNo" runat="server" placeholder="Mobile No" > </telerik:RadButton>--%>
<%-- <asp:TextBox ID="TxtMobileNo" CssClass="textInput"
onkeypress="return isNumberKey(event,this);" onpaste="return false;" placeholder="Enter Mobile Number" MaxLength="10"
runat="server" Width="200px"></asp:TextBox>--%>
<telerik:RadTextBox ID="TxtMobileNo" runat="server" Font-Size="Smaller" Height="28px" onkeypress="return isNumberKey(event,this);" onpaste="return false;" EmptyMessage="Enter Mobile Number" MaxLength="10"
Width="55%">
</telerik:RadTextBox>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldddValidator3" ControlToValidate="TxtMobileNo"
ForeColor="Red" ErrorMessage="*" ValidationGroup="Registration"></asp:RequiredFieldValidator>
<%-- <asp:Button ID="btnVerifay" runat="server" Text="Mobile Verification" Enabled="false" ValidationGroup="mbl" Visible="false" OnClick="btnVerifay_Click" Style="background-color: #a94442; color: white; font-size: 13px; font-family: inherit; padding: 5px 6px; border-radius: 6px;" />--%>
<asp:Image runat="server" ImageUrl="~/DolnaWebsite/images/dc6okxERi.png" ID="imgverify" Width="25px" Visible="false" />
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="2">
<asp:RegularExpressionValidator ControlToValidate="TxtMobileNo" ID="RegularExpressionValidator2" ValidationExpression="^[0-9]{10,10}$" runat="server" ErrorMessage="Invalid!" ForeColor="Red"></asp:RegularExpressionValidator>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<asp:Panel ID="pnlotp" runat="server" Visible="false" Style="margin-left: -4px">
<asp:Label runat="server" ID="Label6" AssociatedControlID="txtotp" ForeColor="Red"> </asp:Label>
<telerik:RadTextBox ID="txtotp" runat="server" Width="200px" Height="28px" Font-Size="13px" EmptyMessage="Enter OTP"></telerik:RadTextBox>
<%-- <asp:TextBox ID="txtotp" placeholder="Enter OTP" Height="28px"
runat="server" Width="150px"></asp:TextBox>--%>
<%-- <asp:RequiredFieldValidator ID="Requiredfieldvalidator20" runat="server" Display="Dynamic"
ControlToValidate="txtotp" ErrorMessage="" Text="Enter OTP" ForeColor="Red"></asp:RequiredFieldValidator>--%>
<asp:Label runat="server" ID="lblmsg" ForeColor="Red" Text=""> </asp:Label>
<asp:Button ID="btnimg" runat="server" Text="Verify" Visible="false" CausesValidation="false" Style="background-color: #337ab7; color: white; font-size: 14px; font-family: inherit; width: 61px; border-radius: 16px;"
OnClick="btnimg_Click" />
</asp:Panel>
<%--<telerik:RadButton ID="vry" runat="server" Text="VERIFY" CausesValidation="false" OnClick="vry_Click"></telerik:RadButton>--%>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="10px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3" SpanMd="6" SpanSm="6" SpanXs="12">
<telerik:RadLabel runat="server" CssClass="textSize">Password:</telerik:RadLabel>
<asp:RequiredFieldValidator ID="rfvUserPass" runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Registration" ControlToValidate="txtPassword"></asp:RequiredFieldValidator>
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7" SpanMd="6" SpanSm="6" SpanXs="12">
<telerik:RadTextBox runat="server" ID="txtPassword" Height="28px" MaxLength="15" TextMode="Password" Width="300px">
<PasswordStrengthSettings ShowIndicator="true" IndicatorWidth="75px"></PasswordStrengthSettings>
</telerik:RadTextBox>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="10px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3" SpanMd="6" SpanSm="6" SpanXs="12">
<telerik:RadLabel runat="server" CssClass="textSize">Confirm password:</telerik:RadLabel>
<asp:RequiredFieldValidator ID="RequiredFieldVasslidator3" runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Registration" ControlToValidate="txtConfirmPassword"></asp:RequiredFieldValidator>
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7" SpanMd="6" SpanSm="6" SpanXs="12">
<telerik:RadTextBox ID="txtConfirmPassword" Height="28px" runat="server" MaxLength="15" TextMode="Password" onkeyup="return checkPasswordMatch();" ValidationGroup="Registration" Width="106px">
</telerik:RadTextBox>
<span id="PasswordRepeatedIndicator" class="Base L0"> </span>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="12" SpanMd="12" SpanSm="12" SpanXs="12">
<asp:CompareValidator ID="Compare1"
ControlToValidate="txtConfirmPassword"
ControlToCompare="txtPassword"
Type="Integer"
EnableClientScript="false"
Text="The Password and Confirmation Password must match."
runat="server" ValidationGroup="Registration" ForeColor="Red"/>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="15px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="10" Style="text-align: center">
<telerik:RadButton ID="btn_submit" runat="server" Text="Submit" Height="28px" CausesValidation="true" ForeColor="White" OnClick="btn_submit_Click" Enabled="false" ValidationGroup="Registration"></telerik:RadButton>
<telerik:RadButton ID="btn_reset" runat="server" Text="Reset" ForeColor="White" Height="28px" OnClick="btn_reset_Click"></telerik:RadButton>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
</Rows>
</telerik:RadPageLayout>
</ContentTemplate>
</asp:UpdatePanel>
<%-- </telerik:RadAjaxPanel>--%>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace KenCommerceWeb.PublicWebsites
{
public partial class Registerpage : System.Web.UI.Page
{
HttpClient client = new HttpClient();
List<Master_Login_User> Login_UserList = null;
public List<Master_Login_User> gETMaster_Login_User = new List<Master_Login_User>();
Master_Login_User Login_UserEntity = new Master_Login_User();
protected void Page_Load(object sender, EventArgs e)
{
var appsurl = ConfigurationManager.AppSettings["APIPath"].ToString();
client.BaseAddress = new Uri(appsurl);
if (!IsPostBack)
{
//btnVerifay.Visible = true;
//imgverify.Visible = false;
clear();
}
}
private List<Master_Login_User> GetLogin_User()
{
HttpResponseMessage Login_User = client.GetAsync("api/User").Result;
if (Login_User.IsSuccessStatusCode)
{
Login_UserList = Login_User.Content.ReadAsAsync<List<Master_Login_User>>().Result;
return Login_UserList.ToList();
}
else
{
return null;
}
}
protected void clear()
{
txtEmail.Text = "";
txtName.Text = "";
txtPassword.Text = "";
txtConfirmPassword.Text = "";
TxtMobileNo.Text = "";
Image1Email.Visible = false;
imgverify.Visible = false;
//btnVerifay.Visible = true;
//btnVerifay.Enabled = false;
EmailVerifyBtn.Visible = true;
//TxtMobileNo.Enabled = false;
}
protected string isKartSession()
{
if (Session["PLACE ORDER"] != null && Session["PLACE ORDER"].ToString() == "PLACE ORDER")
{
return "~/Order/AddCartList.aspx";
}
else if (Session["BUY NOW"] != null && Session["BUY NOW"].ToString() == "BUY NOW")
{
return "~/PublicWebsites/Add2Cart.aspx";
}
else
{
return "";
}
}
protected void btn_submit_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
// SendMail();
var data = GetLogin_User().Where(a => a.Login_EmailId == txtEmail.Text).FirstOrDefault();
if (data == null)
{
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
//if (RadRadioButtonList1.SelectedValue == "Seller")
//{
// Login_UserEntity.Login_User_Type = "Seller";
//}
//else
//{
// Login_UserEntity.Login_User_Type = "Customer";
//}
if (RadRadioButtonList1.SelectedValue == "Customer")
{
Login_UserEntity.Login_User_Type = RadRadioButtonList1.SelectedValue.ToString();
Login_UserEntity.Login_EmailId = txtEmail.Text;
Login_UserEntity.Login_Username = txtName.Text;
Login_UserEntity.Login_Password = txtPassword.Text;
Login_UserEntity.InsertedOn = DateTime.Now;
Login_UserEntity.Login_MobileNo = TxtMobileNo.Text;
Login_UserEntity.InsertedBy = 0;
//Login_UserEntity.LastModifiedOn = ;
//Login_UserEntity.LastModifiedBy =
Login_UserEntity.IsActive = true;
Login_UserEntity.IsDelete = false;
HttpResponseMessage content = client.PostAsJsonAsync("api/User", Login_UserEntity).Result;
if (content.IsSuccessStatusCode)
{
clear();
string LoginUID = content.Content.ReadAsStringAsync().Result;
Session["Loginuserid"] = LoginUID;
HttpResponseMessage Login_User = client.GetAsync("api/User").Result;
if (Login_User.IsSuccessStatusCode)
{
Login_UserList = Login_User.Content.ReadAsAsync<List<Master_Login_User>>().Result;
var result = (from a in Login_UserList
where a.Login_User_ID == Convert.ToInt32(Session["Loginuserid"])
select new
{
a.Login_EmailId,
a.Login_Password,
a.Login_User_Type,
a.Login_Username,
a.Login_User_ID
}).ToList();
if (result.ToList().Count() > 0)
{
Session["Loginuserid"] = result.ToList()[0].Login_User_ID;
Session["UserName"] = result.ToList()[0].Login_Username;
Session["UserType"] = result.ToList()[0].Login_User_Type;
Session["UserMailId"] = result.ToList()[0].Login_EmailId;
Session["Status"] = "FirstTime";
if (isKartSession() == "")
{
Response.Redirect("~/PublicWebsites/Default.aspx", false);
}
else
{
Response.Redirect(isKartSession());
}
}
}
// Session["Loginuserid"] != null && Session["UserName"] != null && Session["UserType"] != null && Session["UserMailId"] != null && Session["UserMailId"] != null && Session["Loged"] != null
//Session["Loginuserid"] = login.Login_User_ID.ToString();
//Response.Redirect("~/RegistationPage.aspx");
//Response.Redirect("~/DolnaWebsite/Default.aspx");
}
}
if (RadRadioButtonList1.SelectedValue == "Artist")
{
Login_UserEntity.Login_User_Type = RadRadioButtonList1.SelectedValue.ToString();
Login_UserEntity.Login_EmailId = txtEmail.Text;
Login_UserEntity.Login_Username = txtName.Text;
Login_UserEntity.Login_Password = txtPassword.Text;
Login_UserEntity.InsertedOn = DateTime.Now;
Login_UserEntity.Login_MobileNo = TxtMobileNo.Text;
Login_UserEntity.InsertedBy = 0;
Login_UserEntity.IsActive = true;
Login_UserEntity.IsDelete = false;
HttpResponseMessage content = client.PostAsJsonAsync("api/User", Login_UserEntity).Result;
if (content.IsSuccessStatusCode)
{
string LoginUID = content.Content.ReadAsStringAsync().Result;
HttpResponseMessage Login_User = client.GetAsync("api/User").Result;
if (Login_User.IsSuccessStatusCode)
{
Login_UserList = Login_User.Content.ReadAsAsync<List<Master_Login_User>>().Result;
var result = (from a in Login_UserList
where a.Login_User_ID == Convert.ToInt32(LoginUID)
select new
{
a.Login_EmailId,
a.Login_Password,
a.Login_User_Type,
a.Login_Username,
a.Login_User_ID
}).ToList();
if (result.ToList().Count() > 0)
{
Session["Loginuserid"] = result.ToList()[0].Login_User_ID;
Session["UserName"] = result.ToList()[0].Login_Username;
Session["UserType"] = result.ToList()[0].Login_User_Type;
Session["UserMailId"] = result.ToList()[0].Login_EmailId;
Session["Status"] = "FirstTime";
clear();
if (isKartSession() == "")
{
Response.Redirect("~/Supplier/Default.aspx");
}
else
{
Response.Redirect(isKartSession());
}
}
}
}
}
if (RadRadioButtonList1.SelectedValue == "Gallerist")
{
Login_UserEntity.Login_User_Type = RadRadioButtonList1.SelectedValue.ToString();
Login_UserEntity.Login_EmailId = txtEmail.Text;
Login_UserEntity.Login_Username = txtName.Text;
Login_UserEntity.Login_Password = txtPassword.Text;
Login_UserEntity.InsertedOn = DateTime.Now;
Login_UserEntity.Login_MobileNo = TxtMobileNo.Text;
Login_UserEntity.InsertedBy = 0;
Login_UserEntity.IsActive = true;
Login_UserEntity.IsDelete = false;
HttpResponseMessage content = client.PostAsJsonAsync("api/User", Login_UserEntity).Result;
if (content.IsSuccessStatusCode)
{
string LoginUID = content.Content.ReadAsStringAsync().Result;
HttpResponseMessage Login_User = client.GetAsync("api/User").Result;
if (Login_User.IsSuccessStatusCode)
{
Login_UserList = Login_User.Content.ReadAsAsync<List<Master_Login_User>>().Result;
var result = (from a in Login_UserList
where a.Login_User_ID == Convert.ToInt32(LoginUID)
select new
{
a.Login_EmailId,
a.Login_Password,
a.Login_User_Type,
a.Login_Username,
a.Login_User_ID
}).ToList();
if (result.ToList().Count() > 0)
{
Session["Loginuserid"] = result.ToList()[0].Login_User_ID;
Session["UserName"] = result.ToList()[0].Login_Username;
Session["UserType"] = result.ToList()[0].Login_User_Type;
Session["UserMailId"] = result.ToList()[0].Login_EmailId;
Session["Status"] = "FirstTime";
clear();
if (isKartSession() == "")
{
Response.Redirect("~/Supplier/Default.aspx");
}
else
{
Response.Redirect(isKartSession());
}
}
}
}
}
}
else
{
clear();
// Response.Redirect("~/DolnaWebsite/Registerpage.aspx");
Notification.Text = "Already exsit!";
Notification.Show();
}
}
}
protected void btn_reset_Click(object sender, EventArgs e)
{
clear();
}
protected void btnimg_Click(object sender, EventArgs e)
{
//Image imgverify = (Image)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("imgverify");
//Panel pnlotp = (Panel)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("pnlotp");
//TextBox txtotp = (TextBox)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("txtotp");
//Label lblmsg = (Label)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("lblmsg");
string sessonOtp = Session["OTP"].ToString();
if (txtotp.Text == sessonOtp)
{
// btnVerifay.Visible = false;
imgverify.Visible = true;
pnlotp.Visible = false;
btn_submit.Enabled = true;
}
else
{
lblmsg.Text = "Enter a valid OTP";
}
}
#region Otp Method
public class SendSMS
{
#region -- Class For Sending SMS --
public static bool Mobile(string MobileNo, string Message)
{
//where the SMS Gateway is running
string ozSURL = "http://bhashsms.com/api/sendmsg.php";
//username for successful login
string ozUser = HttpUtility.UrlEncode("eea");
//user's password
string ozPassw = "Swash@2017";
//type of message
string ozSender = "deee";
//who will get the message
string ozRecipients = HttpUtility.UrlEncode(MobileNo);
//body of message
string ozMessageData = HttpUtility.UrlEncode("One Time Password For Dolna Site Registration is : " + Message); //body of message
//priority of message
string ozPriority = "ndnd";
//type of message
string ozStype = "normal";
string createdURL = ozSURL +
"?user=" + ozUser +
"&pass=" + ozPassw +
"&sender=" + ozSender +
"&phone=" + ozRecipients +
"&text=" + ozMessageData +
"&priority=" + ozPriority +
"&stype=" + ozStype;
try
{
//Create the request and send data to the SMS Gateway Server by HTTP connection
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(createdURL);
//Get response from the SMS Gateway Server and read the answer
HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
string responseString = respStreamReader.ReadToEnd();
respStreamReader.Close();
myResp.Close();
return true;
}
catch (Exception)
{
//if sending request or getting response is not successful the SMS Gateway Server may do not run
return false;
}
}
#endregion
}
private string GeneratePassword(int PasswordLength)
{
#region -- Generating The OTP Password --
string OTP = null;
try
{
// This OTP Code Created By Mr. Satyabrata Behera
string _allowedChars = "0123456789";
Random randNum = new Random();
char[] chars = new char[PasswordLength];
int allowedCharCount = _allowedChars.Length;
for (int i = 0; i < PasswordLength; i++)
{
chars[i] = _allowedChars[(int)((_allowedChars.Length) * randNum.NextDouble())];
}
return new string(chars);
}
catch (Exception Exc)
{
// lblErrorMsg.Text = "Application Error : " + Exc.Message;
return OTP;
}
#endregion
}
#endregion
//protected void btnVerifay_Click(object sender, EventArgs e)
//{
// string OTP = GeneratePassword(5);
// string message = "One Time Password is " + OTP;
// // TextBox txtmobile = (TextBox)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("txtmobile");
// // Panel pnlotp = (Panel)RadPanelBar1.FindItemByValue("AccountInformation").FindControl("pnlotp");
// SendSMS.Mobile(TxtMobileNo.Text, message);
// //SendMail(message);
// Session["OTP"] = OTP;
// // btnVerifay.Visible = false;
// if (Session["OTP"] != "")
// {
// //imgverify.Visible = false;
// pnlotp.Visible = true;
// }
//}
#region MailIntegration
private void SendMail( string otpmsg)
{
string Froms = "satyabrata@kencloud.co.in";
string Tos = txtEmail.Text.Trim();
string UserName = string.Empty;
string url = string.Empty;
MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress(Tos, txtName.Text.Trim()));
msg.From = new MailAddress(Froms, "Dolna");
msg.Subject = "Dolna Testing Mail Azure Web App Email using smtp.office365.com";
#region BodySetup
url = "http://kencommerce.azurewebsites.net/DolnaWebsite/Default.aspx";
//string body = "<html><body><img src='https://swasherpstorageaccount.blob.core.windows.net/dolnastaging412a6577-8b12-4d7b-a8c9-7b911f36a4a1/dolnastaging412a6577-8b12-4d7b-a8c9-7b911f36a4a1image/2e35cb67-c088-468b-857d-59092e6c2b6e-.png'/></body></html>";
string body = "";
body += "Hi, " + txtName.Text.Trim();
body += "<br /><br />Thank you, for Dolna Registration.";
// body += "<br /><br />This is your One Time Password : " + TemporayUseOtp + " use this OTP to complete your registration ";
body += "<br /><br />To Complete Your Registration and verify your email please use the following link";
// body += "<br/>Here Is Your Existing Password : <br/>" + Password + "";
// body += "<br /><a href=\"" + callbackUrl + "\" class='btn btn-default' >Click Here</a>";
body += "<br /><a href=\"" + url + "\" class='btn btn-default' >Activate your account</a>";
//body += "<br /><b>OR</b>";
body += "<br />"+otpmsg+"</b>";
//body += "<br /><br />If you cannot click on the link alternatively copy and paste in to your browser";
body += "<br /><br /> Best Wishes,";
body += "<br />SBackend Team";
body += "<html><body><img src='https://swasherpstorageaccount.blob.core.windows.net/dolnastaging412a6577-8b12-4d7b-a8c9-7b911f36a4a1/dolnastaging412a6577-8b12-4d7b-a8c9-7b911f36a4a1image/2e35cb67-c088-468b-857d-59092e6c2b6e-.png'/></body></html>";
body += "<br />---------------------------------------------------------------------------";
body += "<br /><b>This is a Auto generated message please donot reply back to this</b>";
#endregion
msg.Body = body; //"Test message using smtp.office365.com on Azure from a Web App";
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("satyabrata@kencloud.co.in", "chuma@1234");
client.Port = 587;
client.Host = "smtp.office365.com";
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.EnableSsl = true;
try
{
client.Send(msg);
// statusLabel.Text = "Message Sent Succesfully";
}
catch (Exception ex)
{
// statusLabel.Text = ex.ToString();
}
}
#endregion
protected void EmailVerifyBtn_Click(object sender, EventArgs e)
{
string OTP = GeneratePassword(5);
string message = "One Time Password is " + OTP;
SendMail(message);
Session["OTP2"] = OTP;
// btnVerifay.Visible = false;
if (Session["OTP2"] != "")
{
EmailVerifyBtn.Text = "Resend";
pnlotpEmail.Visible = true;
}
}
protected void btnimg3_Click(object sender, EventArgs e)
{
string sessonOtp = Session["OTP2"].ToString();
if (txtotp1.Text == sessonOtp)
{
EmailVerifyBtn.Visible = false;
Image1Email.Visible = true;
pnlotpEmail.Visible = false;
//btnVerifay.Enabled = true;
TxtMobileNo.Enabled = true;
btn_submit.Enabled = true;
}
else
{
lblmsgEmail.Text = "Enter a valid OTP";
}
}
}
}
===========================
<%@ Page Title="" Language="C#" MasterPageFile="~/PublicWebsites/MainMaster.Master" AutoEventWireup="true" CodeBehind="Registerpage.aspx.cs" Inherits="KenCommerceWeb.PublicWebsites.Registerpage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style>
.textSize {
font-size: 13px !important;
}
.Base {
display: inline;
font: 14px/18px "segoe ui",arial,sans-serif;
height: 20px;
overflow: hidden;
text-align: center;
vertical-align: middle;
width: 121px;
color: #fff;
/*border: 1px solid #333;*/
}
.t-container {
background: rgba(134, 133, 130, 0.3) !important;
}
.RadInput_Bootstrap .riEmpty, .RadInput_Empty_Bootstrap {
color: rgba(85,85,85,0.8) !important;
font-style: initial !important;
font-size: 13px !important;
font-family: inherit !important;
}
.RadButton.RadRadioButton span.rbText.rbToggleRadioChecked, .RadButton.RadRadioButton span.rbText.rbToggleRadio, .RadButton.RadCheckBox span.rbText.rbToggleCheckbox, .RadButton.RadCheckBox span.rbText.rbToggleCheckboxChecked {
display: inline-block;
position: relative;
padding-left: 1.71428571em;
font-size: 15px;
font-family: inherit !important;
}
.RadLabel_Bootstrap {
color: #333;
font-family: inherit !important;
}
.t-container {
padding-left: 15px;
padding-right: 15px;
padding-top: 30px !important;
}
.RadButton .rbText {
line-height: 1.35714286em;
vertical-align: top;
/* font-family: inherit; */
font-size: 15px !important;
}
.L0 {
border: 0 none;
}
.L1 {
background-color: #ff3933;
}
.L2 {
background-color: #ff6633;
}
.L3 {
background-color: #ff3399;
}
.L4 {
background-color: #cccc33;
}
.L5 {
background-color: #33cc00;
}
.RadUpload .ruFakeInput {
height: 2em !important;
}
.RadUpload .ruBrowse {
height: 2em !important;
}
.borderStyle {
border: 1px solid #ffffff !important;
padding: 15px;
border-style: groove !important;
background-color: #dbdbda !important;
}
/*.borderStyle {
border: 1px solid #ffffff !important;
padding: 15px !important;
border-style: groove
}*/
.RadButton_Bootstrap.rbButton, .RadButton_Bootstrap.RadButton.rbButton.rbDisabled, .RadButton_Bootstrap .rbSplitPart {
background-color: #a94442 !important;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px !important;
}
/*.riPassIndicator .riContentWrapper{
max-width: 23% !important;
}
}*/
.RadButton .rbText {
line-height: 1.35714286em;
vertical-align: top;
font-size: 11px !important;
}
.t-col-10 {
width: 79.33333% !important;
}
RadRadioButtonList RadRadioButtonList_Bootstrap rbHorizontalList {
padding-left: 25px !important;
}
</style>
<style>
.RadButton_Bootstrap.rbButton {
padding: 3px 12px !important;
}
</style>
<script>
function numberOnly(sender, eventArgs) {
var k = eventArgs.get_keyCode()
if (!(k >= 48 && k <= 57)) {
eventArgs.set_cancel(true);
}
}
function isNumberKey(evt) {
debugger;
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode != 47 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
else
return true;
}
function Spacevalidation(evt) {
debugger;
if (evt.which == 32)
return false;
}
function BlockScript(evts) {
if (evts.which == 60 || evts.which == 62)
return false;
}
</script>
<script type="text/javascript">
function pageLoad() {
Pass = $find("<%=txtPassword.ClientID %>");
Repass = $find("<%=txtConfirmPassword.ClientID %>");
}
checkPasswordMatch = function () {
debugger
var text1 = Pass.get_textBoxValue();
var text2 = Repass.get_textBoxValue();
if (text2 == "") {
$get("PasswordRepeatedIndicator").innerHTML = " ";
$get("PasswordRepeatedIndicator").className = "Base L0";
}
else if (text1 == text2) {
$get("PasswordRepeatedIndicator").innerHTML = "Matched";
$get("PasswordRepeatedIndicator").className = "Base L5";
}
else {
$get("PasswordRepeatedIndicator").innerHTML = "Not Matched";
$get("PasswordRepeatedIndicator").className = "Base L1";
}
}
</script>
<style>
.riStrengthBarL1 {
font-size: 14px;
}
</style>
<link rel="stylesheet" href="<%#ResolveUrl("~")%>/common/css/login.css" />
<link rel="stylesheet" href="<%#ResolveUrl("~")%>/DolnaWebsite/css/Custom.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<div class="container" style="margin-top: 130px;">
<div class="row">
<div class="col-md-12">
<div class="comment-box2">
<img alt="" src="<%#ResolveUrl("~")%>/DolnaWebsite/images/og.gif" />
<div class="comment-content">
<h2 class="h2s">Register
<span style="float: right;" class="st_sharethis" st_processed="yes">
<span style="text-decoration: none; color: rgb(0, 0, 0); display: inline-block; cursor: pointer; padding-left: 0px; padding-right: 0px; width: 16px;" class="stButton">
<span class="chicklets sharethis"> </span>
</span>
</span>
</h2>
<hr style="margin-top: 5px; margin-bottom: 5px; border: 0; border-top: 1px solid #000000;" />
<p><%--New User Registration, User Will Register in This Page--%></p>
</div>
</div>
</div>
</div>
</div>
<telerik:RadNotification RenderMode="Lightweight" ID="Notification" runat="server" Position="TopCenter"
AutoCloseDelay="2000" Width="350" Height="110" Title="Users Page" TitleIcon="none" LoadContentOn="EveryShow">
</telerik:RadNotification>
<%-- <telerik:RadAjaxManagerProxy ID="panel" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="btn_submit">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadPageLayout1" LoadingPanelID="RadAjaxLoadingPanel1"/>
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="btnimg">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadPageLayout1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="btnVerifay">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadPageLayout1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>--%>
<asp:UpdateProgress ID="updateProgress" runat="server" AssociatedUpdatePanelID="updpnl">
<ProgressTemplate>
<div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0; right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7;">
<asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/common/images/Icons/loading.gif" AlternateText="Loading ..." ToolTip="Loading ..." Style="padding: 10px; position: fixed; top: 45%; left: 50%;" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<%-- <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">--%>
<asp:UpdatePanel ID="updpnl" runat="server">
<ContentTemplate>
<telerik:RadPageLayout runat="server" ID="RadPageLayout1" GridType="Fluid" Width="50%" CssClass="borderStyle">
<Rows>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<telerik:RadRadioButtonList runat="server" Font-Size="13px" ID="RadRadioButtonList1" AutoPostBack="false" Direction="Horizontal" Width="100%">
<Items>
<telerik:ButtonListItem Text="Artist" Value="Artist" />
<telerik:ButtonListItem Text="Gallerist" Value="Gallerist" />
<telerik:ButtonListItem Text="Art Lover" Value="Customer" Selected="true" />
</Items>
</telerik:RadRadioButtonList>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="10px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
<telerik:RadLabel runat="server" CssClass="textSize">Name:</telerik:RadLabel>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator1"
ControlToValidate="txtName" ForeColor="Red" ErrorMessage="*" ValidationGroup="Registration"></asp:RequiredFieldValidator>
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<telerik:RadTextBox ID="txtName" runat="server" MaxLength="35" Font-Size="Smaller" Width="95%" Height="28px" EmptyMessage="Enter Your name"></telerik:RadTextBox>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="10px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
<telerik:RadLabel runat="server" CssClass="textSize">Email (User Id):</telerik:RadLabel>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator2" ControlToValidate="txtEmail"
ForeColor="Red" ErrorMessage="*" ValidationGroup="Registration"></asp:RequiredFieldValidator>
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<telerik:RadTextBox ID="txtEmail" runat="server" Font-Size="Smaller" Width="55%" Height="28px" EmptyMessage="Enter a Valid Email Id"></telerik:RadTextBox>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ControlToValidate="txtEmail"
ForeColor="Red" ErrorMessage="*" ValidationGroup="Registra"></asp:RequiredFieldValidator>
<asp:Button ID="EmailVerifyBtn" runat="server" Text="Email Verification" ValidationGroup="Registra" OnClick="EmailVerifyBtn_Click" Style="background-color: #a94442; color: white; font-size: 14px; font-family: inherit; padding: 4px 6px; border-radius: 6px;" />
<asp:Image runat="server" ImageUrl="~/DolnaWebsite/images/dc6okxERi.png" ID="Image1Email" Width="25px" Visible="false" />
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="2">
<asp:RegularExpressionValidator ID="RegularExpressioddddnValidator3" runat="server" ValidationGroup="Registra" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="txtEmail" ErrorMessage="Invalid!" ForeColor="Red"></asp:RegularExpressionValidator>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<asp:Panel ID="pnlotpEmail" runat="server" Visible="false" Style="margin-left: -4px">
<asp:Label runat="server" ID="Label6r" AssociatedControlID="txtotp1" ForeColor="Red"> </asp:Label>
<telerik:RadTextBox ID="txtotp1" runat="server" Width="200px" Height="28px" Font-Size="13px" EmptyMessage="Enter OTP"></telerik:RadTextBox>
<asp:Label runat="server" ID="lblmsgEmail" ForeColor="Red" Text=""> </asp:Label>
<asp:Button ID="btnimg3" runat="server" Text="Verify" CausesValidation="false" Style="background-color: #337ab7; color: white; font-size: 14px; font-family: inherit; width: 61px; border-radius: 16px;"
OnClick="btnimg3_Click" />
</asp:Panel>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="10px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
<telerik:RadLabel runat="server" CssClass="textSize">Mobile No :</telerik:RadLabel>
<%-- <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator3" ControlToValidate="txtEmail"
ForeColor="Red" ErrorMessage="*" ValidationGroup="Registration"></asp:RequiredFieldValidator>--%>
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<%-- <telerik:RadButton ID="txtMobileNo" runat="server" placeholder="Mobile No" > </telerik:RadButton>--%>
<%-- <asp:TextBox ID="TxtMobileNo" CssClass="textInput"
onkeypress="return isNumberKey(event,this);" onpaste="return false;" placeholder="Enter Mobile Number" MaxLength="10"
runat="server" Width="200px"></asp:TextBox>--%>
<telerik:RadTextBox ID="TxtMobileNo" runat="server" Font-Size="Smaller" Height="28px" onkeypress="return isNumberKey(event,this);" onpaste="return false;" EmptyMessage="Enter Mobile Number" MaxLength="10"
Width="55%">
</telerik:RadTextBox>
<asp:RequiredFieldValidator runat="server" ID="RequiredFieldddValidator3" ControlToValidate="TxtMobileNo"
ForeColor="Red" ErrorMessage="*" ValidationGroup="Registration"></asp:RequiredFieldValidator>
<%-- <asp:Button ID="btnVerifay" runat="server" Text="Mobile Verification" Enabled="false" ValidationGroup="mbl" Visible="false" OnClick="btnVerifay_Click" Style="background-color: #a94442; color: white; font-size: 13px; font-family: inherit; padding: 5px 6px; border-radius: 6px;" />--%>
<asp:Image runat="server" ImageUrl="~/DolnaWebsite/images/dc6okxERi.png" ID="imgverify" Width="25px" Visible="false" />
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="2">
<asp:RegularExpressionValidator ControlToValidate="TxtMobileNo" ID="RegularExpressionValidator2" ValidationExpression="^[0-9]{10,10}$" runat="server" ErrorMessage="Invalid!" ForeColor="Red"></asp:RegularExpressionValidator>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3">
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7">
<asp:Panel ID="pnlotp" runat="server" Visible="false" Style="margin-left: -4px">
<asp:Label runat="server" ID="Label6" AssociatedControlID="txtotp" ForeColor="Red"> </asp:Label>
<telerik:RadTextBox ID="txtotp" runat="server" Width="200px" Height="28px" Font-Size="13px" EmptyMessage="Enter OTP"></telerik:RadTextBox>
<%-- <asp:TextBox ID="txtotp" placeholder="Enter OTP" Height="28px"
runat="server" Width="150px"></asp:TextBox>--%>
<%-- <asp:RequiredFieldValidator ID="Requiredfieldvalidator20" runat="server" Display="Dynamic"
ControlToValidate="txtotp" ErrorMessage="" Text="Enter OTP" ForeColor="Red"></asp:RequiredFieldValidator>--%>
<asp:Label runat="server" ID="lblmsg" ForeColor="Red" Text=""> </asp:Label>
<asp:Button ID="btnimg" runat="server" Text="Verify" Visible="false" CausesValidation="false" Style="background-color: #337ab7; color: white; font-size: 14px; font-family: inherit; width: 61px; border-radius: 16px;"
OnClick="btnimg_Click" />
</asp:Panel>
<%--<telerik:RadButton ID="vry" runat="server" Text="VERIFY" CausesValidation="false" OnClick="vry_Click"></telerik:RadButton>--%>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="10px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3" SpanMd="6" SpanSm="6" SpanXs="12">
<telerik:RadLabel runat="server" CssClass="textSize">Password:</telerik:RadLabel>
<asp:RequiredFieldValidator ID="rfvUserPass" runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Registration" ControlToValidate="txtPassword"></asp:RequiredFieldValidator>
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7" SpanMd="6" SpanSm="6" SpanXs="12">
<telerik:RadTextBox runat="server" ID="txtPassword" Height="28px" MaxLength="15" TextMode="Password" Width="300px">
<PasswordStrengthSettings ShowIndicator="true" IndicatorWidth="75px"></PasswordStrengthSettings>
</telerik:RadTextBox>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="10px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="3" SpanMd="6" SpanSm="6" SpanXs="12">
<telerik:RadLabel runat="server" CssClass="textSize">Confirm password:</telerik:RadLabel>
<asp:RequiredFieldValidator ID="RequiredFieldVasslidator3" runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Registration" ControlToValidate="txtConfirmPassword"></asp:RequiredFieldValidator>
</telerik:LayoutColumn>
<telerik:LayoutColumn Span="7" SpanMd="6" SpanSm="6" SpanXs="12">
<telerik:RadTextBox ID="txtConfirmPassword" Height="28px" runat="server" MaxLength="15" TextMode="Password" onkeyup="return checkPasswordMatch();" ValidationGroup="Registration" Width="106px">
</telerik:RadTextBox>
<span id="PasswordRepeatedIndicator" class="Base L0"> </span>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="12" SpanMd="12" SpanSm="12" SpanXs="12">
<asp:CompareValidator ID="Compare1"
ControlToValidate="txtConfirmPassword"
ControlToCompare="txtPassword"
Type="Integer"
EnableClientScript="false"
Text="The Password and Confirmation Password must match."
runat="server" ValidationGroup="Registration" ForeColor="Red"/>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
<telerik:LayoutRow Height="15px"></telerik:LayoutRow>
<telerik:LayoutRow>
<Columns>
<telerik:LayoutColumn Span="10" Style="text-align: center">
<telerik:RadButton ID="btn_submit" runat="server" Text="Submit" Height="28px" CausesValidation="true" ForeColor="White" OnClick="btn_submit_Click" Enabled="false" ValidationGroup="Registration"></telerik:RadButton>
<telerik:RadButton ID="btn_reset" runat="server" Text="Reset" ForeColor="White" Height="28px" OnClick="btn_reset_Click"></telerik:RadButton>
</telerik:LayoutColumn>
</Columns>
</telerik:LayoutRow>
</Rows>
</telerik:RadPageLayout>
</ContentTemplate>
</asp:UpdatePanel>
<%-- </telerik:RadAjaxPanel>--%>
</asp:Content>
Comments
Post a Comment