private void DgvComenzi_StergereLinie(DataGridViewPersonalizat pDGVSender, int pIndexRand)
        {
            if (this.lSeIncarca)
            {
                return;
            }
            try
            {
                incepeIncarcarea();

                BClientiComenzi comandaDeSters = pDGVSender.Rows[pIndexRand].Tag as BClientiComenzi;

                if (comandaDeSters != null)
                {
                    if (!this.btnActiviInactivi.Selectat)
                    {
                        if (comandaDeSters.IdFactura > 0)
                        {
                            Mesaj.Informare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.LucrarileFacturateNuPotFiSterse), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.Stergere));
                        }
                        else
                        {
                            if (Mesaj.Confirmare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiStergerea), null))
                            {
                                comandaDeSters.Close(true, BMultiLingv.getElementById(BMultiLingv.EnumDictionar.Inchidere), null);
                                ConstruiesteRanduriDGV();
                            }
                        }
                    }
                    else
                    {
                        if (Mesaj.Confirmare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiReactivarea), string.Empty))
                        {
                            comandaDeSters.Close(false, string.Empty, null);
                            ConstruiesteRanduriDGV();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex);
            }
            finally
            {
                finalizeazaIncarcarea();
            }
        }
        private void incarcaRand(DataGridViewRow pRand, double pSold, int pId, BClienti pClinica, BClientiComenzi pUltimaLucrare, BClientiFacturi pUltimaFactura, int pNrLucrariNefacturate)
        {
            pRand.Tag = pClinica;
            pRand.Cells[EnumColoaneDGV.colClient.ToString()].Value = pClinica.Denumire;
            DataGridViewPersonalizat.InitCelulaDeschideClasic(pRand, EnumColoaneDGV.colDeschideDosar.ToString());

            DataGridViewPersonalizat.InitCeluleTelefonEmail(pRand, pClinica.TelefonMobil, pClinica.AdresaMail);

            pRand.Cells[EnumColoaneDGV.colObservatii.ToString()].Value = pClinica.ObservatiiDateClinica;

            DataGridViewPersonalizat.InitCelulaValoareMonetara(pRand, EnumColoaneDGV.colSold.ToString(), pSold);
            IHMUtile.IncarcaRandUltimaLucrare(pRand, pUltimaLucrare);
            IHMUtile.IncarcaRandUltimaFactura(pRand, pUltimaFactura);
            DataGridViewPersonalizat.InitCelulaValoareNumerica(pRand, EnumColoaneDGV.colTotalLucrariNefact.ToString(), pNrLucrariNefacturate);
            DataGridViewPersonalizat.SeteazaAlerta(pRand, EnumColoaneDGV.colSold.ToString());
        }
예제 #3
0
        private void incarcaRand(DataGridViewRow pRand, BClienti pElem, BClientiComenzi pUltimaLucrare)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);
            pRand.Cells[EnumColoaneDGV.colDenumire.ToString()].Value        = pElem.Denumire;
            pRand.Cells[EnumColoaneDGV.colDenumireFiscala.ToString()].Value = pElem.DenumireFiscala;
            pRand.Cells[EnumColoaneDGV.colCUI.ToString()].Value             = pElem.CUI;
            DataGridViewPersonalizat.InitCeluleTelefonEmail(pRand, pElem.TelefonMobil, pElem.AdresaMail);
            pRand.Cells[EnumColoaneDGV.colTelefonFix.ToString()].Value = pElem.TelefonFix;
            pRand.Cells[EnumColoaneDGV.colObservatii.ToString()].Value = pElem.ObservatiiDateClinica;

            IHMUtile.IncarcaRandUltimaLucrare(pRand, pUltimaLucrare, EnumColoaneDGV.colDenumire.ToString());

            DataGridViewPersonalizat.InitCelulaStergere(pRand);
        }
예제 #4
0
        private void DgvListaEtape_StergereLinie(DataGridViewPersonalizat pDGVSender, int pIndexRand)
        {
            if (this.lSeIncarca)
            {
                return;
            }
            try
            {
                incepeIncarcarea();

                BEtape etapa = this.dgvListaEtape.Rows[pIndexRand].Tag as BEtape;
                if (etapa != null)
                {
                    if (Mesaj.Confirmare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiStergerea), etapa.Denumire.ToString()))
                    {
                        this.dgvListaEtape.Rows.RemoveAt(pIndexRand);
                    }
                }
                else
                {
                    BLucrariEtape lucrareEtapa = this.dgvListaEtape.Rows[pIndexRand].Tag as BLucrariEtape;
                    if (lucrareEtapa != null)
                    {
                        if (Mesaj.Confirmare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiStergerea), BEtape.GetEtapaById(lucrareEtapa.IdEtapa, CDefinitiiComune.EnumStare.Activa, null).Denumire.ToString()))
                        {
                            this.dgvListaEtape.Rows.RemoveAt(pIndexRand);
                        }
                    }
                    else
                    {
                        BClientiComenziEtape lucrareClientEtapa = this.dgvListaEtape.Rows[pIndexRand].Tag as BClientiComenziEtape;
                        if (Mesaj.Confirmare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiStergerea), BEtape.GetEtapaById(lucrareClientEtapa.IdEtapa, CDefinitiiComune.EnumStare.Activa, null).Denumire.ToString()))
                        {
                            this.dgvListaEtape.Rows.RemoveAt(pIndexRand);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex);
            }
            finally
            {
                finalizeazaIncarcarea();
            }
        }
예제 #5
0
        private void incarcaRand(DataGridViewRow pRand, BListaPreturiStandard pElem, BListaPreturiClienti pPretClient)
        {
            pRand.Tag = new Tuple <BListaPreturiStandard, BListaPreturiClienti>(pElem, pPretClient);

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);
            pRand.Cells[EnumColoaneDGV.colLucrare.ToString()].Value      = pElem.Denumire;
            pRand.Cells[EnumColoaneDGV.colMoneda.ToString()].Value       = pElem.ValoareRON == 0 ? CUtil.getText(1265) : CUtil.getText(1264);
            pRand.Cells[EnumColoaneDGV.colPretStandard.ToString()].Value = pElem.ValoareRON == 0 ? pElem.ValoareEUR : pElem.ValoareRON;
            if (pPretClient != null)
            {
                pRand.Cells[EnumColoaneDGV.colPretClient.ToString()].Value = pPretClient.GetValoare();
            }
            else
            {
                pRand.Cells[EnumColoaneDGV.colPretClient.ToString()].Value = pElem.ValoareRON == 0 ? pElem.ValoareEUR : pElem.ValoareRON;
            }
        }
        private void incarcaRand(DataGridViewRow pRand, BUtilizator pElem)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);
            pRand.Cells[EnumColoaneDGV.colCuloare.ToString()].Style.BackColor = BDefinitiiGenerale.getCuloareDinARGB(pElem.Culoare);
            pRand.Cells[EnumColoaneDGV.colNume.ToString()].Value    = pElem.Nume;
            pRand.Cells[EnumColoaneDGV.colPrenume.ToString()].Value = pElem.Prenume;
            if (CUtil.isNotNull(pElem.DataNastere))
            {
                pRand.Cells[EnumColoaneDGV.colDataNastere.ToString()].Value = pElem.DataNastere;
            }
            pRand.Cells[EnumColoaneDGV.colTelefonFix.ToString()].Value = pElem.TelefonFix;
            pRand.Cells[EnumColoaneDGV.colCnp.ToString()].Value        = pElem.CNP;
            DataGridViewPersonalizat.InitCeluleTelefonEmail(pRand, pElem.TelefonMobil, pElem.AdresaMail);
            DataGridViewPersonalizat.InitCelulaStergere(pRand);
        }
예제 #7
0
        private void incarcaRand(DataGridViewRow pRand, BEmailuriExtrase pElem)
        {
            pRand.Tag = pElem;
            DataGridViewPersonalizat.InitCelulaDeschideClasic(pRand);
            if (pElem.NumarAtasamente != 0)
            {
                DataGridViewPersonalizat.initCelulaImagine(pRand, EnumColoaneDGV.colAttachment.ToString(), (System.Drawing.Image)Properties.Resources.attachment);
            }
            else
            {
                DataGridViewPersonalizat.initCelulaImagine(pRand, EnumColoaneDGV.colAttachment.ToString(), new Bitmap(1, 1));
            }

            pRand.Cells[EnumColoaneDGV.colSender.ToString()].Value  = pElem.Expeditor;
            pRand.Cells[EnumColoaneDGV.colSubiect.ToString()].Value = pElem.Subiect;
            pRand.Cells[EnumColoaneDGV.colData.ToString()].Value    = pElem.DataServer;
        }
예제 #8
0
        private void incarcaRand(DataGridViewRow pRand, BClientiPlati pElem)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);

            pRand.Cells[EnumColoaneDGV.colData.ToString()].Value       = pElem.DataPlata;
            pRand.Cells[EnumColoaneDGV.colModalitate.ToString()].Value = BDefinitiiGenerale.StructModalitatePlata.GetStringByEnum((BDefinitiiGenerale.EnumModalitatePlata)pElem.ModalitatePlata);
            DataGridViewPersonalizat.InitCelulaValoareMonetara(pRand, EnumColoaneDGV.colValoare.ToString(), pElem.SumaPlatita, CDefinitiiComune.EnumTipMoneda.Lei);

            pRand.Cells[EnumColoaneDGV.colClinica.ToString()].Value    = pElem.DenumireClient;
            pRand.Cells[EnumColoaneDGV.colObservatii.ToString()].Value = pElem.Observatii;
            pRand.Cells[EnumColoaneDGV.colCursBNR.ToString()].Value    = pElem.CursBNR;

            DataGridViewPersonalizat.InitCelulaStergere(pRand);

            DataGridViewPersonalizat.InitCelulaDeschideClasic(pRand, EnumColoaneDGV.colDetaliiClinica.ToString());
        }
예제 #9
0
        private void incarcaRand(DataGridViewRow pRand, BClientiReprezentanti pElem)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);
            pRand.Cells[EnumColoaneDGV.colNumePrenume.ToString()].Value = pElem.Nume + " " + pElem.Prenume;
            DataGridViewPersonalizat.InitCeluleTelefonEmail(pRand, pElem.TelefonMobil, pElem.AdresaMail);

            var lstComenziReprezentanti = BClientiComenzi.getByIdReprezentant(this.lClient.Id, pElem.Id, null);

            if (lstComenziReprezentanti.Count != 0)
            {
                pRand.Cells[EnumColoaneDGV.colUltimaComanda.ToString()].Value = lstComenziReprezentanti[lstComenziReprezentanti.Count - 1].DataPrimire;
            }
            pRand.Cells[EnumColoaneDGV.colTotalComenzi.ToString()].Value = BClientiComenzi.GetListByParamIdClientReprezentant(this.lClient.Id, pElem.Id, CDL.iStomaLab.CDefinitiiComune.EnumStare.Activa, null).Count;
            pRand.Cells[EnumColoaneDGV.colObservatii.ToString()].Value   = pElem.Observatii;
            DataGridViewPersonalizat.InitCelulaStergere(pRand);
        }
예제 #10
0
        private void incarcaRand(DataGridViewRow pRand, BClientiCabinete pElem, BAdrese pAdresa)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);
            pRand.Cells[EnumColoaneDGV.colDenumire.ToString()].Value = pElem.Denumire;
            pRand.Cells[EnumColoaneDGV.colAdresa.ToString()].Value   = pAdresa.ToString();

            var lstComenziCabinet = BClientiComenzi.getById(this.lClient.Id, pElem.Id, null);

            if (lstComenziCabinet.Count != 0)
            {
                pRand.Cells[EnumColoaneDGV.colUltimaComanda.ToString()].Value = lstComenziCabinet[lstComenziCabinet.Count - 1].DataPrimire;
            }

            pRand.Cells[EnumColoaneDGV.colTotalComenzi.ToString()].Value = BClientiComenzi.getById(this.lClient.Id, pElem.Id, null).Count;
            DataGridViewPersonalizat.InitCelulaStergere(pRand);
        }
예제 #11
0
        private void incarcaRand(DataGridViewRow pRand, BLocatii pElem)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);
            pRand.Cells[EnumColoaneDGV.colDenumire.ToString()].Value = pElem.Denumire;
            //pRand.Cells[EnumColoaneDGV.colInitiala.ToString()].Value = pElem.InitialaLocatie;
            pRand.Cells[EnumColoaneDGV.colDenumireFiscala.ToString()].Value = pElem.DenumireFiscala;
            pRand.Cells[EnumColoaneDGV.colInfoContact.ToString()].Value     = pElem.InfoContact;

            pRand.Cells[EnumColoaneDGV.colSerieFacturi.ToString()].Value          = pElem.SerieFacturi;
            pRand.Cells[EnumColoaneDGV.colNumarulUltimeiFacturi.ToString()].Value = pElem.NumarUltimaFactura;

            pRand.Cells[EnumColoaneDGV.colSerieChitante.ToString()].Value          = pElem.SerieChitante;
            pRand.Cells[EnumColoaneDGV.colNumarulUltimeiChitante.ToString()].Value = pElem.NumarUltimaChitanta;

            DataGridViewPersonalizat.InitCelulaStergere(pRand);
        }
        private void incarcaRand(DataGridViewRow pRand, BClientiComenzi pElem)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);
            pRand.Cells[EnumColoaneDGV.colNumeReprezentant.ToString()].Value = BClientiReprezentanti.getReprezentant(pElem.IdReprezentantClient, null).Nume + " " + BClientiReprezentanti.getReprezentant(pElem.IdReprezentantClient, null).Prenume;
            pRand.Cells[EnumColoaneDGV.colNumePacient.ToString()].Value      = pElem.NumePacient;
            if (CUtil.isNotNull(pElem.DataPrimire))
            {
                pRand.Cells[EnumColoaneDGV.colDataPrimire.ToString()].Value = pElem.DataPrimire;
            }
            if (CUtil.isNotNull(pElem.DataLaGata))
            {
                pRand.Cells[EnumColoaneDGV.colDataLaGata.ToString()].Value = pElem.DataLaGata;
            }
            pRand.Cells[EnumColoaneDGV.colObservatii.ToString()].Value = pElem.Observatii;
            DataGridViewPersonalizat.InitCelulaStergere(pRand);
        }
예제 #13
0
        /// <summary>
        /// Manages a new thread used to Export from DataGridView to an Excel worksheet.
        /// This method must be used in combination with the methods:
        /// GetExcelReady()
        /// ToExcel()
        /// </summary>
        /// <param name="dGV">ExtendedDataGridView name.</param>
        /// <param name="initialRow">Number of Excel row where to start copying DataGridView titles.</param>
        /// <param name="initialCol">Number of Excel column where to start copying DataGridView titles.</param>
        /// <param name="exportTitles">True if you want to export DGV titles.</param>
        /// <param name="wksName">How do you want to name the new worksheet.</param>
        //public void ExcelThread(ExtendedDataGridView dGV, int initialRow, int initialCol, bool exportTitles, string wksName)
        //{
        //    Thread t1 = new Thread
        //        (
        //        delegate()
        //        {
        //            OnWorkStart(dGV, new EventArgs());

        //            // If exportTitles is set to false, change initial row value.
        //            if (!exportTitles) { initialRow = initialRow - 1; }

        //            // Export Data.
        //            GetExcelReady(dGV, initialRow, initialCol, exportTitles, wksName);

        //            OnWorkFinished(dGV, new EventArgs());
        //        }
        //        );
        //    t1.Start();
        //}

        /// <summary>
        /// Sets a new Excel object where to export DataGridView.
        /// This method should be used with the methods:
        /// ExcelThread().
        /// ToExcel().
        /// </summary>
        /// <param name="dGV">ExtendedDataGridView name.</param>
        /// <param name="initialRow">Number of Excel row where to start copying DataGridView titles.</param>
        /// <param name="initialCol">Number of Excel column where to start copying DataGridView titles.</param>
        /// <param name="exportTitles">True if you want to export DGV titles.</param>
        /// <param name="wksName">How do you want to name the new worksheet.</param>
        //void GetExcelReady(ExtendedDataGridView dGV, int initialRow, int initialCol, bool exportTitles, string wksName)
        //{
        //    // Declare missing object.
        //    Object oMissing = System.Reflection.Missing.Value;

        //    // Change current thread culture to ("en-US").
        //    // System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

        //    // Create a new Excel instance.
        //    Excel.Application oExcel = new Excel.Application();

        //    // Set Excel workbook to open with only 1 worsheet.
        //    oExcel.SheetsInNewWorkbook = 1;

        //    // Set the UserControl property so Excel won't shut down.
        //    oExcel.UserControl = true;

        //    // Add a workbook.
        //    Excel.Workbook oBook = oExcel.Workbooks.Add(oMissing);

        //    // Get worksheets collection
        //    Excel.Sheets oSheetsColl = oExcel.Worksheets;

        //    // Get Worksheet number 1
        //    Excel.Worksheet oSheet = (Excel.Worksheet)oSheetsColl.get_Item(1);
        //    oSheet.Name = wksName;

        //    // Export dGV columns To Excel worksheet.
        //    ToExcel(dGV, initialRow, initialCol, exportTitles, oSheet);

        //    // Make Excel visible to the user.
        //    oExcel.Visible = true;

        //    // Release the variables.
        //    //oBook.Close(false, oMissing, oMissing);
        //    oBook = null;

        //    //oExcel.Quit();
        //    oExcel = null;

        //    // Collect garbage.
        //    GC.Collect();
        //}

        /// <summary>
        /// Export from DataGridView to Excel worksheet.
        /// This method should be used in combination with the methods:
        /// ExcelThread().
        /// GetExcelReady().
        /// </summary>
        /// <param name="dGV">ExtendedDataGridView name.</param>
        /// <param name="initialRow">Number of Excel row where to start copying DataGridView titles.</param>
        /// <param name="initialCol">Number of Excel column where to start copying DataGridView titles.</param>
        /// <param name="exportTitles">True if you want to export DGV titles.</param>
        /// <param name="wksName">How do you want to name the new worksheet.</param>
        /// <param name="oSheet"></param>
        //void ToExcel(DataGridViewPersonalizat dGV, int initialRow, int initialCol, bool exportTitles, Excel.Worksheet oSheet)
        //{
        //    int colIndex = 0;
        //    foreach (DataGridViewColumn column in dGV.Columns)
        //    {
        //        // Export only visible columns.
        //        //if (dGV.ExportVisibleColumnsOnly)
        //        //{
        //        if (column.Visible)
        //        {
        //            // Export.
        //            if (exportTitles) { oSheet.Cells[initialRow, colIndex + initialCol] = column.HeaderText; }
        //            for (int row = initialRow; row < initialRow + dGV.Rows.Count - 1; row++)
        //            { oSheet.Cells[row + 1, colIndex + initialCol] = dGV[colIndex, row - initialRow].Value; }
        //            colIndex++;
        //        }
        //        //}
        //        //else
        //        //{
        //        //    // Export all columns.
        //        //    if (exportTitles) { oSheet.Cells[initialRow, colIndex + initialCol] = column.HeaderText; }
        //        //    for (int row = initialRow; row < initialRow + dGV.Rows.Count - 1; row++)
        //        //    { oSheet.Cells[row + 1, colIndex + initialCol] = dGV[colIndex, row - initialRow].Value; }
        //        //    colIndex++;
        //        //}
        //    }
        //}
        #endregion

        #region Export To CSV file

        /// <summary>
        /// Manages a new thread used to Export from DataGridView to a csv (comma separated value) file.
        /// This method must be used in combination with the methods:
        /// GetCsvReady().
        /// ToCsV().
        /// </summary>
        /// <param name="dGV">Extended DataGridView.</param>
        /// <param name="filename">Name of csv file.</param>
        public void CsvThread(DataGridViewPersonalizat dGV, string filename)
        {
            this.lDenumireDocument = filename;
            Thread t1 = new Thread
                        (
                delegate()
            {
                OnWorkStart(dGV, new EventArgs());

                // Export Data.
                GetCsvReady(dGV, filename);

                OnWorkFinished(dGV, new EventArgs());
            }
                        );

            t1.Start();
        }
예제 #14
0
        public static string Exporta(Form pEcranParinte, DataGridViewPersonalizat pDGVExport, string pNumeFisier, bool pDeschideDupaCreare, bool pCreeazaInThreadulPrincipal)
        {
            if (pDGVExport == null)
            {
                return(string.Empty);
            }

            using (frmExportDGV ecran = new frmExportDGV(pDGVExport, pNumeFisier, pDeschideDupaCreare, pCreeazaInThreadulPrincipal))
            {
                ecran.AplicaPreferinteleUtilizatorului();
                if (CCL.UI.IHMUtile.DeschideEcran(pEcranParinte, ecran))
                {
                    return(ecran.lNumeFisier);
                }
            }

            return(string.Empty);
        }
        private void incarcaRand(DataGridViewRow pRand, BClientiFacturi pElem, BColectieClientiComenzi pListaLucrari, BColectieClientiPlatiComenzi pListaPlatiPeFact)
        {
            pRand.Tag = pElem;

            double valoare = pListaLucrari.GetValoareTotalaFactura(CDefinitiiComune.EnumTipMoneda.Lei, pElem.CursBNR);
            double achitat = pListaPlatiPeFact.GetValoarePlatita();

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);

            if (pElem.EsteFiscalizata())
            {
                pRand.Cells[EnumColoaneDGV.colTipDocument.ToString()].Value = BMultiLingv.getElementById(BMultiLingv.EnumDictionar.Factura);

                DataGridViewPersonalizat.IndeparteazaAlerta(pRand, EnumColoaneDGV.colTipDocument.ToString());
            }
            else
            {
                pRand.Cells[EnumColoaneDGV.colTipDocument.ToString()].Value = BMultiLingv.getElementById(BMultiLingv.EnumDictionar.Proforma);

                DataGridViewPersonalizat.SeteazaAlerta(pRand, EnumColoaneDGV.colTipDocument.ToString());
            }

            pRand.Cells[EnumColoaneDGV.colDataEmiterii.ToString()].Value = pElem.DataFactura;
            pRand.Cells[EnumColoaneDGV.colSerieFactura.ToString()].Value = pElem.SerieFactura;
            pRand.Cells[EnumColoaneDGV.colNumarFactura.ToString()].Value = pElem.NumarFactura;
            pRand.Cells[EnumColoaneDGV.colClinica.ToString()].Value      = pElem.DenumireClient;
            DataGridViewPersonalizat.InitCelulaValoareMonetara(pRand, EnumColoaneDGV.colValoare.ToString(), valoare, CDefinitiiComune.EnumTipMoneda.Lei);
            //pRand.Cells[EnumColoaneDGV.colValoare.ToString()].Value = ;
            if (pElem.MonedaFactura != CDefinitiiComune.EnumTipMoneda.Lei)
            {
                DataGridViewPersonalizat.SeteazaAlerta(pRand, EnumColoaneDGV.colValoare.ToString());
            }
            pRand.Cells[EnumColoaneDGV.colValoare.ToString()].ToolTipText = CUtil.GetValoareMonetara(valoare, pElem.MonedaFactura);

            DataGridViewPersonalizat.InitCelulaValoareMonetara(pRand, EnumColoaneDGV.colAchitat.ToString(), achitat, CDefinitiiComune.EnumTipMoneda.Lei);
            DataGridViewPersonalizat.InitCelulaValoareMonetara(pRand, EnumColoaneDGV.colRestPlata.ToString(), valoare - achitat, CDefinitiiComune.EnumTipMoneda.Lei);

            pRand.Cells[EnumColoaneDGV.colCursBNR.ToString()].Value    = pElem.CursBNR;
            pRand.Cells[EnumColoaneDGV.colObservatii.ToString()].Value = pElem.Observatii;

            DataGridViewPersonalizat.InitCelulaStergere(pRand);

            DataGridViewPersonalizat.InitCelulaDeschideClasic(pRand, EnumColoaneDGV.colDetaliiClinica.ToString());
        }
예제 #16
0
        private void DgvListaPacienti_StergereLinie(DataGridViewPersonalizat pDGVSender, int pIndexRand)
        {
            if (this.lSeIncarca)
            {
                return;
            }
            try
            {
                incepeIncarcarea();

                BClientiPacienti pacientDeSters = this.dgvListaPacienti.Rows[pIndexRand].Tag as BClientiPacienti;

                if (pacientDeSters != null)
                {
                    string Denumire = pacientDeSters.GetIdentitateReprezentant();  //aici reprezentantul e pacient

                    if (!this.btnActivInactiv.Selectat)
                    {
                        if (Mesaj.Confirmare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiStergerea), Denumire))
                        {
                            pacientDeSters.Close(true, BMultiLingv.getElementById(BMultiLingv.EnumDictionar.Stergere), null);
                            ConstruiesteRanduriDGV();
                        }
                    }
                    else
                    {
                        if (Mesaj.Confirmare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiReactivarea), Denumire))
                        {
                            pacientDeSters.Close(false, string.Empty, null);
                            ConstruiesteRanduriDGV();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex);
            }
            finally
            {
                finalizeazaIncarcarea();
            }
        }
        private void incarcaRandRezumat(DataGridViewRow pRand, BColectiePontaj pElem)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);

            pRand.Cells[EnumColoaneDGVRezumat.colConcedii.ToString()].Value         = this.lUtilizator.NumarZileCOAgreate;
            pRand.Cells[EnumColoaneDGVRezumat.colZileNelucratoare.ToString()].Value = "0";
            pRand.Cells[EnumColoaneDGVRezumat.colZile.ToString()].Value             = CUtil.GetNumarZileLucratoareLuna(this.ctrlPerioada.DataInceput);

            pRand.Cells[EnumColoaneDGVRezumat.colTotal.ToString()].Value = CUtil.GetTextPrescurtatDurataOreMinute(getDurataTotalaPePerioada());

            int ultimaZiDinLuna = Convert.ToInt32(DateAndTime.DateDiff(DateInterval.Day, this.ctrlPerioada.DataInceput, this.ctrlPerioada.DataSfarsit));

            DateTime dataInceput = this.ctrlPerioada.DataInceput;
            DateTime dataSfarsit = dataInceput.AddDays(1);

            for (int i = this.ctrlPerioada.DataInceput.Day; i <= this.ctrlPerioada.DataSfarsit.Day; i++)
            {
                this.dgvListaPontaj.Columns[0].Tag = pElem;

                long totalPontajZi = 0;

                var listaElem = BPontaj.GetListByIdUtilizatorTotalPePerioada(this.lUtilizator.Id, dataInceput, dataSfarsit, null);

                foreach (var elem in listaElem)
                {
                    if (elem.TipPontaj == 1)
                    {
                        dataInceput = elem.DataPontaj;
                    }

                    if (elem.TipPontaj == 2)
                    {
                        totalPontajZi += getNrMinuteZi(dataInceput, elem.DataPontaj);
                    }
                }
                pRand.Cells[(dataInceput.Day).ToString()].Value = CUtil.GetTextPrescurtatDurataOreMinute(totalPontajZi);

                dataInceput = dataInceput.AddDays(1);
                dataSfarsit = dataSfarsit.AddDays(1);
            }
        }
예제 #18
0
        private void incarcaRand(DataGridViewRow pRand, BUtilizator pElem, BColectieUtilizatoriVenituri pVenituri, Tuple <double, double> pTotal)
        {
            pRand.Tag = pElem;
            pRand.Cells[EnumColoaneDGV.colTehnician.ToString()].Value = pElem.GetNumeCompletUtilizator();

            if (!CUtil.EsteListaVida <BUtilizatoriVenituri>(pVenituri))
            {
                pRand.Cells[EnumColoaneDGV.colTipVenit.ToString()].Value = pVenituri.ToString();
            }

            this.dgvListaVenituri.SeteazaFontIngrosat(pRand, EnumColoaneDGV.colTotal.ToString());

            if (pTotal != null)
            {
                DataGridViewPersonalizat.InitCelulaValoareMonetara(pRand, EnumColoaneDGV.colNrElemente.ToString(), pTotal.Item1);
                DataGridViewPersonalizat.InitCelulaValoareMonetara(pRand, EnumColoaneDGV.colTotal.ToString(), pTotal.Item2);
            }

            DataGridViewPersonalizat.InitCelulaDeschideClasic(pRand, EnumColoaneDGV.colDetalii.ToString());
        }
예제 #19
0
        private void DgvListaRegiuni_StergereLinie(DataGridViewPersonalizat pDGVSender, int pIndexRand)
        {
            if (this.lSeIncarca)
            {
                return;
            }
            try
            {
                incepeIncarcarea();

                BRegiuni regiuneDeSters = this.dgvListaRegiuni.Rows[pIndexRand].Tag as BRegiuni;

                if (regiuneDeSters != null)
                {
                    if (!this.btnActiviInactivi.Selectat)
                    {
                        if (Mesaj.Confirmare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiStergerea), regiuneDeSters.Nume))
                        {
                            regiuneDeSters.Close(true, BMultiLingv.getElementById(BMultiLingv.EnumDictionar.Inchidere), null);
                            ConstruiesteRanduriDGV();
                        }
                    }
                    else
                    {
                        if (Mesaj.Confirmare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiReactivarea), regiuneDeSters.Nume))
                        {
                            regiuneDeSters.Close(false, string.Empty, null);
                            ConstruiesteRanduriDGV();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex);
            }
            finally
            {
                finalizeazaIncarcarea();
            }
        }
        private void DgvListaEtape_StergereLinie(DataGridViewPersonalizat pDGVSender, int pIndexRand)
        {
            if (this.lSeIncarca)
            {
                return;
            }
            try
            {
                incepeIncarcarea();

                BClientiComenziEtape etapa = this.dgvListaEtape.Rows[pIndexRand].Tag as BClientiComenziEtape;

                if (etapa != null)
                {
                    if (!this.btnActivDezactivat.Selectat)
                    {
                        if (Mesaj.Confirmare(this, BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiStergerea), etapa.DenumireEtapa))
                        {
                            this.lComanda.CloseEtapa(etapa, null);
                            ConstruiesteRanduriDGV();
                        }
                    }
                    else
                    {
                        if (Mesaj.Confirmare(this.GetFormParinte(), BMultiLingv.getElementById(BMultiLingv.EnumDictionar.ConfirmatiReactivarea), etapa.DenumireEtapa))
                        {
                            etapa.Close(false, string.Empty, null);
                            ConstruiesteRanduriDGV();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex);
            }
            finally
            {
                finalizeazaIncarcarea();
            }
        }
        private void incarcaRand(DataGridViewRow pRand, BClientiComenzi pElem)
        {
            pRand.Tag = pElem;

            if (pElem.DataPrimire != CConstante.DataNula)
            {
                pRand.Cells[EnumColoaneDGV.colDataPrimire.ToString()].Value = pElem.DataPrimire;
            }
            else
            {
                pRand.Cells[EnumColoaneDGV.colDataPrimire.ToString()].Value = string.Empty;
            }

            pRand.Cells[EnumColoaneDGV.colCodComanda.ToString()].Value = pElem.CodLucrare;
            pRand.Cells[EnumColoaneDGV.colClinica.ToString()].Value    = pElem.DenumireClinica;
            pRand.Cells[EnumColoaneDGV.colMedic.ToString()].Value      = pElem.GetIdentitateMedic();
            pRand.Cells[EnumColoaneDGV.colCabinet.ToString()].Value    = pElem.DenumireCabinet;
            pRand.Cells[EnumColoaneDGV.colLucrare.ToString()].Value    = pElem.DenumireLucrare;
            pRand.Cells[EnumColoaneDGV.colNrElemente.ToString()].Value = pElem.NrElemente.ToString();
            pRand.Cells[EnumColoaneDGV.colValoare.ToString()].Value    = pElem.ValoareFinala;
            pRand.Cells[EnumColoaneDGV.colMoneda.ToString()].Value     = pElem.GetEtichetaMoneda();
            if (pElem.DataLaGata != CConstante.DataNula)
            {
                pRand.Cells[EnumColoaneDGV.colDataLaGata.ToString()].Value = pElem.DataLaGata;
            }
            else
            {
                pRand.Cells[EnumColoaneDGV.colDataLaGata.ToString()].Value = string.Empty;
            }

            pRand.Cells[EnumColoaneDGV.colStareEtapa.ToString()].Value   = pElem.StatusEtapaEticheta;
            pRand.Cells[EnumColoaneDGV.colEtapaCurenta.ToString()].Value = pElem.DenumireEtapa;
            pRand.Cells[EnumColoaneDGV.colTehnician.ToString()].Value    = pElem.GetIdentitateTehnician();
            pRand.Cells[EnumColoaneDGV.colPacient.ToString()].Value      = pElem.GetNumePrenumePacient();

            DataGridViewPersonalizat.InitCelulaDeschideClasic(pRand, EnumColoaneDGV.colDetaliiClinica.ToString());
            DataGridViewPersonalizat.InitCelulaDeschideClasic(pRand, EnumColoaneDGV.colDetaliiFisa.ToString());
        }
예제 #22
0
        private void DgvLista_EditareLinie(DataGridViewPersonalizat pDGVSender, int pIndexRand)
        {
            if (this.lSeIncarca)
            {
                return;
            }
            try
            {
                incepeIncarcarea();
                BClientiPlati plata = this.dgvLista.Rows[pIndexRand].Tag as BClientiPlati;

                if (plata != null)
                {
                    BColectieClientiPlatiComenzi listaPlati = BClientiPlatiComenzi.GetByIdPlata(plata.Id, null);
                    if (!CUtil.EsteListaVida <BClientiPlatiComenzi>(listaPlati))
                    {
                        BColectieClientiComenzi listaLucrari = BClientiComenzi.getByListaId(listaPlati.GetListaIdComenzi(), null);

                        BColectieClientiFacturi listaFacturi = BClientiFacturi.GetByListId(listaLucrari.GetListaIdFacturi(), null);

                        BClienti client = plata.GetClient(null);

                        if (FormCreeazaIncasareClient.Afiseaza(this.GetFormParinte(), client, listaLucrari, listaFacturi, plata))
                        {
                            incarcaRand(this.dgvLista.Rows[pIndexRand], plata);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex);
            }
            finally
            {
                finalizeazaIncarcarea();
            }
        }
        private void incarcaRand(DataGridViewRow pRand, BClientiFacturi pElem, BColectieClientiComenzi pListaLucrari, BColectieClientiPlatiComenzi pListaPlatiPeFact)
        {
            pRand.Tag = pElem;
            double valoare = pListaLucrari.GetValoareTotalaFactura(CDefinitiiComune.EnumTipMoneda.Lei, pElem.CursBNR);
            double achitat = pListaPlatiPeFact.GetValoarePlatita(); //pListaPlatiPeFact.GetSumaPlatita();

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);

            pRand.Cells[EnumColoaneDGVFacturi.colDataEmiterii.ToString()].Value = pElem.DataFactura;
            pRand.Cells[EnumColoaneDGVFacturi.colTipDocument.ToString()].Value  = pElem.ToStringTipDocument();
            pRand.Cells[EnumColoaneDGVFacturi.colSerieFactura.ToString()].Value = pElem.SerieFactura;
            pRand.Cells[EnumColoaneDGVFacturi.colNumarFactura.ToString()].Value = pElem.NumarFactura != 0 ? pElem.NumarFactura: pElem.Id;
            DataGridViewPersonalizat.InitCelulaValoareMonetara(pRand, EnumColoaneDGVFacturi.colValoare.ToString(), valoare, CDefinitiiComune.EnumTipMoneda.Lei);
            if (pElem.MonedaFactura != CDefinitiiComune.EnumTipMoneda.Lei)
            {
                DataGridViewPersonalizat.SeteazaAlerta(pRand, EnumColoaneDGVFacturi.colValoare.ToString());
            }
            pRand.Cells[EnumColoaneDGVFacturi.colValoare.ToString()].ToolTipText = CUtil.GetValoareMonetara(valoare, pElem.MonedaFactura);

            DataGridViewPersonalizat.InitCelulaValoareMonetara(pRand, EnumColoaneDGVFacturi.colPlatit.ToString(), achitat, CDefinitiiComune.EnumTipMoneda.Lei);
            DataGridViewPersonalizat.InitCelulaValoareMonetara(pRand, EnumColoaneDGVFacturi.colRest.ToString(), valoare - achitat, CDefinitiiComune.EnumTipMoneda.Lei);

            if (valoare - achitat != 0)
            {
                DataGridViewPersonalizat.SeteazaCuloareTextCelula(pRand, EnumColoaneDGVFacturi.colRest.ToString(), Color.Red);
            }
            else
            {
                DataGridViewPersonalizat.SeteazaCuloareTextCelula(pRand, EnumColoaneDGVFacturi.colRest.ToString(), Color.Black);
            }


            pRand.Cells[EnumColoaneDGVFacturi.colCursBNR.ToString()].Value    = pElem.CursBNR;
            pRand.Cells[EnumColoaneDGVFacturi.colObservatii.ToString()].Value = pElem.Observatii;

            DataGridViewPersonalizat.InitCelulaStergere(pRand);
        }
        private void incarcaRand(DataGridViewRow pRand, BClientiComenzi pElem)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);
            DataGridViewPersonalizat.InitCelulaDeschideClasic(pRand, EnumColoaneDGV.colTotalEtape.ToString());
            pRand.Cells[EnumColoaneDGV.colLucrare.ToString()].Value    = pElem.DenumireLucrare;
            pRand.Cells[EnumColoaneDGV.colNrElemente.ToString()].Value = pElem.NrElemente.ToString();

            if (pElem.IdReprezentantClient != 0)
            {
                pRand.Cells[EnumColoaneDGV.colNumeMedic.ToString()].Value = pElem.GetIdentitateMedic();
            }
            pRand.Cells[EnumColoaneDGV.colNumePacient.ToString()].Value = pElem.NumePacient;

            pRand.Cells[EnumColoaneDGV.colTehnician.ToString()].Value = pElem.GetIdentitateTehnician();

            if (CUtil.isNotNull(pElem.DataPrimire))
            {
                pRand.Cells[EnumColoaneDGV.colDataPrimire.ToString()].Value = pElem.DataPrimire;
            }
            if (CUtil.isNotNull(pElem.DataLaGata))
            {
                pRand.Cells[EnumColoaneDGV.colDataLaGata.ToString()].Value = pElem.DataLaGata;
            }
            if (pElem.IdEtapaSetari != 0)
            {
                pRand.Cells[EnumColoaneDGV.colEtapaCurenta.ToString()].Value = BEtape.GetEtapaById(pElem.IdEtapaSetari, EnumStare.Activa, null).Denumire;
            }

            pRand.Cells[EnumColoaneDGV.colObservatii.ToString()].Value = pElem.Observatii;
            if (CUtil.isNotNull(pElem.DataFactura))
            {
                pRand.Cells[EnumColoaneDGV.colDataFactura.ToString()].Value = pElem.DataFactura;
            }
            DataGridViewPersonalizat.InitCelulaStergere(pRand);
        }
예제 #25
0
        private void incarcaRand(DataGridViewRow pRand, BListaPreturiStandard pElem)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);
            pRand.Cells[EnumColoaneDGV.colDenumire.ToString()].Value    = pElem.Denumire;
            pRand.Cells[EnumColoaneDGV.colPrescurtare.ToString()].Value = pElem.DenumirePrescurtata;
            pRand.Cells[EnumColoaneDGV.colCod.ToString()].Value         = pElem.CodIntern;

            if (pElem.IdCategorie != 0)
            {
                BCategorii categorie = BCategorii.getCategorieById(pElem.IdCategorie, null);

                if (categorie.IdCategorie != 0)
                {
                    pRand.Cells[EnumColoaneDGV.colCategorie.ToString()].Value    = BCategorii.getCategorieById(categorie.IdCategorie, null).Denumire;
                    pRand.Cells[EnumColoaneDGV.colSubcategorie.ToString()].Value = categorie.Denumire;
                }
                else
                {
                    pRand.Cells[EnumColoaneDGV.colCategorie.ToString()].Value    = categorie.Denumire;
                    pRand.Cells[EnumColoaneDGV.colSubcategorie.ToString()].Value = string.Empty;
                }
            }
            else
            {
                pRand.Cells[EnumColoaneDGV.colCategorie.ToString()].Value    = string.Empty;
                pRand.Cells[EnumColoaneDGV.colSubcategorie.ToString()].Value = string.Empty;
            }

            pRand.Cells[EnumColoaneDGV.colTermenMediu.ToString()].Value = pElem.TermenMediuZile;

            pRand.Cells[EnumColoaneDGV.colValoareRon.ToString()].Value  = pElem.GetEtichetaRon();
            pRand.Cells[EnumColoaneDGV.colValoareEuro.ToString()].Value = pElem.GetEtichetaEuro();
            DataGridViewPersonalizat.InitCelulaStergere(pRand);
        }
예제 #26
0
        /// <summary>
        /// Gets the new csv file name and path.
        /// This method should be used with the methods:
        /// CsvThread().
        /// ToCsV().
        /// </summary>
        /// <param name="dGV">Extended DataGridView.</param>
        /// <param name="filename">Name of csv file.</param>
        void GetCsvReady(DataGridViewPersonalizat dGV, List <string> pListaColoaneImprimare, string filename, string pSeparator, bool pDeschideDupaCreare)
        {
            if (string.IsNullOrEmpty(filename))
            {
                dGV.Invoke
                (
                    new MethodInvoker
                    (
                        delegate
                {
                    SaveFileDialog dialog = new SaveFileDialog();
                    dialog.Filter         = "Comma Separated Value (*.csv)|*.csv";
                    dialog.FileName       = filename;
                    dialog.ValidateNames  = true;

                    if (dialog.ShowDialog(dGV) == DialogResult.Cancel)
                    {
                        filename = null;
                    }
                    else
                    {
                        filename = dialog.FileName;
                    }

                    if (filename == null)
                    {
                        return;
                    }
                }
                    )
                );
            }

            // Export data.
            ToCsV(dGV, pListaColoaneImprimare, filename, pSeparator, pDeschideDupaCreare);
        }
예제 #27
0
        private void ConstruiesteColoaneDGVListaElemente()
        {
            this.dgvListaObiecte.IncepeConstructieColoane();

            if (this.lSelectiaInStanga)
            {
                AdaugaColoaneSelectie();
            }

            //Construim coloanele corespunzatoare proprietatilor de afisaj
            this.dgvListaObiecte.Columns.Add(DataGridViewPersonalizat.CreazaColoana());

            if (!this.lSelectiaInStanga)
            {
                AdaugaColoaneSelectie();
            }

            if (!this.lAfiseazaHeaderDGV)
            {
                this.dgvListaObiecte.AscundeHeader();
            }

            this.dgvListaObiecte.FinalizeazaConstructieColoane();
        }
예제 #28
0
 private void incarcaRand(DataGridViewRow pRand, BUtilizator pElem)
 {
     pRand.Tag = pElem;
     DataGridViewPersonalizat.InitCelulaSelectieUnica(pRand, true);
     pRand.Cells[1].Value = pElem.GetNumeCompletUtilizator();
 }
예제 #29
0
    // The class constructor
    public DataGridViewPrinter(DataGridViewPersonalizat pDGV, StructPaletaDGV pPaleta, PrintDocument aPrintDocument, bool CenterOnPage, bool WithTitle, string aTitleText, bool pImprimaTitlulPeFiecarePagina, Font aTitleFont, Color aTitleColor, bool WithPaging, List <string> pListaColoane, Image logo, string pHeader, string pFooter)
    {
        this.lDGVdePrintat    = pDGV;
        this.lPaleta          = pPaleta;
        this.ThePrintDocument = aPrintDocument;
        this.IsCenterOnPage   = CenterOnPage;
        this.IsWithTitle      = WithTitle;
        this.TheTitleText     = aTitleText;
        this.TheTitleFont     = aTitleFont;
        this.TheTitleColor    = aTitleColor;
        this.IsWithPaging     = WithPaging;
        this.lImprimaTitlulPeFiecarePagina = pImprimaTitlulPeFiecarePagina;
        this.lLogo   = logo;
        this.lHeader = pHeader;
        this.lFooter = pFooter;

        if (CUtil.EsteListaVida <string>(pListaColoane))
        {
            this.lListaColoaneImprimare = new List <string>();

            foreach (DataGridViewColumn coloana in pDGV.Columns)
            {
                if (!pDGV.SeIgnoraColoanaLaImprimare(coloana.Name))
                {
                    this.lListaColoaneImprimare.Add(coloana.Name);
                }
            }
        }
        else
        {
            this.lListaColoaneImprimare = pListaColoane;
        }

        PageNumber = 0;

        RowsHeight   = new Dictionary <int, float>();
        ColumnsWidth = new Dictionary <int, float>();

        mColumnPoints      = new List <int[]>();
        mColumnPointsWidth = new List <float>();

        // Claculating the PageWidth and the PageHeight
        if (!ThePrintDocument.DefaultPageSettings.Landscape)
        {
            PageWidth  = ThePrintDocument.DefaultPageSettings.PaperSize.Width;
            PageHeight = ThePrintDocument.DefaultPageSettings.PaperSize.Height;
        }
        else
        {
            PageHeight = ThePrintDocument.DefaultPageSettings.PaperSize.Width;
            PageWidth  = ThePrintDocument.DefaultPageSettings.PaperSize.Height;
        }

        // Calculating the page margins
        LeftMargin   = ThePrintDocument.DefaultPageSettings.Margins.Left;
        TopMargin    = ThePrintDocument.DefaultPageSettings.Margins.Top;
        RightMargin  = ThePrintDocument.DefaultPageSettings.Margins.Right;
        BottomMargin = ThePrintDocument.DefaultPageSettings.Margins.Bottom;

        //Fie cele bifate, fie toate
        listaLiniiSelectate        = lDGVdePrintat.GetListaLiniiSelectate();
        listaIndecsiColoanePrint   = new List <int>();
        listaIndecsiLiniiSelectate = new List <int>();
        foreach (DataGridViewRow linie in listaLiniiSelectate)
        {
            listaIndecsiLiniiSelectate.Add(linie.Index);
        }
        // First, the current row to be printed is the first row in the DataGridView control
        CurrentRow = 0;
    }
예제 #30
0
        /// <summary>
        /// Export the DataGridView to Comma Separated Value file.
        /// This method should be used with the methods:
        /// CsvThread().
        /// GetCsvReady().
        /// </summary>
        /// <param name="dGV">Extended DataGridView.</param>
        /// <param name="filename">Full path & name of  the Name of csv file.</param>
        void ToCsV(DataGridViewPersonalizat dGV, string filename)
        {
            if (string.IsNullOrEmpty(filename))
            {
                return;
            }

            string valoareCelula = string.Empty;

            using (StreamWriter myFile = new StreamWriter(filename, false, Encoding.Default))
            {
                //IMPORTANT!!!
                //Separatorul CVS pentru tarile europene este ; si nu , care este rezervat pentru zecimale

                myFile.WriteLine(this.lDenumireDocument);

                // Export only visible columns.
                //if (dGV.ExportVisibleColumnsOnly)
                //{
                // Export titles:
                StringBuilder sHeaders = new StringBuilder();
                List <int>    listaIndecsiColoaneExportabile = new List <int>();
                string[]      culturiVirgula = { "ar-JO",   "ar-SY", "az-Cyrl-AZ", "az-Latn-AZ", "zh-CN",
                                                 "zh-SG",        "zh-TW", "nl-BE",      "nl-NL",      "en-BZ",     "en-CA",
                                                 "en-NZ",        "en-US", "fr-CA",      "ms-BN",
                                                 "ms-MY",        "nb-NO", "nn-NO",      "pt-BR",      "sr-Cyrl-CS",
                                                 "sr-Latn-CS",   "es-AR", "es-DO",      "es-MX",
                                                 "es-ES_tradnl", "sv-FI", "sv-SE",      "uz-Cyrl-UZ", "uz-Latn-UZ" };

                string separator = "; ";
                if (culturiVirgula.Contains <string>(CultureInfo.CurrentCulture.Name))
                {
                    separator = ", ";
                }

                for (int j = 0; j < dGV.Columns.Count; j++)
                {
                    if (dGV.Columns[j].Visible && !dGV.SeIgnoraColoanaLaImprimare(dGV.Columns[j].Name))
                    {
                        valoareCelula = CUtil.InlocuiesteDiacritice(dGV.Columns[j].HeaderText);
                        sHeaders.Append(valoareCelula);
                        sHeaders.Append(separator);
                        listaIndecsiColoaneExportabile.Add(j); //pentru a exporta datele coloanelor pretabile pentru export
                    }
                }
                myFile.WriteLine(sHeaders);
                sHeaders = null;

                // Export data.
                //Fie cele bifate, fie toate
                List <DataGridViewRow> listaLiniiSelectate = dGV.GetListaLiniiSelectate();
                foreach (DataGridViewRow linie in listaLiniiSelectate)
                {
                    if (linie.Tag == null)
                    {
                        continue;                    //in Tag-ul tuturor liniilor din aplicatie salvam obiectul corespunzator liniei respective; lipsa acestuia implica ignorarea liniei
                    }
                    StringBuilder stLine = new StringBuilder();
                    for (int j = 0; j < linie.Cells.Count; j++)
                    {
                        if (listaIndecsiColoaneExportabile.Contains(j))
                        {
                            stLine.Append(CUtil.ConvertObjectToString(linie.Cells[j].EditedFormattedValue, true));
                            stLine.Append(separator);
                        }
                    }
                    myFile.WriteLine(stLine);
                }

                //}
                //else
                //{
                //    // Export titles:
                //    string sHeaders = "";
                //    for (int j = 0; j < dGV.Columns.Count; j++) { sHeaders = sHeaders.ToString() + dGV.Columns[j].HeaderText + ", "; }
                //    myFile.WriteLine(sHeaders);

                //    // Export data.
                //    for (int i = 0; i < dGV.RowCount - 1; i++)
                //    {
                //        string stLine = "";
                //        for (int j = 0; j < dGV.Rows[i].Cells.Count; j++) { stLine = stLine.ToString() + dGV.Rows[i].Cells[j].Value + ", "; }
                //        myFile.WriteLine(stLine);
                //    }
                //}
            }

            IHMUtile.PornesteProces(filename);
        }