private bool ValidateFields() { try { if (txtBrowser.Text == "") { cmnService.J_UserMessage("Please choose the database"); BtnBrowser.Select(); return(false); } if (cmnService.J_IsFileExist(txtBrowser.Text) == false) { cmnService.J_UserMessage("Database doesn't exist in selected path"); BtnBrowser.Select(); return(false); } if (cmnService.J_GetFileName(txtBrowser.Text).ToUpper() != J_Var.J_pMsAccessDatabaseName.ToUpper()) { cmnService.J_UserMessage("Invalid Database."); BtnBrowser.Select(); return(false); } if (dmlService.J_ValidateConnection(txtBrowser.Text, J_Var.J_pMsAccessDatabasePassword) == false) { cmnService.J_UserMessage("Connection Failed...."); BtnBrowser.Focus(); return(false); } return(true); } catch { cmnService.J_UserMessage("Verify the Config Information and Try again.... !!"); BtnBrowser.Focus(); return(false); } }
private bool ValidateFields() { if (cmbServers.SelectedIndex <= 0) { cmn.J_UserMessage("Please Select the SQL Server Machine Name !!"); cmbServers.Focus(); return(false); } if (txtDatabaseUserName.Text.Trim() == "") { cmn.J_UserMessage("Please enter the Database User Name !!"); txtDatabaseUserName.Focus(); return(false); } if (txtDatabasePassword.Text.Trim() == "") { cmn.J_UserMessage("Please enter the Database Password !!"); txtDatabasePassword.Focus(); return(false); } if (cmbDatabase.SelectedIndex <= 0) { cmn.J_UserMessage("Please Select the SQL Database Name !!"); cmbDatabase.Focus(); return(false); } if (dml.J_ValidateConnection(cmbServers.Text.Trim(), txtDatabaseUserName.Text.Trim(), txtDatabasePassword.Text.Trim(), cmbDatabase.Text.Trim()) == true) { return(true); } else { cmn.J_UserMessage("Verify the Config Information and Try again.... !!"); cmbServers.Focus(); return(false); } }
static void Main() { // set the application name J_Var.J_pApplicationName = "BS v1.0"; // set the project name J_Var.J_pProjectName = "Billing System"; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // start block // set some parameters //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // set the Zip password J_Var.J_pZipFilePassword = "******"; // set the Login Screen come or not //J_Var.J_pLoginScreen = J_LoginScreen.NO; #region FOR MOCROSOFT ACCESS DATABASE // ========================================= // FOR MOCROSOFT ACCESS DATABASE // ========================================= J_Var.J_pMsAccessDatabaseName = "BillingSystem.mdb"; J_Var.J_pMsAccessDatabasePassword = ""; J_Var.J_pApplicationType = J_ApplicationType.StandAlone_Network; J_Var.J_pDatabaseType = J_DatabaseType.SqlServer; J_Var.J_pConnectionProviderType = J_ConnectionProviderType.Sql; // ========================================= // ========================================= #endregion #region FOR MOCROSOFT SQL SERVER DATABASE // ========================================= // FOR MOCROSOFT SQL SERVER DATABASE // ========================================= //J_Var.J_pApplicationType = J_ApplicationType.StandAlone_Network; //J_Var.J_pDatabaseType = J_DatabaseType.SqlServer; //J_Var.J_pConnectionProviderType = J_ConnectionProviderType.Sql; // ========================================= // ========================================= #endregion // set the xml file name as connection to database J_Var.J_pXmlConnectionFileName = "_JS_BS.xml"; // set the xml file name as Branch Information J_Var.J_pXmlBranchInfoFileName = "_JS_BS_B.xml"; // set the command time-out J_Var.J_pCommandTimeout = 99999; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // end block //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // declare & initialization objects DMLService dmlService = new DMLService(); CommonService cmnService = new CommonService(); DateService dtService = new DateService(); // set the Operating Syatem type [32 bit | 64 bit] J_Var.J_pOSType = cmnService.J_GetOSType(); // declare & initialization variable string strSQL = string.Empty; // To Check the DateTime Format if (dtService.J_SystemDateFormatCheck_dd_MM_yyyy() == false) { return; } // to check the application type as StandAlone & SingleMachine if (J_Var.J_pApplicationType == J_ApplicationType.StandAlone_SingleMachine) { // to check the microsoft database file is exist or not if (cmnService.J_IsFileExist(Application.StartupPath + "/" + J_Var.J_pMsAccessDatabaseName) == false) { dmlService.Dispose(); cmnService.J_UserMessage("Database file does not exist.\nPlease check the database file"); return; } // to check the connection is possible or not if (dmlService.J_ValidateConnection() == false) { dmlService.Dispose(); cmnService.J_UserMessage("Invalid database.\nPlease check the database"); return; } // to check the MST_FAYEAR table is exist or not if (dmlService.J_IsDatabaseObjectExist("MST_FAYEAR") == false) { dmlService.Dispose(); cmnService.J_UserMessage("Invalid database structure.\nPlease check the database"); return; } // declare & initialize the hashtable object to create the xml file Hashtable nameValue = new Hashtable(); // store values to hashtable nameValue.Add("SERVERNAME", ""); nameValue.Add("DATABASENAME", Application.StartupPath); nameValue.Add("USERNAME", J_Var.J_pMsAccessDatabaseName); nameValue.Add("PASSWORD", J_Var.J_pMsAccessDatabasePassword); // declare & initialize the object of XMLService XMLService objxml = new XMLService(); // create the xml file to connect to the database objxml.J_CreateXMLFile(nameValue, Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName); if (dmlService.J_IsRecordExist("MST_FAYEAR") == true) { dmlService.Dispose(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (J_Var.J_pLoginScreen == J_LoginScreen.YES) { CmnLogin frm = new CmnLogin(); frm.ShowDialog(); frm.Dispose(); } else if (J_Var.J_pLoginScreen == J_LoginScreen.NO) { J_Var.frmMain = new mdiBillingSystem(); J_Var.frmMain.ShowDialog(); } } else { dmlService.Dispose(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CmnCreate1stFAYear frm = new CmnCreate1stFAYear(); frm.ShowDialog(); frm.Dispose(); } return; } // to check the application type as StandAlone, SingleMachine & Browser to Config window if (J_Var.J_pApplicationType == J_ApplicationType.StandAlone_SingleMachineBrowser) { // to check the microsoft xml file is exist or not if (cmnService.J_IsFileExist(Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName) == false) { dmlService.Dispose(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SysServerInfoLocalBrowser frmLocalBrowser = new SysServerInfoLocalBrowser(); frmLocalBrowser.ShowDialog(); frmLocalBrowser.Dispose(); return; } DataSet dsUserInfo = dmlService.J_ConvertXmlToDataSet(Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName); if (dsUserInfo == null) { return; } J_Var.J_pDatabaseName = cmnService.J_Decode(dsUserInfo.Tables[0].Rows[0][cmnService.J_Encode("DATABASENAME")].ToString()); // to check the microsoft database file is exist or not if (cmnService.J_IsFileExist(J_Var.J_pDatabaseName + "/" + J_Var.J_pMsAccessDatabaseName) == false) { dmlService.Dispose(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SysServerInfoLocalBrowser frmLocalBrowser = new SysServerInfoLocalBrowser(); frmLocalBrowser.ShowDialog(); frmLocalBrowser.Dispose(); return; } // to check the connection is possible or not if (dmlService.J_ValidateConnection() == false) { dmlService.Dispose(); cmnService.J_UserMessage("Invalid database.\nPlease check the database"); return; } // to check the MST_FAYEAR table is exist or not if (dmlService.J_IsDatabaseObjectExist("MST_FAYEAR") == false) { dmlService.Dispose(); cmnService.J_UserMessage("Invalid database structure.\nPlease check the database"); return; } // check atleast one fayear data exist or not. if (dmlService.J_IsRecordExist("MST_FAYEAR") == true) { dmlService.Dispose(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (J_Var.J_pLoginScreen == J_LoginScreen.YES) { CmnLogin frm = new CmnLogin(); frm.ShowDialog(); frm.Dispose(); } else if (J_Var.J_pLoginScreen == J_LoginScreen.NO) { J_Var.frmMain = new mdiBillingSystem(); J_Var.frmMain.ShowDialog(); } } else { dmlService.Dispose(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CmnCreate1stFAYear frm = new CmnCreate1stFAYear(); frm.ShowDialog(); frm.Dispose(); } return; } // to check the microsoft xml file is exist or not if (cmnService.J_IsFileExist(Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName) == true) { if (dmlService.J_ValidateConnection() == true) { // check the MST_FAYEAR table exist or not if (dmlService.J_IsDatabaseObjectExist("MST_FAYEAR") == true) { if (dmlService.J_IsRecordExist("MST_FAYEAR") == true) { dmlService.Dispose(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CmnLogin frm = new CmnLogin(); frm.ShowDialog(); frm.Dispose(); } else { dmlService.Dispose(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); CmnCreate1stFAYear frm = new CmnCreate1stFAYear(); frm.ShowDialog(); frm.Dispose(); } return; } } } dmlService.Dispose(); if (J_Var.J_pDatabaseType == J_DatabaseType.MsAccess) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SysServerInfoLocal frmLocal = new SysServerInfoLocal(); frmLocal.ShowDialog(); frmLocal.Dispose(); } else if (J_Var.J_pDatabaseType == J_DatabaseType.SqlServer) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SysServerInfoNetwork frmNetwork = new SysServerInfoNetwork(); frmNetwork.ShowDialog(); frmNetwork.Dispose(); } return; }
private bool ValidateFields() { try { if (txtServerName.Text.Trim() == "") { cmnService.J_UserMessage("Please enter the SQL Server Machine Name !!"); txtServerName.Select(); return(false); } if (J_Var.J_pDatabaseType != J_DatabaseType.MsAccess) { if (txtDatabaseUserName.Text.Trim() == "") { cmnService.J_UserMessage("Please enter the Database User Name !!"); txtDatabaseUserName.Select(); return(false); } if (txtDatabasePassword.Text.Trim() == "") { cmnService.J_UserMessage("Please enter the Database Password !!"); txtDatabasePassword.Select(); return(false); } } if (txtSQLDatabaseName.Text.Trim() == "") { cmnService.J_UserMessage("Please enter the SQL Database Name !!"); txtSQLDatabaseName.Select(); return(false); } this.strServerName = txtServerName.Text.Trim(); this.strUserName = txtDatabaseUserName.Text.Trim(); this.strPassword = txtDatabasePassword.Text.Trim(); this.strDatabaseName = txtSQLDatabaseName.Text.Trim(); if (J_Var.J_pDatabaseType == J_DatabaseType.MsAccess) { if (txtDatabaseUserName.Text.Trim() == "") { this.strUserName = "******"; } else if (txtDatabaseUserName.Text.Trim() != "") { this.strUserName = txtDatabaseUserName.Text.Trim(); } //this.strDatabaseName = cmnService.J_ConvertMsAccessDatabasePath(txtSQLDatabaseName.Text.Trim(), J_Colon.NO); } if (dmlService.J_ValidateConnection(this.strServerName, this.strUserName, this.strPassword, this.strDatabaseName) == false) { cmnService.J_UserMessage("Connection Failed...."); txtServerName.Focus(); return(false); } return(true); } catch { cmnService.J_UserMessage("Verify the Config Information and Try again.... !!"); txtServerName.Focus(); return(false); } }