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 { 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) { 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 { //Member Master Table if (btnSave.Text.ToString() != "&Save") { // Update sqlQuery = " Update tblCat_Company Set comcode = '" + txtCode.Text.ToString() + "', comName='" + txtName.Text.ToString() + "',comAddress='" + txtCompanyAddress.Text.Trim() + "',comPhone='" + txtCompanyphone.Text.Trim() + "',comFax='" + txtCompanyFax.Text.Trim() + "',comEmail='" + txtCompanyEmail.Text.Trim() + "',comweb='" + txtCompanyWeb.Text.Trim() + "',comAlias='" + txtCompanyAlias.Text.Trim() + "',contPerson='" + txtCompanyContractP.Text.Trim() + "',contDesig='" + txtCompanyContractPD.Text.Trim() + "',comType='" + cboCompanyType.Value + "',IsShowCurrencySymbol=" + ckdCurrencySymble.Tag + ",IsGroup=" + ckdGroup.Tag + ",IsShowZeroBalance=" + ckdZeroBalance.Tag + "" + " Where comId = " + 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); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Succefully"); } else { //Generating New Id sqlQuery = "Select Isnull(Max(comId),0)+1 As NewId from tblCat_Company"; NewId = clsCon.GTRCountingData(sqlQuery); //Insert data sqlQuery = "Insert Into tblCat_Company (comId, aId, comcode, comName,comAddress,comPhone,comFax,comEmail,comWeb,comType,comAlias,contPerson,contDesig,IsGroup,IsShowCurrencySymbol,IsShowZeroBalance)" + " Values (" + NewId + ", " + NewId + ", '" + txtCode.Text.ToString() + "', '" + txtName.Text.ToString() + "','" + txtCompanyAddress.Text.ToString() + "','" + txtCompanyphone.Text.ToString() + "','" + txtCompanyFax.Text.ToString() + "','" + txtCompanyEmail.Text.ToString() + "','" + txtCompanyWeb.Text.ToString() + "','" + cboCompanyType.Value + "','" + txtCompanyAlias.Text.ToString() + "','" + txtCompanyContractP.Text.ToString() + "','" + txtCompanyContractPD.Text.ToString() + "'," + ckdGroup.Tag + "," + ckdCurrencySymble.Tag + ", " + ckdZeroBalance.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 Succefully"); } prcClearData(); txtCode.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 clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { //if (dtJoinUpto.Value != null) //{ // dtJoinUpto.Value = clsProc.GTRDate(dtJoinUpto.Value.ToString()); //} //Member Master Table if (txtPer.Text.Length != 0) { //Update arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Update')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Successfully"); } else { //NewId sqlQuery = "Select Isnull(Max(IncId),0)+1 As NewId from tblEmp_Incr"; NewId = clsCon.GTRCountingData(sqlQuery); //Insert Data //sqlQuery = "INSERT into dbo.tblEmp_Incr(IncId, IncType, EmpId, dtInc, Amount, Percentage, OldSal, CurrSal, OldDesigId, NewDesigId, HR, TA, FA, PBns, OldSectId, NewSectId, OldGrade, NewGrade, OldOTstatus, NewOTstatus, OldStatus, NewStatus, newSectIdSal, OldSectIdSal, IsInactive, ComId, LUserId, PCName)" // + " Values (" + NewId + ",'" + clsProc.GTRDate(dtJoinUpto.Value.ToString()) + "'"+ " ," + txtDollarRate.Text + ",'" + txtPer.Text + // ",'" + Common.Classes.clsMain.strComputerName + "')"; //arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Insert')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Successfully"); } prcClearData(); prcLoadList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnAddNew_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_CadreUnit Set SectName ='" + txtName.Text.ToString() + "', SectNameB='" + txtNameB.Text.ToString() + "' , SLNO= '" + txtSlNo.Text.ToString() + "',DeptId = '" + cboDept.Value.ToString() + "',DeptName ='" + cboDept.Text.ToString() + "' "; //sqlQuery += " Where SectId = " + Int32.Parse(txtId.Text); //arQuery.Add(sqlQuery); //clsCon.GTRSaveDataWithSQLCommand(arQuery); //MessageBox.Show("Data Updated Succefully"); } else { sqlQuery = "Select Isnull(Max(CDId),0)+1 As NewId from tblCat_Cadre "; NewId = clsCon.GTRCountingData(sqlQuery); //Insert to Table sqlQuery = "Insert Into tblCat_CadreUnit(CDId,Position,IdealSet,Ideal,MCDID,MPosition,ComId,PCName,LUserId) "; sqlQuery = sqlQuery + " Values (" + NewId + ",'" + txtPosition.Text.ToString() + "','" + txtCadre.Text.ToString() + "','0','" + cboMPosition.Value.ToString() + "','" + cboMPosition.Text.ToString() + "', '2','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "' )"; arQuery.Add(sqlQuery); sqlQuery = "Insert Into tblCat_CadreUnit(CDId,Position,IdealSet,Ideal,MCDID,MPosition,ComId,PCName,LUserId) "; sqlQuery = sqlQuery + " Values (" + NewId + ",'" + txtPosition.Text.ToString() + "','" + txtCadre.Text.ToString() + "','0','" + cboMPosition.Value.ToString() + "','" + cboMPosition.Text.ToString() + "', '3','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "' )"; arQuery.Add(sqlQuery); sqlQuery = "Insert Into tblCat_CadreUnit(CDId,Position,IdealSet,Ideal,MCDID,MPosition,ComId,PCName,LUserId) "; sqlQuery = sqlQuery + " Values (" + NewId + ",'" + txtPosition.Text.ToString() + "','" + txtCadre.Text.ToString() + "','0','" + cboMPosition.Value.ToString() + "','" + cboMPosition.Text.ToString() + "', '4','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "' )"; arQuery.Add(sqlQuery); sqlQuery = "Insert Into tblCat_CadreUnit(CDId,Position,IdealSet,Ideal,MCDID,MPosition,ComId,PCName,LUserId) "; sqlQuery = sqlQuery + " Values (" + NewId + ",'" + txtPosition.Text.ToString() + "','" + txtCadre.Text.ToString() + "','0','" + cboMPosition.Value.ToString() + "','" + cboMPosition.Text.ToString() + "', '5','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "' )"; arQuery.Add(sqlQuery); sqlQuery = "Insert Into tblCat_CadreUnit(CDId,Position,IdealSet,Ideal,MCDID,MPosition,ComId,PCName,LUserId) "; sqlQuery = sqlQuery + " Values (" + NewId + ",'" + txtPosition.Text.ToString() + "','" + txtCadre.Text.ToString() + "','0','" + cboMPosition.Value.ToString() + "','" + cboMPosition.Text.ToString() + "', '6','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "' )"; arQuery.Add(sqlQuery); sqlQuery = "Insert Into tblCat_CadreUnit(CDId,Position,IdealSet,Ideal,MCDID,MPosition,ComId,PCName,LUserId) "; sqlQuery = sqlQuery + " Values (" + NewId + ",'" + txtPosition.Text.ToString() + "','" + txtCadre.Text.ToString() + "','0','" + cboMPosition.Value.ToString() + "','" + cboMPosition.Text.ToString() + "', '7','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "' )"; arQuery.Add(sqlQuery); sqlQuery = "Insert Into tblCat_CadreUnit(CDId,Position,IdealSet,Ideal,MCDID,MPosition,ComId,PCName,LUserId) "; sqlQuery = sqlQuery + " Values (" + NewId + ",'" + txtPosition.Text.ToString() + "','" + txtCadre.Text.ToString() + "','0','" + cboMPosition.Value.ToString() + "','" + cboMPosition.Text.ToString() + "', '8','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "' )"; arQuery.Add(sqlQuery); sqlQuery = "Insert Into tblCat_CadreUnit(CDId,Position,IdealSet,Ideal,MCDID,MPosition,ComId,PCName,LUserId) "; sqlQuery = sqlQuery + " Values (" + NewId + ",'" + txtPosition.Text.ToString() + "','" + txtCadre.Text.ToString() + "','0','" + cboMPosition.Value.ToString() + "','" + cboMPosition.Text.ToString() + "', '9','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "' )"; arQuery.Add(sqlQuery); sqlQuery = "Insert Into tblCat_Cadre(CDId,Position,IdealSet,MCDID,MPosition,ComId,PCName,LUserId) "; sqlQuery = sqlQuery + " Values (" + NewId + ",'" + txtPosition.Text.ToString() + "','" + txtCadre.Text.ToString() + "','" + cboMPosition.Value.ToString() + "','" + cboMPosition.Text.ToString() + "', '" + Common.Classes.clsMain.intComId + "','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "' )"; int add = 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(); } 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 { //Member Master Table if (txtUnitId.Text.Length != 0) { //Update data sqlQuery = " Update tblCat_Desig Set DesigName = '" + txtName.Text.ToString() + "', DesigNameB = '" + txtNameB.Text.ToString() + "', AttBonus = '" + txtBonus.Text.ToString() + "',Grade = '" + cboGrade.Value.ToString() + "', PCName = '" + Common.Classes.clsMain.strComputerName + "', LUserId =" + Common.Classes.clsMain.intUserId + " " + " Where DesigId = " + Int32.Parse(txtUnitId.Text); arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Update')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Successfully"); } else { //NewId sqlQuery = "Select Isnull(Max(DesigId),0)+1 As NewId from tblCat_Desig"; NewId = clsCon.GTRCountingData(sqlQuery); //Insert to Unit table sqlQuery = "Insert Into tblCat_Desig(DesigId, aId, DesigName,DesigNameB,AttBonus,Grade, PCName, LUserId) " + " Values (" + NewId + ", " + NewId + ", '" + txtName.Text.ToString() + "', '" + txtNameB.Text.ToString() + "','" + txtBonus.Text.ToString() + "','" + cboGrade.Value.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, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Insert')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Successfully"); } prcClearData(); txtName.Focus(); prcLoadList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } var DaysInMonth = DateTime.DaysInMonth(dtFrom.DateTime.Year, dtFrom.DateTime.Month); var firstDay = new DateTime(dtFrom.DateTime.Year, dtFrom.DateTime.Month, 1); dtFrom.Value = firstDay; ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.gridDetails.Rows) { if (row.Cells["empid"].Text.ToString().Length != 0 && row.Cells["isChecked"].Value.ToString() == "1") { //NewId sqlQuery = "Select Isnull(Max(IncId),0)+1 As NewId from tblEmp_Incr"; NewId = clsCon.GTRCountingData(sqlQuery); sqlQuery = " Delete tblEmp_Incr Where empid = '" + row.Cells["empid"].Text.ToString() + "' and ComID = " + Common.Classes.clsMain.intComId + " and dtInc = '" + clsProc.GTRDate(this.dtFrom.Value.ToString()) + "'"; arQuery.Add(sqlQuery); sqlQuery = " Insert Into tblEmp_Incr(ComId,IncId,EmpId,dtInc,OldSal,Amount,NewSal,IncType,PCName,LUserId) " + " Values (" + Common.Classes.clsMain.intComId + "," + NewId + ",'" + row.Cells["empid"].Text.ToString() + "', '" + clsProc.GTRDate(dtFrom.Value.ToString()) + "','" + row.Cells["GS"].Value.ToString() + "','" + row.Cells["Amount"].Value.ToString() + "','" + row.Cells["NewGS"].Value.ToString() + "','" + row.Cells["Remarks"].Value.ToString() + "','" + Common.Classes.clsMain.strComputerName + "'," + GTRHRIS.Common.Classes.clsMain.intUserId + ")"; arQuery.Add(sqlQuery); sqlQuery = " Update E Set E.OldSectID = A.SectID, E.OldDesigID = A.DesigID from tblEmp_Incr E, tblEmp_info A Where E.EmpID = A.EmpID And E.IncId = " + NewId + " and E.EmpID = '" + row.Cells["empid"].Text.ToString() + "'"; arQuery.Add(sqlQuery); sqlQuery = " Update tblEmp_Info Set GS = '" + row.Cells["NewGS"].Value.ToString() + "',IsConfirm = '1',dtConfirm = '" + clsProc.GTRDate(dtFrom.Value.ToString()) + "' Where EmpID = '" + row.Cells["empid"].Text.ToString() + "' and ComID = " + Common.Classes.clsMain.intComId + " and '" + row.Cells["Remarks"].Value.ToString() + "' = 'Confirmation'"; arQuery.Add(sqlQuery); sqlQuery = " Update tblEmp_Info Set GS = '" + row.Cells["NewGS"].Value.ToString() + "',dtIncrement = '" + clsProc.GTRDate(dtFrom.Value.ToString()) + "' Where EmpID = '" + row.Cells["empid"].Text.ToString() + "' and ComID = " + Common.Classes.clsMain.intComId + " and '" + row.Cells["Remarks"].Value.ToString() + "' = 'Increment'"; arQuery.Add(sqlQuery); clsCon.GTRSaveDataWithSQLCommand(arQuery); } } 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("Data Saved Successfully"); prcClearData(); 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 clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { //Member Master Table if (btnSave.Text != "&Save") { //sqlQuery = " Delete From tblLoan_Data Where aid = " + Int32.Parse(txtId.Text.ToString()) + " "; //arQuery.Add(sqlQuery); //Update sqlQuery = "Update tblloan set inputdate = '" + clsProc.GTRDate(this.dtInput.Value.ToString()) + "', dtLoanFrom ='" + clsProc.GTRDate(this.dtFrom.Value.ToString()) + "', dtLoanTo ='" + clsProc.GTRDate(this.dtTo.Value.ToString()) + "', Amount='" + txtAmt.Text.ToString() + "', InstNo = '" + txtInstallNo.Text.ToString() + "', Rate = '" + txtRate.Text.ToString() + "',InsAmount ='" + txtInstallAmnt.Text.ToString() + "',OpBalance = '" + txtOpBalance.Text.ToString() + "',paidamount = '" + txtPaidAmnt.Text.ToString() + "',ClosingBalance = '" + txtClosingBalance.Text.ToString() + "', Remarks = '" + txtRemarks.Text.ToString() + "',LUserId = " + GTRHRIS.Common.Classes.clsMain.intUserId + ",PCName ='" + Common.Classes.clsMain.strComputerName + "' where loanid = '" + this.txtId.Text.ToString() + "' "; arQuery.Add(sqlQuery); fncGridDataUpdate(ref arQuery, txtId.Text.ToString()); // 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("Data Updated Successfully"); } else { //NewId sqlQuery = "Select Isnull(Max(loanId),0)+1 As NewId from tblloan"; NewId = clsCon.GTRCountingData(sqlQuery); //Insert Data //sqlQuery = " Delete tblloan where aid = '" + cboEmpID.Value.ToString() + "' "; //arQuery.Add(sqlQuery); sqlQuery = " Insert Into tblloan(ComId,empid, empCode, empname, LoanID, inputdate,dtLoanFrom, dtLoanTo, Amount, InstNo, Rate, InsAmount,OpBalance,paidamount,ClosingBalance,Remarks,LUserId,PCName) " + " Values ('" + Common.Classes.clsMain.intComId + "', '" + cboEmpID.Value.ToString() + "', '" + cboEmpID.Text.ToString() + "', '" + txtName.Text.ToString() + "', '" + NewId + "', '" + clsProc.GTRDate(dtInput.Value.ToString()) + "','" + clsProc.GTRDate(dtFrom.Value.ToString()) + "','" + clsProc.GTRDate(dtTo.Value.ToString()) + "', '" + txtAmt.Text.ToString() + "', '" + txtInstallNo.Text.ToString() + "','" + txtRate.Text.ToString() + "','" + txtInstallAmnt.Text.ToString() + "','" + txtOpBalance.Text.ToString() + "', '" + txtPaidAmnt.Text.ToString() + "','" + txtClosingBalance.Text.ToString() + "', '" + txtRemarks.Text.ToString() + "'," + GTRHRIS.Common.Classes.clsMain.intUserId + ",'" + Common.Classes.clsMain.strComputerName + "') "; arQuery.Add(sqlQuery); fncGridData(ref arQuery, NewId.ToString()); 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("Data Saved Successfully"); } prcClearData(); prcLoadList(); prcLoadCombo(); cboEmpID.Focus(); } 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().ToUpper() != "&Save".ToUpper()) { //Update //-------------------- sqlQuery = "Update tblCat_DesigCapacity Set Band = '" + cboDesig.Text.ToString() + "', DesigName = '" + cboDesig.Text.ToString() + "',DeptID = '" + cboDept.Value.ToString() + "', SectID = '" + cboSection.Value.ToString() + "', Capacity = '" + txtCapacity.Text.ToString().Trim() + "', IsInactive = '" + chkIsInactive.Tag.ToString() + "' where aId = " + 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(aId),0)+1 As NewId from tblCat_DesigCapacity "; NewId = clsCon.GTRCountingData(sqlQuery); //Insert to Table //-------------------------- sqlQuery = " Insert Into tblCat_DesigCapacity(Band, DesigName, DeptID, SectID,Capacity,IsInactive, aId, PCName, LUserId,ComID)" + " Values('" + cboDesig.Text.ToString() + "','" + cboDesig.Text.ToString() + "','" + cboDept.Value.ToString() + "','" + cboSection.Value.ToString() + "','" + txtCapacity.Text.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(); 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 { //Member Master Table if (btnSave.Text.ToString() != "&Save") { //Update sqlQuery = " Update tbl_subject Set SubjectCode ='" + txtCode.Text.ToString() + "', SubjectName='" + txtName.Text.ToString() + "' , ShortName= '" + txtShrtName.Text.ToString() + "', DepartmentId='" + cboDepartment.Value.ToString() + "', marks = '" + txtMark.Text.ToString() + "', credit = '" + txtCredit.Text.ToString() + "', cr_Cost = '" + txtCost.Text.ToString() + "', houre = '" + dtHour.Value.ToString() + "' Where SubjectId = " + Int32.Parse(txtId.Text); arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Update')"; arQuery.Add(sqlQuery); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Succefully"); } else { //add new sqlQuery = "Select Isnull(Max(subjectId),0)+1 As NewId from tbl_Subject"; NewId = clsCon.GTRCountingData(sqlQuery); //Insert to Table sqlQuery = "Insert Into tbl_Subject(SubjectId, SubjectCode, SubjectName, ShortName,DepartmentId,ComId, UserId,marks,credit,cr_Cost,houre) "; sqlQuery = sqlQuery + " Values (" + NewId + ",'" + txtCode.Text.ToString() + "', '" + txtName.Text.ToString() + "','" + txtShrtName.Text.ToString() + "','" + cboDepartment.Value.ToString() + "','" + Common.Classes.clsMain.intComId + "','" + Common.Classes.clsMain.intUserId + "','" + txtMark.Text.ToString() + "', '" + txtCredit.Text.ToString() + "', '" + txtCost.Text.ToString() + "','" + dtHour.Value.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("'", "|") + "','Insert')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Succefully"); } prcClearData(); txtCode.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 = ""; try { //Member Master Table if (btnSave.Text != "&Save") { //Update sqlQuery = "Exec prcTran_Dept 'Update', " + Common.Classes.clsMain.intComId + ", " + Int32.Parse(txtCode.Tag.ToString()) + ", '" + txtName.Text + "', '" + optType.Tag.ToString() + "', " + cboUnder.Value + ", " + Common.Classes.clsMain.strComputerName + ", " + Common.Classes.clsMain.intUserId + ""; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into GTRHRIS.dbo.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); //Update Section if (optType.Tag.ToString() == "L") { sqlQuery = "Update tblCat_Section Set SectName = '" + txtName.Text.ToString().Trim() + "', SectNameB = '" + txtNameB.Text.ToString().Trim() + "',DeptID = " + cboUnder.Value + " where SectId = '" + secId_update + "'"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into GTRHRIS.dbo.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 Department sqlQuery = "Exec prcTran_Dept 'NEW', " + Common.Classes.clsMain.intComId + ", 0, '" + txtName.Text + "', '" + optType.Tag.ToString() + "', " + cboUnder.Value + ", " + Common.Classes.clsMain.strComputerName + ", " + Common.Classes.clsMain.intUserId + ""; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into GTRHRIS.dbo.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); //---------------------- //add new Section if (optType.Tag.ToString() == "L") { Int32 NewId = 0, NewIdDpt = 0; sqlQuery = "Select Isnull(Max(SectId ),0)+1 As NewId from tblCat_Section "; NewId = clsCon.GTRCountingData(sqlQuery); sqlQuery = "Select Isnull(Max(DeptID),0)+1 from tblCat_Department "; NewIdDpt = clsCon.GTRCountingData(sqlQuery); sqlQuery = "Insert Into tblCat_Section( ComId, SectId, SectName, SectNameB, DeptID, aId , SLNo, PCName, LUserId) values('" + Common.Classes.clsMain.intComId + "','" + NewId + "','" + txtName.Text.Trim().ToString() + "','" + txtNameB.Text.Trim().ToString() + "','" + NewIdDpt + "','" + NewId + "','" + NewId + "','" + Common.Classes.clsMain.strComputerName + "','" + Common.Classes.clsMain.intUserId + "')"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into GTRHRIS.dbo.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(); prcLoadList(); prcLoadCombo(); optType.Focus(); } 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; Int32 MonthId = 0; Int32 CountRow = 0; DateTime lastDay = new DateTime(dtInputeDate.DateTime.Year, dtInputeDate.DateTime.Month, 1); lastDay = lastDay.AddMonths(1); lastDay = lastDay.AddDays(-(lastDay.Day)); dtInputeDate.Value = lastDay; try { if (btnSave.Text.ToString() != "&Save") { //Update sqlQuery = " Update tblCat_ExchangeRatePF Set dtInput = '" + clsProc.GTRDate(dtInputeDate.DateTime.ToString()) + "', ExchRate = '" + clsProc.GTRValidateDouble(txtExchangeRate.Text) + "' Where ExchId = '" + int.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); clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Succefully"); } else { sqlQuery = "Select Isnull(Max(ExchId),0)+1 As NewId from tblCat_ExchangeRatePF"; NewId = clsCon.GTRCountingData(sqlQuery); //Insert to Table sqlQuery = " Insert Into tblCat_ExchangeRatePF (ComId, ExchId, dtInput, ExchRate, aId, PCName, LUserId) " + "Values('" + Common.Classes.clsMain.intComId + "','" + NewId + "','" + clsProc.GTRDate(dtInputeDate.Value.ToString()) + "','" + clsProc.GTRValidateDouble(txtExchangeRate.Text) + "','" + NewId + "','" + 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(); 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; Int32 intId = 0; //Value update with number of rows affected in sql server try { //Member Master Table if (btnSave.Text.ToString() != "&Save") { //Update sqlQuery = "Delete From [tblSubtmp_Data] Where TmpId = " + double.Parse(txtId.Text.ToString()) + ""; arQuery.Add(sqlQuery); foreach (UltraGridRow row in gridTemp.Rows) { if (row.Cells["SubjectId"].Text.ToString().Length == 0) { break; } Int32 RowId = row.Index + 1; sqlQuery = "Insert Into tblSubtmp_Data ( comId,tmpId,subId, subCode, marks,RowNo) " + " Values (" + clsMain.intComId + ", " + txtId.Text.ToString() + ", " + row.Cells["SubjectId"].Value.ToString() + ", '" + row.Cells["subjectCode"].Value.ToString() + "', " + row.Cells["marks"].Text.ToString() + ", " + RowId + ")"; 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("'", "|") + "','Update')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Succefully"); } else { //NewId sqlQuery = "Select Isnull(Max(TmpId),0)+1 As NewId from tblsubTmp_Data"; NewId = clsCon.GTRCountingData(sqlQuery); foreach (UltraGridRow row in gridTemp.Rows) { if (row.Cells["SubjectId"].Text == "") { break; } Int32 RowId = row.Index + 1; sqlQuery = "Insert Into tblSubtmp_Data ( comId,tmpId,subId,subCode, marks, RowNo) " + " Values (" + clsMain.intComId + ", " + NewId + ", " + row.Cells["SubjectId"].Value.ToString() + ", '" + row.Cells["subjectCode"].Value.ToString() + "','" + row.Cells["marks"].Value.ToString() + "', " + RowId + ")"; arQuery.Add(sqlQuery); } sqlQuery = "Insert Into tblSubTmp_info (comId, TmpId, dtCreate, ClassId, Description, sesn, ttlExam, LUserId ) " + " Values (" + clsMain.intComId + ", " + NewId + ", '" + clsProc.GTRDate(dtCreate.Value.ToString()) + "'," + cboClass.Value.ToString() + ",'" + txtDescription.Text.ToString() + "', '" + cbosesn.Text.ToString() + "', '" + cboExam.Text.ToString() + "', " + clsMain.intUserId + ")"; 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("'", "|") + "','Insert')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Succefully"); } prcClearData(); txtTempNo.Focus(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }