コード例 #1
0
        public string saveChange()
        {
            string message = "";

            try
            {
                TblMultasDAO tblMultasDataRepository = new TblMultasDAO();
                {
                    tblMultasDataRepository.idFines      = idFines;
                    tblMultasDataRepository.codeBar      = codeBar;
                    tblMultasDataRepository.dtFines      = dtFines;
                    tblMultasDataRepository.idInfraction = idInfraction;
                    tblMultasDataRepository.idVehicle    = idVehicle;
                    tblMultasDataRepository.idCompany    = idCompany;
                };

                switch (State)
                {
                //Execulta reglas comerciais / calculos
                case EntityState.Add:
                    empresaRepository.Add(tblMultasDataRepository);
                    message = "Usuário Cadastrado com sucesso!";
                    break;

                case EntityState.Modified:
                    empresaRepository.Edit(tblMultasDataRepository);
                    message = "Usuário alterado com sucesso!";
                    break;

                case EntityState.Delete:
                    empresaRepository.Remove((int)idFines);
                    message = "Usuário removido com sucesso!";
                    break;
                }

                return(message);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
コード例 #2
0
 public int Add(TblMultasDAO entity)
 {
     try
     {
         parameters = new List <SqlParameter>
         {
             new SqlParameter("@P1", entity.idVehicle),
             new SqlParameter("@P2", entity.idInfraction),
             new SqlParameter("@P3", entity.idCompany),
             new SqlParameter("@P4", entity.dtFines),
             new SqlParameter("@P5", entity.price),
             new SqlParameter("@P6", entity.codeBar)
         };
         return(ExecuteNonQuery(insert));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }