Exemple #1
0
        public void loadformChoice(string user, string OLTPName)
        {
            FormChoice frm = new FormChoice(user, OLTPName);

            frm.ShowDialog();
        }
        private void Login()
        {
            string Username = comboBox2.Text;
            string Password = q.getPass(comboBox2.Text, prefix);


            string[] arr = Username.Split('_');
            bool     b   = false;
            //try
            //{
            //    b = q.checklogin(Username, g.GetSHA1HashData(Password.Trim()), arr[0].Trim());
            //}
            //catch
            //{
            //    //MessageBox.Show("Sorry your credentials were wrong. Please try again");
            //    //Password = "";
            //    //Username = "";
            //}
            //if (b)
            //{
            //    if (q.checkFirstLogin(arr[0].Trim(), Username.Trim()))
            //    {
            //        SetPassword pass = new SetPassword(Username);
            //        pass.ShowDialog();
            //    }
            int    roleid = q.getrole(Username.Trim(), arr[0].Trim());
            string config = q.checkprojectConfigured(arr[0]);

            if (roleid == 0)
            {
                Thread tDBA = new Thread(loadDBA);
                tDBA.Start();
                this.Close();
            }
            else if (roleid == 1)
            {
                user = Username.Trim();
                if (config == "False")
                {
                    Thread tBasicDetails = new Thread(loadBasicDetails);
                    tBasicDetails.Start();
                }
                else
                {
                    Thread tMainBackend = new Thread(loadMainbackend);
                    tMainBackend.TrySetApartmentState(ApartmentState.STA);
                    tMainBackend.Start();
                }
                //Thread.Sleep(2000);
                try
                {
                    this.Close();
                }
                catch { }
            }
            else if (roleid == 2)
            {
                user = Username.Trim();
                if (config == "False")
                {
                    MessageBox.Show("Sorry Database has not been configured by your Admin. Please try after some time");
                    return;
                }
                string     OLTPName = q.getOLTPName(q.getProjID(user));
                FormChoice frm      = new FormChoice(user, OLTPName);
                frm.ShowDialog();
            }
            else if (roleid == 3)
            {
                user = Username.Trim();
                Thread tMainBackend = new Thread(loadMainbackend);
                tMainBackend.Start();
                try
                {
                    this.Close();
                }
                catch { }
            }
        }