Пример #1
0
        /// <summary>
        /// Validates the data.
        /// </summary>
        /// <returns></returns>
        private bool ValidateData()
        {
            bool result = true;

            if (txtServerName.Text == string.Empty)
            {
                AOS_COMMON.ShowErrorMsg("Server Name Cannot be left blank", txtServerName, MsgType.Error);
                result = false;
            }
            else if (txtDatabaseName.Text == string.Empty)
            {
                AOS_COMMON.ShowErrorMsg("Database Name Cannot be left blank", txtDatabaseName, MsgType.Error);
                result = false;
            }
            else if (txtUserName.Text == string.Empty)
            {
                AOS_COMMON.ShowErrorMsg("User Id Cannot be left blank", txtUserName, MsgType.Error);
                result = false;
            }
            else if (txtPassword.Password == string.Empty)
            {
                AOS_COMMON.ShowErrorMsg("Password Cannot be left blank", txtPassword, MsgType.Error);
                result = false;
            }
            return(result);
        }
Пример #2
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     try
     {
         if (!createdNew)
         {
             return;
         }
         MainWindow _omain = new MainWindow();
         _omain.Show();
     }
     catch (Exception ex)
     { AOS_COMMON.ShowErrorMsg(ex.ToString(), MsgType.Error); }
 }
Пример #3
0
        private bool _Validation()
        {
            bool flag = true;

            if (txtUserName.Text == string.Empty)
            {
                flag = false;
                txtUserName.Focus();
                AOS_COMMON.ShowErrorMsg("user name cannot be left blank", MsgType.Error);
            }
            else if (txtPassword.Password == string.Empty)
            {
                flag = false;
                txtPassword.Focus();
                AOS_COMMON.ShowErrorMsg("password cannot be left blank", MsgType.Error);
            }
            return(flag);
        }
Пример #4
0
 /// <summary>
 /// Handles the Click event of the btnSave control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (ValidateData())
         {
             WriteSetting("AnnexGlas", "Data Source=" + txtServerName.Text.Trim() + ";Initial Catalog=" + txtDatabaseName.Text.Trim() + ";User ID=" + txtUserName.Text.Trim() + ";Password="******" ");
         }
         if (AOS_COMMON.ShowErrorMsg(" *** DB setting  changed successfully *** \n *** Setting will be refelected after restarting the application? ***", txtServerName, MsgType.Info) == MsgResult.OK)
         {
             System.Windows.Application.Current.Shutdown();
         }
     }
     catch (Exception ex)
     {
         AOS_COMMON.ShowErrorMsg(ex.ToString(), txtServerName, MsgType.Error);
         AOS_COMMON.mAppLog.LogMessage(EventNotice.EventTypes.evtError, MethodBase.GetCurrentMethod().Name, ex.ToString());
     }
 }
Пример #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                this.Cursor    = Cursors.Wait;
                lblVer.Content = "Version  " + AOS_COMMON._Version;
                DirectoryInfo _dir = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\" + "Log");
                if (_dir.Exists == false)
                {
                    _dir.Create();
                }
                //BcilLib.BcilLoger _obj = new BcilLib.BcilLogger();
                AOS_COMMON.mAppLog = new BcilLogger();
                AOS_COMMON.mAppLog.ChangeInterval = BcilLib.BcilLogger.ChangeIntervals.ciHourly;
                AOS_COMMON.mAppLog.EnableLogFiles = true;
                AOS_COMMON.mAppLog.LogDays        = 30;
                AOS_COMMON.mAppLog.LogFilesExt    = "log";
                AOS_COMMON.mAppLog.LogFilesPath   = AppDomain.CurrentDomain.BaseDirectory;
                AOS_COMMON.mAppLog.LogFilesPrefix = "BcilApps-AOSMITH WIP";
                AOS_COMMON.mAppLog.StartLogging();
                AOS_COMMON.mAppLog.LogMessage(BcilLib.EventNotice.EventTypes.evtInfo, "BcilAppsAOSMITH WIPInitialize" + "  ::  Main", "Initializing Application.......");
                txtUserName.Focus();

                //AOS_COMMON.UserName = "******";
                //AOS_COMMON.UserID = "1";

                //txtUserName.Text = "1";
                //txtPassword.Password = "******";
                //  Login_Click(this, null);
                //this.Hide();
                //txtUserName.Focus();
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Arrow;
                AOS_COMMON.mAppLog.LogMessage(EventNotice.EventTypes.evtError, MethodBase.GetCurrentMethod().Name, ex.ToString());

                AOS_COMMON.ShowErrorMsg(ex.ToString(), MsgType.Error);
            }
            this.Cursor = Cursors.Arrow;
        }
Пример #6
0
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_Validation())
                {
                    PR_USERS oprUsers = new PR_USERS();
                    BL_Login oLogin   = new BL_Login();

                    OperationResult opResult = new OperationResult();
                    AOS_ENCRYPTION  oEncrypt = new AOS_ENCRYPTION();

                    oprUsers.USERNAME = txtUserName.Text.ToString();
                    oprUsers.PASSWORD = oEncrypt.Encrypt_data(txtPassword.Password.ToString()).ToString();
                    opResult          = oLogin.ValidateLogin(oprUsers);

                    if (txtUserName.Text == "admin" && txtPassword.Password == "bcil")
                    {
                        AOS_COMMON.UserName = txtUserName.Text;
                        HOME oHome = new HOME();
                        oHome.Show();
                        this.Close();
                        opResult = OperationResult.ActiveUsers;
                    }

                    if (opResult == OperationResult.ActiveUsers)
                    {
                        opResult = oLogin.ValidateUserRights(oprUsers);
                        if (opResult == OperationResult.Invalid)
                        {
                            AOS_COMMON.ShowErrorMsg("Application Version Changed,Pls Update,Contact Your IT Persion", MsgType.Error);
                            txtUserName.Focus();
                            return;
                        }

                        AOS_COMMON.UserName = txtUserName.Text;
                        HOME oHome = new HOME();
                        oHome.Show();
                        this.Close();
                    }
                    else if (opResult == OperationResult.InActiveUsers)
                    {
                        AOS_COMMON.ShowErrorMsg("In-Active User", MsgType.Error);
                        txtUserName.Focus();
                    }
                    else if (opResult == OperationResult.Invalid)
                    {
                        AOS_COMMON.ShowErrorMsg("Invalid UserName Or Password", MsgType.Error);
                        txtUserName.Text     = string.Empty;
                        txtPassword.Password = string.Empty;
                        txtUserName.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Arrow;
                AOS_COMMON.mAppLog.LogMessage(EventNotice.EventTypes.evtError, MethodBase.GetCurrentMethod().Name, ex.ToString());
                AOS_COMMON.ShowErrorMsg(ex.ToString(), MsgType.Error);
            }
        }