using System.Collections.Generic; using System.Linq; using Mesnac.Action.ChemicalWeighing.FreeDb; namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB { public class DeviceMaterrialService { public static void Save(List materrials) { var deviceMaterrial = materrials.First(); FreeSqlUnit.Instance.Delete() .Where(x => x.Type == deviceMaterrial.Type && x.DeviceId == deviceMaterrial.DeviceId) .ExecuteDeleted(); foreach (var materrial in materrials) { materrial.Code = StockMaterrialDbHelp.GetCodeById(materrial.MaterrialId); } FreeSqlUnit.Instance.Insert(materrials).ExecuteAffrows(); } public static List GetByTypeId(int type, int deviceId) { return FreeSqlUnit.Instance.Select() .Where(x => x.Type == type && x.DeviceId == deviceId) .ToList(); } private static void ComboboxDBHelper() { } } }