Ejemplo n.º 1
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            //todo-:Connection Settings choose
            //cmbSirket.Items.Clear();
            string sql = "select * from efatura.baglantilar order by alias";

            Conn.OpenConn();
            MySqlDataAdapter daBaglantilar = Conn.OpenAdapter(sql);
            DataTable        dtBaglantilar = new DataTable();

            daBaglantilar.Fill(dtBaglantilar);
            foreach (DataRow row in dtBaglantilar.Rows)
            {
                cbConnection.Items.Add(new ComboboxItem(row["alias"].ToString(),
                                                        new Baglanti(row["alias"].ToString(),
                                                                     row["hostip"].ToString(),
                                                                     row["hostport"].ToString(),
                                                                     row["hostdb"].ToString(),
                                                                     row["SaveXmlPath"].ToString(),
                                                                     row["INGEntVar"].ToString() == "True"?true:false,
                                                                     row["INGKullanici"].ToString(),
                                                                     row["INGSifre"].ToString(),
                                                                     row["INGVKN"].ToString(),
                                                                     row["INGAlias"].ToString()
                                                                     )
                                                        )
                                       );
            }
            if (dtBaglantilar.Rows.Count > 0)
            {
                BaglantiYukle(0);
            }
            dtBaglantilar = null;
            daBaglantilar = null;
            Conn.CloseConn();
            if (cbConnection.Items.Count > 0)
            {
                cbConnection.SelectedIndex = 0;
            }

            lblVersion.Text = Application.ProductVersion.ToString();
            Properties.Settings s = new Properties.Settings();
            if (s.IbemSifre == "18")
            {
                txtUserName.Text = "iadmin";
                txtPassword.Text = "183m8745";
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string kadi, sifre, db = "";

            kadi  = Conn.convert2Latin(txtUserName.Text);
            sifre = Conn.convert2Latin(txtPassword.Text);
            string checkSql = "select {0} as deger from yetkimuhasebe where durum='Aktif' and  kullaniciadi='" + kadi +
                              "' and pwd='" + Conn.CalculateMD5Hash(sifre) + "'";
            string sql = string.Format(checkSql, "count(*)");

            Conn.OpenConn();
            int ok = Int32.Parse(Conn.ReadSingleField(sql, "0"));

            if (ok > 0)
            {
                string userId = Conn.ReadSingleField(string.Format(checkSql, "id"), "0");
                sql = string.Format("select cast(accessright as char) from yetkimuhasebe_yetkiler where userid={0} and zone='acEFaturaIslemleri'", userId);
                int yetki = 0;
                try
                {
                    yetki = Int32.Parse(Conn.ReadSingleField(sql, "0"));
                }
                catch (Exception exx)
                {
                    yetki = 0;
                }
                if (yetki > 0)
                {
                    frmMain f = new frmMain();
                    this.Hide();
                    Conn.CloseConn();
                    Properties.Settings s = new Properties.Settings();
                    s.MysqlDB = db;
                    f.ShowDialog();
                    txtPassword.Clear();
                    this.Show();
                    txtPassword.Focus();
                }
            }
            else
            {
                Conn.CloseConn();
            }
        }
Ejemplo n.º 3
0
        public static void OpenConn()
        {
            Properties.Settings mySettings = new Properties.Settings();
            try
            {
                myConn = new MySqlConnection();
                if (hostIP.Trim() == "")
                {
                    hostIP = mySettings.MysqlHost;
                }
                if (hostDB.Trim() == "")
                {
                    hostDB = mySettings.MysqlDB;
                }
                if (hostPort.Trim() == "")
                {
                    hostPort = mySettings.MysqlPort;
                }
                if (SaveXmlPath.Trim() == "")
                {
                    SaveXmlPath = mySettings.SaveXmlPath;
                }
                myConn.ConnectionString = String.Format("server={0}; user id={1}; password={2}; port={3}; " +
                                                        "database=mysql; pooling=false; Allow User Variables=True; " +
                                                        "Allow Zero Datetime=True; Character Set=utf8; " +
                                                        "Convert Zero Datetime=True; Connect Timeout=30; " +
                                                        "Default Command Timeout=60; Use Compression=True; " +
                                                        "Keep Alive=15; Charset=utf8; database={4}; respect binary flags=false;",
                                                        hostIP, "ibem", "mosgatim1", hostPort, hostDB);

                myConn.Open();
                MySqlCommand c = new MySqlCommand();
                c.Connection = myConn;

                c.CommandText = "create database if not exists efatura collate=utf8_general_ci";
                c.ExecuteNonQuery();

                c.CommandText = "create table if not exists efatura.efatura ( " +
                                " id double unsigned not null auto_increment, " +
                                " faturaid double unsigned not null, " +
                                " faturatipi varchar(20), " +
                                " faturadb varchar(20), " +
                                " faturatarihi date, " +
                                " row_time timestamp default CURRENT_TIMESTAMP()," +
                                " faturaxml longblob, " +
                                " faturaxslt longblob, " +
                                " faturazip longblob, " +
                                " faturalog longblob, " +
                                " primary key (id), " +
                                " key fid(faturaid), " +
                                " key ftip(faturatipi), " +
                                " key fdb(faturadb) " +
                                ") engine=myisam collate=utf8_general_ci";
                c.ExecuteNonQuery();


                c.CommandText = "create table if not exists efatura.efaturalog ( " +
                                " id double unsigned not null , " +
                                " faturaid double unsigned not null, " +
                                " faturatipi varchar(20), " +
                                " faturadb varchar(20), " +
                                " faturatarihi date, " +
                                " row_time datetime," +
                                " faturaxml longblob, " +
                                " faturaxslt longblob, " +
                                " faturazip longblob, " +
                                " faturalog longblob, " +
                                " delete_time timestamp default CURRENT_TIMESTAMP(), " +
                                " delid double unsigned not null auto_increment, " +
                                " primary key (delid), " +
                                " key fid(faturaid), " +
                                " key ftip(faturatipi), " +
                                " key fdb(faturadb)" +
                                ") engine=myisam collate=utf8_general_ci";
                c.ExecuteNonQuery();

                c.CommandText = "create table if not exists efatura.baglantilar ( " +
                                " id double unsigned not null auto_increment, " +
                                " alias varchar(255), " +
                                " hostip varchar(30), " +
                                " hostport varchar(8), " +
                                " hostdb varchar(255), " +
                                " SaveXmlPath varchar(255), " +
                                " primary key(id)," +
                                " unique key alho(alias,hostip) " +
                                ") engine=myisam collate=utf8_general_ci";
                c.ExecuteNonQuery();

                CheckField("efatura.baglantilar", "INGEntVar", "tinyint(1)", " default 0");
                CheckField("efatura.baglantilar", "INGKullanici", "varchar(255)", " default ''");
                CheckField("efatura.baglantilar", "INGSifre", "varchar(255)", " default ''");
                CheckField("efatura.baglantilar", "INGVKN", "varchar(255)", " default ''");
                CheckField("efatura.baglantilar", "INGAlias", "varchar(255)", " default ''");
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("Error connecting to the server: " + ex.Message);
            }
        }