public void BloqueoPeriodo_Consultar(int Id_Cd, int Id_Cte, ref BloqueoPeriodo bp, ref int Verificador, ref int Verificador2, string Conexion) { try { CD_Datos cd_datos = new CD_Datos(Conexion); DataSet ds = null; string[] Parametros = { "@Id_Cd", "@Id_Cte" }; object[] Valores = { Id_Cd, Id_Cte }; SqlCommand sqlcmd = cd_datos.GenerarSqlCommand("spCapBloquePeriodo_Consulta", ref ds, Parametros, Valores); DataTable dt = ds.Tables[0]; foreach (DataRow row in dt.Rows) { Verificador = Convert.ToInt32(row["Verificador"]); } if (Verificador != -2) { DataTable dt2 = ds.Tables[1]; if (dt2.Rows.Count > 0) { Verificador2 = -1; foreach (DataRow row in dt2.Rows) { bp.Cte_nombre = row["Cte_NomComercial"].ToString(); if (row["bp_FechaIni"].ToString() != "") { bp.Bp_FechaIni = Convert.ToDateTime(row["bp_FechaIni"]); } if (row["bp_FechaFin"].ToString() != "") { bp.Bp_FechaFin = Convert.ToDateTime(row["bp_FechaFin"]); } } } else { Verificador2 = -2; } } cd_datos.LimpiarSqlcommand(ref sqlcmd); } catch (Exception ex) { throw ex; } }
public void BloqueoPeriodo_Insertar(BloqueoPeriodo bp, ref int Verificador, string Conexion) { try { CD_BloqueoPeriodo cd_bp = new CD_BloqueoPeriodo(); cd_bp.BloqueoPeriodo_Insertar(bp, ref Verificador, Conexion); } catch (Exception ex) { throw ex; } }
public void BloqueoPeriodo_Consultar(int Id_Cd, int Id_Cte, ref BloqueoPeriodo bp, ref int Verificador, ref int Verificador2, string Conexion) { try { CD_BloqueoPeriodo cd_bp = new CD_BloqueoPeriodo(); cd_bp.BloqueoPeriodo_Consultar(Id_Cd, Id_Cte, ref bp, ref Verificador, ref Verificador2, Conexion); } catch (Exception ex) { throw ex; } }
public void BloqueoPeriodo_Insertar(BloqueoPeriodo bp, ref int Verificador, string Conexion) { try { CD_Datos cd_datos = new CD_Datos(Conexion); string[] Parametros = { "@Id_Cd", "@Id_Cte", "@FechaIni", "@FechaFin" }; object[] Valores = { bp.Id_cd, bp.Id_cte, bp.Bp_FechaIni, bp.Bp_FechaFin }; SqlCommand sqlcmd = cd_datos.GenerarSqlCommand("spCapBloquePeriodo_Insertar", ref Verificador, Parametros, Valores); cd_datos.LimpiarSqlcommand(ref sqlcmd); } catch (Exception ex) { throw ex; } }
private void Guardar() { try { if (this.TxtId_Cd.Text == string.Empty) { Alerta("Seleccione un CDI"); return; } if (this.TxtId_Cte.Text == string.Empty) { Alerta("Ingrese el número de cliente"); return; } if (this.txtFecha1.SelectedDate > this.txtFecha2.SelectedDate) { Alerta("La fecha final no puede ser menor a la fecha inicial"); return; } if (this.txtFecha2.SelectedDate < DateTime.Now) { Alerta("La fecha final no puede ser menor a la fecha actual"); return; } BloqueoPeriodo bp = new BloqueoPeriodo(); bp.Id_cd = int.Parse(this.TxtId_Cd.Text); bp.Id_cte = int.Parse(this.TxtId_Cte.Text); if (this.txtFecha1.SelectedDate != null) { bp.Bp_FechaIni = this.txtFecha1.SelectedDate.Value; } else { bp.Bp_FechaIni = Convert.ToDateTime("1900/01/01"); } if (this.txtFecha2.SelectedDate != null) { bp.Bp_FechaFin = this.txtFecha2.SelectedDate.Value; } else { bp.Bp_FechaFin = Convert.ToDateTime("1900/01/01"); } CN_BloqueoPeriodo cn_bp = new CN_BloqueoPeriodo(); Sesion sesion = (Sesion)Session["Sesion" + Session.SessionID]; int Verificador = 0; cn_bp.BloqueoPeriodo_Insertar(bp, ref Verificador, sesion.Emp_Cnx); if (Verificador == -1) { LimpiarCampos(); Alerta("Los datos se guardaron correctamente"); } else { Alerta("Error al intentar guardar la infromación"); } } catch (Exception ex) { throw ex; } }
private void ConsultarClientes() { try { if (this.TxtId_Cd.Text == string.Empty) { Alerta("Seleccione un CDI"); return; } if (this.TxtId_Cte.Text == string.Empty) { Alerta("Ingrese el numero de cliente"); return; } CN_BloqueoPeriodo cn_bp = new CN_BloqueoPeriodo(); BloqueoPeriodo bp = new BloqueoPeriodo(); Sesion sesion = (Sesion)Session["Sesion" + Session.SessionID]; int Verificador = 0; int Verificador2 = 0; cn_bp.BloqueoPeriodo_Consultar(int.Parse(this.TxtId_Cd.Text), int.Parse(this.TxtId_Cte.Text), ref bp, ref Verificador, ref Verificador2, sesion.Emp_Cnx); if (Verificador == -2) { Alerta("El cliente <b>" + this.TxtId_Cte.Text + "</b> esta en la lista de desbloqueo permanente, no se puede desbloquear por período"); this.TxtId_Cte.Text = string.Empty; } else { if (Verificador2 == -1) { this.TxtId_Cd.Enabled = false; this.CmbId_Cd.Enabled = false; this.TxtId_Cte.Enabled = false; this.TxtCte.Text = bp.Cte_nombre; string valor = bp.Bp_FechaIni.Date.ToString(); if (bp.Bp_FechaIni.Year != 1) { this.txtFecha1.SelectedDate = bp.Bp_FechaIni; } if (bp.Bp_FechaFin.Year != 1) { this.txtFecha2.SelectedDate = bp.Bp_FechaFin; } } else { Alerta("El cliente no existe, favor de verificar la información"); } } } catch (Exception ex) { throw ex; } }