Ejemplo n.º 1
0
        public async Task <IActionResult> CreateWarehouseFieldType([Bind("Id,TypeOfMaterial,NameOfTypeMaterial,Provider,Manufacturer")] Warehouse135Model warehouse135)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    using (SqlConnection sqlConnection = new SqlConnection(_configuration.GetConnectionString("DefaultConnection2")))
                    {
                        sqlConnection.Open();
                        SqlCommand command = new SqlCommand("BasApp_Warehouse_Add", sqlConnection)
                        {
                            CommandType = CommandType.StoredProcedure
                        };

                        command.Parameters.AddWithValue("in_TypeOfMaterial", warehouse135.TypeOfMaterial);
                        command.Parameters.AddWithValue("in_NameOfTypeMaterial", warehouse135.NameOfTypeMaterial);
                        command.Parameters.AddWithValue("in_Provider", warehouse135.Provider);
                        command.Parameters.AddWithValue("in_Manufacturer", warehouse135.Manufacturer);
                        command.Parameters.AddWithValue("in_SubsType", 1);
                        await command.ExecuteNonQueryAsync();
                    }
                }
                catch (SqlException ex)
                {
                    throw ex;
                }
                return(RedirectToAction(nameof(CreateWarehouseFieldType)));
            }
            return(View(ModelState.ErrorCount));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> WarehouseViewAll()
        {
            if (ModelState.IsValid)
            {
                Warehouse135Model warehouse135 = new Warehouse135Model();

                List <string> DiffTypes = new List <string>();

                using (SqlConnection sqlConnection1 = new SqlConnection(_configuration.GetConnectionString("DefaultConnection2")))
                {
                    sqlConnection1.Open();
                    SqlCommand cmd = new SqlCommand("BasApp_Warehouse_GetDistinct", sqlConnection1)
                    {
                        CommandType = CommandType.StoredProcedure
                    };
                    cmd.Parameters.AddWithValue("in_SubsType", 1);

                    using (SqlDataReader reader = await cmd.ExecuteReaderAsync())
                    {
                        while (reader.Read())
                        {
                            DiffTypes.Add(Convert.ToString(reader.GetString(0)));
                        }
                    }
                    sqlConnection1.Close();
                }

                List <DataTable> DiffDataSets = new List <DataTable>();

                using (SqlConnection sqlConnection = new SqlConnection(_configuration.GetConnectionString("DefaultConnection2")))
                {
                    foreach (var item in DiffTypes)
                    {
                        DataTable tdbl = new DataTable();
                        sqlConnection.Open();
                        SqlDataAdapter sqlDA = new SqlDataAdapter("BasApp_Warehouse_ViewAllData", sqlConnection);
                        sqlDA.SelectCommand.Parameters.AddWithValue("in_TypeOfMaterial", item);
                        sqlDA.SelectCommand.Parameters.AddWithValue("in_SubsType", 1);
                        sqlDA.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sqlDA.Fill(tdbl);
                        DiffDataSets.Add(tdbl);
                        sqlConnection.Close();
                    }
                }

                warehouse135.listil = DiffDataSets;
                warehouse135.list   = DiffTypes.ToArray();

                return(View(warehouse135));
            }
            return(View(ModelState.ErrorCount));
        }
Ejemplo n.º 3
0
        public IActionResult CreateWarehouseFields()
        {
            Warehouse135Model     warehouse135    = new Warehouse135Model();
            DataSet               dataset         = GetTypeOfMaterialWarehouse();
            List <SelectListItem> selectListItems = new List <SelectListItem>();

            foreach (DataRow item in dataset.Tables[0].Rows)
            {
                selectListItems.Add(new SelectListItem {
                    Value = item["TypeOfMaterial"].ToString(), Text = item["TypeOfMaterial"].ToString()
                });
            }
            ViewBag.TypeList = selectListItems;
            return(View(warehouse135));
        }
Ejemplo n.º 4
0
        public IActionResult CreateWarehouseFieldType()
        {
            Warehouse135Model warehouse135 = new Warehouse135Model();

            return(View(warehouse135));
        }