public Boolean fncBlank() { if (txtExchangeRate.Text.ToString().Trim() == "") { MessageBox.Show("Provide Exchange Rate."); return(true); } else if (clsProc.GTRValidateDouble(txtExchangeRate.Text.ToString().Trim()) <= 0) { MessageBox.Show("Exchange Rate Must be grater than Zero."); return(true); } return(false); }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); string sqlQuery = ""; Int64 NewId = 0; Int64 ChkData = 0; DateTime lastDay = new DateTime(dtInputDate.DateTime.Year, dtInputDate.DateTime.Month, 1); lastDay = lastDay.AddMonths(1); lastDay = lastDay.AddDays(-(lastDay.Day)); dtInputDate.Value = lastDay; try { //Member Master Table if (btnSave.Text.ToString() != "&Save") { //Update data sqlQuery = " Update tblSal_Suspense Set dtInput = '" + clsProc.GTRDate(dtInputDate.Value.ToString()) + "', amount = '" + clsProc.GTRValidateDouble(txtAmt.Value.ToString()) + "',remarks = '" + txtRemarks.Text.ToString() + "' Where advID = " + Int32.Parse(txtId.Text.ToString()); arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement,PCName, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Update')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Succefully."); } else { //add new //sqlQuery = "Select Isnull(Max(advID),0)+1 As NewId from tblSal_Suspense"; //NewId = clsCon.GTRCountingData(sqlQuery); sqlQuery = "Select dbo.fncCheckData (" + Common.Classes.clsMain.intComId + ",'" + cboEmpID.Value.ToString() + "','" + clsProc.GTRDate(dtInputDate.Value.ToString()) + "','Salary Advance')"; ChkData = clsCon.GTRCountingDataLarge(sqlQuery); if (ChkData == 1) { MessageBox.Show("This employee's advance amount already inputted. Please select another employee Id."); return; } //Insert data sqlQuery = "Insert Into tblSal_Suspense ( empid, dtInput,amount, Remarks,LUserId,comid ,PcName) " + " Values ('" + cboEmpID.Value.ToString() + "', '" + clsProc.GTRDate(dtInputDate.Value.ToString()) + "', '" + clsProc.GTRValidateDouble(txtAmt.Value.ToString()) + "', '" + txtRemarks.Text.ToString() + "'," + Common.Classes.clsMain.intUserId + "," + Common.Classes.clsMain.intComId + ",'" + Common.Classes.clsMain.strComputerName + "')"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement,PCName, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Insert')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Succefully."); } prcClearData(); cboEmpID.Focus(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { //Member Master Table if (btnSave.Text.ToString() != "&Save") { //Update data sqlQuery = " Update tblMobile_Deduct Set dtInput = '" + clsProc.GTRDate(dtInputDate.Value.ToString()) + "', amount = '" + clsProc.GTRValidateDouble(txtAmt.Value.ToString()) + "',remarks = '" + txtRemarks.Text.ToString() + "' Where dedctId = " + Int32.Parse(txtId.Text.ToString()); arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName,tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Update')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Succefully."); } else { //add new sqlQuery = "Select Isnull(Max(dedctId),0)+1 As NewId from tblMobile_Deduct"; NewId = clsCon.GTRCountingData(sqlQuery); //Insert data sqlQuery = "Insert Into tblMobile_Deduct ( aId,dedctId, empid, dtInput,amount, Remarks,LUserId,comid ,PcName) " + " Values (" + NewId + ", " + NewId + ", '" + cboEmpID.Value.ToString() + "', '" + clsProc.GTRDate(dtInputDate.Value.ToString()) + "', '" + clsProc.GTRValidateDouble(txtAmt.Value.ToString()) + "', '" + txtRemarks.Text.ToString() + "'," + Common.Classes.clsMain.intUserId + "," + Common.Classes.clsMain.intComId + ",'" + Common.Classes.clsMain.strComputerName + "')"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName,tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Insert')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Succefully."); } prcClearData(); cboEmpID.Focus(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }