コード例 #1
0
ファイル: WarehouseDAO.cs プロジェクト: JISUNGUK/MiniERP_2019
        public List <MiniERP.Warehouse> GetWarehouses(MiniERP.Warehouse warehouse)
        {
            warehouses = new List <MiniERP.Warehouse>();
            string storedProcedureName = "GET_WAREHOUSE";

            try
            {
                DBConnection con = new DBConnection();

                SqlParameter[] sqlParameters = new SqlParameter[3]
                {
                    new SqlParameter("warehouse_code", warehouse.Warehouse_code),
                    new SqlParameter("warehouse_name", warehouse.Warehouse_name),
                    new SqlParameter("warehouse_standard", warehouse.Warehouse_standard)
                };
                SqlDataReader sr = con.ExecuteSelect(storedProcedureName, sqlParameters);
                while (sr.Read())
                {
                    warehouses.Add(new MiniERP.Warehouse
                    {
                        Warehouse_code     = sr["Warehouse_code"].ToString(),
                        Warehouse_name     = sr["Warehouse_name"].ToString(),
                        Warehouse_standard = sr["Warehouse_standard"].ToString()
                    });
                }
                con.Close();
                return(warehouses);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
ファイル: WarehouseDAO.cs プロジェクト: JISUNGUK/MiniERP_2019
        public int InsertWarehouse(MiniERP.Warehouse warehouse)
        {
            string storedProcedureName = "InsertWarehouse";

            DBConnection con = new DBConnection();

            SqlParameter[] sqlParameters = new SqlParameter[3];
            sqlParameters[0] = new SqlParameter("Warehouse_code", warehouse.Warehouse_code);
            sqlParameters[1] = new SqlParameter("Warehouse_name", warehouse.Warehouse_name);
            sqlParameters[2] = new SqlParameter("Warehouse_standard", warehouse.Warehouse_standard);

            try
            {
                return(con.ExecuteNonQuery(storedProcedureName, sqlParameters));
            }
            catch (Exception)
            {
                throw;
            }
        }