private void ToolStripButton1_Click(object sender, EventArgs e) { var ds1 = new DataSet(); var ds2 = new DataSet(); var MaxRow = ((SFeedingGrid.FocusedView as GridView).RowCount); for (var i = 0; i < MaxRow; i++) { var currentrow = SFeedingGridView.GetDataRow(i); var str1 = "Select EmpCode,EmpName from EmpMst where EmpCode='" + currentrow["EmpCode"].ToString().PadLeft(5, '0') + "'"; ds1 = ProjectFunctions.GetDataSet(str1); if (ds1.Tables[0].Rows.Count > 0) { SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["EmpName"], ds1.Tables[0].Rows[0]["EmpName"].ToString()); } else { SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["EmpCode"], "XXXXXXXXXXXXXXXXXXX"); SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["EmpName"], "XXXXXXXXXXXXXXXXXXX"); XtraMessageBox.Show("Invalid Dept "); } } SFeedingGridView.BestFitColumns(); }
private void OpenFileDialog1_FileOk(object sender, CancelEventArgs e) { SFeedingGrid.Refresh(); var xlConn = string.Empty; xlConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + openFileDialog1.FileName + ";Extended Properties=\"Excel 12.0;\";"; using (var myCommand = new OleDbDataAdapter("SELECT MonthYear,EmpCode,EmpName,EmpDW,EmpPH,EmpEL,EmpCL,EmpSL,EmpPymtMode FROM [Sheet1$]", xlConn)) { myCommand.Fill(dt); SFeedingGrid.DataSource = dt; SFeedingGridView.BestFitColumns(); } }
private void OpenFileDialog1_FileOk(object sender, CancelEventArgs e) { SFeedingGrid.Refresh(); var xlConn = string.Empty; xlConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + openFileDialog1.FileName + ";Extended Properties=\"Excel 12.0;\";"; using (var myCommand = new OleDbDataAdapter("SELECT EmpPartyCode,AccName,UnitCode,UnitName, EmpCode,EmpName,EmpFHRelationTag,EmpFHName,EmpDeptCode,DeptDesc,EmpDesgCode,DesgDesc,EmpDOJ,EmpPFno,EmpUANNo,EmpBasic,EmpHRA,EmpConv,EmpPET,EmpSplAlw,EmpTDS,EmpMscD1,EmpPanNo,EmpAdharCardNo,EmpBankIFSCode,EmpBankAcNo,EmpDOB,PFTAG,FPFTAG,ESITAG FROM[Sheet1$]", xlConn)) { myCommand.Fill(dt); SFeedingGrid.DataSource = dt; SFeedingGridView.BestFitColumns(); } }
private void ToolStripButton1_Click(object sender, EventArgs e) { var ds1 = new DataSet(); var ds2 = new DataSet(); var ds3 = new DataSet(); var ds4 = new DataSet(); var MaxRow = ((SFeedingGrid.FocusedView as GridView).RowCount); for (var i = 0; i < MaxRow; i++) { var currentrow = SFeedingGridView.GetDataRow(i); var str1 = "Select DeptCode,DeptDesc from DeptMst where DeptCode='" + currentrow["EmpDeptCode"].ToString().PadLeft(4, '0') + "'"; ds1 = ProjectFunctions.GetDataSet(str1); var str2 = "Select DesgCode,DesgDesc from DesgMst where DesgCode='" + currentrow["EmpDesgCode"].ToString().PadLeft(4, '0') + "'"; ds2 = ProjectFunctions.GetDataSet(str2); var str3 = "Select UnitCode,UnitName from UnitMst where UnitCode='" + currentrow["UnitCode"].ToString().PadLeft(4, '0') + "'"; ds3 = ProjectFunctions.GetDataSet(str3); var str4 = "Select AccCode,AccName from ActMst where AccCode='" + currentrow["EmpPartyCode"].ToString().PadLeft(4, '0') + "'"; ds4 = ProjectFunctions.GetDataSet(str4); if (ds1.Tables[0].Rows.Count > 0) { SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["DeptDesc"], ds1.Tables[0].Rows[0]["DeptDesc"].ToString()); } else { SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["EmpDeptCode"], "XXXXXXXXXXXXXXXXXXX"); SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["DeptDesc"], "XXXXXXXXXXXXXXXXXXX"); XtraMessageBox.Show("Invalid Dept "); } if (ds2.Tables[0].Rows.Count > 0) { SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["DesgDesc"], ds2.Tables[0].Rows[0]["DesgDesc"].ToString()); } else { SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["EmpDesgCode"], "XXXXXXXXXXXXXX"); SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["DesgDesc"], "XXXXXXXXXXXXXX"); XtraMessageBox.Show("Invalid Designation "); } if (ds3.Tables[0].Rows.Count > 0) { SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["UnitName"], ds3.Tables[0].Rows[0]["UnitName"].ToString()); } else { SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["UnitCode"], "XXXXXXXXXXXXXX"); SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["UnitName"], "XXXXXXXXXXXXXX"); XtraMessageBox.Show("Invalid Unit "); } if (ds4.Tables[0].Rows.Count > 0) { SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["AccName"], ds4.Tables[0].Rows[0]["AccName"].ToString()); } else { SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["EmpPartyCode"], "XXXXXXXXXXXXXX"); SFeedingGridView.SetRowCellValue(i, SFeedingGridView.Columns["AccName"], "XXXXXXXXXXXXXX"); XtraMessageBox.Show("Invalid Unit "); } } SFeedingGridView.BestFitColumns(); }