Untitled

mail@pastecode.io avatar
unknown
vbscript
a month ago
1.4 kB
2
Indexable
Never
  If fld = "Station" And vall <> "" Then 'מוסיף רכב ברירת מחדל
      Dim stationrs As station = _context.station.Where(Function(s) s.FFID = vall).FirstOrDefault
      If Not stationrs Is Nothing Then
          Dim defapp As String = Nz(stationrs.defApparatus, "")
          If defapp <> "" Then
              Dim appars As ApparatusINC = _context.ApparatusINC.Where(Function(a) a.Exposure = ExposureNum And a.Incident = incidentid And a.UnitID = defapp).FirstOrDefault
              If appars Is Nothing Then
                  Dim app As Apparatus = _context.Apparatus.Where(Function(t) t.AppID = defapp).FirstOrDefault
                  Dim apptype As String = ""
                  If Not app Is Nothing Then
                      apptype = Nz(app.Apptype, "")
                  End If
                  appars = New ApparatusINC
                  appars.Incident = incidentid
                  appars.Exposure = ExposureNum
                  appars.UnitID = defapp
                  appars.ApparatusType = apptype
                  _context.ApparatusINC.Add(appars)
                  _contextinci.SaveChanges()
                  _context.SaveChanges()
                  Call fillpersonnel(appars.moneln, incidentid, ExposureNum, Session, Request, _contextinci.Database.Connection.ConnectionString)
              End If
          End If
      End If
  End If
Leave a Comment