Пример #1
0
        private void loginProcess()
        {
            var    passwordEnc = "";
            var    passwordDec = "";
            string query       = @"SELECT  * FROM Employees where Employee_number = @id";

            using (SqlCommand cmd = new SqlCommand(query, ConnUtil.connection))
            {
                cmd.Parameters.AddWithValue("@id", txtUserName.Text);
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        if (reader["Password"].ToString().Length > 0)
                        {
                            passwordEnc = (string)reader["Password"];
                            passwordDec = EncodeDecode.Decrypt(passwordEnc);
                        }
                    }
                    reader.NextResult();
                    if (txtPassword.Text != passwordDec.ToString())
                    {
                        reader.Close();
                        MsgBoxUtil.MsgError("Password Salah");
                        return;
                    }
                    reader.Close();
                    ClsUtil.userLogin = txtUserName.Text;
                    FrmMainMenu frmMainMenu = new FrmMainMenu();
                    frmMainMenu.ShowDialog();
                    this.Hide();
                    this.Close();
                }

                else
                {
                    MsgBoxUtil.MsgError("User Tidak Ditemukan !!");
                    reader.Close();
                }
            }
        }
Пример #2
0
        public FrmLogin()
        {
            InitializeComponent();

            ConnUtil.connection = new SqlConnection(ConnUtil.connectionString);
            try
            {
                ConnUtil.connection.Open();
                string isAutoUpdate = ClsUtil.GetSetting("MST_SETTING", "Description", "Code", "IsAutoupdate");
                if (isAutoUpdate == "1")
                {
                    string autoUpdatePath = ClsUtil.GetSetting("MST_SETTING", "Description", "Code", "AutoupdatePath");
                    AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent;
                    AutoUpdater.Start(autoUpdatePath);
                }
            }
            catch
            {
                MsgBoxUtil.MsgError("Tidak Terkoneksi Dengan Database !!!");
            }
        }