日期:2014-05-18 浏览次数:20433 次
public static bool AddOrder(string order_ID, string customer_ID, string delivery_date, string remark, string door_type, string door_color, string door_H, string door_W, string shutter_type, string shutter_H, string top_front_glass_type, string bottom_behind_glass_type, string top_front_glass_style, string door_collapse, string door_glass_mode, string amount) { bool flag = true; SqlConnection con = DataBase.CreateCon(); con.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; SqlTransaction Sqltrans = con.BeginTransaction(); cmd.Transaction = Sqltrans; try { cmd.CommandText = "insert into [order](order_ID,customer_ID,delivery_date,remark) values(@order_ID,@customer_ID,@delivery_date,@remark)"; SqlParameter para = new SqlParameter("@order_ID", SqlDbType.VarChar, 20); para.Value = order_ID; cmd.Parameters.Add(para); para = new SqlParameter("@customer_ID", SqlDbType.VarChar, 50); para.Value = customer_ID; cmd.Parameters.Add(para); para = new SqlParameter("@delivery_date", SqlDbType.DateTime); para.Value = Convert.ToDateTime(delivery_date); cmd.Parameters.Add(para); para = new SqlParameter("@remark", SqlDbType.VarChar, 200); para.Value = remark; cmd.Parameters.Add(para); cmd.ExecuteNonQuery(); cmd.CommandText = "insert into product(order_ID,door_type,door_color,door_H,door_W,shutter_type,shutter_H,top_front_glass_type,bottom_behind_glass_type,top_front_glass_style,door_collapse,door_glass_mode,amount) values(@order_ID,@door_type,@door_color,@door_H,@door_W,@shutter_type,@shutter_H,@top_front_glass_type,@bottom_behind_glass_type,@top_front_glass_style,@door_collapse,@door_glass_mode,@amount)"; para = new SqlParameter("@order_ID", SqlDbType.VarChar, 20); para.Value = order_ID; cmd.Parameters.Add(para); para = new SqlParameter("@door_type", SqlDbType.VarChar, 50); para.Value = door_type; cmd.Parameters.Add(para); para = new SqlParameter("@door_color", SqlDbType.VarChar, 50); para.Value = door_color; cmd.Parameters.Add(para); para = new SqlParameter("@door_H", SqlDbType.Float); para.Value = Convert.ToDouble(door_H); cmd.Parameters.Add(para); para = new SqlParameter("@door_W", SqlDbType.Float); para.Value = Convert.ToDouble(door_W); cmd.Parameters.Add(para); para = new SqlParameter("@shutter_type", SqlDbType.VarChar, 50); para.Value = shutter_type; cmd.Parameters.Add(para); para = new SqlParameter("@shutter_H", SqlDbType.Float); para.Value = Convert.ToDouble(shutter_H); cmd.Parameters.Add(para); para = new SqlParameter("@top_front_glass_type", SqlDbType.VarChar, 50); para.Value = top_front_glass_type; cmd.Parameters.Add(para); para = new SqlParameter("@bottom_behind_glass_type", SqlDbType.VarChar, 50); para.Value = bottom_behind_glass_type; cmd.Parameters.Add(para); para = new SqlParameter("@top_front_glass_style", SqlDbType.VarChar, 50); para.Value = top_front_glass_style; cmd.Parameters.Add(para); para = new SqlParameter("@door_collapse", SqlDbType.VarChar, 50); para.Value = door_collapse; cmd.Parameters.Add(para); para = new SqlParameter(&qu