Exemplo n.º 1
0
        public List <InteriorColors> GetAllInteriorColors()
        {
            List <InteriorColors> interiorColors = new List <InteriorColors>();

            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("InteriorColorsSelectAll", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                cn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        InteriorColors currentRow = new InteriorColors();
                        currentRow.InteriorColorId          = (int)dr["InteriorColorId"];
                        currentRow.InteriorColorDescription = dr["InteriorColorDescription"].ToString();

                        interiorColors.Add(currentRow);
                    }
                }
            }
            return(interiorColors);
        }
Exemplo n.º 2
0
 public void SetInterior(IEnumerable <InteriorColor> interiorColor)
 {
     foreach (var color in interiorColor)
     {
         InteriorColors.Add(new SelectListItem()
         {
             Value = color.InteriorColorId.ToString(),
             Text  = color.Description
         });
     }
 }
Exemplo n.º 3
0
 public void SetInteriorColor(IEnumerable <LookupValue> interiorColor)
 {
     foreach (var ic in interiorColor)
     {
         InteriorColors.Add(new SelectListItem()
         {
             Value = ic.Description.ToString(),
             Text  = ic.Description.ToString()
         });
     }
 }
 public void Add(InteriorColors interiorColor)
 {
     using (var sqlConnection = new System.Data.SqlClient.SqlConnection())
     {
         sqlConnection.ConnectionString = ConfigurationManager
                                          .ConnectionStrings["DefaultConnection"]
                                          .ConnectionString;
         DynamicParameters dynamicParameters = new DynamicParameters();
         dynamicParameters.Add("@InteriorColorsId", dbType: DbType.Int32, direction: ParameterDirection.Output);
         dynamicParameters.Add("@InteriorColorsName", interiorColor.InteriorColorName);
         sqlConnection.Query <InteriorColors>("AddInteriorColors", dynamicParameters,
                                              commandType: CommandType.StoredProcedure);
     }
 }
Exemplo n.º 5
0
        public Response AddInteriorColors(InteriorColors interiorColor)
        {
            Response response = new Response();

            if (interiorColorRepository.GetAll().Any(t => t.InteriorColorName == interiorColor.InteriorColorName))
            {
                response.Success = false;
                response.Message = "ERROR: InteriorColor name already exists";
            }
            else
            {
                interiorColorRepository.Add(interiorColor);
                response.Success = true;
                response.Message = "InteriorColor added";
            }
            return(response);
        }
Exemplo n.º 6
0
 public void Add(InteriorColors interiorColor)
 {
     interiorColors.Add(interiorColor);
 }