private bool isValidate(RegisterShape LT, ref string OutMsg) { bool isValid = true; if (string.IsNullOrEmpty(LT.Name) || LT.Name.Length == 0) { isValid = false; OutMsg += "\n" + "Name" + " : " + "Required_Field"; } if (string.IsNullOrEmpty(LT.Email) || LT.Email.Length == 0) { isValid = false; OutMsg += "\n" + "Email" + " : " + "Required_Field"; } if (string.IsNullOrEmpty(LT.Password) || LT.Password.Length == 0) { isValid = false; OutMsg += "\n" + "Password" + " : " + "Required_Field"; } return(isValid); }
public HttpResponseMessage Register(RegisterShape LoginUser) { try { string Login = string.Empty; ClassUserAccount Resp = new ClassUserAccount(); DataTable dt = new DataTable(); string IPAddress = "192.168.3.3"; string UserID = ""; string Messages = ""; if (isValidate(LoginUser, ref UserID)) { Messages = Resp.FN_Register(LoginUser, IPAddress, out UserID); if (Messages == "1") { LoginUser.RegNO = UserID; return(Request.CreateResponse(HttpStatusCode.OK, LoginUser)); } else { return(Request.CreateResponse(HttpStatusCode.OK, Messages)); } } else { return(Request.CreateResponse(HttpStatusCode.Unauthorized, Messages)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500_INTERNAL_SERVER_ERROR")); } }
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); }