Example #1
0
        private void btnHistograma_Click(object sender, EventArgs e)
        {
            oEnsamble = new WCF_Ensamble.Hersan_EnsambleClient();
            try {
                CalidadResguardoQA Obj = new CalidadResguardoQA();
                Obj.Producto.Id = int.Parse(cboProducto.SelectedValue.ToString());
                Obj.Carcasa.Id  = int.Parse(cboCarcasa.SelectedValue.ToString());
                Obj.Reflex1.Id  = int.Parse(cboReflejante1.SelectedValue.ToString());
                Obj.Reflex2.Id  = cboReflejante2.SelectedValue != null?int.Parse(cboReflejante2.SelectedValue.ToString()) : 0;

                string Inicial = dtDesde.Value.Year.ToString() + dtDesde.Value.Month.ToString().PadLeft(2, '0') + dtDesde.Value.Day.ToString().PadLeft(2, '0');
                string Final   = dtHasta.Value.Year.ToString() + dtHasta.Value.Month.ToString().PadLeft(2, '0') + dtHasta.Value.Day.ToString().PadLeft(2, '0');

                if (Ensamble)
                {
                    frmHistograma frm = new frmHistograma();
                    frm.Ensamble      = Ensamble;
                    frm.oHistoria     = oEnsamble.CAL_InspeccionEnsamble_HistogramaHistorico(Obj, Inicial, Final);
                    frm.StartPosition = FormStartPosition.CenterScreen;
                    frm.ShowDialog();
                    this.Close();
                }
                else
                {
                    List <CalidadResguardoQADetalle> oList = oEnsamble.CAL_ResguardoQA_Grafica(Obj, Inicial, Final);
                    if (oList.Count > 0)
                    {
                        frmGraficaQA frm = new frmGraficaQA();
                        frm.StartPosition = FormStartPosition.CenterScreen;
                        frm.oList         = oList;
                        frm.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        RadMessageBox.Show("No existen datos a graficar con los criterios seleccionados", this.Text, MessageBoxButtons.OK, RadMessageIcon.Info);
                    }
                }
            } catch (Exception ex) {
                RadMessageBox.Show("Ocurrio un error al cargar las gráficas\n" + ex.Message, this.Text, MessageBoxButtons.OK, RadMessageIcon.Error);
            } finally {
                oEnsamble = null;
            }
        }