Exemplo n.º 1
0
        private void btnGenerarApoyo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DialogResult = XtraMessageBox.Show("¿Desea generar una cuadrilla de apoyo de los elementos seleccionados?", "Genera Cuadrilla", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            if (DialogResult == DialogResult.Yes)
            {
                string[] ODC = CadenaCodigos.Split(',');
                foreach (string vOrden in ODC)
                {
                    for (int i = 0; i < dtgValServicios.RowCount; i++)
                    {
                        int xRow = dtgValServicios.GetVisibleRowHandle(i);
                        if (dtgValServicios.GetRowCellValue(xRow, "PSC_ODC").ToString() == vOrden)
                        {
                            string vFecha         = dtgValServicios.GetRowCellValue(xRow, "PSC_Fecha").ToString();
                            string vODC           = dtgValServicios.GetRowCellValue(xRow, "PSC_ODC").ToString();
                            string vUbicacion     = dtgValServicios.GetRowCellValue(xRow, "PSC_Ubicacion").ToString();
                            string vPesada        = dtgValServicios.GetRowCellValue(xRow, "PSC_Pesada").ToString();
                            string vPlacas        = dtgValServicios.GetRowCellValue(xRow, "PSC_Placas").ToString();
                            string vHuertas       = dtgValServicios.GetRowCellValue(xRow, "PSC_Huertas").ToString();
                            string vProductor     = dtgValServicios.GetRowCellValue(xRow, "PSC_Productor").ToString();
                            string vCajas         = dtgValServicios.GetRowCellValue(xRow, "PSC_Cajas").ToString();
                            string vKilos         = dtgValServicios.GetRowCellValue(xRow, "PSC_Kilos").ToString();
                            string vVariedad      = dtgValServicios.GetRowCellValue(xRow, "PSC_Variedad").ToString();
                            string vJefeCuadrilla = dtgValServicios.GetRowCellValue(xRow, "PSC_JefeCuadrilla").ToString();
                            string vCajasZ        = dtgValServicios.GetRowCellValue(xRow, "PSC_CajasZ").ToString();
                            string vFolioZ        = dtgValServicios.GetRowCellValue(xRow, "PSC_FolioZ").ToString();
                            string vJefeArea      = dtgValServicios.GetRowCellValue(xRow, "PSC_JefeArea").ToString();
                            string vClaveDia      = dtgValServicios.GetRowCellValue(xRow, "PSC_ClaveDia").ToString();

                            int Registros              = BuscarOrdendeCorte(vODC);
                            CLS_ServiciosCortes ins    = new CLS_ServiciosCortes();
                            DateTime            DFecha = Convert.ToDateTime(vFecha);
                            vFecha                = DFecha.Year.ToString() + DosCeros(DFecha.Month.ToString()) + DosCeros(DFecha.Day.ToString());
                            ins.PSC_Fecha         = vFecha;
                            ins.PSC_ODC           = vODC + "_" + Letra(Registros);
                            ins.PSC_Ubicacion     = vUbicacion;
                            ins.PSC_Pesada        = vPesada;
                            ins.PSC_Placas        = vPlacas;
                            ins.PSC_Huertas       = vHuertas;
                            ins.PSC_Productor     = vProductor;
                            ins.PSC_Cajas         = vCajas;
                            ins.PSC_Kilos         = vKilos;
                            ins.PSC_Variedad      = vVariedad;
                            ins.PSC_JefeCuadrilla = vJefeCuadrilla;
                            ins.PSC_CajasZ        = vCajasZ;
                            ins.PSC_FolioZ        = vFolioZ;
                            ins.PSC_JefeArea      = vJefeArea;
                            ins.PSC_ClaveDia      = vClaveDia;
                            ins.MtdInsertarServiciosCortes();
                            if (!ins.Exito)
                            {
                                XtraMessageBox.Show(ins.Mensaje);
                            }
                        }
                    }
                }
                btnBuscarServicios.PerformClick();
                CadenaCodigos = string.Empty;
                gridCheckMarksODC.ClearSelection();
            }
        }
Exemplo n.º 2
0
        private void btnImportar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            int contadorins = 0;

            if (txtClave.Text != string.Empty)
            {
                if (dtgValServicios.RowCount > 0)
                {
                    pgbProgreso.Properties.Maximum = dtgValServicios.RowCount;
                    pgbProgreso.Position           = 0;

                    for (int x = 0; x < dtgValServicios.RowCount; x++)
                    {
                        int xRow = dtgValServicios.GetVisibleRowHandle(x);
                        pgbProgreso.Position = x + 1;
                        Application.DoEvents();
                        string vFecha         = dtgValServicios.GetRowCellValue(xRow, "col_Fecha").ToString();
                        string vODC           = dtgValServicios.GetRowCellValue(xRow, "col_ODC").ToString();
                        string vUbicacion     = dtgValServicios.GetRowCellValue(xRow, "col_Ubicacion").ToString();
                        string vPesada        = dtgValServicios.GetRowCellValue(xRow, "col_Pesada").ToString();
                        string vPlacas        = dtgValServicios.GetRowCellValue(xRow, "col_Placas").ToString();
                        string vHuertas       = dtgValServicios.GetRowCellValue(xRow, "col_Huertas").ToString();
                        string vProductor     = dtgValServicios.GetRowCellValue(xRow, "col_Productor").ToString();
                        string vCajas         = dtgValServicios.GetRowCellValue(xRow, "col_Cajas").ToString();
                        string vKilos         = dtgValServicios.GetRowCellValue(xRow, "col_Kilos").ToString();
                        string vVariedad      = dtgValServicios.GetRowCellValue(xRow, "col_Variedad").ToString();
                        string vJefeCuadrilla = dtgValServicios.GetRowCellValue(xRow, "col_JefeCuadrilla").ToString();
                        string vCajasZ        = dtgValServicios.GetRowCellValue(xRow, "col_CajasZ").ToString();
                        string vFolioZ        = dtgValServicios.GetRowCellValue(xRow, "col_FolioZ").ToString();
                        string vJefeArea      = dtgValServicios.GetRowCellValue(xRow, "col_JefeArea").ToString();
                        if (!BuscarRegistro(vFecha, vODC))
                        {
                            CLS_ServiciosCortes ins    = new CLS_ServiciosCortes();
                            DateTime            DFecha = Convert.ToDateTime(vFecha);
                            vFecha                = DFecha.Year.ToString() + DosCeros(DFecha.Month.ToString()) + DosCeros(DFecha.Day.ToString());
                            ins.PSC_Fecha         = vFecha;
                            ins.PSC_ODC           = vODC;
                            ins.PSC_Ubicacion     = vUbicacion;
                            ins.PSC_Pesada        = vPesada;
                            ins.PSC_Placas        = vPlacas;
                            ins.PSC_Huertas       = vHuertas;
                            ins.PSC_Productor     = vProductor;
                            ins.PSC_Cajas         = vCajas;
                            ins.PSC_Kilos         = vKilos;
                            ins.PSC_Variedad      = vVariedad;
                            ins.PSC_JefeCuadrilla = vJefeCuadrilla;
                            ins.PSC_CajasZ        = vCajasZ;
                            ins.PSC_FolioZ        = vFolioZ;
                            ins.PSC_JefeArea      = vJefeArea;
                            ins.PSC_ClaveDia      = txtClave.Text;
                            ins.MtdInsertarServiciosCortes();
                            if (!ins.Exito)
                            {
                                XtraMessageBox.Show(ins.Mensaje);
                            }
                            else
                            {
                                contadorins++;
                            }
                        }
                    }
                    XtraMessageBox.Show("Se importaron " + contadorins + " de " + dtgValServicios.RowCount);
                    btnLimpiar.PerformClick();
                }
                else
                {
                    XtraMessageBox.Show("No existen registros para importar");
                }
            }
            else
            {
                XtraMessageBox.Show("Se debe capturar Hoja y Clave");
            }
        }