public void Start() { foreach (var item in Operations) { switch (item) { case "+": Dop += Add; break; case "-": Dop += Sub; break; case "/": Dop += Div; break; case "*": Dop += Multi; break; } } Dop?.Invoke(); }
/// <summary> /// Default sort by work_day,part_no,prom_date,ordid,dop,dop_lin all not null /// </summary> /// <param name="other"></param> /// <returns></returns> public int CompareTo([AllowNull] Acc_material_ord other) { if (other == null) { return(1); } else { int result = Work_day.Date.CompareTo(other.Date_entered.Date); if (result == 0) { result = Part_no.CompareTo(other.Part_no); if (result == 0) { result = Prom_date.Date.CompareTo(other.Prom_date.Date); if (result == 0) { result = OrdId.CompareTo(other.OrdId); if (result == 0) { result = Dop.CompareTo(other.Dop); if (result == 0) { result = Dop_lin.CompareTo(other.Dop_lin); } } } } } return(result); } }
public void CreateOrUpdate(DopBindingModel model) { using (var context = new Database()) { Dop element = context.Dops.FirstOrDefault(rec => rec.DopName == model.DopName && rec.Id != model.Id); if (element != null) { //название throw new Exception("Уже есть блюдо с таким названием"); } if (model.Id.HasValue) { element = context.Dops.FirstOrDefault(rec => rec.Id == model.Id); if (element == null) { throw new Exception("Элемент не найден"); } } else { element = new Dop(); context.Dops.Add(element); } element.DopName = model.DopName; element.DataCreateDop = model.DataCreateDop; element.Count = model.Count; element.Place = model.Place; element.OsnvId = model.OsnvId; context.SaveChanges(); } }
public override int GetHashCode() { unchecked { var hashCode = (Family != null ? Family.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Surname != null ? Surname.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Pol; hashCode = (hashCode * 397) ^ DateRo.GetHashCode(); hashCode = (hashCode * 397) ^ DateSm.GetHashCode(); hashCode = (hashCode * 397) ^ (Dop != null ? Dop.GetHashCode() : 0); return(hashCode); } }
public void Delete(DopBindingModel model) { using (var context = new Database()) { Dop element = context.Dops.FirstOrDefault(rec => rec.Id == model.Id); if (element != null) { context.Dops.Remove(element); context.SaveChanges(); } else { throw new Exception("Элемент не найден"); } } }
public override int GetHashCode() { unchecked { var hashCode = (Family != null ? Family.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Surname != null ? Surname.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Pol; hashCode = (hashCode * 397) ^ DateRo.GetHashCode(); hashCode = (hashCode * 397) ^ DateSm.GetHashCode(); hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TypeUl != null ? TypeUl.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Street != null ? Street.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (House != null ? House.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Apartament != null ? Apartament.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Housing != null ? Housing.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Phone != null ? Phone.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PlaceWork != null ? PlaceWork.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Dop != null ? Dop.GetHashCode() : 0); hashCode = (hashCode * 397) ^ DateExit.GetHashCode(); return(hashCode); } }
/// <summary> /// Equatable by Work_day,Part_no,OrdId,Dop,Dop_lin /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals([AllowNull] Acc_material_ord other) { if (other == null) { return(false); } return(Work_day.Date.Equals(other.Work_day.Date) && Part_no.Equals(other.Part_no) && OrdId.Equals(other.OrdId) && Dop.Equals(other.Dop) && Dop_lin.Equals(other.Dop_lin)); }
public GpsService(SerialPortDataTransport <Gps> dataTransport, Codec <Gps> codec) : base(dataTransport, codec) { GpsSVs = new List <SatelliteVehicleInView>(); GlonassSVs = new List <SatelliteVehicleInView>(); ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["BOD"]).DecodeFinished += (sender, e) => { Bod = (Bod)e.Packet; BodChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["GGA"]).DecodeFinished += (sender, e) => { Gga = (Gga)e.Packet; GpsData = new GpsData( Gga.FixTime, Gga.Latitude, Gga.Longitude, Gga.Quality, Gga.Hdop, Gga.NumberOfSatellites, Gga.Altitude, Gga.AltitudeUnits, Gga.HeightOfGeoid, Gga.HeightOfGeoidUnits, Gga.TimeSinceLastDgpsUpdate, Gga.DgpsStationId); GpsDataChanged?.Invoke(this, EventArgs.Empty); GgaChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["GLL"]).DecodeFinished += (sender, e) => { Gll = (Gll)e.Packet; Position = new GeographicPosition(Gll.FixTime, Gll.Latitude, Gll.Longitude, Gll.DataActive, Gll.ModeIndicator); PositionChanged?.Invoke(this, EventArgs.Empty); GllChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["ZDA"]).DecodeFinished += (sender, e) => { Zda = (Zda)e.Packet; FixDateTime = Zda.FixDateTime; FixDateTimeChanged?.Invoke(this, EventArgs.Empty); ZdaChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["VTG"]).DecodeFinished += (sender, e) => { Vtg = (Vtg)e.Packet; VtgChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["RTE"]).DecodeFinished += (sender, e) => { Rte = (Rte)e.Packet; RteChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["RMC"]).DecodeFinished += (sender, e) => { Rmc = (Rmc)e.Packet; RmcChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["RMB"]).DecodeFinished += (sender, e) => { Rmb = (Rmb)e.Packet; RmbChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["GSV"]).DecodeFinished += (sender, e) => { Gsv = (Gsv)e.Packet; if (Gsv.SVs.Count == 0) { return; } if (Gsv.SVs.First().PrnNumber < 64) { if (Gsv.MessageNumber == 1) { GpsSVs = new List <SatelliteVehicleInView>(Gsv.TotalMessages * 4); } foreach (var sv in Gsv.SVs) { GpsSVs.Add(new SatelliteVehicleInView(sv.PrnNumber, sv.Elevation, sv.Azimuth, sv.SignalToNoiseRatio)); } if (Gsv.MessageNumber == Gsv.TotalMessages) { GpsSVsChanged?.Invoke(this, EventArgs.Empty); } } else if (Gsv.SVs.First().PrnNumber < 128) { if (Gsv.MessageNumber == 1) { GlonassSVs = new List <SatelliteVehicleInView>(Gsv.TotalMessages * 4); } foreach (var sv in Gsv.SVs) { GlonassSVs.Add(new SatelliteVehicleInView(sv.PrnNumber, sv.Elevation, sv.Azimuth, sv.SignalToNoiseRatio)); } if (Gsv.MessageNumber == Gsv.TotalMessages) { GlonassSVsChanged?.Invoke(this, EventArgs.Empty); } } GsvChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["GST"]).DecodeFinished += (sender, e) => { Gst = (Gst)e.Packet; Error = new PseudorangeErrorStatics(Gst.FixTime, Gst.Rms, Gst.SigmaLatitudeError, Gst.SigmaLongitudeError, Gst.SigmaHeightError, Gst.SemiMajorError, Gst.SemiMinorError, Gst.ErrorOrientation); ErrorChanged?.Invoke(this, EventArgs.Empty); GstChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["GSA"]).DecodeFinished += (sender, e) => { Gsa = (Gsa)e.Packet; ActiveSatellites = Gsa.SVs.Select(o => new Satellite(o)).ToList(); Dop = new Dop(Gsa.Hdop, Gsa.Vdop, Gsa.Pdop, Gsa.FixMode, Gsa.GpsMode); ActiveSatellitesChanged?.Invoke(this, EventArgs.Empty); DopChanged?.Invoke(this, EventArgs.Empty); GsaChanged?.Invoke(this, EventArgs.Empty); }; ((AncestorGenericPacketEncodingDecorator <string>)codec.Encoding.FindDecoratedEncoding <DescendantGenericPacketEncodingDecorator <Gps, string> >().EncodingDictionary["GNS"]).DecodeFinished += (sender, e) => { Gns = (Gns)e.Packet; GlonassData = new GnssData( Gns.FixTime, Gns.Latitude, Gns.Longitude, Gns.GlonassModeIndicator, Gns.Hdop, Gns.NumberOfSatellites, Gns.OrhometricHeight, Gns.GeoidalSeparation, Gns.TimeSinceLastDgpsUpdate, Gns.DgpsStationId, Gns.Status); GlonassDataChanged?.Invoke(this, EventArgs.Empty); GnsChanged?.Invoke(this, EventArgs.Empty); }; }