Пример #1
0
        //2016-08-08
        // dejan bijela pizza capriciosa velka
        // petar SLAVONSKA velka
        // marko DIAVOLLO velka

        private void btnNoviUnos_Click(object sender, EventArgs e)
        {
            if (txtGenerirano.Text != "")
            {
                string   s          = Class.Registracija.GetMD5(productKey + "5AR").ToUpper();
                string   ns         = s.Substring(0, 6) + "-" + s.Substring(6, 6) + "-" + s.Substring(12, 6) + "-" + s.Substring(18, 6) + "-" + s.Substring(24, 6);
                string[] ss         = ns.Split('-');
                string   generirano = ss[1] + "-" + ss[3] + "-" + ss[0] + "-" + ss[2] + "-" + ss[4];

                if (generirano == txtGenerirano.Text)
                {
                    //if (MessageBox.Show(this, "Sinkronizacija podataka\nOdaberite \"Da\" za preuzimanje podataka sa weba\nOdaberite\"Ne\" za slanje podataka na web", "Registracija", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) {
                    //    MessageBox.Show("Podaci su preuzeti!\nProgram je uspješno registriran.");
                    //} else {
                    using (var ws = new wsSoftKontrol.wsSoftKontrol())
                    {
                        bool rez = ws.Registracija(productKey, generirano, Util.Korisno.oibTvrtke, Class.PodaciTvrtka.nazivPoslovnice, Class.PodaciTvrtka.gradPoslovnicaId, Class.PodaciTvrtka.adresaPoslovnice, Util.Korisno.nazivDucan, Convert.ToInt32(Util.Korisno.nazivBlagajna));
                        if (rez)
                        {
                            string sql = @"INSERT INTO registracija (productKey, activationCode, broj)
VALUES (
'" + productKey + @"',
'" + generirano + @"',
'" + broj + @"'
);";

                            if (Class.Registracija.productKey.Length > 0)
                            {
                                sql = "update registracija set productKey = '" + productKey + @"', activationCode = '" + generirano + @"', broj = '" + broj + "'";
                            }

                            classSQL.Setings_Update(sql);
                            Class.Registracija.getPodaci();
                            MessageBox.Show("Podaci su poslani!\nProgram je uspješno registriran.");

                            //} else {
                            //}
                        }
                    }
                    registrirano = true;
                    //this.Close();
                    //classSQL.Setings_Update("UPDATE postavke SET aktivnost='1'");
                    //File.WriteAllText("code", generirano);
                    Application.Restart();
                }
                else
                {
                    MessageBox.Show("Krivo upisani podaci.");
                }
            }
        }
Пример #2
0
        private void txtSifra_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                e.SuppressKeyPress = true;
                try
                {
                    if (Util.CheckConnection.Check())
                    {
                        //pc1.konektor k = new pc1.konektor();
                        //DataTable DT = k.GetDataset("SELECT * FROM Artikli WHERE ProductID='" + txtSifra.Text + "'", "Artikili", "admin", "q1w2e3r4123").Tables[0];
                        string[] s = new string[4];
                        using (var ws = new wsSoftKontrol.wsSoftKontrol())
                        {
                            s = ws.getArtiklData(txtSifra.Text, null);
                        }

                        if (s != null && s.Count() == 5)
                        {
                            string naziv = s[1];
                            string opis  = s[2];
                            if (naziv.Length > 30)
                            {
                                naziv = naziv.Remove(30);
                            }

                            if (opis.Length > 150)
                            {
                                opis = opis.Remove(150);
                            }

                            txtNaziv.Text          = naziv;
                            txtCijenaGotovina.Text = Math.Round(Convert.ToDecimal(s[3].ToString().Replace(".", ",")), 3).ToString("#0.00");
                            txtCijenaKartice.Text  = Math.Round((Convert.ToDecimal(s[3].ToString().Replace(".", ","))), 3).ToString("#0.00");
                            rtbOpis.Text           = opis;
                            //txtSlika.Text = "http://pc1.hr/Img/artikli/" + DT.Rows[0]["Picture"].ToString();
                            txtSlika.Text = s[4];
                        }
                    }
                }
                catch (Exception ex)
                {
                    //NE PRIKAZUJ GREŠKU JER NA KEY DOWN RADI SAMO NAŠ WEB
                }
            }
        }