private void buttonSaveNew_Click(object sender, EventArgs e) { frmOrderSaleNew2 frmsub = new frmOrderSaleNew2(); frmsub.Show(); }
private void button1_Click(object sender, EventArgs e) { string saleid = dataValue.saleid; try { if (textBoxNumber.Text == "") { MessageBox.Show("未填写数量!"); return; } else { /* string cusid = Cid; * OrderGenerator orderGenerator = new OrderGenerator(); * JObject jsonObject = new JObject(); * jsonObject = JObject.Parse(orderGenerator.orderGenerator(cusid)); * //Boxid= * * /*textBoxOrderid.Text = jsonObject.GetValue("orderid").ToString(); * string orderid = jsonObject.GetValue("orderid").ToString(); * string number = jsonObject.GetValue("number").ToString(); * string sql = "insert into T_allsale (number,orderid,cusid)values('" + number + "','" + orderid + "','" + cusid + "')"; * databaseexe databaseexe = new databaseexe();*/ string boxid = ProductdataGridView2.CurrentRow.Cells[0].Value.ToString(); string idQuery = "select id from T_fixpro where fatherid='" + boxid + "'or id ='" + boxid + "'order by id asc"; databaseexe databaseexe = new databaseexe(); string[] arr = databaseexe.getMultiData(idQuery, "id"); for (int i = 0; i < arr.Length; i++) { string id; id = arr[i]; string sql = "insert into T_ordersale (number,orderid ,proid,cusid,quantity,indate,orderdate,deliverytime,orderperson) values ('" + dataValue.salenumber + "','" + dataValue.saleid + "','" + id + "','" + Cid + "','" + textBoxNumber.Text.Trim() + "','" + dataValue.indate + "','" + dataValue.orderdate + "','" + dataValue.deliverytime + "','" + dataValue.orderPerson + "')"; dbexe.sqlcmd(sql); } string biliQuery = "select quantity from T_fixpro where id ='" + boxid + "' or fatherid = '" + boxid + "' order by id asc"; string[] bili = databaseexe.getMultiData(biliQuery, "quantity"); string shuliang = textBoxNumber.Text.ToString().Trim(); for (int j = 1; j < bili.Length; j++) { string tempid = arr[j]; string tempbili = bili[j]; int tempnumber = int.Parse(tempbili) * int.Parse(shuliang); string sql = "update t_ordersale set quantity='" + tempnumber + "' where proid = '" + tempid + "'"; databaseexe.sqlcmd(sql); } MessageBox.Show("数据添加成功!"); /*teacherdataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; * string sql1 = "select teacherId as 教师编号,teacherName as 教师姓名,tage as 年龄,Tdepartement as 所属学院 from teacher"; * teacherdataGridView1.DataSource = * dbexe.getdataset(sql1, "teacher").Tables[0];*/ string Orderid = dataValue.saleid; frmOrderSaleNew2 frmsub = new frmOrderSaleNew2(Orderid); frmOrderSaleNew2.FrmOrderSaleNew2.dgload(Orderid); this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public frmOrderSaleNew2() { InitializeComponent(); FrmOrderSaleNew2 = this; }