private void btn_out_Click(object sender, EventArgs e) { int index; //decimal cost; string workno; index = grd.get_selectrow_index(); if (index == -1) { MessageBox.Show("请选择一条记录 !"); return; } btn_out.Enabled = false; btn_edit.Enabled = false; chk_type.Enabled = false; btn_search.Enabled = false; btn_del.Enabled = false; addflag = true; groupBox1.Enabled = true; workno = grd.get_value(index, 0).ToString(); txt_workno1.set_value(workno); //cost = dal.getCostbyWorkno(workno)*(-1); //txt_je.set_value( cost.ToString()); 成品库房DAL dal = new 成品库房DAL(); 成品库房 = dal.getCostByWorkno(workno); 成品库房.日期 = mydate.Value; set_txt_out(成品库房); }
// 批量转出 private void btn_export_Click(object sender, EventArgs e) { int rowcount = mygrid.get_row_number(); decimal mycost; 成品库房DAL dal = new 成品库房DAL(); 成品库房表 mod = new 成品库房表(); //foreach ( DataGridViewRow myrow in mygri) for (int i = 0; i < rowcount; i++) { if (bool.Parse(mygrid.get_value(i, 0).ToString())) { mod = dal.getCostByWorkno(mygrid.get_value(i, 1).ToString()); mod.id = Guid.NewGuid().ToString(); mod.日期 = mydate.Value; mod.金额 *= (-1); mod.ty *= (-1); mod.zdh *= (-1); mod.sj *= (-1); mod.ys *= (-1); mod.az *= (-1); mod.qt *= (-1); mod.xsjy *= (-1); mod.gjjy *= (-1); dal.insert成品库房表_转出(mod); } } MessageBox.Show("转出完成!"); fill(); btn_export.Enabled = false; }