コード例 #1
0
        public async Task <IActionResult> Put(Guid TurnoId, [FromBody] TurnoDTO turno)
        {
            turno.TurnoId = TurnoId;
            await Service.Insert(turno);

            return(Ok(true));
        }
コード例 #2
0
ファイル: TurnoDAO.cs プロジェクト: daver1419/gestion2017
        //Probar si funciona
        public static void addNewTurno(TurnoDTO turno)
        {
            // VER EL TEMA DE LA FECHA

            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("turno_hora_inicio", turno.horaInicial);
            parameters.Add("turno_hora_fin", turno.horaFinal);
            parameters.Add("turno_descripcion", turno.descripcion);
            parameters.Add("turno_valor_km", turno.valor);
            parameters.Add("turno_precio_base", turno.precio);

            // Se habilita por defecto en 1
            try
            {
                SQLManager.executePorcedure("altaTurno", parameters);
            }
            catch (SqlException exception)
            {
                if (exception.Number == 50000 || exception.Number == 60000)
                {
                    throw new ApplicationException(exception.Message);
                }
                else
                {
                    throw exception;
                }
            }
        }
コード例 #3
0
ファイル: TurnoDAO.cs プロジェクト: daver1419/gestion2017
        public static void updateTurno(TurnoDTO turnodto)
        {
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("turno_id", turnodto.id);
            parameters.Add("turno_hora_inicio", turnodto.horaInicial);
            parameters.Add("turno_hora_fin", turnodto.horaFinal);
            parameters.Add("turno_descripcion", turnodto.descripcion);
            parameters.Add("turno_valor_km", turnodto.valor);
            parameters.Add("turno_precio_base", turnodto.precio);
            parameters.Add("turno_habilitado", turnodto.estado);

            try
            {
                SQLManager.executePorcedure("updateTurno", parameters);
            }
            catch (SqlException exception)
            {
                if (exception.Number == 50000 || exception.Number == 60000)
                {
                    throw new ApplicationException(exception.Message);
                }
                else
                {
                    throw exception;
                }
            }
        }
コード例 #4
0
 private void agregarEditarTurno(TurnoDTO turnoActivo)
 {
     if (this.edicion)
     {
         // Edicion
         try
         {
             turnoActivo.id = this.turnoEdicion.id;
             TurnoDAO.updateTurno(turnoActivo);
             MessageBox.Show("Se edito el turno correctamente");
             this.Close();
             listener.onOperationFinish();
         }
         catch (ApplicationException ex)
         {
             Utility.ShowError("Error al editar el turno", ex);
         }
     }
     else
     {
         // Alta
         try
         {
             TurnoDAO.addNewTurno(turnoActivo);
             MessageBox.Show("Se agrego el turno correctamente");
             this.Close();
             listener.onOperationFinish();
         }
         catch (ApplicationException ex)
         {
             Utility.ShowError("Error al agregar el turno", ex);
         }
     }
 }
コード例 #5
0
        internal static void generarRendicion(ChoferDTO chofer, TurnoDTO turno, DateTime dateTime,
                                              double importeTotal, List <int> viajesParaRendirList)
        {
            try
            {
                DataTable table = new DataTable();
                table.Columns.Add("viaje_id", typeof(int));
                foreach (int viajeId in viajesParaRendirList)
                {
                    table.Rows.Add(viajeId);
                }

                Dictionary <string, object> parametros = new Dictionary <string, object>();
                parametros.Add("chof_id", chofer.id);
                parametros.Add("turno_id", turno.id);
                parametros.Add("fecha", dateTime);
                parametros.Add("importe_total", importeTotal);
                parametros.Add("viajes", table);

                SQLManager.executePorcedure("generarRendicion", parametros);
            }
            catch (SqlException exception)
            {
                if (exception.Number == 50000)
                {
                    throw new ApplicationException(exception.Message);
                }
                else
                {
                    throw exception;
                }
            }
        }
コード例 #6
0
        public void onOperationFinishTurno(TurnoDTO turno)
        {
            turnoGlobal = turno;
            //txtTurnoDescripcion.Text = turno.descripcion;
            //txtTurnoHoraInicio.Text = turno.horaInicial.ToString();
//            txtTurnoHoraFin.Text = turno.horaFinal.ToString();
        }
コード例 #7
0
ファイル: TurnosFrm.cs プロジェクト: hugoaraujor/GoldenAures
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     currentTurno = new TurnoDTO()
     {
         Desde = textoBoxp2.Text, Hasta = textoBoxp3.Text, Turnodesc = textoBoxp1.Text, Idturno = Convert.ToInt16(labelindex.Text)
     };
     DespliegaCampos();
 }
コード例 #8
0
ファイル: Rendicion.cs プロジェクト: daver1419/gestion2017
 private void onTurnosSelectIndexChanged(object sender, System.EventArgs e)
 {
     if (turnosChoferComboBox.SelectedIndex != -1)
     {
         this.turno = (TurnoDTO)turnosChoferComboBox.SelectedItem;
         inicioTurnoTextBox.Text = Convert.ToString(turno.horaInicial);
         finTurnoTextBox.Text    = Convert.ToString(turno.horaFinal);
     }
 }
コード例 #9
0
        public static SqlDataReader getViajesNoRendidos(ChoferDTO chofer, TurnoDTO turno, DateTime dateTime)
        {
            Dictionary <string, object> parametros = new Dictionary <string, object>();

            parametros.Add("chof_id", chofer.id);
            parametros.Add("turno_id", turno.id);
            parametros.Add("fecha", dateTime);
            parametros.Add("porcentaje_rendicion", Config.newInstance.porcentajeRendicion);

            return(SQLManager.executeProcedureList("getViajesNoRendidos", parametros));
        }
コード例 #10
0
 public TurnoDTO Salvar(TurnoDTO dto)
 {
     if (dto.Codigo > 0)
     {
         return(dao.Alterar(dto));
     }
     else
     {
         return(dao.Adicionar(dto));
     }
 }
コード例 #11
0
        private void cargarDatosEdicion(int turnoModificableID)
        {
            turnoEdicion = TurnoDAO.selectTurnoById(turnoModificableID);

            this.turnoEdicion.id = turnoModificableID;

            this.comboInicio.Text        = turnoEdicion.horaInicial.ToString();
            this.comboFin.Text           = turnoEdicion.horaFinal.ToString();
            this.txtDescripcion.Text     = turnoEdicion.descripcion;
            this.valorKM.Text            = turnoEdicion.valor.ToString();
            this.precioBase.Text         = turnoEdicion.precio.ToString();
            this.checkHabilitado.Checked = turnoEdicion.estado;
        }
コード例 #12
0
        public bool HasValidTurno(TurnoDTO dto)
        {
            var _turno = ObterPorPK(dto);

            if (_turno.StartTime < dto.StartTime && _turno.EndTime > dto.StartTime)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #13
0
        public void Insert(TurnoDTO NewClase)
        {
            var x = NewClase;

            using (var db = new Data())
            {
                db.Turnos.Add(new Turno()
                {
                    Idturno   = 0,
                    Turnodesc = x.Turnodesc,
                    Desde     = x.Desde.ToString(),
                    Hasta     = x.Hasta.ToString()
                });

                db.SaveChanges();
            }
        }
コード例 #14
0
        private bool setearVariables()
        {
            try
            {
                valor = Convert.ToDouble(valorKM.Text);
            }
            catch { MessageBox.Show("Escriba correctamente el valor del Kilometro", "Validacion"); return(false); }

            try
            {
                precio = Convert.ToDouble(precioBase.Text);
            }
            catch { MessageBox.Show("Escriba correctamente el precio base", "Validacion"); return(false); }

            turno = new TurnoDTO(Convert.ToInt32(comboInicio.SelectedItem), Convert.ToInt32(comboFin.SelectedItem), txtDescripcion.Text, valor, precio, checkHabilitado.Checked);

            return(true);
        }
コード例 #15
0
        public void Edit(TurnoDTO Editedclass)
        {
            var x = Editedclass;

            try
            {
                using (var db = new Data())
                {
                    var pac = (from p in db.Turnos where p.Idturno == x.Idturno select p).FirstOrDefault();
                    if (pac != null)
                    {
                        pac.Turnodesc = x.Turnodesc;
                        pac.Desde     = x.Desde;
                        pac.Hasta     = x.Hasta;
                        db.SaveChanges();
                    }
                }
            }
            catch (DbEntityValidationException e)
            { }
        }
コード例 #16
0
        private void btnAgregarTurno_Click(object sender, EventArgs e)
        {
            if (cmbTurno.SelectedIndex == -1)
            {
                MessageBox.Show("Seleccione algun turno para agregar");
                return;
            }

            TurnoDTO turno = (TurnoDTO)cmbTurno.SelectedItem;

            if (turnos.Contains(turno))
            {
                MessageBox.Show("Ya ha agregado este turno");
                return;
            }


            turnos.Add(turno);
            dgvTurnos.Rows.Add(turno.descripcion, turno.horaInicial, turno.horaFinal);
            cmbTurno.SelectedIndex = -1;
        }
コード例 #17
0
ファイル: Rendicion.cs プロジェクト: daver1419/gestion2017
        private void cleanFields()
        {
            this.fechaRendicionDateTimePicker.Value = Config.newInstance.date;

            this.chofer                     = null;
            this.dniTextBox.Text            = "";
            this.nombreApellidoTextBox.Text = "";

            turnosChoferComboBox.DataSource = null;

            this.turno = null;
            inicioTurnoTextBox.Text = "";
            finTurnoTextBox.Text    = "";

            viajesParaRendirDataGridView.DataSource = null;

            viajesParaRendirList.Clear();

            importeTotal = 0;
            totalRendicionMontoLabel.Text = "";
        }
コード例 #18
0
ファイル: TurnoDAO.cs プロジェクト: daver1419/gestion2017
        public static List <TurnoDTO> getTurnos(SqlDataReader dataReader)
        {
            List <TurnoDTO> listaTurnos = new List <TurnoDTO>();

            if (dataReader.HasRows)
            {
                while (dataReader.Read())
                {
                    TurnoDTO turno = new TurnoDTO();
                    turno.id          = Convert.ToInt32(dataReader["turno_id"]);
                    turno.horaInicial = Convert.ToInt32(dataReader["turno_hora_inicio"]);
                    turno.horaFinal   = Convert.ToInt32(dataReader["turno_hora_fin"]);
                    turno.descripcion = Convert.ToString(dataReader["turno_descripcion"]);
                    turno.valor       = Convert.ToDouble(dataReader["turno_valor_km"]);
                    turno.precio      = Convert.ToDouble(dataReader["turno_precio_base"]);
                    turno.estado      = Convert.ToBoolean(dataReader["turno_habilitado"]);

                    listaTurnos.Add(turno);
                }
            }
            dataReader.Close();
            dataReader.Dispose();
            return(listaTurnos);
        }
コード例 #19
0
 public TurnoDTO ObterPorPK(TurnoDTO dto)
 {
     return(dao.ObterPorPK(dto));
 }
コード例 #20
0
 public bool Excluir(TurnoDTO dto)
 {
     return(dao.Eliminar(dto));
 }
コード例 #21
0
ファイル: TurnosFrm.cs プロジェクト: hugoaraujor/GoldenAures
        public void SeleccionoBarra()
        {
            this.textoBoxp1.Focus();

            if (comandBar1.Status == RecordAction.None)
            {
                Utilities.Controles(this, "Lock");
            }
            if (comandBar1.Status == RecordAction.Insert)
            {
                this.labelindex.Text = "-1";
                textoBoxp1.Text      = "";
                textoBoxp2.Text      = "";
                textoBoxp3.Text      = "";
            }
            if (comandBar1.Status == RecordAction.Insert || (comandBar1.Status == RecordAction.Update))
            {
                textoBoxp1.Focus();
                textoBoxp1.Enabled = true;
                textoBoxp2.Enabled = true;
                textoBoxp3.Enabled = true;
                listBox1.Enabled   = false;
                textoBoxp1.Focus();
            }

            if (comandBar1.Status == RecordAction.Delete && comandBar1.confirma)
            {
                turnoManager.Delete(currentTurno.Idturno);
                this.comandBar1.confirma = false;
                textoBoxp1.Enabled       = false;
                textoBoxp2.Enabled       = false;
                textoBoxp3.Enabled       = false;
                this.labelindex.Text     = "-1";
                textoBoxp1.Text          = "";
                textoBoxp2.Text          = "";
                textoBoxp3.Text          = "";
            }
            if (comandBar1.Status == RecordAction.Save)
            {
                var aux = "";                // validaforma();
                //if (aux != "")
                //{
                //	errorBar1.Mensaje = aux;
                //	errorBar1.Status = errorType.Error;
                //	this.comandBar1.Novalido();
                //	return;
                //}
                //if (comandBar1.Status == RecordAction.Save)
                {
                    currentTurno = new TurnoDTO
                    {
                        Idturno   = Convert.ToInt16(labelindex.Text),
                        Turnodesc = textoBoxp1.Text,
                        Desde     = textoBoxp2.Text,
                        Hasta     = textoBoxp3.Text
                    };
                }
                if (comandBar1.Status == RecordAction.Save && comandBar1.previo == RecordAction.Insert && aux == "")
                {
                    var aux1 = validarRegistro(currentTurno);
                    if (aux1.Length > 0)
                    {
                        Utilities.Mensaje(errorBar1, aux1, errorType.Error);
                        return;
                    }
                    turnoManager.Insert(currentTurno);
                    this.comandBar1.previo = RecordAction.None;
                    reset();
                }

                if (comandBar1.Status == RecordAction.Save && comandBar1.previo == RecordAction.Update && aux == "")
                {
                    var aux1 = validarRegistro(currentTurno);
                    if (aux1.Length > 0)
                    {
                        Utilities.Mensaje(errorBar1, aux1, errorType.Error);
                        return;
                    }
                    turnoManager.Edit(currentTurno);
                    this.comandBar1.previo = RecordAction.None;
                }
            }
            loadCombo();
            listBox1.Enabled = true;
            listBox1.Focus();
        }
コード例 #22
0
 public void onOperationFinishTurno(TurnoDTO turno)
 {
     //Do nothing
 }
コード例 #23
0
        public async Task <IActionResult> Post([FromBody] TurnoDTO turno)
        {
            await Service.Insert(turno);

            return(Ok(true));
        }
コード例 #24
0
 public void onOperationFinishTurno(TurnoDTO turno)
 {
     // NO SE IMPLEMENTA
 }
コード例 #25
0
ファイル: TurnosFrm.cs プロジェクト: hugoaraujor/GoldenAures
 private string validarRegistro(TurnoDTO currentTurno)
 {
     return("");
 }
コード例 #26
0
 public List <TurnoDTO> ObterPorFiltro(TurnoDTO dto)
 {
     return(dao.ObterPorFiltro(dto));
 }
コード例 #27
0
 public async Task Update(TurnoDTO entityDTO)
 {
     var entity =
         Builders.GenericBuilder.builderDTOEntity <TTurno, TurnoDTO>(entityDTO);
     await repository.Save(entity);
 }