예제 #1
0
        ///Create Procedure Data Controller

        public int createGeoLocationCity(geoLocationModel currentLocation)
        {
            int success;

            try
            {
                DbCommand sp_createct2GeoLocationCity = db.GetStoredProcCommand("sp_createct2GeoLocationCity");
                sp_createct2GeoLocationCity.Connection = db.CreateConnection();
                sp_createct2GeoLocationCity.Connection.Open();


                foreach (cityModel city in currentLocation.cities)
                {
                    db.AddInParameter(sp_createct2GeoLocationCity, "@cityDescription", SqlDbType.VarChar, city.cityDescription);
                    db.AddInParameter(sp_createct2GeoLocationCity, "@stateIDFK", SqlDbType.VarChar, currentLocation.stateID);

                    success = sp_createct2GeoLocationCity.ExecuteNonQuery();
                }

                return(1);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
예제 #2
0
        public int createGeoLocationState(geoLocationModel currentLocation)
        {
            int stateID = 0;
            int cityID  = 0;

            DbCommand sp_createct2GeoLocationState = db.GetStoredProcCommand("sp_createct2GeoLocationState");

            sp_createct2GeoLocationState.Connection = db.CreateConnection();
            sp_createct2GeoLocationState.Connection.Open();

            db.AddInParameter(sp_createct2GeoLocationState, "@stateDescription", SqlDbType.VarChar, currentLocation.stateDescription);

            stateID = sp_createct2GeoLocationState.ExecuteNonQuery();

            if (stateID == 0)
            {
                // do nothing
            }
            else
            {
                currentLocation.stateID = stateID;
                cityID = createGeoLocationCity(currentLocation);
            }

            return(stateID);
        }
예제 #3
0
        public bool DeleteState(geoLocationModel removingState)
        {
            DbCommand sp_deletect2GeoLocationState = db.GetStoredProcCommand("sp_deletect2GeoLocationState");

            db.AddInParameter(sp_deletect2GeoLocationState, "@stateID", SqlDbType.Int, removingState.stateID);

            return(false);
        }
예제 #4
0
        public bool UpdateState(geoLocationModel currentState)
        {
            DbCommand sp_updatect2GeoLocationState = db.GetStoredProcCommand("sp_updatect2GeoLocationState");

            db.AddInParameter(sp_updatect2GeoLocationState, "@stateID", SqlDbType.Int, currentState.stateID);
            db.AddInParameter(sp_updatect2GeoLocationState, "@stateDescription", SqlDbType.VarChar, currentState.stateDescription);

            return(false);
        }