コード例 #1
0
        public MsCrmResultObj <List <Town> > GetAllTowns(string token)
        {
            MsCrmResultObj <List <Town> > returnValue = new MsCrmResultObj <List <Town> >();

            LoginSession ls = new LoginSession();

            try
            {
                #region | CHECK SESSION |
                MsCrmResultObj <LoginSession> sessionResult = GetUserSession(token);

                if (!sessionResult.Success)
                {
                    returnValue.Result = sessionResult.Result;
                    return(returnValue);
                }
                else
                {
                    ls = sessionResult.ReturnObject;
                }

                #endregion

                _sda = new SqlDataAccess();
                _sda.openConnection(Globals.ConnectionString);

                returnValue = LocationHelper.GetAllTowns(_sda);
            }
            catch (Exception ex)
            {
                returnValue.HasException = true;
                returnValue.Result       = ex.Message;
            }
            finally
            {
                if (_sda != null)
                {
                    _sda.closeConnection();
                }
            }

            return(returnValue);
        }