public OpResponse GetPassword(string LoginId) { OpResponse orp = new OpResponse(); orp.IsSuccess = false; using (IDbConnection dbConnection = dbHelper.GetConnection()) { using (IDbCommand dbCommand = dbHelper.GetCommand("getpassword", CommandType.StoredProcedure, dbConnection)) { dbHelper.AddParameter("userlogin", LoginId, dbCommand); using (IDataReader dr = dbCommand.ExecuteReader()) { while (dr.Read()) { orp.IsSuccess = true; orp.OpMsg = dr["userpassword"].ToString(); } } if (!orp.IsSuccess) { orp.OpMsg = "Not able to find User"; } } } return(orp); }
public OpResponse Divide(string x, string y) { int ix = (x != null) ? Int32.Parse(x) : 0; int iy = (y != null) ? Int32.Parse(y) : 0; int r = -1; string error = ""; if (iy > 0) { r = ix / iy; } else { error = "Divide by zero exception."; } addToDB("divide", ix, iy, error); OpResponse response = new OpResponse("Divide", ix, iy, r); response.Error = error; return(response); }
public OpResponse ChangeProfile(Profile profile) { OpResponse orp = new OpResponse(); orp.IsSuccess = false; using (IDbConnection dbConnection = dbHelper.GetConnection()) { using (IDbCommand dbCommand = dbHelper.GetCommand("updateprofile", CommandType.StoredProcedure, dbConnection)) { dbHelper.AddParameter("userlogin", profile.LoginId, dbCommand); dbHelper.AddParameter("newpassword", profile.NewPassword, dbCommand); dbHelper.AddParameter("phoneNumber", profile.PhoneNumber, dbCommand); dbHelper.AddParameter("DName", profile.DisplayName, dbCommand); if (dbCommand.ExecuteNonQuery() > 0) { orp.IsSuccess = true; orp.OpMsg = "Profile changed successfully"; } } } return(orp); }
public OpResponse ForgotPassword(string LoginId) { OpResponse OpResponse = new OpResponse(); LoginResponse lr = loginRepos.GetUserByID(LoginId); if (lr != null) { OpResponse.IsSuccess = true; OpResponse.OpMsg = string.Format("Email sent to {0}", lr.Email); MQBatchRequest batchRequest = new MQBatchRequest() { EventType = EventDef.FORGOTPASSWORD, MessageData = lr }; MQManager.QueueEmployeeUpdate(batchRequest); } else { OpResponse.IsSuccess = false; OpResponse.OpMsg = "User not exists"; } return(OpResponse); }
public HttpResponseMessage ChangeProfile(Profile profile) { var responseMessage = new HttpResponseMessage(); try { EzMoveIdentity ezMoveIdentity = (EzMoveIdentity)HttpContext.Current.User.Identity; if (ezMoveIdentity != null && ezMoveIdentity.loginResponse != null) { profile.LoginId = ezMoveIdentity.loginResponse.LoginID; OpResponse opResponse = LoginService.ChangeProfile(profile); responseMessage = Request.CreateResponse(HttpStatusCode.OK, opResponse); } else { responseMessage = Request.CreateResponse(HttpStatusCode.Unauthorized, "Given User Name or Password is wrong"); } } catch (Exception ex) { responseMessage = Request.CreateResponse(HttpStatusCode.InternalServerError, new ResultMessage(ex)); } return(responseMessage); }