Esempio n. 1
0
        public static void Insert(PINNstock3 data, SqlConnection conn)
        {
            var sql = @"INSERT INTO [dbo].[PINN_stock3](
					origin,warehouse,product,long_description,exvat_price,Disc_Code,orig_analysis,remap_anal,prod_range,key_core_slow,abc_category,LCM_xref,salekey,
					Supplier,SuppCurr,AdminType,StockType,[3monthsales],reorder_days,economic_reorder_q,bin_number,weight,dimensions,finish,type,current_cost)
				VALUES (@origin,@warehouse,@product,@long_description,@exvat_price,@Disc_Code,@orig_analysis,@remap_anal,@prod_range,@key_core_slow,
				@abc_category,@LCM_xref,@salekey,@Supplier,@SuppCurr,@AdminType,@StockType,@3monthsales,@reorder_days,@economic_reorder_q,@bin_number,@weight,@dimensions,@finish,@type,@current_cost)"                ;

            using (var cmd = new SqlCommand(sql, conn))
            {
                cmd.Parameters.AddWithValue("@origin", data.origin);
                cmd.Parameters.AddWithValue("@warehouse", data.warehouse);
                cmd.Parameters.AddWithValue("@product", data.product);
                cmd.Parameters.AddWithValue("@long_description", data.long_description);
                cmd.Parameters.AddWithValue("@exvat_price", data.exvat_price);
                cmd.Parameters.AddWithValue("@Disc_Code", data.Disc_Code);
                cmd.Parameters.AddWithValue("@orig_analysis", (object)data.orig_analysis ?? DBNull.Value);
                cmd.Parameters.AddWithValue("@remap_anal", (object)data.remap_anal ?? DBNull.Value);
                cmd.Parameters.AddWithValue("@prod_range", data.prod_range);
                cmd.Parameters.AddWithValue("@key_core_slow", (object)data.key_core_slow ?? DBNull.Value);
                cmd.Parameters.AddWithValue("@abc_category", data.abc_category);
                cmd.Parameters.AddWithValue("@LCM_xref", data.LCM_xref);
                cmd.Parameters.AddWithValue("@salekey", data.salekey);
                cmd.Parameters.AddWithValue("@Supplier", data.Supplier);
                cmd.Parameters.AddWithValue("@SuppCurr", data.SuppCurr);
                cmd.Parameters.AddWithValue("@AdminType", data.AdminType);
                cmd.Parameters.AddWithValue("@StockType", (object)data.StockType ?? DBNull.Value);
                cmd.Parameters.AddWithValue("@3monthsales", data.Threemonthsales);
                cmd.Parameters.AddWithValue("@reorder_days", data.reorder_days);
                cmd.Parameters.AddWithValue("@economic_reorder_q", data.economic_reorder_q);
                cmd.Parameters.AddWithValue("@bin_number", data.bin_number);
                cmd.Parameters.AddWithValue("@weight", data.weight);
                cmd.Parameters.AddWithValue("@dimensions", (object)data.dimensions ?? DBNull.Value);
                cmd.Parameters.AddWithValue("@finish", data.finish);
                cmd.Parameters.AddWithValue("@type", (object)data.type ?? DBNull.Value);
                cmd.Parameters.AddWithValue("@current_cost", data.current_cost);
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 2
0
        private void Initialize(IList <Mpcportalprodlist> mpcData, IList <PINNstock3> pinnStock3Data = null, IList <poheadm> poHeaders = null, IList <podetm> poDetails = null)
        {
            using (var conn = GetAndOpenConnection())
            {
                CleanTables(conn);

                foreach (var mpc in mpcData)
                {
                    Mpcportalprodlist.Insert(mpc, conn);
                }

                if (pinnStock3Data != null)
                {
                    foreach (var pd in pinnStock3Data)
                    {
                        PINNstock3.Insert(pd, conn);
                    }
                }

                if (poHeaders != null)
                {
                    foreach (var h in poHeaders)
                    {
                        poheadm.Insert(h, conn);
                    }
                }

                if (poDetails != null)
                {
                    foreach (var d in poDetails)
                    {
                        podetm.Insert(d, conn);
                    }
                }
            }
        }