Esempio n. 1
0
        private void logIn(string userName, string pwd)
        {
            if (userName != "")
            {
                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();


                                this.Visible       = false;
                                this.Enabled       = true;
                                this.ShowInTaskbar = false;
    #if FASTTRACK
                                FastTrackForm formMain = new FastTrackForm(this);
    #endif
    #if CCFB
                                formMain = new MainForm(this);
    #endif
    #if VolLog
                                formMain = new VolLogMain(this);
    #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 = "";
        }
Esempio n. 2
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 = "";
        }