private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(); string sqlQuery = ""; try { //Member Master Table if (txtCode.Text.Length != 0) { //Update sqlQuery = "Exec prcTran_HaySystem 'Update', " + Common.Classes.clsMain.intComId + ", " + Int32.Parse(txtCode.Tag.ToString()) + ", '" + txtName.Text + "', '" + txtNameShort.Text + "', '" + optType.Tag.ToString() + "', " + cboUnder.Value + ""; 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); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Succefully"); } else { //add new sqlQuery = "Exec prcTran_HaySystem 'NEW', " + Common.Classes.clsMain.intComId + ", 0, '" + txtName.Text + "', '" + txtNameShort.Text + "', '" + optType.Tag.ToString() + "', " + cboUnder.Value + ""; 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); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Succefully"); } prcClearData(); prcLoadList(); prcLoadCombo(); optType.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(); int NewId = 0; string sqlQuery = ""; try { int rowCount; for (rowCount = 0; rowCount < dsList.Tables["Grid"].Rows.Count; rowCount++) { if (dsList.Tables["Grid"].Rows[rowCount][0].ToString().Trim().Length > 0 && dsList.Tables["Grid"].Rows[rowCount]["Flag"].ToString() == "1") { //Update Table sqlQuery = "Update tblMachineNo_GTR Set IpAddress = '" + dsList.Tables["Grid"].Rows[rowCount][2] + "', Location = '" + dsList.Tables["Grid"].Rows[rowCount][3] + "', isActive = '" + dsList.Tables["Grid"].Rows[rowCount][4] + "', isTFT = '" + dsList.Tables["Grid"].Rows[rowCount][5] + "' where Id = '" + dsList.Tables["Grid"].Rows[rowCount][1] + "' and ComId = " + Common.Classes.clsMain.intComId + ""; arQuery.Add(sqlQuery); } else if (dsList.Tables["Grid"].Rows[rowCount][0].ToString().Trim().Length == 0) { // Insert To Table sqlQuery = "Insert into tblMachineNo_GTR(ComId, IpAddress, Location, isActive, isTFT) values(" + Common.Classes.clsMain.intComId + ",'" + dsList.Tables["Grid"].Rows[rowCount][2] + "','" + dsList.Tables["Grid"].Rows[rowCount][3] + "','" + dsList.Tables["Grid"].Rows[rowCount][4] + "','" + dsList.Tables["Grid"].Rows[rowCount][5] + "')"; arQuery.Add(sqlQuery); } // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Insert')"; arQuery.Add(sqlQuery); } clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved [Or/And ] Update Succefully"); prcLoadList(); btnSave.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private Boolean fncSoftwareExDate() { try { string sqlQuery = ""; System.Data.DataSet dsCheck = new System.Data.DataSet(); clsConnection clscon = new clsConnection(); sqlQuery = "select exDate,isInActive from tbl_varMenu"; clscon.GTRFillDatasetWithSQLCommand(ref dsCheck, sqlQuery); dsCheck.Tables[0].TableName = "CheckDate"; DataRow dr; dr = dsCheck.Tables["CheckDate"].Rows[0]; dtCheck.Value = dr["exDate"]; string isInactive = dr["isInActive"].ToString(); if (dtCheck.Value.ToString() == DateTime.Now.Date.ToString() || isInactive == "1") { sqlQuery = "update tbl_varMenu set isInActive=1"; clscon.GTRSaveDataWithSQLCommand(sqlQuery); frmMaster frm = new frmMaster(); frm.Close(); return(true); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return(false); }
private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to delete Group/End Group information of [" + txtName.Text + "]", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(); try { //sqlQuery = "Exec prcTran_HaySystem 'DELETE', " + Common.Classes.clsMain.intComId + ", " + Int32.Parse(txtCode.Tag.ToString()) + ",'" + txtCode.Text.ToString() + "', '', '', '"+optType.Tag.ToString()+"', " + cboUnder.Value + ""; string sqlQuery = ""; sqlQuery = "Exec prcTran_HaySystem 'DELETE', " + Common.Classes.clsMain.intComId + ", " + Int32.Parse(txtCode.Tag.ToString()) + ",'" + txtCode.Text.ToString() + "', '','" + optType.Tag.ToString() + "', " + cboUnder.Value + ""; 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 + "','Delete')"; arQuery.Add(sqlQuery); clsCon.GTRSaveDataWithSQLCommand(arQuery); prcClearData(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
private void btnProcess_Click(object sender, EventArgs e) { clsConnection clsCon = new clsConnection(); ArrayList arQuery = new ArrayList(); try { string SQLQuery = "Exec prcProcessDN " + Common.Classes.clsMain.intComId + ", '" + txtFileName.Tag.ToString() + "', '" + txtProcessNo.Text.ToString() + "', " + Common.Classes.clsMain.intUserId + ", '" + Common.Classes.clsMain.strComputerName + "'"; arQuery.Add(SQLQuery); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data processed successfully."); btnProcess.Enabled = false; prcLoadList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
private void prcSaveData(DataSet ds) { clsConnection clsCon = new clsConnection(); ArrayList arQuery = new ArrayList(); try { // Clear Existing Data string query = "Truncate Table tblDN_xls"; clsCon.GTRSaveDataWithSQLCommand(query); txtProcessNo.Text = DateTime.Now.ToString("yyyyMMddHHmmss"); string dtProcess = DateTime.Today.ToString("dd-MMM-yyyy"); //Generating Insert Statement Row By Row for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (ds.Tables[0].Rows[i][0].ToString().Replace("'", "").Length > 0) { string sqlQuery = "Insert Into tblDN_xls (ComId, xlsFileName, dtProcess, EntryNo, Consignee, BookingNo, Carrier, FVessel, ETDCGP, ETAHub, MVessel, ETDHub, ETADestination, ContainerNo, " + " SealNo, Size, Type, Shipper, PO, ItemNo, ttlCartoon, ttlPCS, ttlCBM, ttlGrossWT, Mode, ttlLP, dtRcvdCGO, dtDocRcvd, dtStuffing, " + " Desitnation, ShipBillNo, VAT, HBLNo, OBLNo, Remarks, PayTerms, NoOfOriginal) " + " Values(" + Common.Classes.clsMain.intComId + ",'" + txtFileName.Tag.ToString() + "', '" + dtProcess + "','" + txtProcessNo.Text.ToString() + "', '" + ds.Tables[0].Rows[i][0].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][1].ToString().Replace("'", "") + "','" + ds.Tables[0].Rows[i][2].ToString().Replace("'", "") + "', " + " '" + ds.Tables[0].Rows[i][3].ToString().Replace("'", "") + "', '" + clsProc.GTRDate(ds.Tables[0].Rows[i][4].ToString().Replace("'", "")) + "', " + " '" + ds.Tables[0].Rows[i][5].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][6].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][7].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][8].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][9].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][10].ToString().Replace("'", "") + "', " + " '" + ds.Tables[0].Rows[i][11].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][12].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][13].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][14].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][15].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][16].ToString().Replace("'", "").Replace("NA", "0").Replace("N/A", "0") + "', " + " '" + ds.Tables[0].Rows[i][17].ToString().Replace("'", "").Replace("NA", "0").Replace("N/A", "0") + "', '" + ds.Tables[0].Rows[i][18].ToString().Replace("'", "").Replace("NA", "0").Replace("N/A", "0") + "', '" + ds.Tables[0].Rows[i][19].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][20].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][21].ToString().Replace("'", "").Replace("NA", "0").Replace("N/A", "0") + "', '" + ds.Tables[0].Rows[i][22].ToString().Replace("'", "") + "', " + " '" + ds.Tables[0].Rows[i][23].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][24].ToString().Replace("'", "''") + "', '" + ds.Tables[0].Rows[i][25].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][26].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][27].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][28].ToString().Replace("'", "") + "', " + " '" + ds.Tables[0].Rows[i][29].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][30].ToString().Replace("'", "''") + "', '" + ds.Tables[0].Rows[i][31].ToString().Replace("'", "") + "', '" + ds.Tables[0].Rows[i][32].ToString().Replace("'", "") + "')"; arQuery.Add(sqlQuery); } } //Transaction with database server clsCon.GTRSaveDataWithSQLCommand(arQuery); } catch (Exception ex) { throw (ex); } finally { arQuery = null; clsCon = null; } }
private void btnReport_Click(object sender, EventArgs e) { ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int32 NewId = 0; string ReportPath = "", SQLQuery1 = "", FormCaption = "", DataSourceName = "DataSet1"; DataSourceName = "DataSet1"; FormCaption = "Report :: Loan Information..."; try { sqlQuery = "Delete tblTempLoan"; arQuery.Add(sqlQuery); foreach (UltraGridRow row in this.gridData.Rows) { sqlQuery = "Insert Into tblTempLoan (ComId, EmpId, InstallmentNo,LoanAmt,instAmt,Balance,InterestAmt,FlatAmt,DeductAmt,dtFrom,dtTo,Rate)" + " Values ('" + Common.Classes.clsMain.intComId + "', '" + cboEmpID.Value.ToString() + "', '" + row.Cells["InstallmentNo"].Text.ToString() + "','" + row.Cells["LoanAmt"].Text.ToString() + "','" + row.Cells["instAmt"].Text.ToString() + "','" + row.Cells["Balance"].Text.ToString() + "','" + row.Cells["InterestAmt"].Text.ToString() + "','" + row.Cells["FlatAmt"].Text.ToString() + "','" + row.Cells["DeductAmt"].Text.ToString() + "','" + row.Cells["dtFrom"].Text.ToString() + "','" + row.Cells["dtTo"].Text.ToString() + "'," + txtRate.Value.ToString() + ")"; arQuery.Add(sqlQuery); } //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); ReportPath = Common.Classes.clsMain.AppPath + @"\Payroll\Reports\rptLoan.rdlc"; SQLQuery1 = "Exec [rptLoanTemp] " + Common.Classes.clsMain.intComId + ",'" + cboEmpID.Value.ToString() + "'"; clsReport.strReportPathMain = ReportPath; clsReport.strQueryMain = SQLQuery1; clsReport.strDSNMain = DataSourceName; FM.prcShowReport(FormCaption); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnIncFracUp_Click(object sender, EventArgs e) { if (fncBlankFr()) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new clsConnection(); string sqlQuery = ""; int year = dtInc.DateTime.Year; DateTime YearfirstDay = new DateTime(year, 1, 1); dtInc.Value = YearfirstDay; try { sqlQuery = "Exec prcProcessIncrement " + Common.Classes.clsMain.intComId + ",'" + this.clsProc.GTRDate(this.dtInc.Value.ToString()) + "','" + this.clsProc.GTRDate(this.dtJoinFrom.Value.ToString()) + "','" + this.clsProc.GTRDate(this.dtJoinTo.Value.ToString()) + "','" + txtRateFr.Value.ToString() + "','" + txtPerFr.Value.ToString() + "','" + cboEmpId.Value.ToString() + "',2"; arQuery.Add(sqlQuery); sqlQuery = "Update tblEmp_Incr Set NewSal = '" + txtPrSalFr.Value.ToString() + "',NewSalUSD = '" + txtPrUSDFr.Value.ToString() + "',FMonth = '" + txtMonth.Value.ToString() + "' Where ComId = " + Common.Classes.clsMain.intComId + " and EmpId = '" + cboEmpId.Value.ToString() + "' and dtInc = '" + this.clsProc.GTRDate(this.dtInc.Value.ToString()) + "' and IncYearly in (1,2)"; arQuery.Add(sqlQuery); sqlQuery = "Exec prcProcessIncrement " + Common.Classes.clsMain.intComId + ",'" + this.clsProc.GTRDate(this.dtInc.Value.ToString()) + "','" + this.clsProc.GTRDate(this.dtJoinFrom.Value.ToString()) + "','" + this.clsProc.GTRDate(this.dtJoinTo.Value.ToString()) + "','" + txtRateFr.Value.ToString() + "','" + txtPerFr.Value.ToString() + "','" + cboEmpId.Value.ToString() + "',3"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Insert')"; arQuery.Add(sqlQuery); sqlQuery = "Update tblEmp_Incr Set LUserId = " + GTRHRIS.Common.Classes.clsMain.intUserId + ",PCName = '" + Common.Classes.clsMain.strComputerName + "' Where ComId = " + Common.Classes.clsMain.intComId + " and EmpId = '" + cboEmpId.Value.ToString() + "' and dtInc = '" + this.clsProc.GTRDate(this.dtInc.Value.ToString()) + "' and IncYearly in (1,2)"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Successfully"); prcClearData(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
//private void txtInstallNo_ValueChanged(object sender, EventArgs e) //{ // if (txtAmt.Text.Length == 0) // { // txtAmt.Value = 0; // txtInstallNo.Value = 0; // txtInstallAmnt.Value = 0; // } // //if (double.Parse(txtAmt.Value.ToString()) > 0 && double.Parse(txtRate.Value.ToString()) >= 0) // //{ // // txtInstallAmnt.Value = ((double.Parse(txtAmt.Value.ToString())) / (double.Parse(txtInstallNo.Value.ToString()))); // // txtFlat.Value = ((((double.Parse(txtAmt.Value.ToString())) * (double.Parse(txtRate.Value.ToString()))) / 100) / (double.Parse(txtInstallNo.Value.ToString()))); // //} // if (double.Parse(txtAmt.Value.ToString()) > 0) // { // txtInstallAmnt.Value = ((double.Parse(txtAmt.Value.ToString())) / (double.Parse(txtInstallNo.Value.ToString()))); // } // if (double.Parse(txtRate.Value.ToString()) >= 0) // { // txtInstallAmnt.Value = ((double.Parse(txtAmt.Value.ToString())) / (double.Parse(txtInstallNo.Value.ToString()))); // txtFlat.Value = ((((double.Parse(txtAmt.Value.ToString())) * (double.Parse(txtRate.Value.ToString()))) / 100) / (double.Parse(txtInstallNo.Value.ToString()))); // } //} private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to delete Loan for selected Employee.", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new clsConnection(); string sqlQuery = ""; try { sqlQuery = " Delete From tblLoan Where loanid = " + Int32.Parse(txtId.Text.ToString()) + " "; arQuery.Add(sqlQuery); sqlQuery = " Delete From tblLoan_Data Where loanid = " + 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 (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Delete')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Delete Successfully"); prcClearData(); prcLoadList(); prcLoadCombo(); cboEmpID.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void prcImportData() { //Getting Selected File Information From List prcGetListviewData(); clsConnection clsCon = new clsConnection(); ArrayList arQuery = new ArrayList(); string sqlQuery = ""; try { using (StreamReader sr = new StreamReader(File.Open(strFileNameWithLoc, FileMode.Open))) { string line = ""; while (!string.IsNullOrEmpty(line = sr.ReadLine())) { string[] parts = line.Split(new string[] { ":" }, StringSplitOptions.None); string strTime = parts[3] + ":" + parts[4] + ":" + parts[5]; string strStNo = DateTime.Parse(parts[2].ToString()).ToString("dd:MM:yyyy").Replace(":", ""); strStNo += DateTime.Parse(strTime.ToString()).ToString("HH:mm:ss").Replace(":", ""); sqlQuery = string.Format( " INSERT INTO tblRawData ( DeviceNo, cardno, dtPunchDate, dtPunchTime, stNo, PCName, LUserId) " + " VALUES ('{0}','{1}','{2}','{3}', '{4}', '{5}', '{6}')", parts[0], parts[1], parts[2], strTime, double.Parse(strStNo), clsProc.GTRGetComputerName(), Common.Classes.clsMain.intUserId); arQuery.Add(sqlQuery); } } sqlQuery = "Update tblRawdata Set EmpId = B.EmpId, IsNew = 1 From tblRawdata AS A Inner Join tblEmp_Info As B On A.CardNo = B.CardNo Where IsNew = 0 "; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); //Moving Data To Another Folder prcTransferDataFile(); MessageBox.Show("Data collection completed successfully."); } catch (Exception ex) { throw(ex); } finally { arQuery = null; clsCon = null; } }
private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to Delete this IP Address ?", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(); string sqlQuery = ""; try { foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.gridDetails.Rows) { if (row.Cells["Id"].Text.ToString().Length != 0 && row.Cells["isChecked"].Value.ToString() == "1" && row.Cells["IpAddress"].Text.ToString().Length != 0) { //Delete Data sqlQuery = "Delete from tblMachineNo_GTR Where Id= '" + row.Cells["Id"].Text.ToString() + "'"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Insert')"; arQuery.Add(sqlQuery); } } clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Deleted Succefully Complete."); prcLoadList(); } 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 clsConnection(); string sqlQuery = ""; try { sqlQuery = "Update tblEmp_Info Set RegNo = '" + txtReg.Value.ToString() + "', dtPF = '" + clsProc.GTRDate(this.dtPF.Value.ToString()) + "' Where ComID = " + Common.Classes.clsMain.intComId + " and EmpID = '" + cboCode.Value.ToString() + "'"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType)" + " Values (" + GTRHRIS.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("Employee PF Info Update Successfully"); prcClearData(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //arQuery = null; //clsCon = null; } }
private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to delete SRR information of [" + txtTimes.Text + "]", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } string sqlQuery = ""; ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(""); try { //sqlQuery = "Update tblStr_Issue_Main Set Isposted=2 where IssueId=" + // int.Parse(txtsrid.Text.ToString()) + ""; //arQuery.Add(sqlQuery); //sqlQuery = "Exec prcProcessStoreUnPost '" + clsProc.GTRDate(dtDate.Value.ToString()) + "'," + // Common.Classes.clsMain.intComId + ""; //arQuery.Add(sqlQuery); sqlQuery = "Delete from tblStr_Issue_Main Where IssueId = " + Int64.Parse(txtTimes.Text.ToString()) + ""; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into GTRHRIS.dbo.tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Delete')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Delete SuccessFuly"); prcClearData(); prcLoadList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnDelete_Click(object sender, EventArgs e) { if ( MessageBox.Show("Do you want to delete Company information of [" + txtName.Text + "]", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(); try { string sqlQuery = ""; //Delete Data sqlQuery = "Delete from tblCat_CompanyCasual Where CSComId = " + Int32.Parse(txtId.Text) + " and ComID = " + Common.Classes.clsMain.intComId + " "; 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 + "','Delete')"; arQuery.Add(sqlQuery); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Deleted Successfully."); prcClearData(); txtName.Focus(); prcLoadList(); // prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(); string sqlQuery = ""; try { sqlQuery = " Update tblML Set FirstPaid ='" + checkPaid1.Tag.ToString() + "',LastPaid ='" + checkPaid2.Tag.ToString() + "',OtherBonus = '" + txtBonus.Value.ToString() + "',OtherDeduct = '" + txtDeduct.Value.ToString() + "' Where lvId = '" + 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 + "','Insert')"; arQuery.Add(sqlQuery); sqlQuery = "prcProcessML " + Common.Classes.clsMain.intComId + ",'" + txtId.Text.ToString() + "',2"; arQuery.Add(sqlQuery); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Successfully."); prcLoadList(); prcClearData(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnDelete_Click(object sender, EventArgs e) { if ( MessageBox.Show("Do you want to Delete Employee information of [" + txtCode.Text.ToString() + "]", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new clsConnection(); try { string sqlQuery = ""; //Delete Data sqlQuery = "Delete from tblEmpCasual_Info Where EmpID = " + Int32.Parse(txtCode.Value.ToString()) + ""; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType,EmpId)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Delete'," + Int32.Parse(txtCode.Value.ToString()) + ")"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); prcClearData(); prcLoadList(); prcLoadList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to approve all employee increment ?", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { sqlQuery = " Update E Set E.GS = A.NewSal, E.GSUSD = A.NewSalUSD, E.GS = A.GS, E.BS = A.BS,E.HR = A.HR, E.MA = A.MA from tblEmp_Info E, tblEmp_Incr A Where E.EmpID = A.EmpID And E.ComId = " + Common.Classes.clsMain.intComId + " And A.ComId = " + Common.Classes.clsMain.intComId + " and A.dtInc = '" + this.clsProc.GTRDate(this.dtInc.Value.ToString()) + "' and A.IncYearly = 2"; arQuery.Add(sqlQuery); sqlQuery = " Update tblEmp_Incr Set IncYearly = 1 Where ComId = " + Common.Classes.clsMain.intComId + " And dtInc = '" + this.clsProc.GTRDate(this.dtInc.Value.ToString()) + "' and IncYearly = 2"; arQuery.Add(sqlQuery); sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement,PCName, tranType)" + " Values (" + GTRHRIS.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("Increment Approve Successfully Completed"); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
public void prcLogin() { clsConnection clsCon = new clsConnection(); try { int Result = 0; string sqlQuery = ""; sqlQuery = "Insert Into tblLogin_Activity_Log (LUserId, LoginDate, LoginStartTime, LoginPCName, LoginPCIP, LoginPCMac) " + " Select " + clsMain.intUserId + ", convert(varchar,GETDATE(),107), GETDATE(), '" + clsMain.strComputerName + "', '" + Common.Classes.clsMain.strIPAddress + "', '" + Common.Classes.clsMain.strMacAddress + "'"; Result = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); } catch (Exception ex) { throw (ex); } finally { clsCon = null; } }
public void prcLogout() { clsConnection clsCon = new clsConnection(); try { int Result = 0; string sqlQuery = ""; sqlQuery = "Update tblLogin_Activity_Log Set LoginEndTime = GETDATE() Where SLNo = " + "(Select MAX(SLNo) From tblLogin_Activity_Log Where LUserId = " + Common.Classes.clsMain.intUserId + ")"; Result = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); } catch (Exception ex) { throw (ex); } finally { clsCon = null; } }
private void btnChange_Click(object sender, EventArgs e) { ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { sqlQuery = "Delete tblTempLoan"; arQuery.Add(sqlQuery); foreach (UltraGridRow row in this.gridData.Rows) { sqlQuery = "Insert Into tblTempLoan (ComId, EmpId, InstallmentNo,LoanAmt,instAmt,Balance,InterestAmt,FlatAmt,DeductAmt,dtFrom,dtTo,Rate)" + " Values ('" + Common.Classes.clsMain.intComId + "', '" + cboEmpID.Value.ToString() + "', '" + row.Cells["InstallmentNo"].Text.ToString() + "','" + row.Cells["LoanAmt"].Text.ToString() + "','" + row.Cells["instAmt"].Text.ToString() + "','" + row.Cells["Balance"].Text.ToString() + "','" + row.Cells["InterestAmt"].Text.ToString() + "','" + row.Cells["FlatAmt"].Text.ToString() + "','" + row.Cells["DeductAmt"].Text.ToString() + "','" + row.Cells["dtFrom"].Text.ToString() + "','" + row.Cells["dtTo"].Text.ToString() + "'," + txtRate.Value.ToString() + ")"; arQuery.Add(sqlQuery); } clsCon.GTRSaveDataWithSQLCommand(arQuery); prcLoadLoan(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to delete Fee Temp . Temp No : [" + txtTempNo.Text + "]", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(); try { string sqlQuery = ""; //Delete Database sqlQuery = "Delete tblFee_Tmp Where FeeMgtID = " + double.Parse(txtTempNo.Tag.ToString()) + ""; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into GTRSystem.dbo.tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Delete')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Delete Succefully"); prcClearData(); gridList.DataSource = null; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to delete Process information of [" + btnDelete.Tag + "]", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } clsConnection clsCon = new clsConnection(); ArrayList arQuery = new ArrayList(); try { string SQLQuery = "Delete From tblDN_xls_Main where EntryNo='" + btnDelete.Tag + "'"; arQuery.Add(SQLQuery); // Insert Information To Log File SQLQuery = "Insert Into Gtrsystem.dbo.tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + SQLQuery.Replace("'", "|") + "','Delete')"; arQuery.Add(SQLQuery); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Delete successfully."); // btnProcess.Enabled = false; prcLoadList(); btnDelete.Visible = false; btnDelete.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int64 NewId = 0; try { //Member Master Table if (btnSave.Text != "&Save") { //Update sqlQuery = "Update tblEmpCasual_Info set EmpCode = '" + this.txtCode.Text.ToString() + "', empType = '" + this.cboEmpType.Value.ToString() + "', EmpName ='" + this.txtName.Text.ToString() + "',DesigID = '" + this.cboDesig.Value.ToString() + "', SectId= '" + this.cboSec.Value.ToString() + "',dtJoin= '" + clsProc.GTRDate(this.dtJDate.Value.ToString()) + "',dtBirth= '" + clsProc.GTRDate(this.dtBirthDate.Value.ToString()) + "',GS='" + this.txtGS.Text.ToString() + "',ShiftType='G',ShiftID='1',ShiftCat= 'G',Religion='" + this.cboRelegion.Value.ToString() + "',Sex='" + this.cboSex.Value.ToString() + "',ResUser='******',VehicleNo = '" + this.txtTrnNo.Text + "',cardno = '" + this.txtnewcode.Text + "' ,IsAllowOT='" + checkOT.Tag.ToString() + "',IsInactive='" + checkYesNo.Tag.ToString() + "' where empid = '" + this.txtnewcode.Text + "' "; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType,EmpId)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Update','" + this.txtnewcode.Text + "')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Successfully"); } else { //NewId sqlQuery = "Select Isnull(Max(EmpId),0)+1 As NewId from tblEmpCasual_Info"; NewId = clsCon.GTRCountingDataLarge(sqlQuery); //Insert Data sqlQuery = "Insert Into tblEmpCasual_Info (ComId,aEmpid,Empid, EmpCode, empType, EmpName,DesigID, SectId,CSComId,ResUser,VehicleNo, dtJoin,dtBirth,GS,ShiftType, ShiftID, ShiftCat, Religion, Sex,cardno, IsAllowOT, IsInactive)" + " Values (" + this.cboCom.Value.ToString() + ", " + NewId + ", " + NewId + ",'" + NewId + "', '" + this.cboEmpType.Value.ToString() + "',' " + this.txtName.Text + "', " + this.cboDesig.Value.ToString() + ", " + this.cboSec.Value.ToString() + "," + this.cboCom.Value.ToString() + ",'" + this.cboResUser.Value.ToString() + "','" + this.txtTrnNo.Text + "','" + this.clsProc.GTRDate(this.dtJDate.Value.ToString()) + "','" + clsProc.GTRDate(this.dtBirthDate.Value.ToString()) + "','" + this.txtGS.Text.ToString() + "','G','1', 'G','" + this.cboRelegion.Value.ToString() + "','" + this.cboSex.Value.ToString() + "','" + NewId + "', '" + this.checkOT.Tag.ToString() + "','" + this.checkYesNo.Tag.ToString() + "')"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType,EmpId)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Insert'," + NewId + ")"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Successfully"); } prcClearData(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; //cboCode.Value = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new clsConnection(); DateTime firstDay = new DateTime(dtTransferDate.DateTime.Year, dtTransferDate.DateTime.Month, 1); dtTranTo.Value = firstDay; DateTime lastDay = new DateTime(dtTransferDate.DateTime.Year, dtTransferDate.DateTime.Month, 1); lastDay = lastDay.AddMonths(1); lastDay = lastDay.AddDays(-(lastDay.Day)); dtTranLast.Value = lastDay; string sqlQuery = ""; try { sqlQuery = "Update tblEmp_Info Set EmpCode = 'T'+EmpCode, ComID = '" + cboUnit.Value.ToString() + "' Where ComID = " + Common.Classes.clsMain.intComId + " and EmpID = '" + cboCode.Value.ToString() + "'"; arQuery.Add(sqlQuery); sqlQuery = "Update tblRawData Set ComId = '" + cboUnit.Value.ToString() + "' Where ComId = " + Common.Classes.clsMain.intComId + " and EmpID = '" + cboCode.Value.ToString() + "' and dtPunchDate Between '" + clsProc.GTRDate(this.dtTranTo.Value.ToString()) + "' and '" + clsProc.GTRDate(this.dtTranLast.Value.ToString()) + "'"; arQuery.Add(sqlQuery); sqlQuery = "Update tblProcesseddata Set ComId = '" + cboUnit.Value.ToString() + "' Where ComId = " + Common.Classes.clsMain.intComId + " and EmpID = '" + cboCode.Value.ToString() + "' and dtPunchDate Between '" + clsProc.GTRDate(this.dtTranTo.Value.ToString()) + "' and '" + clsProc.GTRDate(this.dtTranLast.Value.ToString()) + "'"; arQuery.Add(sqlQuery); sqlQuery = "Update tblEmp_PF Set ComId = '" + cboUnit.Value.ToString() + "' Where ComId = " + Common.Classes.clsMain.intComId + " and EmpID = '" + cboCode.Value.ToString() + "'"; arQuery.Add(sqlQuery); sqlQuery = "Update tblLeave_Balance Set ComId = '" + cboUnit.Value.ToString() + "' Where ComId = " + Common.Classes.clsMain.intComId + " and EmpID = '" + cboCode.Value.ToString() + "'"; arQuery.Add(sqlQuery); sqlQuery = "Update tblLeave_Avail Set ComId = '" + cboUnit.Value.ToString() + "' Where ComId = " + Common.Classes.clsMain.intComId + " and EmpID = '" + cboCode.Value.ToString() + "'"; arQuery.Add(sqlQuery); sqlQuery = "Update tblML Set ComId = '" + cboUnit.Value.ToString() + "' Where ComId = " + Common.Classes.clsMain.intComId + " and EmpID = '" + cboCode.Value.ToString() + "'"; arQuery.Add(sqlQuery); sqlQuery = "Insert Into tblEmpTransfer (comId, ComIdTran,EmpId,dtTranDate,PCName, LUserId)" + " Values (" + Common.Classes.clsMain.intComId + ",'" + cboUnit.Value.ToString() + "', '" + cboCode.Value.ToString() + "','" + clsProc.GTRDate(this.dtTransferDate.Value.ToString()) + "','" + Common.Classes.clsMain.strComputerName + "'," + GTRHRIS.Common.Classes.clsMain.intUserId + ")"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType,EmpId)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Insert','" + cboCode.Value.ToString() + "')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Employee Transfer Successfully Complete."); prcClearData(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //arQuery = null; //clsCon = null; } }
private void btnPreview_Click(object sender, EventArgs e) { clsConnection clsCon = new clsConnection(); try { string SQLQuery = "", ReportPath = "", Criteria = "", Status = "", SectId = "0", type = "", Lettertype = "", EmpId = "0"; Criteria = gridCriteria.ActiveRow.Cells["CValue"].Value.ToString(); Lettertype = gridIncrType.ActiveRow.Cells["CValue"].Value.ToString(); Status = gridEmpStatus.ActiveRow.Cells["EmpStatus"].Text.ToString(); if (Criteria == "Section") { SectId = gridArea.ActiveRow.Cells["SectId"].Value.ToString(); } type = gridEmpType.ActiveRow.Cells["EmpType"].Value.ToString(); if (Criteria == "Employee") { EmpId = gridEmp.ActiveRow.Cells["EmpId"].Value.ToString(); } if (gridIncrType.ActiveRow.Cells["CValue"].Text.ToString() == "Temporary") { ReportPath = Common.Classes.clsMain.AppPath + @"\Letter\Reports\rptSuspendTemporary.rdlc"; SQLQuery = "Exec rptLetterSuspend " + Common.Classes.clsMain.intComId + "," + SectId + ", " + EmpId + ",'" + Lettertype + "' "; //SQLQuery = "Exec rptAppointment " + Common.Classes.clsMain.intComId + ", '" + Criteria + "', '" + Status + "','" + // clsProc.GTRDate(dtFrom.Value.ToString()) + "', '" + // clsProc.GTRDate(dtTo.Value.ToString()) + "', '" + type + "'," + SectId + ", " + EmpId + " "; } else if (gridIncrType.ActiveRow.Cells["CValue"].Text.ToString() == "Termination") { ReportPath = Common.Classes.clsMain.AppPath + @"\Letter\Reports\rptSuspendTermination.rdlc"; SQLQuery = "Exec rptLetterSuspend " + Common.Classes.clsMain.intComId + "," + SectId + ", " + EmpId + ",'" + Lettertype + "' "; } else if (gridIncrType.ActiveRow.Cells["CValue"].Text.ToString() == "Dismiss") { ReportPath = Common.Classes.clsMain.AppPath + @"\Letter\Reports\rptSuspendDismiss.rdlc"; SQLQuery = "Exec rptLetterSuspend " + Common.Classes.clsMain.intComId + "," + SectId + ", " + EmpId + ",'" + Lettertype + "' "; } clsCon.GTRSaveDataWithSQLCommand(SQLQuery); string DataSourceName = "DataSet1"; string FormCaption = "Report :: Suspend Letter..."; clsReport.strReportPathMain = ReportPath; clsReport.dsReport = dsDetails; clsReport.strDSNMain = DataSourceName; Common.Classes.clsMain.strExtension = optFormat.Value.ToString(); Common.Classes.clsMain.strFormat = optFormat.Text.ToString(); FM.prcShowReport(FormCaption); //GTRLibrary.clsReport.strReportPathMain = ReportPath; //GTRLibrary.clsReport.strQueryMain = SQLQuery; //GTRLibrary.clsReport.strDSNMain = DataSourceName; //FM.prcShowReport(FormCaption); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { if (btnSave.Text.ToString().ToUpper() != "&Save".ToUpper()) { //Update //-------------------- sqlQuery = "Update tblCat_Shift Set ShiftCode = '" + txtId.Text.ToString().Trim() + "', ShiftName = '" + txtName.Text.ToString().Trim() + "', ShiftDesc = '" + txtDescription.Text.ToString().Trim() + "', ShiftType = 'G', ShiftCat = 'G', ShiftIn = '" + (txtInTime.Value.TimeOfDay.ToString().Trim()) + "', ShiftOut = '" + (txtOutTime.Value.TimeOfDay.ToString().Trim()) + "', ShiftLate = '" + (txtShiftLate.Value.TimeOfDay.ToString().Trim()) + "', LunchTime = '" + (txtLunch.Value.TimeOfDay.ToString().Trim()) + "', LunchIn = '" + (txtLunchIn.Value.TimeOfDay.ToString().Trim()) + "', LunchOut = '" + (txtLunchOut.Value.TimeOfDay.ToString().Trim()) + "', TiffinTime = '" + (txtTiffin.Value.TimeOfDay.ToString().Trim()) + "', TiffinIn = '" + (txtTiffinIn.Value.TimeOfDay.ToString().Trim()) + "', TiffinTime1 = '" + (txtTiffin1.Value.TimeOfDay.ToString().Trim()) + "', TiffinTimeIn1 = '" + (txtTiffinIn1.Value.TimeOfDay.ToString().Trim()) + "', TiffinTime2 = '" + (txtTiffin2.Value.TimeOfDay.ToString().Trim()) + "', TiffinTimeIn2 = '" + (txtTiffinIn2.Value.TimeOfDay.ToString().Trim()) + "', TiffinOut = '00:00',RegHour = '" + (txtRegHrs.Value.TimeOfDay.ToString().Trim()) + "', IsInactive = " + chkIsInactive.Tag + " where ShiftId = " + int.Parse(txtId.Text.ToString().Trim()) + ""; //---------------------- 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); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Succefully"); } else { sqlQuery = " Select Isnull(Max(ShiftId),0)+1 As NewId from tblCat_Shift "; NewId = clsCon.GTRCountingData(sqlQuery); //Insert to Table //-------------------------- sqlQuery = " Insert Into tblCat_Shift(ShiftId, ShiftCode, ShiftName, ShiftDesc, ShiftType, ShiftCat, ShiftIn, ShiftOut, ShiftLate, LunchTime, LunchIn, LunchOut, TiffinTime, TiffinIn, TiffinTime1,TiffinTimeIn1,TiffinTime2,TiffinTimeIn2,TiffinOut, RegHour, IsInactive, aId, PCName, LUserId,ComID)" + " Values(" + NewId + ", '" + NewId + "','" + txtName.Text.ToString() + "','" + txtDescription.Text.ToString() + "','G','G','" + (txtInTime.Value.TimeOfDay.ToString().Trim()) + "','" + (txtOutTime.Value.TimeOfDay.ToString().Trim()) + "','" + (txtShiftLate.Value.TimeOfDay.ToString().Trim()) + "','" + (txtLunch.Value.TimeOfDay.ToString().Trim()) + "','" + (txtLunchIn.Value.TimeOfDay.ToString().Trim()) + "','" + (txtLunchOut.Value.TimeOfDay.ToString().Trim()) + "','" + (txtTiffin.Value.TimeOfDay.ToString().Trim()) + "','" + (txtTiffinIn.Value.TimeOfDay.ToString().Trim()) + "','" + (txtTiffin1.Value.TimeOfDay.ToString().Trim()) + "','" + (txtTiffinIn1.Value.TimeOfDay.ToString().Trim()) + "','" + (txtTiffin2.Value.TimeOfDay.ToString().Trim()) + "','" + (txtTiffinIn2.Value.TimeOfDay.ToString().Trim()) + "','00:00','" + (txtRegHrs.Value.TimeOfDay.ToString().Trim()) + "','" + chkIsInactive.Tag.ToString() + "'," + NewId + ",'" + Common.Classes.clsMain.strComputerName + "'," + Common.Classes.clsMain.intUserId + "," + Common.Classes.clsMain.intComId + ")"; 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); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Succefully"); } prcClearData(); prcLoadList(); } 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(); clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { if (btnSave.Text.ToString() != "&Save") { //Update sqlQuery = " Update tblCat_Post Set PostName ='" + txtName.Text.ToString() + "', PostNameShort='" + txtSName.Text.ToString() + "'"; sqlQuery += " Where PostId = " + Int32.Parse(txtId.Text); 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); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Succefully"); } else { sqlQuery = "Select Isnull(Max(PostId ),0)+1 As NewId from tblCat_Post "; NewId = clsCon.GTRCountingData(sqlQuery); //Insert to Table sqlQuery = "Insert Into tblCat_Post( PostId,aId,PostName ,PostNameShort, PCName, LUserId ) "; sqlQuery = sqlQuery + " Values (" + NewId + ", " + NewId + ", '" + txtName.Text.ToString() + "','" + txtSName.Text.ToString() + "','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "')"; 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); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Succefully"); } prcClearData(); txtName.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(); clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { string Module = ""; foreach (UltraGridRow row in gridModule.Rows) { if (int.Parse(row.Cells["Mark"].Value.ToString()) == 1) { Module += row.Cells["moduleId"].Value + ","; } } Module = Module.Substring(0, Module.Length - 1); //Member Master Table if (txtVarId.Text.Length != 0) { //Update data sqlQuery = " Update tblCat_Variable Set varName = '" + txtVarName.Text.ToString() + "', varType='" + cboVarType.Text.ToString() + "', IsInactive=" + chkInactive.Tag + ",ModuleId='" + Module + "',IsChild='" + chkChild.Tag + "',Remarks='" + txtRemarks.Text + "' Where VarId = " + Int32.Parse(txtVarId.Text); 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 Successfully"); } else { //newId sqlQuery = "Select Isnull(Max(VarId),0)+1 As NewId from tblCat_Variable"; NewId = clsCon.GTRCountingData(sqlQuery); //Insert Data sqlQuery = "Insert Into tblCat_Variable (VarId, aId, varName, varType, IsInactive,ModuleId,Remarks,IsChild) " + " Values (" + NewId + ", " + NewId + ", '" + txtVarName.Text.ToString() + "', '" + cboVarType.Text.ToString() + "', " + chkInactive.Tag + ",'" + Module + "','" + txtRemarks.Text + "'," + chkChild.Tag + ")"; 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 Successfully"); } prcClearData(); txtVarName.Focus(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { int rowCount; for (rowCount = 0; rowCount < dsList.Tables["Varible"].Rows.Count; rowCount++) { if (fncBlank("Varible", rowCount)) { return; } } for (rowCount = 0; rowCount < dsList.Tables["Varible"].Rows.Count; rowCount++) { if (dsList.Tables["Varible"].Rows[rowCount][0].ToString().Trim().Length > 0 && dsList.Tables["Varible"].Rows[rowCount]["Flag"].ToString() == "1") { //Update Table sqlQuery = "Update tblInput_Permission Set FirstAppId = '" + dsList.Tables["Varible"].Rows[rowCount][4] + "', FinalAppId = '" + dsList.Tables["Varible"].Rows[rowCount][5] + "', isInactive = '" + dsList.Tables["Varible"].Rows[rowCount][8] + "', Remarks = '" + dsList.Tables["Varible"].Rows[rowCount][9] + "', AppFirst = 0, AppFinal=1,LUserId = " + Common.Classes.clsMain.intUserId + ",PCName ='" + Common.Classes.clsMain.strComputerName + "' where PId = '" + dsList.Tables["Varible"].Rows[rowCount][0] + "'"; 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); sqlQuery = "Update tblInput_Permission Set AppFirst = 1,AppFinal = 1 Where FirstAppId = FinalAppId and PId ='" + dsList.Tables["Varible"].Rows[rowCount][0] + "'"; arQuery.Add(sqlQuery); sqlQuery = "Update tblEmpApprove_Info Set FirstAppId = '" + dsList.Tables["Varible"].Rows[rowCount]["FirstAppId"] + "' Where FirstAppId = '" + dsList.Tables["Varible"].Rows[rowCount]["FirstAppIdPrev"] + "' and Approved = 0"; arQuery.Add(sqlQuery); sqlQuery = "Update tblEmpApprove_Info Set FinalAppId = '" + dsList.Tables["Varible"].Rows[rowCount]["FinalAppId"] + "' Where FinalAppId ='" + dsList.Tables["Varible"].Rows[rowCount]["FinalAppIdPrev"] + "' and Approved = 0"; arQuery.Add(sqlQuery); } else if (dsList.Tables["Varible"].Rows[rowCount][0].ToString().Trim().Length == 0) { // Insert To Table sqlQuery = "Insert into tblInput_Permission(PType,EmpType,ComName,FirstAppId,FinalAppId,AppFirst,AppFinal,ComId,isInactive,Remarks,LUserId,PCName) values('" + cboPName.Text.ToString() + "','" + cboType.Text.ToString() + "', '" + dsList.Tables["Varible"].Rows[rowCount][3] + "','" + dsList.Tables["Varible"].Rows[rowCount][4] + "','" + dsList.Tables["Varible"].Rows[rowCount][5] + "',0,1,0,'" + dsList.Tables["Varible"].Rows[rowCount][8] + "','" + dsList.Tables["Varible"].Rows[rowCount][9] + "'," + Common.Classes.clsMain.intUserId + ",'" + 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); sqlQuery = "Update tblInput_Permission Set AppFirst = 1,AppFinal = 1 Where FirstAppId = FinalAppId and PType = '" + cboPName.Text.ToString() + "' and EmpType = '" + cboType.Text.ToString() + "'"; arQuery.Add(sqlQuery); sqlQuery = "Update P Set P.ComId = C.ComId from tblInput_Permission P,tblCat_Company C Where P.ComName COLLATE DATABASE_DEFAULT = C.ComName and P.ComId = 0 and P.PType = '" + cboPName.Text.ToString() + "' and P.EmpType = '" + cboType.Text.ToString() + "'"; arQuery.Add(sqlQuery); } } clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved [Or/And ] Update Succefully"); //prcClearData(); prcLoadList(); prcLoadComboList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { ArrayList arQuery = new ArrayList(); clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { int rowCount; for (rowCount = 0; rowCount < dsList.Tables["Varible"].Rows.Count; rowCount++) { if (fncBlank("Varible", rowCount)) { return; } } for (rowCount = 0; rowCount < dsList.Tables["Varible"].Rows.Count; rowCount++) { if (dsList.Tables["Varible"].Rows[rowCount][0].ToString().Trim().Length > 0 && dsList.Tables["Varible"].Rows[rowCount]["Flag"].ToString() == "1") { //Update Table sqlQuery = "Update tblCat_Variable Set varName = '" + dsList.Tables["Varible"].Rows[rowCount][1] + "', varType = '" + dsList.Tables["Varible"].Rows[rowCount][2] + "', aId = '" + dsList.Tables["Varible"].Rows[rowCount][3] + "', isInactive = '" + dsList.Tables["Varible"].Rows[rowCount][4] + "', Remarks = '" + dsList.Tables["Varible"].Rows[rowCount][5] + "' where VarId = '" + dsList.Tables["Varible"].Rows[rowCount][0] + "'"; 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); } else if (dsList.Tables["Varible"].Rows[rowCount][0].ToString().Trim().Length == 0) { // Insert To Table sqlQuery = "Insert into tblCat_Variable(varName, varType, aId, isInactive, Remarks) values('" + dsList.Tables["Varible"].Rows[rowCount][1] + "','" + this.Tag + "','" + dsList.Tables["Varible"].Rows[rowCount][3] + "','" + dsList.Tables["Varible"].Rows[rowCount][4] + "','" + dsList.Tables["Varible"].Rows[rowCount][5] + "')"; 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); } } clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved [Or/And ] Update Succefully"); prcClearData(); prcLoadList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }