public void CreateClothing(clothingDAO clothingToCreate) { try { using (SqlConnection _connection = new SqlConnection(connectionstring)) { using (SqlCommand _command = new SqlCommand("Sp_CreateClothing", _connection)) { _command.CommandType = CommandType.StoredProcedure; _command.Parameters.AddWithValue("@TypeOFClothing", clothingToCreate.TypeOFClothing); _command.Parameters.AddWithValue("@Description", clothingToCreate.ClothingDescription); _command.Parameters.AddWithValue("@Sizes", clothingToCreate.Sizes); _command.Parameters.AddWithValue("@Price", clothingToCreate.ClothingPrice); _command.Parameters.AddWithValue("@Name", clothingToCreate.ClothingName); _command.Parameters.AddWithValue("@ClothingQuantity", clothingToCreate.ClothingQuantity); _connection.Open(); _command.ExecuteNonQuery(); _connection.Close(); _connection.Dispose(); } } } catch (Exception _Error) { Error_Logger Log = new Error_Logger(); Log.Errorlogger(_Error); } }
public bool DeleteClothing(clothingDAO clothingToDelete) { bool yes = false; try { using (SqlConnection _connection = new SqlConnection(connectionstring)) { using (SqlCommand _command = new SqlCommand("Sp_DeleteClothing", _connection)) { _command.CommandType = CommandType.StoredProcedure; _command.Parameters.AddWithValue("@Clothing_ID", clothingToDelete.Clothing_ID); _connection.Open(); _command.ExecuteNonQuery(); yes = true; _connection.Close(); } } } catch (Exception _Error) { Error_Logger Log = new Error_Logger(); Log.Errorlogger(_Error); } if (yes == true) { } return(yes); }
public ActionResult CreateClothing(Clothing newClothing) { if ((int)Session["Role_ID"] == 3 || (int)Session["Role_ID"] == 2) { clothingDAO ClothingToCreate = _mapper.SingleClothing(newClothing); _ClothingDataAccess.CreateClothing(ClothingToCreate); } return(RedirectToAction("ClothingView")); }
public ActionResult UpdateClothing(Clothing _ClothingInfo) { if ((int)Session["Role_ID"] == 3 || (int)Session["Role_ID"] == 2) { clothingDAO _recievedClothing = _mapper.SingleClothing(_ClothingInfo); _ClothingDataAccess.UpdateClothing(_recievedClothing); return(RedirectToAction("ClothingView")); } return(RedirectToAction("ClothingView")); }
public ActionResult DeleteClothing(int Delete_Clothing) { if ((int)Session["Role_ID"] == 3) { clothingDAO _DeleteClothing = new clothingDAO(); _DeleteClothing.Clothing_ID = Delete_Clothing; _ClothingDataAccess.DeleteClothing(_DeleteClothing); } return(RedirectToAction("ClothingView")); }
public Clothing SelectClothing(clothingDAO _SelectClothingToMap) { Clothing ClothingToReturn = new Clothing(); { Clothing _clothingToView = new Clothing(); _clothingToView.Clothing_ID = _SelectClothingToMap.Clothing_ID; _clothingToView.TypeOFClothing = _SelectClothingToMap.TypeOFClothing; _clothingToView.ClothingDescription = _SelectClothingToMap.ClothingDescription; _clothingToView.Sizes = _SelectClothingToMap.Sizes; _clothingToView.ClothingPrice = _SelectClothingToMap.ClothingPrice; _clothingToView.ClothingName = _SelectClothingToMap.ClothingName; _clothingToView.ClothingQuantity = _SelectClothingToMap.ClothingQuantity; ClothingToReturn = _clothingToView; } return(ClothingToReturn); }
public clothingDAO SingleClothing(Clothing _SingleClothingToMap) { clothingDAO ClothingToReturn = new clothingDAO(); { clothingDAO _clothingToView = new clothingDAO(); _clothingToView.Clothing_ID = _SingleClothingToMap.Clothing_ID; _clothingToView.TypeOFClothing = _SingleClothingToMap.TypeOFClothing; _clothingToView.ClothingDescription = _SingleClothingToMap.ClothingDescription; _clothingToView.Sizes = _SingleClothingToMap.Sizes; _clothingToView.ClothingPrice = _SingleClothingToMap.ClothingPrice; _clothingToView.ClothingName = _SingleClothingToMap.ClothingName; _clothingToView.ClothingQuantity = _SingleClothingToMap.ClothingQuantity; ClothingToReturn = _clothingToView; } return(ClothingToReturn); }
public List <clothingDAO> GetAllClothing() { List <clothingDAO> _clothinglist = new List <clothingDAO>(); try { using (SqlConnection _connection = new SqlConnection(connectionstring)) { using (SqlCommand _command = new SqlCommand("Sp_ViewClothing", _connection)) { _command.CommandType = CommandType.StoredProcedure; _connection.Open(); using (SqlDataReader _reader = _command.ExecuteReader()) { while (_reader.Read()) { clothingDAO _clothingToList = new clothingDAO(); _clothingToList.Clothing_ID = _reader.GetInt32(0); _clothingToList.TypeOFClothing = _reader.GetString(1); _clothingToList.ClothingDescription = _reader.GetString(2); _clothingToList.Sizes = _reader.GetString(3); _clothingToList.ClothingPrice = _reader.GetDecimal(4); _clothingToList.ClothingName = _reader.GetString(5); _clothingToList.ClothingQuantity = _reader.GetInt32(6); _clothinglist.Add(_clothingToList); } } } } } catch (Exception _Error) { Error_Logger Log = new Error_Logger(); Log.Errorlogger(_Error); } return(_clothinglist); }