示例#1
0
        public static LocationInfo[] GetAllLocations()
        {
            ArrayList al = new ArrayList();

            int retValue = -1;

            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetAllLocations(out retValue)) //Initialize and retrieve code for Datareader goes here
            {

                while (dr.Read())
                {
                    LocationInfo location = new LocationInfo();
                    location.LocationId = Convert.ToInt32(dr["location_id"]);
                    location.LocationName = dr["location_name"].ToString();
                    location.CreatedDate = Convert.ToDateTime(dr["created_date"]);
                    location.ChangedDate = Convert.ToDateTime(dr["changed_date"]);
                    location.ChangedByName = dr["changed_by"].ToString();
                    al.Add(location);
                }
                //dr.Close();
            }

            LocationInfo[] allInfo = new LocationInfo[al.Count];
            al.CopyTo(allInfo);
            return allInfo;
        }
示例#2
0
        public static int AddNewLocation(LocationInfo location)
        {
            if (location == null)
                throw new ArgumentNullException("Location is missing");

            int retValue = -1;
            return ProjManagementAdmin.AddNewLocation(location, out retValue);
        }
示例#3
0
        /*public JsonResult<IEnumerable<ProjectInfo>> FetchInactiveProjectsAtLocation(int id)
        {

            ProjectInfo[] ListOfProjects = LocationBl.GetInactiveProjectsAtLocation(id);

            var proj = from c in ListOfProjects
                       select c;
            return Json(proj);

        }*/
        // POST api/<controller>
        public HttpResponseMessage Post(LocationInfo location)
        {
            try
            {
                LocationBl.AddNewLocation(location);
                return new HttpResponseMessage(HttpStatusCode.OK);
            }
            catch (Exception ex)
            {
                return new HttpResponseMessage(HttpStatusCode.BadRequest);
            }
        }
示例#4
0
        public static LocationInfo GetLocationById(int locationId)
        {
            int retValue = -1;
            LocationInfo location = new LocationInfo();
            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetLocationById(locationId, out retValue)) //Initialize and retrieve code for Datareader goes here
            {
                while (dr.Read())
                {
                    location.LocationId = Convert.ToInt32(dr["location_id"]);
                    location.LocationName = dr["location_name"].ToString();
                    location.IsActive = Convert.ToBoolean(dr["is_active"]);
                    location.CreatedDate = Convert.ToDateTime(dr["created_date"]);
                    location.ChangedDate = Convert.ToDateTime(dr["changed_date"]);
                    location.ChangedByName = dr["changed_by"].ToString();
                }
                //dr.Close();
            }

            return location;
        }
 public HttpResponseMessage Post(LocationInfo location)
 {
     return LocationBl.UpdateLocation(location);
 }
 public LocationInfo Get(int id)
 {
     LocationInfo loc = new LocationInfo();
     loc = LocationBl.GetLocationById(id);
     return loc;
 }
示例#7
0
        private static SqlParameter[] GetAddLocationParams(LocationInfo location)
        {
            SqlParameter[] sqlParms = new SqlParameter[100];
            sqlParms = SQLHelper.GetCachedParameters(PROC_ADDNEWLOCATION);
            if (sqlParms == null)
            {
                sqlParms = new SqlParameter[]
                            {
                                new SqlParameter(PARAM_RETURN, SqlDbType.Int),
                                new SqlParameter(PARAM_LOCATION_NAME, SqlDbType.NVarChar, 100),
                                new SqlParameter(PARAM_CHANGEDBY, SqlDbType.NVarChar, 100)
                            };

                sqlParms[0].Direction = ParameterDirection.ReturnValue;
                SQLHelper.CacheParameters(PROC_ADDNEWLOCATION, sqlParms);
            }

            //Assigning values to parameter
            sqlParms[0].Value = -1;
            sqlParms[1].Value = location.LocationName;
            sqlParms[2].Value = "vysali";

            return sqlParms;
        }
示例#8
0
 public static int UpdateLocation(LocationInfo location, out int retValue)
 {
     retValue = -1;
     SqlParameter[] parms = GetUpdateLocationParams(location);
     return ExecuteNonQuery(PROC_UPDATELOCATION, parms, out retValue);
 }
示例#9
0
 public static int AddNewLocation(LocationInfo location, out int retValue)
 {
     retValue = -1;
     SqlParameter[] parms = GetAddLocationParams(location);
     return ExecuteNonQuery(PROC_ADDNEWLOCATION, parms, out retValue);
 }
示例#10
0
 public static int UpdateLocation(LocationInfo location)
 {
     int retValue = -1;
     return ProjManagementAdmin.UpdateLocation(location, out retValue);
 }