Exemplo n.º 1
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            if (checkdata() == false)
            {
                return;
            }
            string sqlusername   = "******" + cmb_user.Text + "'";
            string sqlpass       = "******" + cmb_user.Text + "'";
            string sqlpermission = "select distinct permission from m_user where  usercode = '" + cmb_user.Text + "'";
            sqlCON connect       = new sqlCON();

            if (connect.sqlExecuteScalarString(sqlpass) != txt_pass.Text)
            {
                infomesge mes = new infomesge();
                mes.ErrorMesger("Password is not correct", "Warning System", this);
                txt_pass.Text = "";
                return;
            }
            sqlCON connected = new sqlCON();
            sqlCON permi     = new sqlCON();

            Class.valiballecommon va = Class.valiballecommon.GetStorage();
            va.UserName   = connected.sqlExecuteScalarString(sqlusername);
            va.Permission = permi.sqlExecuteScalarString(sqlpermission);
            va.UserCode   = cmb_user.Text;
            MainFr newfr = new MainFr();

            newfr.Show();
            //this.Hide();
        }
Exemplo n.º 2
0
 bool checkdata()
 {
     if (cmb_user.Text == "" || txt_pass.Text == "")
     {
         infomesge mes = new infomesge();
         mes.WarningMesger("Data is null", "Warning System", this);
         return(false);
     }
     return(true);
 }
Exemplo n.º 3
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            //MySql_importfg_warehouse tem = new MySql_importfg_warehouse();
            //if (tem.Open())
            //{
            //    MessageBox.Show("Connect Mysql sucess");
            //    return;
            //}
            //else
            //{
            //    return;
            //}
            if (checkdata() == false)
            {
                return;
            }
            string sqlusername   = "******" + cmb_user.Text + "'";
            string sqlpass       = "******" + cmb_user.Text + "'";
            string sqlpermission = "select distinct permission from m_user where  usercode = '" + cmb_user.Text + "'";
            sqlCON connect       = new sqlCON();

            if (connect.sqlExecuteScalarString(sqlpass) != txt_pass.Text)
            {
                infomesge mes = new infomesge();
                mes.ErrorMesger("Password is not correct", "Warning System", this);
                txt_pass.Text = "";
                return;
            }
            sqlCON connected = new sqlCON();
            sqlCON permi     = new sqlCON();

            Class.valiballecommon va = Class.valiballecommon.GetStorage();
            va.UserName   = connected.sqlExecuteScalarString(sqlusername);
            va.Permission = permi.sqlExecuteScalarString(sqlpermission);
            va.UserCode   = cmb_user.Text;
            if (cb_Language.SelectedItem != null)
            {
                va.Language = (string)cb_Language.SelectedItem;
            }
            if (cb_Database.SelectedItem != null)
            {
                if (cb_Database.SelectedItem.ToString() == "TECHLINK")
                {
                    va.DBERP = "TECHLINK";
                    va.DBSFT = "SFT_TECHLINK";
                }
                else if (cb_Database.SelectedItem.ToString() == "TLVN2")
                {
                    va.DBERP = "TLVN2";
                    va.DBSFT = "SFT_TLVN2";
                }
                else if (cb_Database.SelectedItem.ToString() == "TEST03152021")
                {
                    va.DBERP = "TEST03152021";
                    va.DBSFT = "SFT_TEST03152021";
                }
            }
            MainLayout mainLayout = new MainLayout();

            mainLayout.Show();
            //this.Hide();
            //MainFr newfr = new MainFr();
            //newfr.Show();
            //   this.Hide();
        }