Example #1
0
        private void btnlogin_click(Object sender, EventArgs e)
        {
            //For Default SYSADM->SYSADM@12345
            if (txtUserID.Text.Length == 0)
            {
                RepLogger.ShowMessage(this, "User ID harus diisi!", MessageBoxIcon.Stop, MessageBoxButtons.OK);
                txtUserID.Focus();
            }
            else if (txtPassword.Text.Length < Constant.Public.MinLenghtPassword)
            {
                RepLogger.ShowMessage(this, "Password minimal harus " + Constant.Public.MinLenghtPassword + " digit!", MessageBoxIcon.Stop, MessageBoxButtons.OK);
                txtPassword.Focus();
            }
            else
            {
                var hasil = rep.GetLogin(txtUserID.Text, txtPassword.Text);
                if (hasil.JSONResult)
                {
                    Constant.Public.UserLogin = (Models.Dto.MUser)hasil.JSONValue;
                    RepLogger.ShowMessage(this, "Selamat datang " + Constant.Public.UserLogin.nama + ", selamat beraktifitas.", MessageBoxIcon.Information, MessageBoxButtons.OK);

                    DialogResult = DialogResult.OK;
                    Close();
                }
                else
                {
                    RepLogger.ShowMessage(this, hasil.JSONMessage, MessageBoxIcon.Warning, MessageBoxButtons.OK);
                }
            }

            DialogResult = DialogResult.OK;
            Close();
        }
Example #2
0
        public LoginPage(IWebDriver driver)
        {
            this.driver = driver;

            rep = new RepLogger(driver);

            wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
        }
Example #3
0
        public static async Task <bool> getLoginAsync(string UserID, string Pwd)
        {
            bool hasil = false;

            client.BaseUrl = Properties.Settings.Default.Base_Url;
            JsonResult json = await client.LoginAsync(UserID, Pwd);

            if (json != null)
            {
                hasil = (bool)json.JsonResult1;
                if (hasil)
                {
                    string jsonStr = JsonConvert.SerializeObject(json.JsonValue);
                    Repository.Utils.UserLogin = JsonConvert.DeserializeObject <Models.Dto.MUser>(jsonStr);
                }
                else
                {
                    RepLogger.ShowMessage(json.JsonMessage, System.Windows.Forms.MessageBoxIcon.Warning);
                }
            }
            return(hasil);
        }
Example #4
0
 private void menuLoginOut()
 {
     if (Constant.Public.UserLogin != null || Constant.Public.UserLogin.id <= 0)
     {
         using (frmLogin frm = new frmLogin())
         {
             try
             {
                 if (frm.ShowDialog(this) == DialogResult.OK)
                 {
                     //Gak Ngapa-ngapain
                 }
             }
             catch (Exception ex)
             {
                 RepLogger.ShowMessage(this, "ERR : " + ex.Message, MessageBoxIcon.Error, MessageBoxButtons.OK);
             }
         }
     }
     else
     {
     }
 }