public ApiResponseModel <List <Data.Entity.Profile> > GetAllProfileByCurrentUser([FromQuery] GetAllProfileByCurrentUserRequestModel requestModel, [FromHeader] string displayLanguage)
        {
            var responseModel = new ApiResponseModel <List <Data.Entity.Profile> >();

            responseModel.DisplayLanguage = displayLanguage;

            if (requestModel.EmployeeId <= 0)
            {
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Error;
                responseModel.ResultStatusMessage = "Employee Id Must Be Entered";
                return(responseModel);
            }
            try
            {
                responseModel.Data                = _profileEmployeeService.GetAllProfileByCurrentUser(requestModel.EmployeeId);
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Success;
                responseModel.ResultStatusMessage = "Success";
            }
            catch (Exception ex)
            {
                responseModel.ResultStatusCode    = ResultStatusCodeStatic.Error;
                responseModel.ResultStatusMessage = ex.Message;
            }

            return(responseModel);
        }
예제 #2
0
        // todo: Login metodu yeni projeye gore kodlanacak

        /*
         * public static SessionLoginResult Login(string userRegNum, string userPasswordClear, bool isWindowsAuthentication, IUserService userService, IBshCasAuthService bshCasAuthService, ICustomAppUserService customAppUserService, IBshCasProfileService bshCasProfileService, IDepartmentService departmentService)
         */

        public static SessionLoginResult Login(string userName, string userPasswordClear,
                                               IAuthenticationService authenticationService, IProfileDetailService profileDetailService,
                                               IProfileEmployeeService profileEmployeeService)
        {
            var existUser = authenticationService.Login(userName, userPasswordClear, CurrentLanguageTwoChar);

            if (existUser.ResultStatusCode == ResultStatusCodeStatic.Error)
            {
                return(new SessionLoginResult(false, existUser.ResultStatusMessage));
            }

            SessionUser currentUser = new SessionUser();

            currentUser.Id        = existUser.Data.Id;
            currentUser.TC        = existUser.Data.TC;
            currentUser.Name      = existUser.Data.Name;
            currentUser.LastName  = existUser.Data.LastName;
            currentUser.Phone     = existUser.Data.Phone;
            currentUser.Address   = existUser.Data.Address;
            currentUser.UserToken = existUser.Data.UserToken;


            var apiAuthResponse = profileDetailService.GetAllAuthByCurrentUser(existUser.Data.UserToken, CurrentLanguageTwoChar, existUser.Data.Id);

            if (apiAuthResponse.ResultStatusCode != ResultStatusCodeStatic.Success)
            {
                return(new SessionLoginResult(false, apiAuthResponse.ResultStatusMessage));
            }
            currentUser.AuthList = apiAuthResponse.Data;

            var apiProfileResponse = profileEmployeeService.GetAllProfileByCurrentUser(existUser.Data.UserToken, CurrentLanguageTwoChar, existUser.Data.Id);

            if (apiProfileResponse.ResultStatusCode != ResultStatusCodeStatic.Success)
            {
                return(new SessionLoginResult(false, apiProfileResponse.ResultStatusMessage));
            }
            currentUser.ProfileList = apiProfileResponse.Data;


            CurrentUser = currentUser;

            return(new SessionLoginResult(true, null));
        }
예제 #3
0
        // todo: Login metodu yeni projeye gore kodlanacak

        /*
         * public static SessionLoginResult Login(string userRegNum, string userPasswordClear, bool isWindowsAuthentication, IUserService userService, IBshCasAuthService bshCasAuthService, ICustomAppUserService customAppUserService, IBshCasProfileService bshCasProfileService, IDepartmentService departmentService)
         */

        public static SessionLoginResult Login(string userName, string userPasswordClear,
                                               IAuthenticationService authenticationService, IProfileDetailService profileDetailService,
                                               IProfileEmployeeService profileEmployeeService)
        {
            var existUser = authenticationService.Login(userName, userPasswordClear, CurrentLanguageTwoChar);

            if (existUser.ResultStatusCode == ResultStatusCodeStatic.Error)
            {
                return(new SessionLoginResult(false, existUser.ResultStatusMessage));
            }

            SessionUser currentUser = new SessionUser();

            currentUser.ID           = existUser.Data.ID;
            currentUser.TRNationalId = existUser.Data.TRNationalId;
            currentUser.Name         = existUser.Data.Name;
            currentUser.LastName     = existUser.Data.LastName;

            currentUser.SexId = existUser.Data.SexId;

            currentUser.UserToken = existUser.Data.UserToken;


            var apiAuthResponse = profileDetailService.GetAllAuthByCurrentUser(existUser.Data.UserToken, CurrentLanguageTwoChar, existUser.Data.ID);

            if (apiAuthResponse.ResultStatusCode != ResultStatusCodeStatic.Success)
            {
                return(new SessionLoginResult(false, apiAuthResponse.ResultStatusMessage));
            }
            currentUser.AuthList = apiAuthResponse.Data;

            var apiProfileResponse = profileEmployeeService.GetAllProfileByCurrentUser(existUser.Data.UserToken, CurrentLanguageTwoChar, existUser.Data.ID);

            if (apiProfileResponse.ResultStatusCode != ResultStatusCodeStatic.Success)
            {
                return(new SessionLoginResult(false, apiProfileResponse.ResultStatusMessage));
            }
            currentUser.ProfileList = apiProfileResponse.Data;



            // check username and password

            // SessionUser currentUser = new SessionUser();
            // currentUser.Id = 1; //existUser.Id;
            // currentUser.FirstName = "Name1"; // existUser.Name;
            // currentUser.LastName = "LastName1"; //existUser.Surname;
            // currentUser.NameSurname = "Name1 LastName1"; // existUser.NameSurname;
            // currentUser.Email = "*****@*****.**"; //existUser.Email;
            // currentUser.RegNum = "1"; //existUser.RegNum;
            // currentUser.RegNumManager = "2"; //existUser.RegNumManager;
            // currentUser.RegNoManager = 2; // existUser.RegNoManager;
            // currentUser.PhoneMobile = "05071234567"; // existUser.PhoneMobile;
            // currentUser.TitleTxt = "Developer"; //existUser.TitleTxt;
            // currentUser.IsActive = true; //existUser.Status == "A" ? true : false;
            // currentUser.UserToken = "";
            // currentUser.UserName = "******";
            //currentUser.CompanyId = "ALUMINYUM";//DEFAULT olarak bu verildi. ilerleyen zamanda employye'inin company ıd 'si koyulacak.
            // //currentUser.CompanyId = "BILISIM";//DEFAULT olarak bu verildi. ilerleyen zamanda employye'inin company ıd 'si koyulacak.


            //currentUser.RoleId = 1;//default olarak 1 verildi.
            // uygulamada role tanımlaması yerine yetki bazlı çalışma bulunmaktadır

            // kullanıcıya ait yetki tanımları elde edilip session'a doldurulur
            // 111,222,333,444 sicil numarasına göre t_cas_user tablosundaki atanacak regno var mı kontrol edilecek

            //currentUser.UserBshCasAuthList = bshCasAuthService.GetAllByProjectCodeAndUserIdWhichAuthStatusIsActive(ConfigHelper.BshCasProjectCode, existUser.Id);
            //currentUser.UserBshCasProfileList = bshCasProfileService.GetAllByProjectCodeAndUserId(ConfigHelper.BshCasProjectCode, existUser.Id);

            //// oturum açan kullanıcının departman koduna göre appliance tracker'daki departman kaydı elde edilir
            //currentUser.ApplianceTrackerDeparment = departmentService.GetByBshCasDepartmentCodeWhichIsActiveTrue(existUser.DepartmentCode);
            //if (currentUser.ApplianceTrackerDeparment == null)
            //{
            //    return new SessionLoginResult(false, "Can not find departmant info from Appliance Tracker system for user.");
            //}

            /*
             * // trace guid oluşturulması, session'a bu bilginin eklenmesi ve db tablosuna eklenmesi
             * string traceGuid = Guid.NewGuid().ToString();
             * UserSessionTrace userSessionTrace = new UserSessionTrace();
             * userSessionTrace.CreatedDate = DateTime.Now;
             * userSessionTrace.SessionTraceGuid = traceGuid;
             * userSessionTrace.UserId = currentUser.Id;
             * userSessionTrace.UserIpAddress = SessionHelper.GetCurrentRequestIpAddress();
             * int resultUserSessionTrace = new UserSessionTraceService().Add(userSessionTrace);
             * currentUser.UserSessionTrace_SessionTraceGuid = traceGuid;
             */

            CurrentUser = currentUser;

            return(new SessionLoginResult(true, null));
        }