Exemplo n.º 1
0
        private void btnModifica_Click(object sender, RoutedEventArgs e)
        {
            linieSelectataGrid = gridIntrastat.SelectedIndex;
            if (linieSelectataGrid == -1)
            {
                gridIntrastat.SelectedIndex = 0;
            }
            Declaratii declaratieSelectata = gridIntrastat.SelectedItem as Declaratii;
            // DataRowView dataRow = (DataRowView)gridIntrastat.SelectedItem;
            // int index = gridIntrastat.CurrentCell.Column.DisplayIndex;
            string tip  = declaratieSelectata.Tip_Declaratie;
            string luna = declaratieSelectata.Luna;
            string an   = declaratieSelectata.Anul;

            StreamReader stream = new StreamReader(FileLocation.System + "key\\chei.txt");
            string       line   = "";
            bool         flag   = false;

            while (true)
            {
                line = stream.ReadLine();
                if (line == null)
                {
                    break;
                }
                string[] keys      = line.Split('\t');
                string[] arrKeyTxt = new string[4];

                if (keys[0].Length > 17)
                {
                    arrKeyTxt = Inregistrare.DecodeKey(keys[0]);
                    if (arrKeyTxt[0] == keys[1] && an == keys[2])
                    {
                        flag = true;
                    }
                }
            }

            stream.Close();

            if (flag == true)
            {
                Frm_Intrastat frmIntrastat = new Frm_Intrastat(tip, luna, an);
                frmIntrastat.Show();
            }
            else
            {
                Frm_Mesaj_Demo frmIntrastat = new Frm_Mesaj_Demo("Inregistrare");
                frmIntrastat.Show();
            }
        }
Exemplo n.º 2
0
        private void btnAdauga_Click(object sender, RoutedEventArgs e)
        {
            StreamReader stream = new StreamReader(FileLocation.System + "key\\chei.txt");
            string       line   = "";
            bool         flag   = false;

            while (true)
            {
                line = stream.ReadLine();
                if (line == null)
                {
                    break;
                }
                string[] keys      = line.Split('\t');
                string[] arrKeyTxt = new string[4];

                if (keys[0].Length > 17)
                {
                    arrKeyTxt = Inregistrare.DecodeKey(keys[0]);
                    if (arrKeyTxt[0] == keys[1] && txtAn.Text == keys[2])
                    {
                        flag = true;
                    }
                }
            }

            stream.Close();

            if (flag == true)
            {
                if (cmbTipDeclaratie.SelectionBoxItem.ToString() == "ACHIZITIE")
                {
                    Frm_Intrastat frmIntrastat = new Frm_Intrastat("I", txtLuna.Text, txtAn.Text);
                    frmIntrastat.Show();
                }
                else
                {
                    Frm_Intrastat frmIntrastat = new Frm_Intrastat("O", txtLuna.Text, txtAn.Text);
                    frmIntrastat.Show();
                }
            }
            else
            {
                Frm_Mesaj_Demo frmIntrastat = new Frm_Mesaj_Demo("Inregistrare");
                frmIntrastat.Show();
            }
        }
Exemplo n.º 3
0
        private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (gridIntrastat.SelectedIndex < 0)
            {
                MessageBox.Show("Nici o linie nu este selectata!");
            }
            else
            {
                int dataIndexNo = gridIntrastat.SelectedIndex;

                StreamReader stream = new StreamReader(FileLocation.System + "key\\chei.txt");
                string       line   = "";
                bool         flag   = false;
                while (true)
                {
                    line = stream.ReadLine();
                    if (line == null)
                    {
                        break;
                    }
                    string[] keys      = line.Split('\t');
                    string[] arrKeyTxt = new string[4];

                    if (keys[0].Length > 17)
                    {
                        arrKeyTxt = Inregistrare.DecodeKey(keys[0]);
                        if (arrKeyTxt[0] == keys[1] && lista[dataIndexNo].Anul == keys[2])
                        {
                            flag = true;
                        }
                    }
                }

                stream.Close();

                if (flag == true)
                {
                    Frm_Intrastat frmIntrastat = new Frm_Intrastat(lista[dataIndexNo].Tip_Declaratie, lista[dataIndexNo].Luna, lista[dataIndexNo].Anul);
                    frmIntrastat.Show();
                }
                else
                {
                    Frm_Mesaj_Demo frmIntrastat = new Frm_Mesaj_Demo("Inregistrare");
                    frmIntrastat.Show();
                }
            }
        }