private void BtnOK_Click(object sender, EventArgs e) { if (ValidateFields() == false) { return; } if (MessageBox.Show(this, "Are you sure to change your Password ?", J_Var.J_pProjectName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { dmlService.J_BeginTransaction(); strSQL = "UPDATE MST_USER " + "SET USER_PASSWORD = '******'" + "WHERE BRANCH_ID = " + J_Var.J_pBranchId + " " + "AND USER_ID = " + J_Var.J_pUserId + ""; if (dmlService.J_ExecSql(strSQL) == false) { dmlService.J_Rollback(); return; } dmlService.J_Commit(); cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, "Password Updated to :: ******* "); dmlService.Dispose(); Application.Restart(); } }
private void BtnCancel_Click(object sender, EventArgs e) { dmlService.Dispose(); this.Close(); this.Dispose(); }
private void BtnOK_Click(object sender, EventArgs e) { try { // Check the Validation if (ValidateFields() == false) { return; } // Make the query string for Company Information strSQL = "SELECT " + cmnService.J_SQLDBFormat("MST_SETUP.BRANCH_ID", J_ColumnType.Integer, J_SQLColFormat.NullCheck) + " AS BRANCH_ID," + " " + cmnService.J_SQLDBFormat("MST_SETUP.BRANCH_CODE", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS BRANCH_CODE," + " " + cmnService.J_SQLDBFormat("MST_SETUP.BRANCH_NAME", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS BRANCH_NAME," + " " + cmnService.J_SQLDBFormat("MST_SETUP.COMPANY_NAME", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS COMPANY_NAME," + " " + cmnService.J_SQLDBFormat("MST_SETUP.ADDRESS", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS ADDRESS," + " " + cmnService.J_SQLDBFormat("MST_SETUP.START_DATE", J_ColumnType.Date, J_SQLColFormat.DateFormatDDMMYYYY) + " AS START_DATE," + " " + cmnService.J_SQLDBFormat("MST_SETUP.SAVE_CONFIRMATION_MSG", J_ColumnType.Integer, J_SQLColFormat.NullCheck) + " AS SAVE_CONFIRMATION_MSG," + " " + cmnService.J_SQLDBFormat("MST_SETUP.NETWORK_CREDENTIAL_USERNAME", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS NETWORK_CREDENTIAL_USERNAME," + " " + cmnService.J_SQLDBFormat("MST_SETUP.NETWORK_CREDENTIAL_PASSWORD", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS NETWORK_CREDENTIAL_PASSWORD," + " " + cmnService.J_SQLDBFormat("MST_SETUP.NETWORK_CREDENTIAL_PORT", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS NETWORK_CREDENTIAL_PORT," + " " + cmnService.J_SQLDBFormat("MST_SETUP.NETWORK_CREDENTIAL_HOST", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS NETWORK_CREDENTIAL_HOST, " + " " + cmnService.J_SQLDBFormat("MST_SETUP.SMS_WORKING_KEY", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS SMS_WORKING_KEY, " + " " + cmnService.J_SQLDBFormat("MST_SETUP.SMS_OFFLINE_INVOICE_MESSAGE", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS SMS_OFFLINE_INVOICE_MESSAGE, " + " " + cmnService.J_SQLDBFormat("MST_SETUP.SMS_ONLINE_INVOICE_MESSAGE", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS SMS_ONLINE_INVOICE_MESSAGE, " + " " + cmnService.J_SQLDBFormat("MST_SETUP.SMS_SENDER_NAME", J_ColumnType.String, J_SQLColFormat.NullCheck) + " AS SMS_SENDER_NAME " + "FROM MST_SETUP " + "WHERE MST_SETUP.BRANCH_ID = " + J_Var.J_pBranchId + ""; // return the data reader as per above query string this.reader = dmlService.J_ExecSqlReturnReader(strSQL); // check the given reader is null if (reader == null) { cmbLoginId.Select(); return; } // fetch the data from reader while (reader.Read()) { J_Var.J_pBranchId = Convert.ToInt32(Convert.ToString(reader["BRANCH_ID"])); J_Var.J_pBranchCode = Convert.ToString(reader["BRANCH_CODE"]); J_Var.J_pBranchName = Convert.ToString(reader["BRANCH_NAME"]); J_Var.J_pCompanyName = Convert.ToString(reader["COMPANY_NAME"]); J_Var.J_pBranchAddress = Convert.ToString(reader["ADDRESS"]); J_Var.J_pSoftwareStartDate = Convert.ToString(reader["START_DATE"]); J_Var.J_pSaveConfirmMsg = Convert.ToInt32(Convert.ToString(reader["SAVE_CONFIRMATION_MSG"])); //ADDED BY DHRUB ON 31/01/2015 FOR SEND EMAIL AGAINST IVOICE J_Var.J_pNetworkCredential_Username = Convert.ToString(Convert.ToString(reader["NETWORK_CREDENTIAL_USERNAME"])); J_Var.J_pNetworkCredential_Password = Convert.ToString(Convert.ToString(reader["NETWORK_CREDENTIAL_PASSWORD"])); J_Var.J_pNetworkCredential_Port = Convert.ToString(Convert.ToString(reader["NETWORK_CREDENTIAL_PORT"])); J_Var.J_pNetworkCredential_Host = Convert.ToString(Convert.ToString(reader["NETWORK_CREDENTIAL_HOST"])); //ADDED BY DHRUB ON 31/01/2015 FOR SEND EMAIL AGAINST IVOICE J_Var.J_pSMS_WorkingKey = Convert.ToString(Convert.ToString(reader["SMS_WORKING_KEY"])); J_Var.J_pOfflineInvoiceSMS_Text = Convert.ToString(Convert.ToString(reader["SMS_OFFLINE_INVOICE_MESSAGE"])); J_Var.J_pOnlineInvoiceSMS_Text = Convert.ToString(Convert.ToString(reader["SMS_ONLINE_INVOICE_MESSAGE"])); J_Var.J_pSMS_SenderName = Convert.ToString(Convert.ToString(reader["SMS_SENDER_NAME"])); } // reader is closed & disposed this.reader.Close(); this.reader.Dispose(); // Make the query string strSQL = "SELECT USER_ID," + " DISPLAY_NAME," + " USER_CATEGORY " + "FROM MST_USER " + "WHERE " + cmnService.J_SQLDBFormat("LOGIN_ID", J_SQLColFormat.UCase) + " = '" + cmnService.J_ReplaceQuote(cmbLoginId.Text.ToUpper().Trim()) + "' " + "AND USER_PASSWORD = '******' "; if (cmbLoginId.Text.ToUpper() != "ADMIN") { strSQL = strSQL + "AND BRANCH_ID = " + J_Var.J_pBranchId + " "; } // return the dataset as per above query string DataSet ds = dmlService.J_ExecSqlReturnDataSet(strSQL); // check the given dataset is null if (ds == null) { cmbLoginId.Select(); return; } if (ds.Tables[0].Rows.Count > 0) { J_Var.J_pUserId = Convert.ToInt32(Convert.ToString(ds.Tables[0].Rows[0][0])); J_Var.J_pLoginId = cmnService.J_ReplaceQuote(cmbLoginId.Text.ToUpper().Trim()); J_Var.J_pUserDisplayName = Convert.ToString(ds.Tables[0].Rows[0][1]); J_Var.J_pUserCategory = Convert.ToInt32(Convert.ToString(ds.Tables[0].Rows[0][2])); // Close & Dispose the MstLogin Class dmlService.Dispose(); this.Close(); this.Dispose(); if (J_Var.J_pLoginStatus == 1) { J_Var.frmMain.Close(); J_Var.frmMain.Dispose(); } Hashtable nameValue = new Hashtable(); nameValue.Add("BRANCHINFO", J_Var.J_pBranchCode); XMLService objxml = new XMLService(); objxml.J_CreateXMLFile(nameValue, Application.StartupPath + "/" + J_Var.J_pXmlBranchInfoFileName, "BRANCHINFO"); // Create object of MDI Class J_Var.frmMain = new mdiBillingSystem(); J_Var.frmMain.ShowDialog(); } else { cmbLoginId.Select(); } } catch (Exception err_handler) { this.reader.Close(); this.reader.Dispose(); cmnService.J_UserMessage(err_handler.Message); cmbLoginId.Select(); } }
private void BtnExit_Click(object sender, System.EventArgs e) { dmlService.Dispose(); this.Close(); this.Dispose(); }
private void mdiBillingSystem_FormClosing(object sender, FormClosingEventArgs e) { dmlService.Dispose(); cmnService.Dispose(); }
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 void BtnSave_Click(object sender, EventArgs e) { try { // All validation if (ValidateFields() == false) { return; } // Transaction is started dmlService.J_BeginTransaction(); //--------------------------------------------- strSQL = @" UPDATE MST_PARTY SET MOBILE_NO = '" + cmnService.J_ReplaceQuote(txtMobileNo.Text.Trim()) + @"', EMAIL_ID = '" + cmnService.J_ReplaceQuote(txtEmailID.Text.Trim()) + @"', CONTACT_PERSON = '" + cmnService.J_ReplaceQuote(txtContactPersonName.Text.Trim()) + @"' WHERE PARTY_ID = " + lngPartyId; if (dmlService.J_ExecSql(strSQL) == false) { //Rollback Transaction dmlService.J_Rollback(); return; } //--------------------------------------------- //Commit Transaction //--------------------------------------------- dmlService.J_Commit(); //--------------------------------------------- BS.BS_PartyContactPerson = cmnService.J_ReplaceQuote(txtContactPersonName.Text.Trim()); BS.BS_PartyMobNo = cmnService.J_ReplaceQuote(txtMobileNo.Text.Trim()); BS.BS_PartyEmailId = cmnService.J_ReplaceQuote(txtEmailID.Text.Trim()); // if (chkSMS.Checked == true) { BS.BS_PartySendSMS = true; } else { BS.BS_PartySendSMS = false; } // if (chkEmail.Checked == true) { BS.BS_PartySendEmail = true; } else { BS.BS_PartySendEmail = false; } //--------------------------------------------- BS.BS_SaveInvoiceStatus = true; dmlService.Dispose(); this.Close(); this.Dispose(); } catch (Exception err) { //Rollback Transaction dmlService.J_Rollback(); cmnService.J_UserMessage(err.Message); } }
private void BtnSubmit_Click(object sender, EventArgs e) { try { // all validations if (ValidateFields() == false) { return; } string strDatabasePath = cmnService.J_GetDirectoryName(txtBrowser.Text); // create the connection xml file Hashtable nameValue = new Hashtable(); nameValue.Add("SERVERNAME", ""); nameValue.Add("DATABASENAME", strDatabasePath); nameValue.Add("USERNAME", J_Var.J_pMsAccessDatabaseName); nameValue.Add("PASSWORD", J_Var.J_pMsAccessDatabasePassword); XMLService objxml = new XMLService(); objxml.J_CreateXMLFile(nameValue, Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName); if (dmlService.J_IsDatabaseObjectExist("MST_FAYEAR") == true) { // Close & Dispose the MstLogin Class this.Close(); this.Dispose(); // Close & Dispose the main Class if (J_Var.J_pLoginStatus == 1) { J_Var.frmMain.Close(); J_Var.frmMain.Dispose(); } if (dmlService.J_IsRecordExist("MST_FAYEAR") == true) { dmlService.Dispose(); 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(); CmnCreate1stFAYear frm = new CmnCreate1stFAYear(); frm.ShowDialog(); frm.Dispose(); } return; } else { dmlService.Dispose(); cmnService.J_UserMessage("Invalid database structure.\nPlease check the database"); BtnBrowser.Focus(); return; } } catch (Exception err_handler) { dmlService.Dispose(); cmnService.J_UserMessage(err_handler.Message); } }