コード例 #1
0
        private void Delete()
        {
            string LastMessage;
            try
            {
               if(Kierowca != null)
                {
                   IHP_KIEROWCA dousuniecja = context.IHP_KIEROWCA.Find(_kierowca.ID_IHP_KIEROWCA);
                    context.Entry(dousuniecja).State = EntityState.Deleted;
                    context.IHP_KIEROWCA.Remove(dousuniecja);
                    context.SaveChanges();
                    Clear();
                    LoadCollection();
                    SentKierowcy();
                }
               }
            catch (DbUpdateException Ex)
            {
                LogManager.WriteLogMessage(LogManager.LogType.Error, String.Format("DbUpdateException \"{0}\"  :", Ex.InnerException.Message));
                throw Ex;
            }

            catch (Exception ex)
            {
                LastMessage = ex.ToString();
                if (LastMessage == String.Empty)
                    LastMessage = ex.InnerException.ToString();
                LogManager.WriteLogMessage(LogManager.LogType.Error, LastMessage);
                throw ex;
            }
        }
コード例 #2
0
 private void Clear()
 {
     if (_kontrah != null)
     {
         Kontrah  = null;
         _kontrah = null;
     }
     if (_kierowca != null)
     {
         Kierowca  = null;
         _kierowca = null;
     }
     Nazwa   = string.Empty;
     Telefon = string.Empty;
 }
コード例 #3
0
        private void Save()
        {
            int defcena = 1;

            if (_defceny != null)
            {
                defcena = _defceny.ID_IHP_DEFCENY;
            }

            IHP_NUMERACJA numerkr = GetId(3);

            if (numerkr != null)
            {
                numerkr.NUMER++;
            }

            string LastMessage;

            try
            {
                IHP_KIEROWCA kierowca = new IHP_KIEROWCA()
                {
                    ID_IHP_KIEROWCA   = numerkr.NUMER,
                    NAZWA             = _nazwa,
                    TELEFON           = _telefon,
                    ID_IHP_KONTRAHENT = _kontrah.ID_IHP_KONTRAHENT,
                    IHP_KONTRAHENT    = _kontrah
                };

                context.IHP_NUMERACJA.Add(numerkr);
                context.Entry(numerkr).State = EntityState.Modified;
                context.IHP_KIEROWCA.Add(kierowca);
                context.SaveChanges();
                LoadCollection();
                SentKierowcy();
            }
            catch (Exception ex)
            {
                LastMessage = ex.ToString();
                if (LastMessage == String.Empty)
                {
                    LastMessage = ex.InnerException.ToString();
                }
                LogManager.WriteLogMessage(LogManager.LogType.Error, LastMessage);
                throw ex;
            }
        }
コード例 #4
0
        private void Clear()
        {
            if (_samochod != null)
            {
                Samochod  = null;
                _samochod = null;
                newrec    = true;
            }
            if (_kierowca != null)
            {
                Kierowca  = null;
                _kierowca = null;
            }

            NrRej            = String.Empty;
            _isreadonlynrrej = false;
            Nazwa            = String.Empty;
            WagaReczna       = String.Empty;
        }
コード例 #5
0
        private void Clear()
        {
            if (_samochod != null)
            {
                Samochod  = null;
                _samochod = null;
            }

            if (_kontrah != null)
            {
                _kontrah = null;
                Kontrah  = null;
            }

            if (_kontraharch != null)
            {
                _kontraharch = null;
                KontrahArch  = null;
            }

            if (_kierowca != null)
            {
                _kierowca = null;
                Kierowca  = null;
            }

            if (_rodzajdok != null)
            {
                _rodzajdok = null;
            }
            if (_wazenie != null)
            {
                Wazenie  = null;
                _wazenie = null;
            }
            _nrrej  = string.Empty;
            NrRej   = string.Empty;
            _nazwa  = string.Empty;
            Nazwa   = string.Empty;
            _wagakg = string.Empty;
            WagaKg  = string.Empty;
        }
コード例 #6
0
        private void Clear()
        {
            if (_samochod != null)
            {
                Samochod  = null;
                _samochod = null;
            }

            if (_kontrah != null)
            {
                _kontrah = null;
                Kontrah  = null;
            }

            if (_kontraharch != null)
            {
                _kontraharch = null;
                KontrahArch  = null;
            }

            if (_kierowca != null)
            {
                _kierowca = null;
                Kierowca  = null;
            }

            if (_rodzajdok != null)
            {
                _rodzajdok = null;
            }
            if (_wazenie != null)
            {
                Wazenie  = null;
                _wazenie = null;
            }
            KierowcaNazwa   = string.Empty;
            KontrahentNazwa = string.Empty;
            NrRejNazwa      = string.Empty;
            Uwagi           = string.Empty;
            _ispopraw       = false;
            LoadCollection();
        }
コード例 #7
0
        private void Delete()
        {
            string LastMessage;

            try
            {
                if (Kierowca != null)
                {
                    if (context.IHP_SAMOCHOD.Any(x => x.ID_IHP_KIEROWCA == _kierowca.ID_IHP_KIEROWCA))
                    {
                        MessageBoxService.ShowMessage("Nie mozna usunąć kierowca przypisany do samochodu !");
                        return;
                    }

                    IHP_KIEROWCA dousuniecja = context.IHP_KIEROWCA.Find(_kierowca.ID_IHP_KIEROWCA);
                    context.Entry(dousuniecja).State = EntityState.Deleted;
                    context.IHP_KIEROWCA.Remove(dousuniecja);
                    context.SaveChanges();
                    Clear();
                    LoadCollection();
                    SentKierowcy();
                }
            }
            catch (DbUpdateException Ex)
            {
                LogManager.WriteLogMessage(LogManager.LogType.Error, String.Format("DbUpdateException \"{0}\"  :", Ex.InnerException.Message));
                throw Ex;
            }

            catch (Exception ex)
            {
                LastMessage = ex.ToString();
                if (LastMessage == String.Empty)
                {
                    LastMessage = ex.InnerException.ToString();
                }
                LogManager.WriteLogMessage(LogManager.LogType.Error, LastMessage);
                throw ex;
            }
        }