Exemple #1
0
        public void InitializeFormValuesFromXMLFile()
        {
            try
            {
                // FileLocation => Settings/E_Intrastat/Setari/FileLocation
                txtLocatieDirectorBazaDate.Text     = XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/FileLocation/DataBase");
                txtLocatieDirectorSistemExcel.Text  = XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/FileLocation/System");
                txtLocatieDefinitieRapoarte.Text    = XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/FileLocation/ReportDefinitionPath");
                txtLocatieSalvareDeclaratiiXML.Text = XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/FileLocation/DirectorSalvare");

                // Zecimale => Settings/E_Intrastat/Setari/Zecimale
                txtZecimaleRotunjireCalcule.Text = XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Zecimale/ZecRotCalcule");
                txtZecimaleCalculValuta.Text     = XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Zecimale/ZecRotValuta");
                txtZecimaleCalculLei.Text        = XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Zecimale/ZecRotLEI");
                txtZecimaleCalculTaxare.Text     = XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Zecimale/NrZecTaxare");

                // Culori => Settings/E_Intrastat/Setari/Culori

                lblCuloareBaraMeniu.Background            = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#" + XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Culori/Meniu_Color")));
                lblCuloareFundalLinieSelectata.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#" + XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Culori/HighlightRowStyle_BackColor")));
                lblCuloareLinieSelectata.Background       = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#" + XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Culori/HighlightRowStyle_ForeColor")));
                lblCuloareTabelaAlternativa1.Background   = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#" + XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Culori/OddRowStyle_BackColor")));
                lblCuloareTabelaAlternativa2.Background   = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#" + XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Culori/EvenRowStyle_BackColor")));

                // Diverse => Settings/E_Intrastat/Setari/Diverse

                chkActualizareAutomataCursValutar.IsChecked = Convert.ToBoolean(Convert.ToInt16(XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Diverse/UpdateCurs")));
                chkActualizareAutomataProgram.IsChecked     = Convert.ToBoolean(Convert.ToInt16(XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Diverse/VerificaUpdate")));
                chkVerificareaGreutatiiNete.IsChecked       = Convert.ToBoolean(Convert.ToInt16(XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Diverse/VerificaNet")));
            }
            catch (Exception exp)
            {
                MessageBox.Show("Eroare: " + exp.Message);
            }
        }
Exemple #2
0
        private void IncarcaGrid(string tableName)
        {
            int    decimals = Convert.ToInt32(XML_Operatii.CitesteValoareNodXML(CONSTANTE.Setting_XML_file, @"Settings/E_Intrastat/Setari/Zecimale/ZecRotCalcule"));
            string spec     = "{0:N" + decimals + "}";

            string          _oleDBConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data source=" + FileLocation.DataBase + Firma.CodFiscal + ".mdb";
            OleDbConnection dbConn    = new OleDbConnection(_oleDBConnectionString);
            OleDbCommand    dbCommand = null;
            OleDbDataReader dbReader  = null;
            string          dbQuery   = string.Empty;

            dbConn.Open();
            dbQuery   = "SELECT * FROM " + tableName;
            dbCommand = new OleDbCommand(dbQuery, dbConn);
            dbReader  = dbCommand.ExecuteReader();
            if (dbReader.HasRows)
            {
                while (dbReader.Read())
                {
                    if (dbReader[0].ToString() != string.Empty)
                    {
                        string imagePath = "";

                        if (dbReader[0].ToString() == "I")
                        {
                            imagePath = FileLocation.System + "Imagini\\Arrow\\IN.gif";
                        }
                        else
                        {
                            imagePath = FileLocation.System + "Imagini\\Arrow\\OUT.gif";
                        }

                        lista.Add(new Declaratii(toBitmap(File.ReadAllBytes(imagePath)), dbReader[1].ToString(), dbReader[2].ToString(), dbReader[3].ToString(),
                                                 string.Format(spec, Convert.ToDouble(dbReader[4])), string.Format(spec, Convert.ToDouble(dbReader[5])), string.Format(spec, Convert.ToDouble(dbReader[6])), dbReader[7].ToString()));
                    }
                }
            }

            FrameworkElementFactory factory = new FrameworkElementFactory(typeof(Image));
            Binding bind = new Binding("Sens1");//please keep "image" name as you have set in your class data member name

            factory.SetValue(Image.SourceProperty, bind);
            DataTemplate cellTemplate = new DataTemplate()
            {
                VisualTree = factory
            };
            DataGridTemplateColumn imgCol = new DataGridTemplateColumn()
            {
                Header       = "Sens", //this is upto you whatever you want to keep, this will be shown on column to represent the data for helping the user...
                CellTemplate = cellTemplate,
                Width        = 42
            };

            gridIntrastat.Columns.Add(imgCol);

            gridIntrastat.ItemsSource = lista;
            dbConn.Close();
        }
Exemple #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            #region Diverse => Settings/E_Intrastat/Setari/Diverse
            // XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "DataBase", drive + "E_Intrastat\\System\\DataBase\\", true);
            if (chkActualizareAutomataCursValutar.IsChecked == true)
            {
                XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/Diverse", "UpdateCurs", "1", true);
            }
            else
            {
                XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/Diverse", "UpdateCurs", "0", true);
            }


            if (chkActualizareAutomataProgram.IsChecked == true)
            {
                XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/Diverse", "VerificaUpdate", "1", true);
            }
            else
            {
                XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/Diverse", "VerificaUpdate", "0", true);
            }

            if (chkVerificareaGreutatiiNete.IsChecked == true)
            {
                XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/Diverse", "VerificaNet", "1", true);
            }
            else
            {
                XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/Diverse", "VerificaNet", "0", true);
            }
            #endregion

            #region  Zecimale => Settings/E_Intrastat/Setari/Zecimale

            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/Zecimale", "ZecRotCalcule", txtZecimaleRotunjireCalcule.Text, true);
            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/Zecimale", "ZecRotValuta", txtZecimaleCalculValuta.Text, true);
            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/Zecimale", "ZecRotLEI", txtZecimaleCalculLei.Text, true);
            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/Zecimale", "NrZecTaxare", txtZecimaleCalculTaxare.Text, true);



            #endregion


            #region  FileLocation => Settings/E_Intrastat/Setari/FileLocation


            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "DataBase", txtLocatieDirectorBazaDate.Text, true);
            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "System", txtLocatieDirectorSistemExcel.Text, true);
            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "ReportDefinitionPath", txtLocatieDefinitieRapoarte.Text, true);
            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "DirectorSalvare", txtLocatieSalvareDeclaratiiXML.Text, true);
            #endregion
        }
        private void Frm_Pornire_Loaded(object sender, RoutedEventArgs e)
        {
            string formatNrScurt = "##,##0";
            string formatNrLung  = "##,##0.00";
            // string Settings_XML_File = string.Empty;
            string sPath          = string.Empty;
            string numeFisierVers = string.Empty;

            try
            {
                // Determin locatia unde este fisierul Settings.XML
                string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                // Settings_XML_File = Environment.CurrentDirectory + @"\E_Intrastat'Settings.xml";
                CONSTANTE.Setting_XML_file = path + @"\E_Intrastat\Settings.xml";
                // if (!XML_Operatii.Verifica_Fisier(Settings_XML_File))
                //  {
                //    MessageBox.Show("EROARE identificare fisier setari: " + Settings_XML_File + " nu exista");
                //    return;
                //  }
                XML_Setari_Default.Setari_Default_XML();

                EU_Registrii_Operatii.EU_Registrii();
                XML_Public_Citeste.Citeste_CUlori();
                XML_Public_Citeste.Citeste_Zecimale();
                XML_Public_Citeste.Citeste_FileLocation();
                XML_Public_Citeste.Citeste_Diverse();

                if (Diverse.VerificaUpdate == true)
                {
                    string   versionFilePath  = FileLocation.System + "vers.txt";
                    string[] versionFileLines = File.ReadAllLines(versionFilePath);
                    numeFisierVers = UpdatesHelper.Verifica_Update_Versiune(versionFileLines[0]);
                    if (numeFisierVers != "0")
                    {
                        if (MessageBoxResult.Yes ==
                            MessageBox.Show("Exista o versiune noua pentru descarcare\nDoriti descarcarea si instalarea noii versiuni?", "Info", MessageBoxButton.YesNo))
                        {
                            sPath = Environment.CurrentDirectory + @"UpdateWEB\UpdateWEB.exe";
                            ClasaSuport.StartProgramByFileName(sPath, true);
                            Application.Current.Shutdown();
                            return;
                        }
                    }
                }

                string comunpath = "C:\\E_Intrastat\\System\\DataBase\\Comun.mdb";
                bool   flag      = false;
                if (!Verifica_Exista_Fisier.Verifica_Fisier(comunpath))
                {
                    foreach (var drive in DriveInfo.GetDrives())
                    {
                        if (Verifica_Exista_Fisier.Verifica_Fisier(drive + "E_Intrastat\\System\\DataBase\\Comun.mdb"))
                        // MessageBox.Show("FIșierul a fost gasit!");
                        {
                            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "DataBase", drive + "E_Intrastat\\System\\DataBase\\", true);
                            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "System", drive + "E_Intrastat\\System\\", true);
                            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "DirectorSalvare", drive + "E_Intrastat\\System\\DeclaratiiXML\\", true);
                            XML_Operatii.Actualizare_XML(CONSTANTE.Setting_XML_file, "/Settings/E_Intrastat/Setari/FileLocation", "ReportDefinitionPath", drive + "E_Intrastat\\System\\RaportDefinition", true);

                            flag = true;
                        }
                    }
                }
                else
                {
                    flag = true;
                }
                if (flag == false)
                {
                    MessageBox.Show("Baza de date NU a fost gasita! Exemplu locatie : D:\\E-Intrastat\\System");
                    Application.Current.Shutdown();
                }
                else
                {
                    Update_Curs();
                    Open_Conection_Common();
                    this.Hide();
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show("Frm_Pornire_Loaded Error: " + exp.Message);
                Application.Current.Shutdown();
            }
        }