public static ResponseDto ChangeProfilePhoto(ChangeProfilePhotoRequest request) { ResponseDto response = new ResponseDto(); AgentBoss agentBoss = null; try { //if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) //{ // return response; //} using (AgentBossDao dao = new AgentBossDao()) { agentBoss = dao.FindById(request.user_id); if (agentBoss != null) { agentBoss.ProfileImage = request.profile_image; dao.Update(agentBoss); } response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("profile.changed"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }
public static GetAgentBossDetailsResponse GetDetails(GetAgentBossDetailsRequest request) { GetAgentBossDetailsResponse response = new GetAgentBossDetailsResponse(); AgentBoss agentBoss = null; try { if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { return(response); } using (AgentBossDao dao = new AgentBossDao()) { agentBoss = dao.FindById(request.user_id); response.agent_boss_details = new AgentBossMoreDetailsDto(); response.agent_boss_details.agent_boss_id = agentBoss.AbosID; response.agent_boss_details.profile_image = ImagePathService.agentBossImagePath + agentBoss.ProfileImage; response.agent_boss_details.agent_boss_name = agentBoss.OwnerName; response.agent_boss_details.mobile_number = agentBoss.MobileNumber; response.agent_boss_details.agent_boss_email = agentBoss.Email; response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("admin.boss.details"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }
public static ResponseDto ChangeProfile(ChangeProfileAgentBossRequest request) { request.mobile_number = Common.GetStandardMobileNumber(request.mobile_number); ResponseDto response = new ResponseDto(); AgentBoss agentBoss = null; try { if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { return(response); } using (AgentBossDao dao = new AgentBossDao()) { agentBoss = dao.FindById(request.user_id); agentBoss.OwnerName = request.agent_boss_name; //agentBoss.MobileNumber = request.mobile_number; //agentBoss.ProfileImage = request.profile_image; //Commented bcz image is uploading as multipart agentBoss.Email = request.agent_boss_email; dao.Update(agentBoss); response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("profile.changed"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }
public static AgentBoss GetAuthAgentBossNotAuthToken(int userId, ResponseDto response = null) { AgentBoss agentBoss = null; using (AgentBossDao dao = new AgentBossDao()) { agentBoss = dao.FindById(userId); if (agentBoss != null) { return(agentBoss); } if (response != null) { response.code = 1; response.has_resource = 0; response.message = MessagesSource.GetMessage("invalid.agentboss"); } return(null); } }
public static ResponseDto ChangePassword(ChangePasswordAgentBossRequest request) { ResponseDto response = new ResponseDto(); AgentBoss agentBoss = null; string oldPasswordHash = TokenGenerator.GetHashedPassword(request.old_password, 49); try { if (!AgentBossServices.CheckAgentBoss(request.user_id, request.auth_token, response)) { MakeNouserResponse(response); return(response); } using (AgentBossDao dao = new AgentBossDao()) { agentBoss = dao.FindById(request.user_id); if (agentBoss.Password == oldPasswordHash) { agentBoss.Password = TokenGenerator.GetHashedPassword(request.new_password, 49); dao.Update(agentBoss); response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("password.changed"); return(response); } } response.code = 1; response.has_resource = 0; response.message = MessagesSource.GetMessage("exception"); return(response); } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }