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; } }