//Insert queries

        public void insertLocationDetails(locationModel buildingMod)
        {
            if (con.State.ToString() != "Open")
            {
                con.Open();
            }
            string query = "INSERT INTO locationTB(locationName)  VALUES ('" + buildingMod.buildingname + "')";

            SqlCommand com = new SqlCommand(query, con);
            int        ret = NewMethod(com);

            MessageBox.Show("No of Records have been inserted" + ret, "Information");
            con.Close();
        }
Esempio n. 2
0
        //Insert queries

        public void insertLocationDetails(locationModel studentMod)
        {
            if (con.State.ToString() != "Open")
            {
                con.Open();
            }
            string query = "INSERT INTO LocationTimeTable(locationID,locationName)  VALUES ('" + studentMod.locationPID + "','" + studentMod.locationPName + "')";

            SqlCommand com = new SqlCommand(query, con);
            int        ret = NewMethod(com);

            MessageBox.Show("No of Records have been inserted" + ret, "Information");
            con.Close();
        }
Esempio n. 3
0
        public void insertRoomDetails(locationModel studentMod)
        {
            if (con.State.ToString() != "Open")
            {
                con.Open();
            }

            string query = "INSERT INTO RoomTable(buildingName,roomID,roomName, roomCapacity,roomType)  VALUES ('" + studentMod.buildingName + "','" + studentMod.roomID + "','" + studentMod.roomName + "','" + studentMod.roomCapacity + "','" + studentMod.roomType + "')";

            SqlCommand com = new SqlCommand(query, con);
            int        ret = NewMethod(com);

            MessageBox.Show("No of Records have been inserted" + ret, "Information");
            con.Close();
        }
        //delete quarry

        public void DeleteLocationDet(locationModel buildingMod)
        {
            if (con.State.ToString() != "Open")
            {
                con.Open();
            }

            string     query = "DELETE  FROM locationTB  WHERE  locationID='" + buildingMod.buildingID + "'";
            SqlCommand com   = new SqlCommand(query, con);

            string ans = MessageBox.Show("Are sure to delete this record?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning).ToString();


            if (ans == "Yes")
            {
                int ret = com.ExecuteNonQuery();
                MessageBox.Show("No of records deleted" + ret, "Information");
            }

            con.Close();
        }
 public int AddLocation(locationModel loc)
 {
     try
     {
         Location Location = new Location()
         {
             Id   = loc.Id,
             Lat  = loc.Lat,
             Lng  = loc.Lng,
             Name = loc.LocName,
             Type = loc.Type,
             Logo = loc.Logo
         };
         _db.Locations.Add(Location);
         _db.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 6
0
 public int AddLocation([FromBody] locationModel location)
 {
     return(LocationDataAccessLayer.AddLocation(location));
 }