private void cmdOK_Click(object sender, EventArgs e) { try { string check_userName = UserBL.GetColumn(String.Format("SELECT UserName FROM Users WHERE UserName='******'", txtUser.Text.Trim())); string check_pwd = UserBL.GetColumn(String.Format("SELECT ISNULL(Password,'') FROM Users WHERE UserName='******'", txtUser.Text.Trim())); if ((check_userName != "")) { //UidBool = check_userName.CompareTo(txtUser.Text.Trim()); if (check_pwd != "") { check_pwd = UserBL.Decrypt(check_pwd); } txtPassword.Text = check_pwd; pwdBool = check_pwd.CompareTo(txtPassword.Text.Trim()); if ((UidBool == 0) && (pwdBool == 0)) { Cursor.Current = Cursors.WaitCursor; BsfGlobal.g_sUserName = txtUser.Text.Trim(); BsfGlobal.g_lUserId = Convert.ToInt32(UserBL.GetColumn(String.Format("SELECT UserId FROM Users WHERE UserName='******'", txtUser.Text.Trim()))); BsfGlobal.CheckPowerUser(BsfGlobal.g_lUserId); BsfGlobal.GetPermission(BsfGlobal.g_lUserId); CommFun.g_iCurrencyDigit = 2; BsfGlobal.InsertLog(DateTime.Now, "Login", "S", "Login", 0, 0, 0, BsfGlobal.g_sWorkFlowDBName, "", BsfGlobal.g_lUserId); //Application.Run(new frmNewMain()); frmHomeScreen HomePage = new frmHomeScreen(); Hide(); ShowInTaskbar = false; HomePage.Show(); Cursor.Current = Cursors.Default; } else { MessageBox.Show("Incorrect Password"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); BsfGlobal.g_lUserId = 1; BsfGlobal.GetDBString(); BsfGlobal.GetPassString(); BsfGlobal.CheckPowerUser(BsfGlobal.g_lUserId); BsfGlobal.CheckDB(); BsfGlobal.GetPermission(BsfGlobal.g_lUserId); DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.OfficeSkins).Assembly); DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.BonusSkins).Assembly); Application.Run(new frmVendorMain()); //BsfGlobal.g_sUserId = string.Empty; //GetDBString(); //GetPassString(); //CheckMenu(); //OpenDB(); //SetCustomColor(g_lUserId); //if (sStr == "1") //{ // //frmNewProj.Execute(""); //} //else if (sStr == "2") //{ // //frmOpenProj.ShowDialog(); //} //else //{ // //frmMDIMain.ShowDialog(); //} //try //{ //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //BsfGlobal.GetDBString(); //string script = File.ReadAllText(Application.StartupPath + "\\SQLQuery1.sql"); //BsfGlobal.OpenVendorAnalDB(); //SqlCommand cmd; //cmd = new SqlCommand("DeleteAllProcedures", BsfGlobal.g_VendorDB); //cmd.CommandType = System.Data.CommandType.StoredProcedure; //cmd.ExecuteNonQuery(); //string[] splitter = new string[] { "\r\nGO\r\n" }; //string[] commandTexts = script.Split(splitter, // StringSplitOptions.RemoveEmptyEntries); //foreach (string commandText in commandTexts) //{ // cmd = new SqlCommand(commandText, BsfGlobal.g_VendorDB); // cmd.CommandType = System.Data.CommandType.Text; // try // { // cmd.ExecuteNonQuery(); // } // catch (Exception e) // { // MessageBox.Show(e.ToString()); // } // Server server = new Server(new ServerConnection(BsfGlobal.OpenVendorAnalDB())); // server.ConnectionContext.ExecuteNonQuery(script); //} //catch (Exception e) //{ // throw e; //} // Application.Run(new frmVendor()); }