コード例 #1
0
        public ResponseUserDetail GetAllUsers(string Instance, string Version, string SessionId)
        {
            const string FUNCTION_NAME = "GetAllUsers";

            SICTLogger.WriteInfo(CLASS_NAME, FUNCTION_NAME, "Start");
            ResponseUserDetail ResponseUserDetail = new ResponseUserDetail();

            try
            {
                UserDetailsBusiness ObjSessionValidation   = new FactoryBusiness().GetUserDetailsBusiness(BusinessConstants.VERSION_BASE);
                UserDetailsBusiness ObjUserDetailsBusiness = new FactoryBusiness().GetUserDetailsBusiness(Version);
                if (ObjSessionValidation.IsSessionIdValid(SessionId))
                {
                    ResponseUserDetail = ObjUserDetailsBusiness.GetAllUser();
                }
                else
                {
                    ResponseUserDetail.ReturnCode    = 0;
                    ResponseUserDetail.ReturnMessage = "Invalid session";
                    SICTLogger.WriteWarning(CLASS_NAME, FUNCTION_NAME, "Invalid session ");
                }
            }
            catch (Exception Ex)
            {
                ResponseUserDetail.ReturnCode    = -1;
                ResponseUserDetail.ReturnMessage = "Error in API Execution";
                SICTLogger.WriteException(CLASS_NAME, FUNCTION_NAME, Ex);
            }
            SICTLogger.WriteInfo(CLASS_NAME, FUNCTION_NAME, "End ");
            return(ResponseUserDetail);
        }
コード例 #2
0
        public ResponseUserDetail GetAllUser()
        {
            ResponseUserDetail ResponseUserDetail = new ResponseUserDetail();

            SICTLogger.WriteInfo(UserDetailsBusiness.CLASS_NAME, "GetAllUser", "Start ");
            try
            {
                DataAccessLayer.DataAccessLayer DBLayer = new DataAccessLayer.DataAccessLayer();
                SICTLogger.WriteVerbose(UserDetailsBusiness.CLASS_NAME, "GetAllUser", "Retrieving All User Details from DB Start");
                DataTable DtUser = DBLayer.GetAllUseDetails();
                System.Collections.Generic.List <UserDetail> UserDetails = new System.Collections.Generic.List <UserDetail>();
                foreach (DataRow Dr in DtUser.Rows)
                {
                    UserDetail TempUserDetails = new UserDetail();
                    if (!string.IsNullOrEmpty(Dr[BusinessConstants.USER_USERID].ToString()))
                    {
                        TempUserDetails.UserId = System.Convert.ToInt32(Dr[BusinessConstants.USER_USERID].ToString());
                    }
                    else
                    {
                        TempUserDetails.UserId = -1;
                    }
                    TempUserDetails.IsLogin = System.Convert.ToBoolean(Dr[BusinessConstants.USER_ISLOGIN].ToString());
                    if (!string.IsNullOrEmpty(Dr[BusinessConstants.USER_USERNAME].ToString()))
                    {
                        TempUserDetails.UserName = Dr[BusinessConstants.USER_USERNAME].ToString();
                    }
                    if (!string.IsNullOrEmpty(Dr[BusinessConstants.USER_PASSWORD].ToString()))
                    {
                        TempUserDetails.Password = Dr[BusinessConstants.USER_PASSWORD].ToString();
                    }
                    if (!string.IsNullOrEmpty(Dr[BusinessConstants.AIRPORTID].ToString()))
                    {
                        TempUserDetails.AirportId = System.Convert.ToInt32(Dr[BusinessConstants.AIRPORTID].ToString());
                    }
                    if (!string.IsNullOrEmpty(Dr[BusinessConstants.USER_AIRPORTNAME].ToString()))
                    {
                        string AirportName = Dr[BusinessConstants.USER_AIRPORTNAME].ToString();
                        int    Index       = AirportName.LastIndexOf('(');
                        if (Index > 0)
                        {
                            AirportName = AirportName.Remove(AirportName.LastIndexOf('('));
                        }
                        AirportName = AirportName.Trim();
                        TempUserDetails.AirportName = AirportName;
                    }
                    if (!string.IsNullOrEmpty(Dr[BusinessConstants.USER_ISACTIVE].ToString()))
                    {
                        TempUserDetails.IsActive = System.Convert.ToBoolean(Dr[BusinessConstants.USER_ISACTIVE].ToString());
                    }
                    if (!string.IsNullOrEmpty(Dr[BusinessConstants.USER_DEPARTUREFORMACCESS].ToString()))
                    {
                        TempUserDetails.DepartureFormAccess = System.Convert.ToBoolean(Dr[BusinessConstants.USER_DEPARTUREFORMACCESS].ToString());
                    }
                    if (!string.IsNullOrEmpty(Dr[BusinessConstants.USER_ARRIVALFORMACCESS].ToString()))
                    {
                        TempUserDetails.ArrivalFormAccess = System.Convert.ToBoolean(Dr[BusinessConstants.USER_ARRIVALFORMACCESS].ToString());
                    }
                    if (!string.IsNullOrEmpty(Dr[BusinessConstants.USER_ROLE].ToString()))
                    {
                        TempUserDetails.RoleId = System.Convert.ToInt32(Dr[BusinessConstants.USER_ROLE].ToString());
                    }
                    UserDetails.Add(TempUserDetails);
                }
                ResponseUserDetail.UserDetails   = UserDetails;
                ResponseUserDetail.ReturnCode    = 1;
                ResponseUserDetail.ReturnMessage = "Retrieved Successfully";
            }
            catch (System.Exception Ex)
            {
                SICTLogger.WriteException(UserDetailsBusiness.CLASS_NAME, "GetAllUser", Ex);
                ResponseUserDetail.ReturnCode    = -1;
                ResponseUserDetail.ReturnMessage = "Error in API";
            }
            SICTLogger.WriteInfo(UserDetailsBusiness.CLASS_NAME, "GetAllUser", "End");
            return(ResponseUserDetail);
        }