private void cargarReclamaciones() { try { Reclamaciones reclamaciones = new Reclamaciones(); reclamaciones.Id_Emp = this.sesion.Id_Emp; reclamaciones.Id_Cd = this.sesion.Id_Cd_Ver; reclamaciones.Id_Rec = Convert.ToInt32(this.HF_ID.Value); CN_CapReclamaciones CNCapReclamaciones = new CN_CapReclamaciones(); CNCapReclamaciones.ConsultaReclamaciones(ref reclamaciones, sesion.Emp_Cnx); //*** DESCRIPCION ***\\ this.rdFecha.SelectedDate = reclamaciones.Rec_Fecha; this.txtNumCliente.Text = reclamaciones.Id_Cte.ToString(); this.txtClienteNombre.Text = reclamaciones.Cte_NomComercial; this.CargarTerritorios(); this.txtUsuario.Text = reclamaciones.Rec_Usuario.ToString(); this.txtTelefono.Text = reclamaciones.Rec_Telefono.ToString(); this.cmbTerritorio.SelectedIndex = this.cmbTerritorio.FindItemIndexByValue(reclamaciones.Id_Ter.ToString()); this.cmbTerritorio.Text = this.cmbTerritorio.FindItemByValue(reclamaciones.Id_Ter.ToString()).Text; this.txtTerritorioId.Text = reclamaciones.Id_Ter.ToString(); this.cmbTipo.SelectedIndex = this.cmbTipo.FindItemIndexByValue(reclamaciones.Id_tipo.ToString()); this.CargaNoConformidades(); this.txtCodigo.Text = reclamaciones.Id_NoConf.ToString(); this.cmbCodigo.SelectedIndex = this.cmbCodigo.FindItemIndexByValue(reclamaciones.Id_NoConf.ToString()); this.cmbCodigo.Text = this.cmbCodigo.FindItemByValue(reclamaciones.Id_NoConf.ToString()).Text; this.txtDescripcion.Text = reclamaciones.Rec_Descripcion.ToString(); this.txtCausa.Text = reclamaciones.Rec_CausaRaiz.ToString(); //*** ACCION ***\\ this.dpFecha.SelectedDate = reclamaciones.Rec_FecAccion; this.txtAccion1.Text = reclamaciones.Rec_AcAccion1.ToString(); this.txtAccion2.Text = reclamaciones.Rec_AcAccion2.ToString(); this.txtResponsable.Text = reclamaciones.Rec_AcResponsable.ToString(); //*** CONFORMIDAD ***\\ this.dpFecha1.SelectedDate = reclamaciones.Rec_FecConformidad; this.txtNombre.Text = reclamaciones.Rec_ConNombre.ToString(); this.txtDepartamento.Text = reclamaciones.Rec_ConDepartamento.ToString(); //*** COMENTARIOS ***\\ this.txtComentario.Text = reclamaciones.Rec_Comentarios.ToString(); } catch (Exception ex) { throw ex; } }
private void GuardarReclamacion() { try { if (dpFecha.DbSelectedDate != null) { bool accion = false; if (txtAccion1.Text == "") { Label21.Text = "*Requerido"; accion = true; } else { Label21.Text = ""; } if (txtAccion2.Text == "") { Label22.Text = "*Requerido"; accion = true; } else { Label22.Text = ""; } if (txtResponsable.Text == "") { Label23.Text = "*Requerido"; accion = true; } else { Label23.Text = ""; } if (accion) { RadPageViewAccion.Selected = true; RadTabStrip1.Tabs[1].Selected = true; return; } } if (dpFecha1.DbSelectedDate != null) { bool accion = false; if (txtAccion1.Text == "") { Label21.Text = "*Requerido"; accion = true; } else { Label21.Text = ""; } if (txtAccion2.Text == "") { Label22.Text = "*Requerido"; accion = true; } else { Label22.Text = ""; } if (txtResponsable.Text == "") { Label23.Text = "*Requerido"; accion = true; } else { Label23.Text = ""; } if (accion) { RadPageViewAccion.Selected = true; RadTabStrip1.Tabs[1].Selected = true; return; } bool conformidad = false; if (txtNombre.Text == "") { Label24.Text = "*Requerido"; conformidad = true; } else { Label24.Text = ""; } if (txtDepartamento.Text == "") { Label25.Text = "*Requerido"; conformidad = true; } else { Label25.Text = ""; } if (conformidad) { RadPageViewConformidad.Selected = true; RadTabStrip1.Tabs[2].Selected = true; return; } } //Valida que las fechas de accion o conformidad esten vacias //si hay datos en los respectivos textboxes de ests if (this.rdFecha.SelectedDate == null) { this.Alerta("Es necesaria la fecha de descripción"); this.rdFecha.Focus(); return; } if (this.dpFecha.SelectedDate == null && (this.txtAccion1.Text != string.Empty || this.txtAccion2.Text != string.Empty || this.txtResponsable.Text != string.Empty)) { this.Alerta("Es necesaria la fecha de acción"); this.dpFecha.Focus(); return; } if (this.dpFecha1.SelectedDate == null && (this.txtNombre.Text != string.Empty || this.txtDepartamento.Text != string.Empty)) { this.Alerta("Es necesaria la fecha de conformidad"); this.dpFecha.Focus(); return; } Reclamaciones reclamaciones = new Reclamaciones(); string varEstatus = "C"; //Estatus por defaul de las reclamaciones C -Creado- //*** DESCRIPCION ***\\ reclamaciones.Id_Emp = sesion.Id_Emp; reclamaciones.Id_Cd = sesion.Id_Cd_Ver; reclamaciones.Id_Rec = Convert.ToInt32(this.txtReclamacion.Text); reclamaciones.Rec_Fecha = this.rdFecha.SelectedDate.Value; reclamaciones.Id_Cte = Convert.ToInt32(this.txtNumCliente.Text); reclamaciones.Rec_Usuario = this.txtUsuario.Text.ToString(); reclamaciones.Rec_Telefono = this.txtTelefono.Text.ToString(); reclamaciones.Id_Ter = Convert.ToInt32(this.txtTerritorioId.Text); reclamaciones.Id_tipo = Convert.ToInt32(this.cmbTipo.SelectedValue); reclamaciones.Id_NoConf = Convert.ToInt32(this.txtCodigo.Text); reclamaciones.Rec_Descripcion = this.txtDescripcion.Text.ToString(); reclamaciones.Rec_CausaRaiz = this.txtCausa.Text.ToString(); if (this.dpFecha.SelectedDate != null) { reclamaciones.Rec_FecAccion = this.dpFecha.SelectedDate.Value; } else { reclamaciones.Rec_FecAccion = null; } //*** ACCION ***\\ reclamaciones.Rec_AcAccion1 = this.txtAccion1.Text.ToString(); reclamaciones.Rec_AcAccion2 = this.txtAccion2.Text.ToString(); reclamaciones.Rec_AcResponsable = this.txtResponsable.Text.ToString(); // Verifica si los contrles de la pestaña de accion estan llenos, si por lo menos // uno tiene datos, establecera el estatus en A -Accion-, sino, entonces lo // deja el estatus por default C -Creado- if (this.txtAccion1.Text != string.Empty || this.txtAccion2.Text != string.Empty || this.txtResponsable.Text != string.Empty || this.dpFecha.SelectedDate != null) { varEstatus = "A"; } //*** CONFORMIDAD ***\\ if (this.dpFecha1.SelectedDate != null) { reclamaciones.Rec_FecConformidad = this.dpFecha1.SelectedDate.Value; } else { reclamaciones.Rec_FecConformidad = null; } reclamaciones.Rec_ConNombre = this.txtNombre.Text.ToString(); reclamaciones.Rec_ConDepartamento = this.txtDepartamento.Text.ToString(); // Verifica si los datos correspondientes estan llenos, si es asi, entonces pone como // estatus F -Conformidad-, sino lo deja el estatus por default C -Creado- if (this.txtNombre.Text != string.Empty || this.txtDepartamento.Text != string.Empty || this.dpFecha1.SelectedDate != null) { if (this.txtAccion1.Text == string.Empty || this.txtAccion2.Text == string.Empty || this.txtResponsable.Text == string.Empty || this.dpFecha.SelectedDate == null) { this.Alerta("No puede generar una conformidad sin los datos de la acción tomada"); return; } else { varEstatus = "F"; } } //*** COMENTARIOS ***\\ reclamaciones.Rec_Comentarios = this.txtComentario.Text.ToString(); //*** ESTATUS ***\\ reclamaciones.Rec_Estatus = varEstatus; string mensaje = string.Empty; int verificador = -1; CN_CapReclamaciones CNCapReclamaciones = new CN_CapReclamaciones(); if (this.HF_ID.Value == "") { if (!_PermisoGuardar) { Alerta("No tiene permisos para grabar"); return; } CNCapReclamaciones.InsertaReclamaciones(reclamaciones, dt, sesion.Emp_Cnx, ref verificador); mensaje = "Los datos se guardaron correctamente"; } else { if (!_PermisoModificar) { Alerta("No tiene permiso para modificar los datos"); return; } reclamaciones.Id_Rec = Convert.ToInt32(this.HF_ID.Value); CNCapReclamaciones.ModificaReclamaciones(reclamaciones, dt, sesion.Emp_Cnx, ref verificador); mensaje = "Los datos se modificaron correctamente"; } if (verificador > 0) { //cerrar ventana radWindow de reclamaciones RAM1.ResponseScripts.Add(string.Concat(@"CloseWindow('", mensaje, "')")); } else { Alerta("Ocurrio un error al intentar guardar la reclamación"); } } catch (Exception ex) { throw ex; } }