예제 #1
0
        /// <summary>
        /// Envia los cambios del st_ServicioTareasDataset.st_ServicioTareasDataTable a la base de datos.
        /// </summary>
        public static void Update(st_ServicioTareasDataset.st_ServicioTareasDataTable dataTable)
        {
            ApplicationAssert.Check(dataTable != null, "El argumento dataTable no debe ser nulo.", ApplicationAssert.LineNumber);
            ApplicationAssert.Check(dataTable.Rows.Count > 0, "El argumento dataTable debe poseer alguna fila.", ApplicationAssert.LineNumber);

            mz.erp.dataaccess.st_ServicioTareas.Update(dataTable);
        }
예제 #2
0
        public static void Update(st_ServicioTareasDataset.st_ServicioTareasDataTable dataTable, SqlTransaction trx)
        {
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.TableMappings.AddRange(
                new System.Data.Common.DataTableMapping[] {
                new System.Data.Common.DataTableMapping("Table", "st_ServicioTareas",
                                                        new System.Data.Common.DataColumnMapping[] {
                    new System.Data.Common.DataColumnMapping("IdServicio", "IdServicio"),
                    new System.Data.Common.DataColumnMapping("IdTarea", "IdTarea"),
                    new System.Data.Common.DataColumnMapping("FechaCreacion", "FechaCreacion"),
                    new System.Data.Common.DataColumnMapping("IdConexionCreacion", "IdConexionCreacion"),
                    new System.Data.Common.DataColumnMapping("UltimaModificacion", "UltimaModificacion"),
                    new System.Data.Common.DataColumnMapping("IdConexionUltimaModificacion", "IdConexionUltimaModificacion"),
                    new System.Data.Common.DataColumnMapping("RowId", "RowId"),
                    new System.Data.Common.DataColumnMapping("PrecioTarea", "PrecioTarea"),
                    new System.Data.Common.DataColumnMapping("Peso", "Peso")
                }
                                                        )
            }
                );

            SqlCommand sqlCommandUpdate = new SqlCommand("Pr_st_ServicioTareas_Update", trx.Connection);

            sqlCommandUpdate.Transaction = trx;
            sqlCommandUpdate.CommandType = CommandType.StoredProcedure;
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@IdServicio", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdServicio", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@IdTarea", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdTarea", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@PrecioTarea", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "PrecioTarea", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@Peso", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Peso", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@UltimaModificacion", SqlDbType.Timestamp, 8, ParameterDirection.InputOutput, false, ((System.Byte)(0)), ((System.Byte)(0)), "UltimaModificacion", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@IdConexionUltimaModificacion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdConexionUltimaModificacion", DataRowVersion.Current, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@OldIdServicio", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdServicio", DataRowVersion.Original, null));
            sqlCommandUpdate.Parameters.Add(new SqlParameter("@OldIdTarea", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdTarea", DataRowVersion.Original, null));

            SqlCommand sqlCommandDelete = new SqlCommand("Pr_st_ServicioTareas_Delete", trx.Connection);

            sqlCommandDelete.Transaction = trx;
            sqlCommandDelete.CommandType = CommandType.StoredProcedure;
            sqlCommandDelete.Parameters.Add(new SqlParameter("@IdServicio", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdServicio", DataRowVersion.Original, null));
            sqlCommandDelete.Parameters.Add(new SqlParameter("@IdTarea", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdTarea", DataRowVersion.Original, null));
            sqlCommandDelete.Parameters.Add(new SqlParameter("@UltimaModificacion", SqlDbType.Timestamp, 8, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UltimaModificacion", DataRowVersion.Original, null));

            SqlCommand sqlCommandInsert = new SqlCommand("Pr_st_ServicioTareas_Insert", trx.Connection);

            sqlCommandInsert.Transaction = trx;
            sqlCommandInsert.CommandType = CommandType.StoredProcedure;
            sqlCommandInsert.Parameters.Add(new SqlParameter("@IdServicio", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdServicio", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@IdTarea", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdTarea", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@FechaCreacion", SqlDbType.DateTime, 0, ParameterDirection.InputOutput, false, ((System.Byte)(0)), ((System.Byte)(0)), "FechaCreacion", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@IdConexionCreacion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "IdConexionCreacion", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@PrecioTarea", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "PrecioTarea", DataRowVersion.Current, null));
            sqlCommandInsert.Parameters.Add(new SqlParameter("@Peso", SqlDbType.Decimal, 0, ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Peso", DataRowVersion.Current, null));

            adapter.UpdateCommand = sqlCommandUpdate;
            adapter.DeleteCommand = sqlCommandDelete;
            adapter.InsertCommand = sqlCommandInsert;
            adapter.Update(dataTable);
        }
예제 #3
0
        public DataTable ServiciosEnBD()
        {
            _servicios = new Hashtable();
            st_FallaDataset.st_FallaDataTable serviciosEnBD = st_Falla.GetList().st_Falla;
            foreach (st_FallaDataset.st_FallaRow rowServ in serviciosEnBD.Rows)
            {
                ArrayList tareas           = new ArrayList();
                long      IdFalla          = rowServ.IdFalla;
                string    Descripcion      = rowServ.Descripcion;
                int       DuracionDias     = rowServ.DuracionDias;
                decimal   Costo            = rowServ.Costo;
                decimal   CostoMaximo      = rowServ.CostoMaximo;
                decimal   CostoPresupuesto = rowServ.CostoPresupuesto;
                st_ServicioTareasDataset.st_ServicioTareasDataTable tableST = st_ServicioTareas.GetList(IdFalla).st_ServicioTareas;
                foreach (st_ServicioTareasDataset.st_ServicioTareasRow rowST in tableST.Rows)
                {
                    long IdTarea = rowST.IdTarea;
                    st_TareaDataset.st_TareaRow rowTarea = st_Tarea.GetByPk(IdTarea);
                    string  Codigo           = rowTarea.Codigo;
                    string  DescripcionTarea = rowTarea.Descripcion;
                    string  IdProducto       = rowTarea.IdProducto;
                    string  Complejidad      = rowTarea.Complejidad;
                    decimal Duracion         = rowTarea.Duracion;
                    decimal ValorTecnico     = rowTarea.ValorTecnico;
                    //Sabrina 20100623 - Tarea 786
                    //decimal ValorCliente = rowTarea.ValorCliente;
                    decimal ValorCliente = 0;
                    st_ListaDePreciosTareaDataset.st_ListaDePreciosTareaRow rowLPT = st_ListaDePreciosTarea.GetByIdTarea(IdTarea);
                    if (rowLPT != null)
                    {
                        ValorCliente = rowLPT.Precio;
                    }
                    //Fin Sabrina 20100623 - Tarea 786

                    decimal ValorTecnicoProvisorio = rowTarea.ValorTecnicoProvisorio;
                    decimal PrecioTareaServicio    = 0;
                    if (rowST["PrecioTarea"] != System.DBNull.Value)
                    {
                        PrecioTareaServicio = rowST.PrecioTarea;
                    }
                    decimal Peso = 0;
                    if (rowST["Peso"] != System.DBNull.Value)
                    {
                        Peso = rowST.Peso;
                    }
                    Tarea tarea = new Tarea(IdTarea, Codigo, DescripcionTarea, IdProducto, Complejidad, Duracion, ValorTecnico, ValorCliente, ValorTecnicoProvisorio, PrecioTareaServicio, Peso, string.Empty);
                    tareas.Add(tarea);
                }
                Servicio servicio = new Servicio(IdFalla, Descripcion, DuracionDias, Costo, CostoMaximo, CostoPresupuesto, tareas, string.Empty);
                _servicios.Add(IdFalla, servicio);
            }
            return(serviciosEnBD);
        }