public void CatConfiguracionDias_Lista(ref List <ConfiguracionDias> List, string Conexion) { try { CD_Datos cd_datos = new CD_Datos(Conexion); SqlDataReader dr = null; SqlCommand sqlcmd = cd_datos.GenerarSqlCommand("spCatDiasPermiso_Lista", ref dr); ConfiguracionDias c; while (dr.Read()) { c = new ConfiguracionDias(); c.Id_DF = Convert.ToInt32(dr["Id_DF"]); c.CD_Nombre = dr["CD_Nombre"].ToString(); c.DF_NivelStr = dr["DF_NivelStr"].ToString(); c.DF_RepNombre = dr["DF_RepNombre"].ToString(); c.DF_TipoStr = dr["DF_TipoStr"].ToString(); c.DF_FechaIni = Convert.ToDateTime(dr["DF_FechaIni"]); c.DF_FechaFin = Convert.ToDateTime(dr["DF_FechaIni"]); c.DF_Comentario = dr["DF_Comentario"].ToString(); List.Add(c); } dr.Close(); cd_datos.LimpiarSqlcommand(ref sqlcmd); } catch (Exception ex) { throw ex; } }
public void CatConfiguracionDias_Insertar(ConfiguracionDias cf, ref int Verificador, string Conexion) { try { CD_ConfiguracionDias cd_cf = new CD_ConfiguracionDias(); cd_cf.CatConfiguracionDias_Insertar(cf, ref Verificador, Conexion); } catch (Exception ex) { throw ex; } }
public void CatConfiguracionDias_Insertar(ConfiguracionDias cf, ref int Verificador, string Conexion) { try { CD_Datos cd_datos = new CD_Datos(Conexion); string[] Parametros = { "@Id_CD", "@Id_Rik", "@DF_FechaIni", "@DF_FechaFin", "@DF_RepNombre", "@DF_Nivel", "@DF_Tipo", "@DF_Comentario", "@Id_U" }; object[] Valores = { cf.Id_Cd, cf.Id_Rik, cf.DF_FechaIni, cf.DF_FechaFin, cf.DF_RepNombre, cf.DF_Nivel, cf.DF_Tipo, cf.DF_Comentario, cf.Id_U }; SqlCommand sqlcmd = cd_datos.GenerarSqlCommand("spCatDiasPermiso_Insertar", ref Verificador, Parametros, Valores); cd_datos.LimpiarSqlcommand(ref sqlcmd); } catch (Exception ex) { throw ex; } }
private void Guardar() { try { Sesion sesion = (Sesion)Session["Sesion" + Session.SessionID]; ConfiguracionDias cf = new ConfiguracionDias(); CN_ConfiguracionDias cn_cf = new CN_ConfiguracionDias(); int Verificador = 0; if (this.CmbNivel.SelectedValue == "2") { if (this.CmbCdi.SelectedValue == "-1") { Alerta("Seleccione el CDI"); return; } } else if (this.CmbNivel.SelectedValue == "3") { if (this.CmbCdi.SelectedValue == "-1") { Alerta("Seleccione el CDI"); return; } if (this.CmbRepresentante.SelectedValue == "-1") { Alerta("Seleccione el Representante"); return; } } if (this.CmbTipo.SelectedValue == "-1") { Alerta("Seleccione un tipo de justificación"); return; } if (this.rdFechaIni.SelectedDate == (DateTime?)null) { Alerta("Ingrese la fecha inicial"); return; } if (this.rdFechaIni.SelectedDate == (DateTime?)null) { Alerta("Ingrese la fecha final"); return; } if (this.rdFechaIni.SelectedDate > rdFechaFin.SelectedDate) { Alerta("La fecha incial no puede ser mayor a la fecha final"); return; } cf.Id_Cd = int.Parse(this.CmbCdi.SelectedValue); cf.Id_Rik = int.Parse(this.CmbRepresentante.SelectedValue); cf.DF_RepNombre = this.CmbRepresentante.Text.Trim(); cf.DF_FechaIni = Convert.ToDateTime(rdFechaIni.SelectedDate); cf.DF_FechaFin = Convert.ToDateTime(rdFechaFin.SelectedDate); cf.DF_Nivel = int.Parse(this.CmbNivel.SelectedValue); cf.DF_Tipo = int.Parse(this.CmbTipo.SelectedValue); cf.DF_Comentario = this.TxtDF_Comentario.Text.Trim(); cf.Id_U = sesion.Id_U; cn_cf.CatConfiguracionDias_Insertar(cf, ref Verificador, sesion.Emp_Cnx); if (Verificador == -1) { Alerta("Los datos se guardaron correctamente"); Inicializar(); rgDias.Rebind(); } } catch (Exception ex) { throw ex; } }