private void EditPreferencesForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (dataChanged == true)
     {
         CCFBPrefs.Init();
     }
 }
Пример #2
0
 private void logIn()
 {
     if (cboUsers.SelectedIndex >= 0 || cboUsers.Text != "")
     {
         for (int i = 0; i < clsUsers.RowCount; i++)
         {
             if (clsUsers.DSet.Tables[0].Rows[i]["UserName"].ToString().ToUpper() ==
                 cboUsers.Text.ToUpper())
             {
                 if (tbPassword.Text.ToUpper() ==
                     clsUsers.DSet.Tables[0].Rows[i]["Password"].ToString().ToUpper())
                 {
                     CCFBGlobal.currentUser_Name            = clsUsers.DSet.Tables[0].Rows[i]["UserName"].ToString();
                     CCFBGlobal.currentUser_PermissionLevel =
                         getPermissionsInt(clsUsers.DSet.Tables[0].Rows[i].Field <string>("UserRole"));
                     CCFBGlobal.pcName = System.Windows.Forms.SystemInformation.ComputerName;
                     saveToRegistry();
                     writeToDSNValues();
                     CCFBPrefs.Init();
                     CCFBGlobal.LoadTypes();
                     MainForm frmMain = new MainForm(this);
                     this.Visible       = false;
                     this.ShowInTaskbar = false;
                     frmMain.ShowDialog();
                     break;
                 }
                 else
                 {
                     MessageBox.Show("The Password Does Not Match For This User");
                     tbPassword.Text = "";
                     tbPassword.Focus();
                     Application.DoEvents();
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("Please Select A User");
     }
 }
Пример #3
0
        private void logIn(string userName, string pwd)
        {
            if (userName.Length > 0)
            {
                this.Enabled  = false;
                btnCancel.Tag = "login";
                for (int i = 0; i < clsUsers.RowCount; i++)
                {
                    if (cancelLogIn == false)
                    {
                        if (clsUsers.DSet.Tables[0].Rows[i]["UserName"].ToString().ToUpper() == userName)
                        {
                            if (pwd == clsUsers.DSet.Tables[0].Rows[i]["Password"].ToString().ToUpper())
                            {
                                CCFBGlobal.currentUser_Name            = clsUsers.DSet.Tables[0].Rows[i]["UserName"].ToString();
                                CCFBGlobal.currentUser_PermissionLevel =
                                    getPermissionsInt(clsUsers.DSet.Tables[0].Rows[i].Field <string>("UserRole"));
                                CCFBGlobal.pcName     = System.Windows.Forms.SystemInformation.ComputerName;
                                CCFBGlobal.dbUserName = CCFBGlobal.currentUser_Name + "/" + CCFBGlobal.pcName;
                                saveToRegistry();
                                writeToDSNValues();
                                CultureInfo cultureTest = new CultureInfo(CultureInfo.CurrentCulture.LCID, true);
                                if (cultureTest.DateTimeFormat.ShortDatePattern != CCFBGlobal.DefaultShortDateFmt || cultureTest.DateTimeFormat.ShortTimePattern != CCFBGlobal.DefaultShortTimeFmt)
                                {
                                    cultureTest.DateTimeFormat.ShortDatePattern = CCFBGlobal.DefaultShortDateFmt;
                                    cultureTest.DateTimeFormat.ShortTimePattern = CCFBGlobal.DefaultShortTimeFmt;
                                    Application.CurrentCulture = cultureTest;
                                }

                                //CCFBPrefs.Init();
                                CCFBGlobal.LoadTypes();

                                CCFBGlobal.getRegTemplatePath();
                                this.Visible       = false;
                                this.Enabled       = true;
                                this.ShowInTaskbar = false;
                            #if FASTTRACK
                                FastTrackForm formMain = new FastTrackForm(this);
                            #endif
                            #if CCFB
                                CCFBPrefs.Init();
                                formMain = new MainForm(this);
                            #endif
                            #if CUSTSQL
                                formMain = new SelectTables();
                            #endif
                                formMain.ShowDialog();
                                resetForm();
                                break;
                            }
                            else
                            {
                                MessageBox.Show("The Password Does Not Match For This User");
                                tbPassword.Text = "";
                                this.Enabled    = true;
                                tbPassword.Focus();
                                Application.DoEvents();
                            }
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Please Select A User");
            }
            btnCancel.Tag = "";
        }