Пример #1
0
        private void ButtonRegister_Click(object sender, EventArgs e)
        {
            if (!ValidateRegister())
            {
                MessageBox.Show("Preencha os campos necessários.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxName.Focus();

                return;
            }

            Manager.Name     = TextBoxName.Text;
            Manager.Username = TextBoxUsername.Text;
            Manager.Password = TextBoxPassword.Text;
            Manager.Enabled  = true;

            Manager.CreatedAt = DateTime.Now;
            Manager.UpdatedAt = DateTime.Now;

            try {
                DAO.Managers.Add(Manager);

                MessageBox.Show("Bem-vindo a Prophet Shop, " + Manager.Name + "!", "", MessageBoxButtons.OK);

                Close();
            } catch {
                MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TextBoxUsername.Focus();

                return;
            }
        }
Пример #2
0
 private void ClearControls()
 {
     TextBoxConfirmPword.Clear();
     TextBoxNewPword.Clear();
     TextBoxOldPword.Clear();
     TextBoxUsername.Clear();
 }
Пример #3
0
        private bool ValidateLogin()
        {
            try {
                if (!ValidateUsername())
                {
                    MessageBox.Show("Nome de usuário indisponível.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    TextBoxUsername.Focus();

                    return(false);
                }
            } catch {
                MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TextBoxUsername.Focus();

                return(false);
            }

            if (!ValidateCurrentPassword())
            {
                MessageBox.Show("A senha atual não confere.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                TextBoxUsername.Focus();

                return(false);
            }

            return(true);
        }
Пример #4
0
 private void ButtonAdd_Click(object sender, RoutedEventArgs e)
 {
     Dispatcher.Invoke(() =>
     {
         ListBoxFriends.Items.Add(TextBoxUsername.Text);
         TextBoxUsername.Clear();
     });
 }
Пример #5
0
 private void TextBoxUsername_Enter(object sender, EventArgs e)
 {
     if (TextBoxUsername.ForeColor == Color.DimGray && TextBoxUsername.Text == "Username")
     {
         TextBoxUsername.Clear();
         TextBoxUsername.ForeColor = Color.Black;
     }
 }
Пример #6
0
        private void CheckBoxUseVirtualAccount_OnUnchecked(object sender, RoutedEventArgs e)
        {
            TextBoxUsername.IsReadOnly  = false;
            TextBoxUsername.Foreground  = Brushes.Black;
            TextBoxUsername.BorderBrush = Brushes.DarkGray;
            TextBoxUsername.Clear();

            TextBoxPassword.Clear();
        }
Пример #7
0
 private void ButtonPopup_Click(object sender, RoutedEventArgs e)
 {
     ApplicationTitle.Text       = " ";
     popupCredentails.IsOpen     = true;
     LayoutRoot.IsHitTestVisible = false;
     ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = true;
     ((ApplicationBarIconButton)ApplicationBar.Buttons[1]).IsEnabled = true;
     TextBoxUsername.Focus();
 }
    protected void BtnResetUserPassword_Click(object sender, EventArgs e)
    {
        string UserName2    = TextBoxUsername.Text.Trim();
        string EmailEntered = TextBoxEmail.Text.Trim();

        if (UserName2.Equals(""))
        {
            ShowMessage("Please Enter your System Username", true);
            TextBoxUsername.Focus();
        }
        else if (EmailEntered.Equals(""))
        {
            ShowMessage("Please Enter Your System Email", true);
            TextBoxEmail.Focus();
        }
        else
        {
            dataTable = datafile.GetUserPassword(UserName2, EmailEntered);
            SystemUser user = new SystemUser();
            if (dataTable.Rows.Count > 0)
            {
                user.Userid = int.Parse(dataTable.Rows[0]["Userid"].ToString());
                user.Email  = dataTable.Rows[0]["UserEmail"].ToString();
                user.Fname  = dataTable.Rows[0]["FirstName"].ToString();
                user.Uname  = dataTable.Rows[0]["UserName"].ToString();
                user.Sname  = dataTable.Rows[0]["SurName"].ToString();
                user.Oname  = dataTable.Rows[0]["OtherName"].ToString();
                string passwd = bll.PasswdString(8);
                user.Passwd = bll.EncryptString(passwd);
                /// Reset Password
                datafile.ResetPassword(user);
                // DataLogin gg = new DataLogin();

                string Subject = "New  PegPay Portal Credentials";
                string Body    = "Hello\t" + user.Fname + "\t" + user.Sname + "\t" + user.Oname + "<br></br><br></br>" + "Please Find Below your New Portal Credentials" +
                                 "<br></br><br></br>" + "Username:\t" + user.Uname +
                                 "<br></br><br></br>" + "Password:\t" + passwd + "<br></br><br></br><br></br>Thank You" + "<br></br><b></br><b></br>Pegasus Technologies";


                SendMail mm = new SendMail();
                mm.SendUserEmail(user.Email, Subject, Body);
                ShowMessage1("Hello\t" + user.Fname + "\t" + user.Sname + "\t" + user.Oname + "\t your new credentials have been sent to your Email", true);


                MultiView1.ActiveViewIndex = 0;
            }
            else
            {
                ShowMessage("Your Username and Email are not corresponding", true);
                ClearControls();
                MultiView1.ActiveViewIndex = 2;
            }
        }
    }
Пример #9
0
        private void metroTileChange_Click(object sender, EventArgs e)
        {
            int rows = 0;

            if (TextBoxUsername.Text == "" || !isUsernameValid())
            {
                MessageBox.Show("Username is not valid");
                TextBoxUsername.Focus();
            }
            else if (!isCurrentUser())
            {
                MessageBox.Show("You can't change password for " + TextBoxUsername.Text + "\nYou should logon as " + TextBoxUsername.Text + " to change its password");
            }
            else if (TextBoxOldPword.Text == "" || !isOldPasswordValid())
            {
                MessageBox.Show("Old password is not valid");
                TextBoxOldPword.Focus();
            }
            else if (TextBoxNewPword.Text == "")
            {
                MessageBox.Show("You should enter new password");
                TextBoxNewPword.Focus();
            }
            else if (TextBoxConfirmPword.Text == "")
            {
                MessageBox.Show("You should confirm new password");
                TextBoxConfirmPword.Focus();
            }
            else if (TextBoxNewPword.Text != TextBoxConfirmPword.Text)
            {
                MessageBox.Show("Passwords do not match");
                TextBoxConfirmPword.Focus();
            }
            else
            {
                try
                {
                    rows = changePTA.UpdatePassword(TextBoxNewPword.Text, TextBoxUsername.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error changing password:\n" + ex.Message.ToString());
                }
                if (rows > 0)
                {
                    MessageBox.Show("Password has been changed successfully");
                    ClearControls();
                }
                else
                {
                    MessageBox.Show("Password not updated");
                }
            }
        }
Пример #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        objMedicationLogin = new Streamline.UserBusinessServices.MedicationLogin();
        try
        {
            DataSet datasetSystemConfigurationKeys = null;
            Streamline.DataService.SharedTables objSharedTables = new Streamline.DataService.SharedTables();
            datasetSystemConfigurationKeys = objSharedTables.GetSystemConfigurationKeys();
            _logoPath = objSharedTables.GetSystemConfigurationKeys("CustomLogoPath", datasetSystemConfigurationKeys.Tables[0]);
            if (_logoPath == null)
            {
                _logoPath = "App_Themes/Includes/Images/logo.gif";
            }

            ButtonOk.Attributes.Add("onclick", "var varValidate=Validates(); return varValidate;");
            //-----------Code Adedd by Pradeep as per task#3329 on 3 March 2011 Start over here
            Session["DataSetPrescribedClientMedications"] = null;
            //-----------Code Adedd by Pradeep as per task#3329 on 3 March 2011 End over here
            if (!IsPostBack)
            {
                CommonFunctions.Event_Trap(this);
                //TextBoxUsername.Text = objMedicationLogin.getLastUserName().Trim();
                TextBoxUsername.Focus();
                HiddenFieldUseName.Value = TextBoxUsername.Text;
                //TextBoxPassword.Focus();
                DivLogin.Style.Add("display", "block");
            }
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "###Source Function Name - MedicationLogin--Page_Load(), ParameterCount -0 ###";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }

            Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this);
        }
        finally
        {
            objMedicationLogin = null;
        }
        //Below code was added by Vithobha for Engineering Improvement Initiatives- NBL(I): #283 In Rx login page(Chrome) after entering Usernae/Password and on enter Key, Password was clearing
        Page.Form.DefaultFocus  = TextBoxUsername.UniqueID;
        Page.Form.DefaultButton = ButtonLogon.UniqueID;
    }
Пример #11
0
        private void ButtonSave_Click(object sender, EventArgs e)
        {
            if (!ValidateProfile())
            {
                MessageBox.Show("Preencha os campos necessários.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxUsername.Focus();

                return;
            }

            if (!ValidateLogin())
            {
                return;
            }

            if (!ValidateInfo())
            {
                return;
            }

            Customer.Username = TextBoxUsername.Text;

            if (!TextBoxNewPassword.Text.Equals("") && TextBoxNewPassword.Text != null)
            {
                Customer.Password = Util.Encryptor.MD5Hash(TextBoxNewPassword.Text);
            }

            Customer.Name     = TextBoxName.Text;
            Customer.Document = TextBoxDocument.Text;
            Customer.Email    = TextBoxEmail.Text;
            Customer.Phone    = TextBoxPhone.Text;

            Customer.Address.Name    = TextBoxAddressName.Text;
            Customer.Address.ZipCode = TextBoxAddressZipCode.Text;
            Customer.Address.City    = ComboBoxAddressCity.GetItemText(ComboBoxAddressCity.SelectedItem);
            Customer.Address.State   = ComboBoxAddressState.GetItemText(ComboBoxAddressState.SelectedItem);

            try {
                DAO.Customers.Update(Customer);

                Main.Menu.Customer = Customer;
                Main.Menu.UpdateView();

                Close();
            } catch {
                MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TextBoxUsername.Focus();

                return;
            }
        }
Пример #12
0
        private void Login()
        {
            var online = true;

            if (TextBoxUsername.Text == "")
            {
                labelLogin.Text = "Username cannot be empty";
                return;
            }

            if (TextBoxPassword.Text == "")
            {
                labelLogin.Text = "Password cannot be empty";
                return;
            }

            try
            {
                _user = Database.SearchByUsername(TextBoxUsername.Text) ?? null;
            }
            catch (SqlException)
            {
                online = false;
                _user  = new User
                {
                    Name = TextBoxUsername.Text
                };
            }

            if (_user == null)
            {
                labelLogin.Text = "user '" + TextBoxUsername.Text + "' not found";
                TextBoxUsername.Clear();
                TextBoxPassword.Clear();
                TextBoxUsername.Focus();
                return;
            }

            if (online && !_user.CheckPassword(TextBoxPassword.Text))
            {
                labelLogin.Text      = "wrong password :(";
                TextBoxPassword.Text = "";
                TextBoxPassword.Focus();
                return;
            }

            StartGame(online);
        }
Пример #13
0
        private void ButtonLogin_Click(object sender, EventArgs e)
        {
            if (!ValidateUsername())
            {
                MessageBox.Show("Insira seu nome de usuário.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxUsername.Focus();

                return;
            }

            if (!ValidatePassword())
            {
                MessageBox.Show("Insira sua senha.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxUsername.Focus();

                return;
            }

            try {
                Manager manager = DAO.Managers.FindOneByLogin(TextBoxUsername.Text, TextBoxPassword.Text);

                if (manager != null)
                {
                    Session.Login(manager);

                    FormDashboard dashboard = new FormDashboard();

                    Main.Hide();
                    Hide();

                    dashboard.ShowDialog();

                    Main.Reset();
                    Main.Show();
                    Close();
                }
                else
                {
                    MessageBox.Show("Nome de usuário e/ou senha inválidos.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            } catch {
                MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            TextBoxUsername.Focus();
        }
Пример #14
0
        private void ButtonLogin_Click(object sender, EventArgs e)
        {
            if (!ValidateUsername())
            {
                MessageBox.Show("Insira seu nome de usuário.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxUsername.Focus();

                return;
            }

            if (!ValidatePassword())
            {
                MessageBox.Show("Insira sua senha.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxUsername.Focus();

                return;
            }

            try {
                Customer customer = DAO.Customers.FindOneByLogin(TextBoxUsername.Text, TextBoxPassword.Text);

                if (customer != null)
                {
                    Session.Login(customer);
                    Main.Menu.Customer = (Customer)Session.User;
                    Main.Menu.UpdateView();

                    if (Login != null)
                    {
                        Hide();
                        Login(this, EventArgs.Empty);
                    }

                    Close();
                }
                else
                {
                    MessageBox.Show("Nome de usuário e/ou senha inválidos.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            } catch {
                MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            TextBoxUsername.Focus();
        }
Пример #15
0
        private void ButtonStepOne_Click(object sender, EventArgs e)
        {
            if (!ValidateStepOne())
            {
                MessageBox.Show("Preencha os campos necessários.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxUsername.Focus();

                return;
            }

            try {
                if (!ValidateUsername())
                {
                    MessageBox.Show("Nome de usuário indisponível.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    TextBoxUsername.Focus();

                    return;
                }
            } catch {
                MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TextBoxUsername.Focus();

                return;
            }

            if (!ValidateEqualityPasswords())
            {
                MessageBox.Show("As senhas não conferem.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                TextBoxUsername.Focus();

                return;
            }

            Customer.Username = TextBoxUsername.Text;
            Customer.Password = TextBoxPassword.Text;

            PanelStepOne.Visible = false;
            PanelStepTwo.Visible = true;

            AcceptButton = ButtonStepTwo;
        }
Пример #16
0
        private void ButtonRegister_Click(object sender, EventArgs e)
        {
            if (!ValidateStepThree())
            {
                MessageBox.Show("Preencha os campos necessários.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TextBoxAddressName.Focus();

                return;
            }

            TextBoxAddressName.Focus();

            Customer.Address         = new Address();
            Customer.Address.Name    = TextBoxAddressName.Text;
            Customer.Address.ZipCode = TextBoxAddressZipCode.Text;
            Customer.Address.City    = ComboBoxAddressCity.GetItemText(ComboBoxAddressCity.SelectedItem);
            Customer.Address.State   = ComboBoxAddressState.GetItemText(ComboBoxAddressState.SelectedItem);

            Customer.Enabled   = true;
            Customer.CreatedAt = DateTime.Now;
            Customer.UpdatedAt = DateTime.Now;

            try {
                DAO.Customers.Add(Customer);
                MessageBox.Show("Bem-vindo " + Customer.Name + "!", "", MessageBoxButtons.OK);

                Session.Login(Customer);

                Main.Menu.Customer = Customer;
                Main.Menu.UpdateView();

                Close();
            } catch {
                MessageBox.Show("Ocorreu um erro interno, tente novamente mais tarde.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TextBoxUsername.Focus();

                return;
            }
        }
Пример #17
0
        private async void btLogin_Click(object sender, RoutedEventArgs e)
        {
            var sc = ServerConnection.CurrentInstance ?? new ServerConnection();

            UserClient = new Client();
            SettingHandler.SetIpPort(TbIpPort.Text);

            if (TextBoxUsername.Text.Length == 0)
            {
                Errormessage.Text = "Please enter a Username.";
                TextBoxUsername.Focus();
                return;
            }
            Errormessage.Text = "";
            BiBusy.IsBusy     = true;
            //Force UI Redraw
            Dispatcher.Invoke(() => { }, DispatcherPriority.ContextIdle);

            UserClient.UserName    = TextBoxUsername.Text;
            UserClient.EncPassword = new Encryption(PasswordBox1.Password).EncryptStringToBytes(PasswordBox1.Password);
            var successfullLogin = await sc.TryLogin(UserClient);

            if (successfullLogin)
            {
                var mw = new MainWindow
                {
                    LocalCient = UserClient
                };

                SettingHandler.SetIsLoggedIn(true);
                mw.Show();
                Close();
            }
            else
            {
                BiBusy.IsBusy = false;
            }
        }
Пример #18
0
    protected void RepeaterTransaksi_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Batal")
        {
            HiddenFieldIDTransaksi.Value = e.CommandArgument.ToString();
            LabelKeterangan.Text         = "Batal Transaksi #" + e.CommandArgument.ToString();

            PenggunaLogin Pengguna = (PenggunaLogin)Session["PenggunaLogin"];

            Konfigurasi_Class Konfigurasi_Class = new Konfigurasi_Class(Pengguna.IDGrupPengguna);

            if (Konfigurasi_Class.ValidasiKonfigurasi(EnumKonfigurasi.MembatalkanTransaksi))
            {
                BatalTransaksi();
            }
            else
            {
                TextBoxUsername.Text = string.Empty;
                TextBoxPassword.Text = string.Empty;
                TextBoxUsername.Focus();
                ModalPopupExtenderSupervisor.Show();
            }
        }
    }
Пример #19
0
        private void ButtonCreercompte_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            //Exceptions
            if (TextBoxUserFirstname.Text.Length == 0)

            {   //Envoyez une notification
                //Concentrez sur ce textbox


                TextBoxUserFirstname.Focus();
            }
            else if (TextBoxUserSecondname.Text.Length == 0)
            {   //Envoyez une notification
                //Concentrez sur ce textbox
                TextBoxUserSecondname.Focus();
            }
            else if (TextBoxUsername.Text.Length == 0)
            {   //Envoyez une notification
                //Concentrez sur ce textbox
                TextBoxUsername.Focus();
            }
            else if (PasswordBoxMotdepasse.Password.Length == 0)
            {   //Envoyez une notification
                //Concentrez sur ce textbox
                PasswordBoxMotdepasse.Focus();
            }
            else if (PasswordBoxMotdepasseC.Password.Length == 0)
            {   //Envoyez une notification
                //Concentrez sur ce textbox
                PasswordBoxMotdepasseC.Focus();
            }
            else if (TextBoxEmail.Text.Length == 0)
            {
                //Envoyez une notification


                //Concentrez sur ce textbox
                TextBoxEmail.Focus();
            }
            else if (TextBoxNumerodetelephone.Text.Length == 0)
            {
                //Envoyez une notification


                //Concentrez sur ce textbox
                TextBoxNumerodetelephone.Focus();
            }

            //else if ((!Regex.IsMatch(TextBoxEmail.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"))
            //    {   //Envoyez une notification
            //        MessageBox.Show("Enter a valid email.");

            //        TextBoxEmail.Select(0, TextBoxEmail.Text.Length);
            //        TextBoxEmail.Focus();
            //}
            //Verification des mots de passe
            else
            {
                string _password  = PasswordBoxMotdepasse.Password;
                string _passwordC = PasswordBoxMotdepasseC.Password;
                if (_password != _passwordC)
                {
                    //Concentrez sur ce PasswordBox
                    PasswordBoxMotdepasse.Focus();
                    MessageBox.Show("Mot de passe différent dans le deuxième champ");
                    return;
                }

                //Création du compte
                string UserFirstname  = TextBoxUserFirstname.Text;
                string UserSecondname = TextBoxUserSecondname.Text;
                string Username       = TextBoxUsername.Text;
                string mail           = TextBoxEmail.Text;
                string phonenumber    = TextBoxNumerodetelephone.Text;
                string password       = PasswordBoxMotdepasse.Password;

                User user = new User();
                user.userFirstName  = UserFirstname;
                user.userSecondName = UserSecondname;
                user.userName       = Username;
                user.userMail       = mail;
                user.phoneNumber    = phonenumber;
                user.pathOfPicture  = this.profilePicTextBox.Text;
                if (user.pathOfPicture != "" && !File.Exists(user.pathOfPicture))
                {
                    MessageBox.Show("Veuillez introduire un lien correct vers l'image");
                    return;
                }
                user.Activities["Activité scolaire"] = "#ff5722";
                bool b = DataSupervisor.ds.CreateAccount(user, password);
                if (b == false)
                {
                    MessageBox.Show("Nom d'utilisateur déjà existant");
                    return;
                }
                TextBoxNumerodetelephone.Text   = "";
                TextBoxEmail.Text               = "";
                TextBoxUserFirstname.Text       = "";
                TextBoxUsername.Text            = "";
                TextBoxUserSecondname.Text      = "";
                profilePicTextBox.Text          = "";
                PasswordBoxMotdepasse.Password  = "";
                PasswordBoxMotdepasseC.Password = "";
                MainWindow.mw.SignIn();
            }
        }
Пример #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            #region GENERATE STORE KEY
            using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
            {
                StoreKey_Class ClassStoreKey = new StoreKey_Class(db, true);

                ClassStoreKey.Generate();

                EnumAlert enumAlert = ClassStoreKey.Validasi();

                if (enumAlert == EnumAlert.danger)
                {
                    LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Danger, ClassStoreKey.MessageDanger);
                }
                else if (enumAlert == EnumAlert.warning)
                {
                    LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Warning, ClassStoreKey.MessageWarning);
                }
                else
                {
                    LiteralWarning.Text = "";
                }
            }
            #endregion

            TextBoxUsername.Focus();

            if (Request.QueryString["do"] == "logout")
            {
                PenggunaLogin Pengguna = (PenggunaLogin)Session["PenggunaLogin"];

                if (Pengguna != null)
                {
                    //menambah LogPengguna tipe Logout : 2
                    LogPengguna.Tambah(2, Pengguna.IDPengguna);

                    //MENGHAPUS SESSION
                    Session.Abandon();

                    //MENGHAPUS COOKIES
                    Response.Cookies["WITEnterpriseSystem"].Value   = string.Empty;
                    Response.Cookies["WITEnterpriseSystem"].Expires = DateTime.Now.AddDays(-1);

                    if (Pengguna.PointOfSales == TipePointOfSales.Retail) //RETAIL KEMBALI KE HALAMAN LOGIN
                    {
                        Response.Cookies["WMSLogin"].Value   = string.Empty;
                        Response.Cookies["WMSLogin"].Expires = DateTime.Now.AddDays(-1);
                    }
                    else if (Pengguna.PointOfSales == TipePointOfSales.Restaurant) //RESTAURANT KEMBALI KE HALAMAN LOGIN PIN
                    {
                        //JIKA VALUE COOKIES ADA MELAKUKAN ENCRYPT
                        string[] value = EncryptDecrypt.Decrypt(Request.Cookies["WMSLogin"].Value).Split('|');

                        //AMBIL VALUE TANGGAL DAN TANGGAL HARI INI HARUS LEBIH KECIL DARI VALUE COOKIES
                        if (DateTime.Now <= value[0].ToDateTime())
                        {
                            Response.Redirect("LoginPIN.aspx");
                        }
                    }
                }
            }
            else
            {
                Redirect();
            }
        }
    }
Пример #21
0
 protected void Page_Load(object sender, EventArgs e)
 {
     TextBoxUsername.Focus();
 }
Пример #22
0
        private void LoadServiceInfos()
        {
            #region GeneralTab

            //Set to readonly when it has already a service name
            if (!string.IsNullOrWhiteSpace(_tempServiceConfig.ServiceName))
            {
                TextBoxServiceName.Text = _tempServiceConfig.ServiceName;
            }

            if (!_createNewService)
            {
                TextBoxServiceName.IsReadOnly  = true;
                TextBoxServiceName.Foreground  = Brushes.Gray;
                TextBoxServiceName.BorderBrush = Brushes.LightGray;
            }

            TextBoxDisplayName.Text = _tempServiceConfig.DisplayName;

            if (!string.IsNullOrWhiteSpace(_tempServiceConfig.BinaryPath))
            {
                TextBoxFilePath.Text = _tempServiceConfig.BinaryPath;
            }

            TextBoxParam.Text       = _tempServiceConfig.Arguments;
            TextBoxDescription.Text = _tempServiceConfig.Description;

            //StartType
            switch (_tempServiceConfig.StartType)
            {
            case Advapi32.ServiceStartType.AutoStart:
                ComboBoxStartType.SelectedIndex = _tempServiceConfig.DelayedStart ? 1 : 0;
                break;

            case Advapi32.ServiceStartType.StartOnDemand:
                ComboBoxStartType.SelectedIndex = 2;
                break;

            case Advapi32.ServiceStartType.Disabled:
                ComboBoxStartType.SelectedIndex = 3;
                break;

            default:
                ComboBoxStartType.SelectedIndex = 0;
                break;
            }

            #endregion

            #region CustomUser

            if (Equals(_tempServiceConfig.Credentials, ServiceCredentials.LocalSystem))
            {
                TextBoxUsername.Clear();
                TextBoxPassword.Clear();
                CheckBoxUseLocalSystem.IsChecked    = true;
                CheckBoxUseVirtualAccount.IsChecked = false;
            }
            else if (ServiceCredentials.IsVirtualAccount(_tempServiceConfig.Credentials))
            {
                CheckBoxUseVirtualAccount.IsChecked = true;
                CheckBoxUseLocalSystem.IsChecked    = false;
            }
            else
            {
                TextBoxUsername.Text                = _tempServiceConfig.Credentials.Username;
                TextBoxPassword.Password            = _createNewService ? string.Empty : PLACEHOLDER_PASSWORD;
                CheckBoxUseLocalSystem.IsChecked    = false;
                CheckBoxUseVirtualAccount.IsChecked = false;
            }

            #endregion

            #region AdvancedTab


            TextBoxMaxRestarts.Text         = _tempServiceConfig.ProcessMaxRestarts.ToString();
            TextBoxProcessTimeoutTime.Text  = _tempServiceConfig.ProcessTimeoutTime.ToString();
            TextBoxProcessRestartDelay.Text = _tempServiceConfig.ProcessRestartDelay.ToString();
            TextBoxCounterResetTime.Text    = _tempServiceConfig.CounterResetTime.ToString();
            TextBoxLoadOrderGroup.Text      = _tempServiceConfig.LoadOrderGroup;

            //Process Priority
            switch (_tempServiceConfig.ProcessPriority)
            {
            case ProcessPriorityClass.Idle:
                ComboBoxProcessPriority.SelectedIndex = 0;
                break;

            case ProcessPriorityClass.BelowNormal:
                ComboBoxProcessPriority.SelectedIndex = 1;
                break;

            case ProcessPriorityClass.Normal:
                ComboBoxProcessPriority.SelectedIndex = 2;
                break;

            case ProcessPriorityClass.AboveNormal:
                ComboBoxProcessPriority.SelectedIndex = 3;
                break;

            case ProcessPriorityClass.High:
                ComboBoxProcessPriority.SelectedIndex = 4;
                break;

            case ProcessPriorityClass.RealTime:
                ComboBoxProcessPriority.SelectedIndex = 5;
                break;

            default:
                ComboBoxProcessPriority.SelectedIndex = 2;
                break;
            }

            CheckBoxIsConsoleApp.IsChecked    = _tempServiceConfig.IsConsoleApplication;
            RadioButtonUseCtrlC.IsChecked     = _tempServiceConfig.UseCtrlC;
            RadioButtonUseCtrlBreak.IsChecked = !_tempServiceConfig.UseCtrlC;


            //Hide check box interact with desktop on not supported systems (windows 10 1803+)
            if (!DaemonMasterUtils.IsSupportedWindows10VersionForIwd)
            {
                CheckBoxInteractDesk.IsChecked = false;
                CheckBoxInteractDesk.IsEnabled = false;
            }
            else
            {
                CheckBoxInteractDesk.IsChecked = _tempServiceConfig.CanInteractWithDesktop;
            }

            CheckBoxUseEventLog.IsChecked = _tempServiceConfig.UseEventLog;

            #endregion

            #region Dependency Listboxes

            #region DependOnService

            //Load Data into _dependOnServiceObservableCollection
            _dependOnServiceObservableCollection = new ObservableCollection <ServiceInfo>();
            foreach (string dep in _tempServiceConfig.DependOnService)
            {
                var serviceInfo = new ServiceInfo
                {
                    ServiceName = dep
                };

                //Get display name
                using (var serviceController = new ServiceController(dep))
                {
                    serviceInfo.DisplayName = serviceController.DisplayName;
                }

                _dependOnServiceObservableCollection.Add(serviceInfo);
            }

            //Sort the list in alphabetical order
            ICollectionView collectionView1 = CollectionViewSource.GetDefaultView(_dependOnServiceObservableCollection);
            collectionView1.SortDescriptions.Add(new SortDescription("DisplayName", ListSortDirection.Ascending));
            ListBoxDependOnService.ItemsSource = collectionView1;

            #endregion

            #region AllServices

            //Load Data into _allServicesObservableCollection
            _allServicesObservableCollection = new ObservableCollection <ServiceInfo>();
            foreach (ServiceController service in ServiceController.GetServices())
            {
                var serviceInfo = new ServiceInfo
                {
                    DisplayName = service.DisplayName,
                    ServiceName = service.ServiceName
                };

                if (_dependOnServiceObservableCollection.All(x => x.ServiceName != serviceInfo.ServiceName))
                {
                    _allServicesObservableCollection.Add(serviceInfo);
                }
            }

            //Sort the list in alphabetical order
            ICollectionView collectionView2 = CollectionViewSource.GetDefaultView(_allServicesObservableCollection);
            collectionView2.SortDescriptions.Add(new SortDescription("DisplayName", ListSortDirection.Ascending));
            ListBoxAllServices.ItemsSource = collectionView2;

            #endregion

            #region AllGroups

            //Load Data into _allGroupsObservableCollection
            _allGroupsObservableCollection = new ObservableCollection <string>(RegistryManagement.GetAllServiceGroups());
            //Sort the list in alphabetical order
            ICollectionView collectionView3 = CollectionViewSource.GetDefaultView(_allGroupsObservableCollection);
            collectionView3.SortDescriptions.Add(new SortDescription());
            ListBoxAllGroups.ItemsSource = collectionView3;

            #endregion

            #region DependOnGroup

            //Load Data into _dependOnGroupObservableCollection
            _dependOnGroupObservableCollection = new ObservableCollection <string>(_tempServiceConfig.DependOnGroup);
            //Sort the list in alphabetical order
            ICollectionView collectionView4 = CollectionViewSource.GetDefaultView(_dependOnGroupObservableCollection);
            collectionView3.SortDescriptions.Add(new SortDescription());
            ListBoxDependOnGroup.ItemsSource = collectionView4;

            #endregion

            #endregion
        }