public static bool UpdateLeftCount(CigarreteLeftCountInfo info, decimal groupNo) { using (DZEntities en = new DZEntities()) { T_PRODUCE_SORTTROUGH infos = new T_PRODUCE_SORTTROUGH(); infos = en.T_PRODUCE_SORTTROUGH.Where(item => item.CIGARETTETYPE == 30 && item.GROUPNO == groupNo && item.STATE == "10" && item.MACHINESEQ == info.MachineSeq).OrderBy(item => item.MACHINESEQ).FirstOrDefault(); infos.MANTISSA = info.Mantissa; infos.THRESHOLD = info.Threshold; return(en.SaveChanges() > 0); } }
private void button1_Click(object sender, EventArgs e) { CigarreteLeftCountInfo info = new CigarreteLeftCountInfo() { CigaretteCode = itemno, CigaretteName = itemName, MachineSeq = Convert.ToDecimal(machineseq), Threshold = Convert.ToDecimal(tbhjws.Text), Mantissa = Convert.ToDecimal(tbws.Text) }; if (CigarreteLeftCountClass.UpdateLeftCount(info, groupNo)) { MessageBox.Show("修改成功"); } else { MessageBox.Show("修改失败"); } }