public void AddRow(ro_HorasProfesores_det_Info info_det) { ro_rubro_tipo_Bus bus_rub = new ro_rubro_tipo_Bus(); var info_rubro = bus_rub.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdRubro); ro_empleado_Bus bus_emppleado = new ro_empleado_Bus(); ro_empleado_Info info_empleado = new ro_empleado_Info(); info_empleado = bus_emppleado.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdEmpleado); List <ro_HorasProfesores_det_Info> list = get_list(); info_det.Secuencia = list.Count == 0 ? 1 : list.Max(q => q.Secuencia) + 1; info_det.ru_descripcion = info_rubro.ru_descripcion; info_det.pe_apellido = info_empleado.pe_apellido + " " + info_empleado.pe_nombre; list.Add(info_det); }
private void cargar_combo() { try { bus_tipo = new ro_marcaciones_tipo_Bus(); ViewBag.lst_tipo = bus_tipo.get_list(); bus_empleado = new ro_empleado_Bus(); bus_catalogo = new ro_catalogo_Bus(); ro_nomina_tipo_Bus bus_nomina = new ro_nomina_tipo_Bus(); IdEmpresa = GetIdEmpresa(); ViewBag.lst_empleado = bus_empleado.get_list_combo(IdEmpresa); ViewBag.lst_tipomarcacion = bus_catalogo.get_list_x_tipo(18); } catch (Exception) { throw; } }
public void UpdateRow(ro_HorasProfesores_det_Info info_det) { ro_rubro_tipo_Bus bus_rub = new ro_rubro_tipo_Bus(); var info_rubro = bus_rub.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdRubro); ro_empleado_Bus bus_emppleado = new ro_empleado_Bus(); ro_empleado_Info info_empleado = new ro_empleado_Info(); info_empleado = bus_emppleado.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdEmpleado); ro_HorasProfesores_det_Info edited_info = get_list().Where(m => m.Secuencia == info_det.Secuencia).First(); edited_info.NumHoras = info_det.NumHoras; edited_info.Valor = info_det.Valor; edited_info.ValorHora = info_det.ValorHora; edited_info.IdRubro = info_det.IdRubro; edited_info.IdEmpleado = info_empleado.IdEmpleado; edited_info.ru_descripcion = info_rubro.ru_descripcion; edited_info.pe_apellido = info_empleado.pe_apellido + " " + info_empleado.pe_nombre; }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { #region Variables ro_empleado_Bus bus_empleado = new ro_empleado_Bus(); Af_Activo_fijo_tipo_Bus bus_tipo = new Af_Activo_fijo_tipo_Bus(); Af_Activo_fijo_tipo_List ListaTipo = new Af_Activo_fijo_tipo_List(); List <Af_Activo_fijo_tipo_Info> Lista_Tipo = new List <Af_Activo_fijo_tipo_Info>(); Af_Activo_fijo_Categoria_List ListaCategoria = new Af_Activo_fijo_Categoria_List(); List <Af_Activo_fijo_Categoria_Info> Lista_Categoria = new List <Af_Activo_fijo_Categoria_Info>(); Af_Departamento_List ListaDepartamento = new Af_Departamento_List(); List <Af_Departamento_Info> Lista_Departamento = new List <Af_Departamento_Info>(); Af_Catalogo_List ListaCatalogo = new Af_Catalogo_List(); List <Af_Catalogo_Info> Lista_Catalogo = new List <Af_Catalogo_Info>(); Af_Activo_fijo_List ListaActivoFijo = new Af_Activo_fijo_List(); List <Af_Activo_fijo_Info> Lista_ActivoFijo = new List <Af_Activo_fijo_Info>(); //Af_Activo_fijo_CtaCble_List ListaActivoFijoCtaCble = new Af_Activo_fijo_CtaCble_List(); List <Af_Activo_fijo_CtaCble_Info> Lista_ActivoFijoCtaCble = new List <Af_Activo_fijo_CtaCble_Info>(); int cont = 0; decimal IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual); int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); #endregion Stream stream = new MemoryStream(e.UploadedFile.FileBytes); if (stream.Length > 0) { IExcelDataReader reader = null; reader = ExcelReaderFactory.CreateOpenXmlReader(stream); #region Tipo while (reader.Read()) { if (!reader.IsDBNull(0) && cont > 0) { Af_Activo_fijo_tipo_Info info = new Af_Activo_fijo_tipo_Info { IdEmpresa = IdEmpresa, IdActivoFijoTipo = Convert.ToInt32(reader.GetValue(0)), CodActivoFijo = reader.GetString(1), Af_Descripcion = reader.GetString(2), Af_Porcentaje_depre = Convert.ToDouble(reader.GetValue(3)), Af_anio_depreciacion = Convert.ToInt32(reader.GetValue(4)), IdCtaCble_Activo = Convert.ToString(reader.GetValue(6)), IdCtaCble_Dep_Acum = Convert.ToString(reader.GetValue(7)), IdCtaCble_Gastos_Depre = Convert.ToString(reader.GetValue(8)), Se_Deprecia = reader.GetString(5) == "SI" ? true : false, IdCtaCble_CostoVenta = Convert.ToString(reader.GetValue(9)), IdCtaCble_Mejora = Convert.ToString(reader.GetValue(10)), IdCtaCble_Baja = Convert.ToString(reader.GetValue(11)), IdCtaCble_Retiro = Convert.ToString(reader.GetValue(12)), IdUsuario = SessionFixed.IdUsuario }; Lista_Tipo.Add(info); } else { cont++; } } ListaTipo.set_list(Lista_Tipo, IdTransaccionSession); #endregion cont = 0; //Para avanzar a la siguiente hoja de excel reader.NextResult(); #region Categoria while (reader.Read()) { if (!reader.IsDBNull(0) && cont > 0) { Af_Activo_fijo_Categoria_Info info = new Af_Activo_fijo_Categoria_Info { IdEmpresa = IdEmpresa, IdCategoriaAF = Convert.ToInt32(reader.GetValue(0)), IdActivoFijoTipo = Convert.ToInt32(reader.GetValue(1)), CodCategoriaAF = string.IsNullOrEmpty(Convert.ToString(reader.GetValue(2))) ? null : Convert.ToString(reader.GetValue(2)), Descripcion = Convert.ToString(reader.GetValue(3)), IdUsuario = SessionFixed.IdUsuario }; Lista_Categoria.Add(info); } else { cont++; } } ListaCategoria.set_list(Lista_Categoria, IdTransaccionSession); #endregion cont = 0; reader.NextResult(); #region Departamento while (reader.Read()) { if (!reader.IsDBNull(0) && cont > 0) { Af_Departamento_Info info = new Af_Departamento_Info { IdEmpresa = IdEmpresa, IdDepartamento = Convert.ToInt32(reader.GetValue(0)), Descripcion = Convert.ToString(reader.GetValue(1)), IdUsuarioCreacion = SessionFixed.IdUsuario }; Lista_Departamento.Add(info); } else { cont++; } } ListaDepartamento.set_list(Lista_Departamento, IdTransaccionSession); #endregion cont = 0; reader.NextResult(); #region Catalogo while (reader.Read()) { if (!reader.IsDBNull(0) && cont > 0) { Af_Catalogo_Info info = new Af_Catalogo_Info { IdCatalogo = Convert.ToString(reader.GetValue(0)), IdTipoCatalogo = Convert.ToString(reader.GetValue(1)), Descripcion = Convert.ToString(reader.GetValue(2)), IdUsuario = SessionFixed.IdUsuario }; info.IdCatalogo = info.IdCatalogo.Trim(); info.IdTipoCatalogo = info.IdTipoCatalogo.Trim(); Lista_Catalogo.Add(info); } else { cont++; } } ListaCatalogo.set_list(Lista_Catalogo, IdTransaccionSession); #endregion cont = 0; reader.NextResult(); #region ActivoFijo var ListaEmpleado = bus_empleado.get_list_combo(IdEmpresa); ro_empleado_info_list Lista_Empleado = new ro_empleado_info_list(); Lista_Empleado.set_list(ListaEmpleado); while (reader.Read()) { if (!reader.IsDBNull(0) && cont > 0) { var IdTipo = Convert.ToInt32(reader.GetValue(3)); var ini_depre = Convert.ToDateTime(reader.GetValue(13)); var info_empleado_custodio = Lista_Empleado.get_list().Where(q => q.pe_cedulaRuc == Convert.ToString(reader.GetValue(23))).FirstOrDefault(); var info_empleado_encargado = Lista_Empleado.get_list().Where(q => q.pe_cedulaRuc == Convert.ToString(reader.GetValue(22))).FirstOrDefault(); var info_tipo_activofijo = ListaTipo.get_list(IdTransaccionSession).Where(q => q.IdActivoFijoTipo == IdTipo).FirstOrDefault(); Af_Activo_fijo_Info info = new Af_Activo_fijo_Info { IdEmpresa = IdEmpresa, IdUsuario = SessionFixed.IdUsuario, IdActivoFijo = Convert.ToInt32(reader.GetValue(0)), CodActivoFijo = string.IsNullOrEmpty(Convert.ToString(reader.GetValue(1))) ? null : Convert.ToString(reader.GetValue(1)), Af_Codigo_Barra = string.IsNullOrEmpty(Convert.ToString(reader.GetValue(24))) ? null : Convert.ToString(reader.GetValue(24)), Af_Nombre = Convert.ToString(reader.GetValue(2)), IdCategoriaAF = Convert.ToInt32(reader.GetValue(4)), IdActivoFijoTipo = Convert.ToInt32(reader.GetValue(3)), IdSucursal = Convert.ToInt32(reader.GetValue(5)), IdDepartamento = Convert.ToInt32(reader.GetValue(6)), IdCatalogo_Marca = Convert.ToString(reader.GetValue(7)), IdCatalogo_Modelo = Convert.ToString(reader.GetValue(8)), IdCatalogo_Color = Convert.ToString(reader.GetValue(10)), IdTipoCatalogo_Ubicacion = Convert.ToString(reader.GetValue(11)), IdEmpleadoCustodio = info_empleado_custodio.IdEmpleado, IdEmpleadoEncargado = info_empleado_encargado.IdEmpleado, Af_fecha_compra = Convert.ToDateTime(reader.GetValue(12)), Af_fecha_ini_depre = ini_depre, Af_costo_compra = Convert.ToDouble(reader.GetValue(15)), Af_Depreciacion_acum = Convert.ToDouble(reader.GetValue(16)), Af_ValorSalvamento = Convert.ToDouble(reader.GetValue(25)), Af_NumSerie = string.IsNullOrEmpty(Convert.ToString(reader.GetValue(9))) ? null : Convert.ToString(reader.GetValue(9)), Af_NumPlaca = string.IsNullOrEmpty(Convert.ToString(reader.GetValue(21))) ? null : Convert.ToString(reader.GetValue(21)), Estado_Proceso = "TIP_ESTADO_AF_ACTIVO", Af_fecha_fin_depre = ini_depre.AddYears(info_tipo_activofijo.Af_anio_depreciacion), Af_Meses_depreciar = (info_tipo_activofijo.Af_anio_depreciacion * 12), Af_porcentaje_deprec = info_tipo_activofijo.Af_Porcentaje_depre, Af_Vida_Util = info_tipo_activofijo.Af_anio_depreciacion, Af_observacion = Convert.ToString(reader.GetValue(20)), Cantidad = Convert.ToInt32(reader.GetValue(26)) }; Lista_ActivoFijo.Add(info); } else { cont++; } } ListaActivoFijo.set_list(Lista_ActivoFijo, IdTransaccionSession); #endregion cont = 0; reader.NextResult(); #region ActivoFijo_CtaCble //while (reader.Read()) //{ // if (!reader.IsDBNull(0) && cont > 0) // { // Af_Activo_fijo_CtaCble_Info info = new Af_Activo_fijo_CtaCble_Info // { // IdEmpresa = IdEmpresa, // IdActivoFijo = Convert.ToInt32(reader.GetValue(0)), // IdDepartamento = Convert.ToInt32(reader.GetValue(1)), // IdCtaCble = Convert.ToString(reader.GetValue(2)), // Porcentaje = Convert.ToDouble(reader.GetValue(3)) // }; // Lista_ActivoFijoCtaCble.Add(info); // } // else // cont++; //} //ListaActivoFijoCtaCble.set_list(Lista_ActivoFijoCtaCble, IdTransaccionSession); #endregion } }