private void buttonSave_Click(object sender, EventArgs e) { string Id = textBoxID.Text.Trim(); string TypeName = textBoxName.Text.Trim(); string productDouble = comboBoxDouble.Text.Trim(); string productDing = comboBoxDing.Text.Trim(); string price = textBoxPrice.Text.Trim(); string productlength = textBoxLong.Text.Trim(); string productWeight = textBoxWeight.Text.Trim(); string sql = "update T_ProductType set TypeName='" + TypeName + "',productDouble='" + productDouble + "',productding='" + productDing + "',price='" + price + "',productLength='" + productlength + "',productweight='" + productWeight + "' where id = '" + Id + "'"; dbexe.sqlcmd(sql); MessageBox.Show("数据保存成功!"); }
private void buttonDelete_Click(object sender, EventArgs e) { try { DialogResult dialogresult = MessageBox.Show("您确定要删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogresult == DialogResult.No) { return; } else { databaseexe dbexe = new databaseexe(); string PairID = PairListdataGridView.SelectedRows[0].Cells["编码"].Value.ToString(); string sql = "delete from T_fixpro where ID='" + PairID + "'"; dbexe.sqlcmd(sql); MessageBox.Show("数据删除成功!"); PairListdataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; string sql1 = "select id as 编码, productname as 名称,producttype as 纸箱种类, materialname as 纸板材质,plength as 长,pwide as 宽,pheight as 高,unit as 单位,quantity as 数量 from T_fixpro where fatherId='" + fatherId + "'"; PairListdataGridView.DataSource = dbexe.getdataset(sql1, "T_fixpro").Tables[0]; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ProductIndataGridView1_CellEndEdit_1(object sender, DataGridViewCellEventArgs e) { string zhuananid = ProductIndataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); string changestring = ProductIndataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); try { databaseexe databaseexe = new databaseexe(); //string QuantityNow = ClientdataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); //int CurrentQuantity = int.Parse(QuantityNow) + int.Parse(changestring); string QuantityQuery = "select sum(proinquantity) as a from T_productin group by zhuananID having sum(proinquantity)is not null and zhuananID='" + zhuananid + "'"; string lastQuantity = databaseexe.getTopselect(QuantityQuery, "a"); int CurrentQuantity = int.Parse(lastQuantity) + int.Parse(changestring); string sql = "update T_productIn set proinquantity ='" + changestring + "',proquantity ='" + CurrentQuantity + "'where zhuananid ='" + zhuananid + "'and proinid='" + textBoxProductInId.Text.ToString() + "'"; databaseexe.sqlcmd(sql); // dgload2(purid); string MatStock = "Update T_fixpro set Stock=Stock+'" + changestring + "' where id=(select pid from T_alls where id='" + zhuananid + "')"; dbexe.sqlcmd(MatStock); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonSave_Click(object sender, EventArgs e) { string CusId = textBoxCusId.Text.Trim(); string CusShort = textBoxCusShort.Text.Trim(); string CusName = textBoxCusName.Text.Trim(); string CusTel = textBoxCusTel.Text.Trim(); string CusFax = textBoxCusFax.Text.Trim(); string CusAdress = textBoxCusAdress.Text.Trim(); string CusPerson = textBoxCusPerson.Text.Trim(); string CusBank = textBoxBank.Text.Trim(); string CusAccount = textBoxAccount.Text.Trim(); string CusMemo = textBoxMemo.Text.Trim(); string sql = "update T_Customer set CusShort='" + CusShort + "',CusName='" + CusName + "',CusTelephone='" + CusTel + "',CusFax='" + CusFax + "',CusAdress='" + CusAdress + "',CusPerson='" + CusPerson + "',CusBank='" + CusBank + "',CusAccount='" + CusAccount + "',CusMemo='" + CusMemo + "'where CusId='" + CusId + "'"; dbexe.sqlcmd(sql); MessageBox.Show("数据保存成功!"); }
private void buttonSaveNew_Click(object sender, EventArgs e) { try { //databaseexe dbexe = new databaseexe(); string SupId = textBoxSupId.Text.Trim(); string SupShort = textBoxSupShort.Text.Trim(); string SupName = textBoxSupName.Text.Trim(); string SupTel = textBoxSupTel.Text.Trim(); string SupFax = textBoxSupFax.Text.Trim(); string SupAdress = textBoxSupAdress.Text.Trim(); string SupPerson = textBoxSupPerson.Text.Trim(); if (SupId == "" || SupShort == "" || SupName == "" || SupTel == "" || SupFax == "" || SupAdress == "" || SupPerson == "") { MessageBox.Show("数据添加不完整"); } else { try { string sql = "insert into T_supplier (SupId,SupShort,SupName,SupTelephone,SupFax,SupAdress,SupPerson) values ('" + SupId + "','" + SupShort + "','" + SupName + "','" + SupTel + "','" + SupFax + "','" + SupAdress + "','" + SupPerson + "')"; dbexe.sqlcmd(sql); MessageBox.Show("数据添加成功!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } /*string sql = "insert into T_supplier (SupId,SupShort,SupName,SupTelelphone,SupFax,SupAdress,SupPerson) values ('" + SupId + "','" + SupShort + "','" + SupName + "','" + SupTel + "','"+SupFax+"','"+SupAdress+"','"+SupPerson+"')"; * dbexe.sqlcmd(sql); * MessageBox.Show("数据添加成功!"); * CoursedataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; * string sql1 = "select courseid as 课程编号,courseName as 课程名称, scoreHour as 课程学时, department as 所属院系 from course"; * CoursedataGridView1.DataSource = * dbexe.getdataset(sql1, "course").Tables[0];*/ } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonSaveNew_Click(object sender, EventArgs e) { string memo = textBoxMemo.Text.ToString(); string purchasePerson = textBoxPurchasePerson.Text.ToString(); string PId = textBoxPurchaseid.Text.ToString(); string sql = "update T_purchaseOrder set purchasePerson='" + purchasePerson + "',purchasedate='" + PurchasedateTimePicker2.Value.ToShortDateString() + "',deliverydate='" + DeliveryTimePicker2.Value.ToShortDateString() + "',memo='" + memo + "'where purchaseid='" + PId + "'"; dbexe.sqlcmd(sql); MessageBox.Show("1"); }
private void buttonChoose_Click(object sender, EventArgs e) { try { databaseexe databaseexe = new databaseexe(); string ZhuanAnid = PurchaseOrderdataGridView2.CurrentRow.Cells[0].Value.ToString(); string PurchaseQuantity = PurchaseOrderdataGridView2.CurrentRow.Cells[5].Value.ToString(); string BomidQuery = "select bomid from T_pur where zhuananid='" + ZhuanAnid + "'"; string bomid = databaseexe.getTopselect(BomidQuery, "bomid"); string priceQuery = "Select materialprice from T_BOMPRICE where bomid='" + bomid + "'and Supid='" + Supid + "'"; string price = databaseexe.getTopselect(priceQuery, "materialprice"); string sql1 = "insert into T_purchaseOrder (purchaseid,purchasequantity,zhuananid,price,supid) values('" + PurchaseId + "','" + PurchaseQuantity + "','" + ZhuanAnid + "','" + price + "','" + Supid + "')"; dbexe.sqlcmd(sql1); /*string sql = "select zhuananid as 专案编号,CusShort as 客户,productName as 品名,materialName as 纸板名称,bomsize as 规格, allMaterialQuantity-matstock as 欠料数量 from T_pur where purchaseid is null and manuid is not null "; * dbexe.sqlcmd(sql);*/ string sql2 = "select zhuananid as 专案编号,CusShort as 客户,productName as 品名,materialName as 纸板名称,bomsize as 规格, allMaterialQuantity-matstock as 欠料数量 from T_pur where purchaseid is null and manuid is not null "; // dbexe.getdataset(sql2, "T_pur").Tables[0]; DataTable Datatable; Datatable = dbexe.getdataset(sql2, "T_pur").Tables[0]; for (int i = 0; i < Datatable.Rows.Count; i++) { if (int.Parse(Datatable.Rows[i]["欠料数量"].ToString()) < 0) { Datatable.Rows[i]["欠料数量"] = "0"; } } PurchaseOrderdataGridView2.DataSource = Datatable; /*string[] arr; * arr = databaseexe.getMultiData(sql, "id"); * for (int i = 0; i < arr.Length; i++) * { * * * //string AllMaterialQuery = " Select unitquantity*orderquantity as a from T_manus where ZhuanAnID = '" + arr[i].ToString() + "'"; * //string AllMaterialQuantity = databaseexe.getTopselect(AllMaterialQuery, "a"); * //string PurchaseQuantity="update T_PurchaseOrder set purchasequantity='"+PurchaseOrderdataGridView2.CurrentRow.Cells[5].Value.ToString()+"'where zhuananid= '"+ZhuanAnid+"'"; * * }*/ frmPurchaseAdd4 f1 = (frmPurchaseAdd4)this.Owner; f1.dgload(PurchaseId); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonSaveNew_Click(object sender, EventArgs e) { try { string MaterialId = textBoxID.Text.Trim(); string MaterialName = textBoxName.Text.Trim(); string MaterialType = textBoxType.Text.Trim(); string sql = "insert into T_Material (MaterialID ,MaterialName,MaterialType) values ('" + MaterialId + "','" + MaterialName + "','" + MaterialType + "')"; dbexe.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];*/ } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonChoose_Click(object sender, EventArgs e) { try { databaseexe databaseexe = new databaseexe(); string PurId = ChooseProductGridView1.CurrentRow.Cells[1].Value.ToString(); dataValue.CurrentQuantity = ChooseProductGridView1.CurrentRow.Cells[5].Value.ToString(); string SupShort = comboBox1.Text.ToString(); string SupidQuery = "select Supid from T_Supplier where SupShort='" + SupShort + "'"; string Supid = databaseexe.getTopselect(SupidQuery, "Supid"); string sql1 = "insert into T_MaterialIn (Matinid,PurId,Supid,MatinDate,MatDate,MatinPerson) values('" + MatInID + "','" + PurId + "','" + Supid + "','" + Matindate + "','" + Matdate + "','" + MatPerson + "')"; dbexe.sqlcmd(sql1); string sql = "select SupShort as 供方,purid as 采购序号,MaterialName as 纸板名称,bomsize as 规格,PurchaseQuantity as 采购数量,MatQuantity as 进料数量,(purchaseQuantity-matquantity)as 未进数量,PurchaseDate as 订货日期,deliverydate as 交货日期 from T_Matin2 where id is null and purid is not null and purchaseQuantity <> '0' and Supshort ='" + SupShort + "' or id in(select max(id) from T_Matin2 group by Purid having max(id)is not null ) and purchaseQuantity <> '0' and Supshort ='" + SupShort + "'"; DataTable Datatable; Datatable = dbexe.getdataset(sql, "T_MATin2").Tables[0]; for (int i = 0; i < Datatable.Rows.Count; i++) { if (Datatable.Rows[i]["进料数量"].ToString() == "") { Datatable.Rows[i]["进料数量"] = "0"; Datatable.Rows[i]["未进数量"] = Datatable.Rows[i]["采购数量"]; } } ChooseProductGridView1.DataSource = Datatable; string QuantityRefresh = "update T_Matin3 set MatQuantity='" + dataValue.CurrentQuantity + "'where matinid='" + MatInID + "'and purid='" + PurId + "'"; dbexe.sqlcmd(QuantityRefresh); frmMaterialInOrder4 f1 = (frmMaterialInOrder4)this.Owner; f1.dgload(Supid, MatInID, PurId); //f1.dgload2(PurId); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonSave_Click(object sender, EventArgs e) { string BomName = textBoxBomname1.Text.Trim(); string proid = textBoxProId.Text.Trim(); string bomsize = textBoxBomSize1.Text.Trim(); string Unitquantity = textBoxQuantity1.Text.Trim(); string BomUnit = textBoxUnit1.Text.Trim(); string BomFrom = textBoxBomfrom1.Text.Trim(); string materialid = BomNamecomboBox1.Text.Trim(); string sql = "insert into T_bom ( bomname,bomsize,unitquantity,bomunit,bomfrom,proid,materialid) values ('" + BomName + "','" + bomsize + "','" + Unitquantity + "','" + BomUnit + "','" + BomFrom + "','" + proid + "','" + materialid + "')"; dbexe.sqlcmd(sql); MessageBox.Show("数据添加成功!"); }
private void buttonModify_Click(object sender, EventArgs e) { try { string MatQuery = textBoxMatStock.Text.ToString(); string bomid = MatStockdataGridView1.CurrentRow.Cells[0].Value.ToString(); string sql = "update T_Bom set Stock='" + MatQuery + "'where bomid= '" + bomid + "'"; dbexe.sqlcmd(sql); //MessageBox.Show("当前库存修改成功!"); string sql1 = "select Bomid as 编号,BomName AS 物料名称,BomSize as 物料规格,Stock as 当前库存 from T_bom "; MatStockdataGridView1.DataSource = dbexe.getdataset(sql1, "T_Bom").Tables[0]; textBoxMatStock.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message); } // FixProductGridView1.CurrentRow.Cells[0].Value.ToString(); }
private void buttonChoose_Click(object sender, EventArgs e) { try { databaseexe databaseexe = new databaseexe(); string zhuananid = FixProductGridView1.CurrentRow.Cells[1].Value.ToString(); string CusShort = FixProductGridView1.CurrentRow.Cells[0].Value.ToString(); //dataValue.CurrentQuantity = ChooseProductGridView1.CurrentRow.Cells[5].Value.ToString(); //string SupShort = comboBox1.Text.ToString(); //string SupidQuery = "select Supid from T_Supplier where SupShort='" + SupShort + "'"; //string Supid = databaseexe.getTopselect(SupidQuery, "Supid"); string sql1 = "insert into T_DeliveryOut (DeliveryId,zhuananid,deliveryPerson,deliveryindate,deliverydate) values('" + DeliveryId + "','" + zhuananid + "','" + DeliveryPerson + "','" + Deliveryindate + "','" + DeliveryDate + "')"; dbexe.sqlcmd(sql1); string sql = "select CusShort as 客户,zhuananid as 专案编号,Orderid as 订单号,productName as 品名,producttYPE as 箱式,plength as 长,pwide as 宽,pheight as 高,unit as 单位,materialName as 纸板名称,orderquantity as 订单数量, deliveryquantity as 已送数量,(orderquantity-deliveryquantity)as 未送数量,deliverytime as 交货日期 from T_delout where id is null and zhuananid is not null or id in(select max(id) from T_delout group by zhuananid having max(id)is not null )"; DataTable Datatable; Datatable = dbexe.getdataset(sql, "T_delout").Tables[0]; for (int i = 0; i < Datatable.Rows.Count; i++) { if (Datatable.Rows[i]["已送数量"].ToString() == "") { Datatable.Rows[i]["已送数量"] = "0"; Datatable.Rows[i]["未送数量"] = Datatable.Rows[i]["订单数量"]; } } FixProductGridView1.DataSource = Datatable; //string QuantityRefresh = "update T_Matin3 set MatQuantity='" + dataValue.CurrentQuantity + "'where matinid='" + MatInID + "'and purid='" + PurId + "'"; //dbexe.sqlcmd(QuantityRefresh); frmDeliveryAdd5 f1 = (frmDeliveryAdd5)this.Owner; f1.dgload(DeliveryId, zhuananid, CusShort); //f1.dgload2(PurId); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void DeliverydataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { string zhuananid = DeliverydataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); string changestring = DeliverydataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); string deliveryId = textBoxDeliveryID.Text.ToString(); try { databaseexe databaseexe = new databaseexe(); //string QuantityNow = ClientdataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); //int CurrentQuantity = int.Parse(QuantityNow) + int.Parse(changestring); string QuantityQuery = "select sum(deliveryoutquantity) as a from T_deliveryOut group by zhuananID having sum(deliveryoutquantity)is not null and zhuananID='" + zhuananid + "'"; string lastQuantity = databaseexe.getTopselect(QuantityQuery, "a"); int CurrentQuantity = int.Parse(lastQuantity) + int.Parse(changestring); string sql = "update T_deliveryOut set deliveryoutquantity ='" + changestring + "',deliveryquantity ='" + CurrentQuantity + "'where zhuananid ='" + zhuananid + "'and deliveryid='" + textBoxDeliveryID.Text.ToString() + "'"; databaseexe.sqlcmd(sql); this.BeginInvoke(new MethodInvoker(() => {//异步处理 string sql1 = "select CusShort as 客户,zhuananid as 专案编号,productName as 品名,productType as 箱式,materialName as 纸板名称,plength as 长,pwide as 宽,pheight as 高,unit as 单位,deliveryoutquantity as 出货数量,price as 单价,(deliveryOutquantity*price) as 金额 from T_DelOut where deliveryid='" + deliveryId + "'"; //DeliverydataGridView1.DataSource = //dbexe.getdataset(sql1, "T_delout").Tables[0]; //string sql = "select CusShort as 客户,zhuananid as 专案编号,Orderid as 订单号,productName as 品名,producttYPE as 箱式,plength as 长,pwide as 宽,pheight as 高,unit as 单位,materialName as 纸板名称,orderquantity as 订单数量, deliveryquantity as 已送数量,(orderquantity-deliveryquantity)as 未送数量,deliverytime as 交货日期 from T_delout where id is null and zhuananid is not null or id in(select max(id) from T_delout group by zhuananid having max(id)is not null )"; DataTable Datatable; Datatable = dbexe.getdataset(sql1, "T_DelOut").Tables[0]; DeliverydataGridView1.DataSource = Datatable; })); this.BeginInvoke(new MethodInvoker(() => { string MatStock = "Update T_fixpro set Stock=Stock-'" + changestring + "' where id=(select pid from T_alls where id='" + zhuananid + "')"; dbexe.sqlcmd(MatStock); })); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonCheck_Click(object sender, EventArgs e) { string OrderId = textBoxOrderid.Text.ToString(); string CheckTime = DateTime.Now.ToShortDateString(); string checkperson = dataValue.StaffName; string sql = "update T_OrderSale set status ='已审核',checktime ='" + CheckTime + "',checkperson='" + checkperson + "' where orderid='" + OrderId + "'"; dbexe.sqlcmd(sql); string statusQuery = "select distinct(status) from T_ordersale where orderid='" + OrderId + "'"; databaseexe databaseexe = new databaseexe(); string da = databaseexe.getTopselect(statusQuery, "status"); textBoxStatus.Text = da; string CheckDateQuery = "select distinct(checktime) from T_ordersale where orderid='" + OrderId + "'"; string dc = databaseexe.getTopselect(CheckDateQuery, "checktime"); textBoxCheckDate.Text = dc; string checkPersonQuery = "select distinct(checkperson) from T_ordersale where orderid='" + OrderId + "'"; string db = databaseexe.getTopselect(checkPersonQuery, "checkperson"); textBoxCheckPerson.Text = db; }
private void buttonSaveNew_Click(object sender, EventArgs e) { try { databaseexe dbexe = new databaseexe(); string CusId = textBoxCusId.Text.Trim(); string CusShort = textBoxCusShort.Text.Trim(); string CusName = textBoxCusName.Text.Trim(); string CusTel = textBoxCusTel.Text.Trim(); string CusFax = textBoxCusFax.Text.Trim(); string CusAdress = textBoxCusAdress.Text.Trim(); string CusPerson = textBoxCusPerson.Text.Trim(); string CusBank = textBoxBank.Text.Trim(); string CusAccount = textBoxAccount.Text.Trim(); string CusMemo = textBoxMemo.Text.Trim(); if (CusId == "" || CusShort == "" || CusName == "" || CusTel == "" || CusAdress == "") { MessageBox.Show("数据添加不完整"); } else { try { string sql = "insert into T_Customer (CusID,CusShort,CusName,CusTelephone,CusFax,CusAdress,CusPerson,CusBank,CusAccount,CusMemo) values ('" + CusId + "','" + CusShort + "','" + CusName + "','" + CusTel + "','" + CusFax + "','" + CusAdress + "','" + CusPerson + "','" + CusBank + "','" + CusAccount + "','" + CusMemo + "')"; dbexe.sqlcmd(sql); MessageBox.Show("数据添加成功!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void MaterialIndataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { string changestring = MaterialIndataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); string Purid = MaterialIndataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); try { string QuantityNow = ClientdataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(); int CurrentQuantity = int.Parse(QuantityNow) + int.Parse(changestring); string sql = "update T_MaterialIN set matinquantity ='" + changestring + "',matquantity = '" + CurrentQuantity + "' where id =(select top 1 id from T_matin2 where purid ='" + Purid + "' order by id desc)"; databaseexe databaseexe = new databaseexe(); databaseexe.sqlcmd(sql); // dgload2(purid); ClientdataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; string sql1 = "select Zhuananid as 专案编号,CusShort as 客户,ProductName as 品名,purchaseQuantity as 采购数量,Matquantity as 入仓数量 from T_matin3 where matinid = '" + textBoxProductInId.Text.ToString() + "'"; ClientdataGridView1.DataSource = dbexe.getdataset(sql1, "T_matin3").Tables[0]; ClientdataGridView1.EnableHeadersVisualStyles = false; ClientdataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold); ClientdataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.LightSlateGray; ClientdataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.White; string UniqueId = ClientdataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); string MatStock = "Update T_Bom set Stock=Stock+'" + MaterialIndataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString() + "' where bomid=(select bomid from T_pur where ZhuanAnID='" + UniqueId + "')"; dbexe.sqlcmd(MatStock); // string MatStock="update T_Bom set stock=" } catch (Exception ex) { MessageBox.Show(ex.Message); } }
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); } }
private void buttonSaveNew_Click(object sender, EventArgs e) { //this.buttonPair.Enabled = true; try { string CusID = textBoxClientID.Text.Trim(); string ProductName = textBoxProductName.Text.Trim(); string typeId = comboBoxTypeID.Text.Trim(); string TypeName = textBoxTypeNAME.Text.Trim(); string unit = textBoxUnit.Text.Trim(); string materialID = comboBoxMaterialID.Text.Trim(); string materialName = textBoxMaterialName.Text.Trim(); string Plength = textBoxLength.Text.Trim(); string Pwide = textBoxWide.Text.Trim(); string Pheight = textBoxHeight.Text.Trim(); string quantity = textBoxQuantity.Text.Trim(); string memo = textBoxMemo.Text.Trim(); string price = textBoxPrice.Text.Trim(); Boolean yinshua = checkBox1.Checked; Boolean zhanjiao = checkBox2.Checked; Boolean dading = checkBox3.Checked; string MidQuery = "select ID from T_MATERIAL where materialid ='" + materialID + "'"; databaseexe databaseexe = new databaseexe(); string id = databaseexe.getTopselect(MidQuery, "ID"); //string sql = "insert into T_fixbox (cusID,productname,producttype,materialname,plength,pwide,pheight,unit,quantity,price,memo) values string sql = "insert into T_fixPRO (cusID,productname,typeID,producttype,materialid,materialname,plength,pwide,pheight,unit,quantity,memo,price) values ('" + CusID + "','" + ProductName + "','" + typeId + "','" + TypeName + "','" + id + "','" + materialName + "','" + Plength + "','" + Pwide + "','" + Pheight + "','" + unit + "','" + quantity + "','" + memo + "','" + price + "')"; /*string sql = "update T_Customer set CusShort='" + CusShort + "',CusName='" + CusName + "',CusTelephone='" + CusTel + "',CusFax='" + CusFax + "',CusAdress='" + CusAdress + "',CusPerson='" + CusPerson + "',CusBank='" + CusBank + "',CusAccount='" + CusAccount + "',CusMemo='" + CusMemo + "'where CusId='" + CusId + "'";*/ dbexe.sqlcmd(sql); string sql1 = "select top 1 id from T_FixPRO order by id DESC "; databaseexe databaseexe2 = new databaseexe(); string newid = databaseexe2.getTopid(sql1); if (yinshua.Equals(true)) { string sql2 = "update T_fixPRO set yingshua ='true' where id='" + newid + "'"; dbexe.sqlcmd(sql2); } if (zhanjiao.Equals(true)) { string sql3 = "update T_fixPRO set zhanjiao ='true' where id='" + newid + "'"; dbexe.sqlcmd(sql3); } if (dading.Equals(true)) { string sql4 = "update T_fixPRO set dading ='true' where id='" + newid + "'"; dbexe.sqlcmd(sql4); } MessageBox.Show("数据保存成功!"); string sql5 = "select top 1 id from T_FixPRO order by id DESC "; databaseexe databaseexe3 = new databaseexe(); textBoxFixId.Text = databaseexe2.getTopid(sql5); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonSaveNew_Click(object sender, EventArgs e) { try { string FixID = textBoxFixId.Text.Trim(); string CusID = textBoxClientID.Text.Trim(); string ProductName = textBoxProductName.Text.Trim(); string typeId = comboBoxTypeID.Text.Trim(); string TypeName = textBoxTypeNAME.Text.Trim(); string unit = textBoxUnit.Text.Trim(); string materialID = comboBoxMaterialID.Text.Trim(); string materialName = textBoxMaterialName.Text.Trim(); string Plength = textBoxLength.Text.Trim(); string Pwide = textBoxWide.Text.Trim(); string Pheight = textBoxHeight.Text.Trim(); string quantity = textBoxQuantity.Text.Trim(); string memo = textBoxMemo.Text.Trim(); string price = textBoxPrice.Text.Trim(); Boolean yinshua = checkBox1.Checked; Boolean zhanjiao = checkBox2.Checked; Boolean dading = checkBox3.Checked; string MidQuery = "select ID from T_MATERIAL where materialid ='" + materialID + "'"; databaseexe databaseexe = new databaseexe(); string id = databaseexe.getTopselect(MidQuery, "ID"); string sql = "update T_FixPRO set typeId='" + typeId + "',ProductName ='" + ProductName + "',productType='" + TypeName + "',materialId='" + id + "',MaterialName='" + materialName + "',Plength='" + Plength + "',Pwide='" + Pwide + "',Pheight='" + Pheight + "',unit='" + unit + "',quantity='" + quantity + "',price='" + price + "',memo='" + memo + "'where Id='" + FixID + "'"; dbexe.sqlcmd(sql); if (yinshua.Equals(true)) { string sql2 = "update T_fixPRO set yingshua ='true' where id='" + FixID + "'"; dbexe.sqlcmd(sql2); } if (zhanjiao.Equals(true)) { string sql3 = "update T_fixPRO set zhanjiao ='true' where id='" + FixID + "'"; dbexe.sqlcmd(sql3); } if (dading.Equals(true)) { string sql4 = "update T_fixPRO set dading ='true' where id='" + FixID + "'"; dbexe.sqlcmd(sql4); } if (yinshua.Equals(false)) { string sql5 = "update T_fixPRO set yingshua ='false' where id='" + FixID + "'"; dbexe.sqlcmd(sql5); } if (zhanjiao.Equals(false)) { string sql6 = "update T_fixPRO set zhanjiao ='false' where id='" + FixID + "'"; dbexe.sqlcmd(sql6); } if (dading.Equals(false)) { string sql7 = "update T_fixPRO set dading ='false' where id='" + FixID + "'"; dbexe.sqlcmd(sql7); } MessageBox.Show("数据保存成功!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonChoose_Click(object sender, EventArgs e) { try { ManuGenarator manu = new ManuGenarator(); dataValue.ManuSaleid = SaleOrderdataGridView1.CurrentRow.Cells[0].Value.ToString(); string ManuOrderid = dataValue.ManuSaleid; string ManuId = manu.manuGenerator(ManuOrderid); string sql = " Select id from t_ordersale where orderid ='" + ManuOrderid + "'order by id asc"; databaseexe databaseexe = new databaseexe(); string[] arr; arr = databaseexe.getMultiData(sql, "id"); for (int i = 0; i < arr.Length; i++) { string AllMaterialQuery = " Select unitquantity*orderquantity as a from T_manus where ZhuanAnID = '" + arr[i].ToString() + "'"; string AllMaterialQuantity = databaseexe.getTopselect(AllMaterialQuery, "a"); string sql1 = "insert into T_manuOrder (manuid,allmaterialquantity,saleid,zhuananid) values('" + ManuId + "','" + AllMaterialQuantity + "','" + ManuOrderid + "','" + arr[i].ToString() + "')"; dbexe.sqlcmd(sql1); } frmManuOrderAdd3 f1 = (frmManuOrderAdd3)this.Owner; f1.dgload(ManuOrderid, ManuId); } catch (Exception ex) { MessageBox.Show(ex.Message); } /*string orderQuantity = SaleOrderdataGridView1.CurrentRow.Cells[10].Value.ToString(); * string Uniqueid = SaleOrderdataGridView1.CurrentRow.Cells[1].Value.ToString(); * string unitQuantityQuery = "select unitquantity from T_manus where zhuananid ='" + Uniqueid + "'"; * databaseexe databaseexe = new databaseexe(); * string UnitQuantity = databaseexe.getTopselect(unitQuantityQuery, "unitquantity"); * * AutoCount autoCount = new AutoCount(); * string MaterialAll = autoCount.MaterialCount(orderQuantity,UnitQuantity); * * //frmManuOrderAdd3 frmsub = new frmManuOrderAdd3(SaleOrderdataGridView1.CurrentRow); * //frmsub.Show(); * * * /* string Orderid = dataValue.saleid; * frmOrderSaleNew2 frmsub = new frmOrderSaleNew2(Orderid); * frmOrderSaleNew2.FrmOrderSaleNew2.dgload(Orderid); * this.Close();*/ //string Orderid = dataValue.saleid; /* dataValue.ManuSaleid = SaleOrderdataGridView1.CurrentRow.Cells[0].Value.ToString(); * string ManuOrderid = dataValue.ManuSaleid; * Select id from t_ordersale * * string sql = "insert into T_manuOrder (manuid,saleid,allMaterialQuantity) values ('" + ManuId + "','"+ManuOrderid+ "','"+MaterialAll+"')"; * dbexe.sqlcmd(sql); * MessageBox.Show("数据添加成功!");*/ //frmManuOrderAdd3 frmManuOrderAdd3 = new frmManuOrderAdd3(ManuOrderid); // frmManuOrderAdd3.FrmManuOrderAdd3.dgload(ManuOrderid); this.Close(); MessageBox.Show("数据添加成功!"); }