public void Updatecktj(ckb c) { db.AddParameters("@spbh", SqlDbType.Int, c.spbh); db.AddParameters("@xh", SqlDbType.VarChar, c.xh); db.AddParameters("@sl", SqlDbType.Int, c.sl); db.Update("update spxxb set sl=sl-@sl where spbh=@spbh and xh=@xh"); }
public void DataBindingCmbckSpxh(ComboBox cmbxh, ckb c) { //组合框的绑定 db.AddParameters("@spbh", SqlDbType.Int, c.spbh); dtxh = db.Select("select xh from hjxxb where spbh=@spbh and sl>0"); bd.bd(cmbxh, dtxh, "xh", "xh"); }
public int dgvCellContentClickrk(ckb c) { DataTable dt = new DataTable(); db.AddParameters("@spm", SqlDbType.Char, c.spm); db.AddParameters("@xh", SqlDbType.Char, c.xh); db.AddParameters("@hjbh", SqlDbType.Char, c.cfhj); dt = db.Select("SELECT dbo.hjxxb.sl FROM dbo.hjxxb INNER JOIN dbo.spb ON dbo.hjxxb.spbh = dbo.spb.spbh where spm=@spm and xh=@xh and hjbh=@hjbh"); if (int.Parse(dt.Rows[0]["sl"].ToString()) < c.sl) { MessageBox.Show("数量不足"); return(1); } else { db.AddParameters("@ckbh", SqlDbType.Int, c.ckbh); db.AddParameters("@spm", SqlDbType.Char, c.spm); db.AddParameters("@xh", SqlDbType.Char, c.xh); db.AddParameters("@sl", SqlDbType.Char, c.sl); db.AddParameters("@chr", SqlDbType.Char, c.chr); db.AddParameters("@shr", SqlDbType.Char, c.shr); db.AddParameters("@cfhj", SqlDbType.Char, c.cfhj); db.Update("update ckb set yz=0 where ckbh=@ckbh"); return(2); } }
public void DataBindingCmbckcfhj(ComboBox cmbcfhj, ckb c) { //组合框的绑定 db.AddParameters("@spbh", SqlDbType.Int, c.spbh); db.AddParameters("@xh", SqlDbType.VarChar, c.xh); dthj = db.Select("select hjbh from hjxxb where spbh=@spbh and xh=@xh"); bd.bd(cmbcfhj, dthj, "hjbh", "hjbh"); }
public void DataBindingDataGridView(DataGridView dgvck, int num, ckb c, khb k) { dgvck.Rows.Add(); dgvck.Rows[num].Cells[0].Value = c.spm; dgvck.Rows[num].Cells[1].Value = c.xh; dgvck.Rows[num].Cells[2].Value = c.sl; dgvck.Rows[num].Cells[3].Value = c.cfhj; dgvck.Rows[num].Cells[4].Value = k.kh; }
public void Insertckhj(ckb c) { DataTable dthj = new DataTable(); db.AddParameters("@hjbh", SqlDbType.Char, c.cfhj); db.AddParameters("@spbh", SqlDbType.Int, c.spbh); db.AddParameters("@xh", SqlDbType.VarChar, c.xh); db.AddParameters("@sl", SqlDbType.Int, c.sl); db.Update("update hjxxb set sl=sl-@sl where hjbh=@hjbh and spbh=@spbh and xh=@xh"); }
public void dgvCellContentClickth(ckb c) { db.AddParameters("@ckbh", SqlDbType.Int, c.ckbh); db.AddParameters("@spm", SqlDbType.NChar, c.spm); db.AddParameters("@xh", SqlDbType.Char, c.xh); db.AddParameters("@sl", SqlDbType.Char, c.sl); db.AddParameters("@chr", SqlDbType.Char, c.chr); db.AddParameters("@shr", SqlDbType.Char, c.shr); db.AddParameters("@cfhj", SqlDbType.Char, c.cfhj); db.Update("update ckb set yz=-1 where ckbh=@ckbh"); }
public void Insertrktj(ckb c) { db.AddParameters("@spbh", SqlDbType.Int, c.spbh); db.AddParameters("@spm", SqlDbType.Char, c.spm); db.AddParameters("@xh", SqlDbType.VarChar, c.xh); db.AddParameters("@sl", SqlDbType.Int, c.sl); db.AddParameters("@chr", SqlDbType.VarChar, c.chr); db.AddParameters("@shr", SqlDbType.Int, c.shr); db.AddParameters("@cfhj", SqlDbType.Char, c.cfhj); db.Insert("insert into ckb (spbh,spm,xh,sl,chr,shr,cfhj,cksj,yz)values(@spbh,@spm,@xh,@sl,@chr,@shr,@cfhj,GETDATE(),1)"); }
public void DataBindingCmbcksl(ckb c) { db.AddParameters("@spbh", SqlDbType.Int, c.spbh); db.AddParameters("@xh", SqlDbType.VarChar, c.xh); db.AddParameters("@hjbh", SqlDbType.VarChar, c.cfhj); dtrksl = db.Select2("select sl from hjxxb where hjbh=@hjbh and spbh=@spbh and xh=@xh"); while (dtrksl.Read())//每次读取一行,记录会自动下移至下一条记录,反复读取,直到读完记录 { c.sl = int.Parse(dtrksl[0].ToString()); } db.close(); }