Exemplo n.º 1
0
        public HttpResponseMessage CreateOTPRegistraion(dynamic SearchForm)
        {
            try
            {
                string Email = string.Empty;
                Email = (string)SearchForm.Email;
                string OTPType = string.Empty;
                OTPType = (string)SearchForm.OTPType;
                UserClass CLE = new UserClass();
                DataTable dt  = new DataTable();
                dt = CLE.FN_CreateOTPRegistraion(Email, OTPType);
                string OTPCode = "";

                if (dt.Rows.Count > 0)
                {
                    OTPCode = dt.Rows[0]["OPTCode"].ToString();
                    string     Emails    = dt.Rows[0]["email"].ToString();
                    string     OTPtext   = "Use  below code to  " + OTPType + " your Account (The below otp is only for " + OTPType + " Account)";
                    ClassEmail OBJ       = new ClassEmail();
                    string     EmailText = OBJ.GetTemplate("otp.htm");
                    EmailText = EmailText.Replace("XXXOTPTypeXX", OTPtext).Replace("XXOTPXX", OTPCode);
                    try { OBJ.sendMail(Emails, "OTP code for registration", EmailText); } catch { }
                }

                return(Request.CreateResponse(HttpStatusCode.OK, OTPCode));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500_Internal_Server_Error"));
            }
        }
Exemplo n.º 2
0
        public string FN_Register(RegisterShape LoginUser, string IPAddress, out string RegNO)
        {
            string        status      = "";
            string        AppMstRegNo = "";
            SqlConnection con         = new SqlConnection(method.str);
            SqlCommand    com         = new SqlCommand("Insertdata5", con);

            com.CommandType    = CommandType.StoredProcedure;
            com.CommandTimeout = 99999999;
            com.Parameters.AddWithValue("@SessionID", LoginUser.SponsorId.Trim());
            com.Parameters.AddWithValue("@sponserID", LoginUser.SponsorId.Trim());
            com.Parameters.AddWithValue("@AppMstFName", LoginUser.Name.Trim());
            com.Parameters.AddWithValue("@mobile", "NA");
            com.Parameters.AddWithValue("@emailid", LoginUser.Email.Trim());
            com.Parameters.AddWithValue("@AppMstleftright", LoginUser.Position.Trim());
            com.Parameters.AddWithValue("@BTCAddres", "NA");
            com.Parameters.AddWithValue("@country", LoginUser.country.Trim());
            com.Parameters.AddWithValue("@Pwd", LoginUser.Password.Trim());
            com.Parameters.AddWithValue("@IPAddress", IPAddress);
            com.Parameters.AddWithValue("@Key", LoginUser.Password.Trim());
            com.Parameters.AddWithValue("@OTP", LoginUser.OTP.Trim());
            com.Parameters.Add("@regDisplay", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
            com.Parameters.Add("@flag", SqlDbType.VarChar, 50).Direction       = ParameterDirection.Output;
            com.Parameters.Add("@flagpwd", SqlDbType.VarChar, 50).Direction    = ParameterDirection.Output;

            try
            {
                con.Open();
                com.CommandTimeout = 999999;
                com.ExecuteNonQuery();
                RegNO = com.Parameters["@regDisplay"].Value.ToString();
                string flagpwd = com.Parameters["@flagpwd"].Value.ToString();
                status = com.Parameters["@flag"].Value.ToString();
                if (status == "1")
                {
                    AppMstRegNo = status;
                    ClassEmail OBJ       = new ClassEmail();
                    string     EmailText = OBJ.GetTemplate("successful.htm");
                    EmailText = EmailText.Replace("XXNameXX", LoginUser.Name.Trim().ToUpper()).Replace("XXusernameXX", RegNO).Replace("XXpasswordXX", flagpwd);
                    try { OBJ.sendMail(LoginUser.Email.Trim(), "Welcome To XS COIN", EmailText); } catch { }
                }

                else
                {
                    AppMstRegNo = status;
                }
            }
            catch (Exception ex)
            {
                RegNO       = "";
                AppMstRegNo = status;
            }

            return(AppMstRegNo);
        }
        public HttpResponseMessage ForgetPassword(dynamic LoginUser)
        {
            try
            {
                string Login = string.Empty;

                Login = (string)LoginUser.LoginID;
                ClassUserAccount Resp     = new ClassUserAccount();
                DataTable        dt       = new DataTable();
                string           Password = "";
                string           Email    = "";
                string           Name     = "";
                dt = Resp.FN_ForgetPassword(Login);

                if (dt.Rows.Count > 0)
                {
                    Password = dt.Rows[0]["AppMstPassword"].ToString();
                    Email    = dt.Rows[0]["email"].ToString();
                    Name     = dt.Rows[0]["AppMstFName"].ToString();
                    ClassEmail OBJ       = new ClassEmail();
                    string     EmailText = OBJ.GetTemplate("forgotpass.htm");
                    EmailText = EmailText.Replace("XXNameXX", Name.ToUpper()).Replace("XXUserIDXX", Login).Replace("XXPaswordIDXX", Password);
                    try { OBJ.sendMail(Email, "Password", EmailText); } catch { }

                    return(Request.CreateResponse(HttpStatusCode.OK, new { USERID = Email }));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.Unauthorized, "UserID and Passwrod invalid"));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500_INTERNAL_SERVER_ERROR"));
            }
        }