コード例 #1
0
ファイル: wycena.cs プロジェクト: slawek19926/Okna
        public void wyliczenie_kwoty()
        {
            sumaTXT.Text = suma().ToString("c");

            decimal kwota  = Convert.ToDecimal(suma());
            int     zlote  = (int)kwota;
            int     grosze = (int)(100 * kwota) % 100;

            slownie.Text = String.Format("{0} {1} {2} {3}",
                                         Formatowanie.LiczbaSlownie(zlote),
                                         Formatowanie.WalutaSlownie(zlote, "złote"),
                                         Formatowanie.LiczbaSlownie(grosze),
                                         Formatowanie.WalutaSlownie(grosze, "grosze"));
        }
コード例 #2
0
ファイル: wycena.cs プロジェクト: slawek19926/Okna
        public void wycena_Load(object sender, EventArgs e)
        {
            //pobiera numer wyceny
            var MyIni = new INIFile("WektorSettings.ini");

            server   = MyIni.Read("server", "Okna");
            database = MyIni.Read("database", "Okna");
            uid      = MyIni.Read("login", "Okna");
            password = Decrypt(MyIni.Read("pass", "Okna"));

            var connectionString = "SERVER=" + server + ";" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD="******";";

            using (var connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                string klient = Form1.logged.Text;
                var    query  = $"{$"SELECT lpad(max(wycena+1),"}{MyIni.Read("zera","wyceny")},0) as numer,wycena,id FROM uzytkownicy WHERE id = (SELECT id FROM uzytkownicy WHERE username = '******')";
                using (var command = new MySqlCommand(query, connection))
                {
                    using (var reader = command.ExecuteReader())
                    {
                        //wycena numer
                        while (reader.Read())
                        {
                            if (MyIni.Read("przed", "wyceny") == "")
                            {
                                numer_wyceny    = "wyc/" + reader.GetString("numer") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Today.Year;
                                wycena_nr.Text  = numer_wyceny;
                                numberBAZA.Text = reader.GetString("wycena");
                                userID.Text     = reader.GetString("id");
                            }
                            else
                            {
                                numer_wyceny    = "" + MyIni.Read("przed", "wyceny") + "/" + reader.GetString("numer") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Today.Year;
                                wycena_nr.Text  = numer_wyceny;
                                numberBAZA.Text = reader.GetString("wycena");
                                userID.Text     = reader.GetString("id");
                            }
                            numerek.Text = reader.GetString("numer");
                        }
                    }
                }
            }


            metroGrid1.Columns[1].Width = 325;
            metroGrid1.Columns[2].DefaultCellStyle.Format = "c";
            decimal kwota  = Convert.ToDecimal(suma());
            int     zlote  = (int)kwota;
            int     grosze = (int)(100 * kwota) % 100;

            slownie.Text = String.Format("{0} {1} {2} {3}",
                                         Formatowanie.LiczbaSlownie(zlote),
                                         Formatowanie.WalutaSlownie(zlote, "złote"),
                                         Formatowanie.LiczbaSlownie(grosze),
                                         Formatowanie.WalutaSlownie(grosze, "grosze"));

            if (klientTXT.Text == "")
            {
                userBTN.Text = "Wybierz klienta";
            }
            else
            {
                userBTN.Text = "Zmień klienta";
            }

            //this.reportViewer1.RefreshReport();
        }