void BindData(DataTable dt) { if (dt != null && dt.Rows.Count > 0 && gridView4 != null && gridView4.RowCount > 0) { for (int i = 0; i < gridView4.RowCount; i++) { if ((Int32)this.radioGroup1.EditValue == 1)//Revenue Code { objRevCode = gridView4.GetRowCellValue(i, "RevenueCode"); } else if ((Int32)this.radioGroup1.EditValue == 2)//Bank Branch { objRevCode = gridView4.GetRowCellValue(i, "BranchCode"); } if (objRevCode != null) { for (int j = 0; j < dt.Rows.Count; j++) { string revCode = Convert.ToString(objRevCode); string revCode1 = Convert.ToString(dt.Rows[j][0]); if (revCode.Trim() == revCode1.Trim()) //if (object.Equals(objRevCode, dt.Rows[0])) { //gridView4.SelectRow(i); selection.SelectRow(i, true); } } } } } }
void BindData() { DataTable dts = (new Logic()).getSqlStatement((String.Format("SELECT RevenueCode FROM tblPrintingRevenueCode ", ID, stationcode))).Tables[0]; if (dts != null) { //BindData(dts); boolIsUpdate = true; } if (dts != null && dts.Rows.Count > 0 && gridView4 != null && gridView4.RowCount > 0) { for (int i = 0; i < gridView4.RowCount; i++) { object objRevCode = gridView4.GetRowCellValue(i, "RevenueCode"); if (objRevCode != null) { for (int j = 0; j < dts.Rows.Count; j++) { string revCode = Convert.ToString(objRevCode); string revCode1 = Convert.ToString(dts.Rows[j][0]); if (revCode.Trim() == revCode1.Trim()) //if (object.Equals(objRevCode, dt.Rows[0])) { //gridView4.SelectRow(i); selection.SelectRow(i, true); } } } } } }
/// <summary> /// Handles the Load event of the FrmXtraExchangeRateDetail control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void FrmXtraExchangeRateDetail_Load(object sender, EventArgs e) { BudgetSourceSelection = new GridCheckMarksSelection(gridViewBudgetSource); if (ActionMode == ActionModeEnum.Edit && _rowHander >= 0) { BudgetSourceSelection.SelectRow(_rowHander, true); } BudgetSourceSelection.CheckMarkColumn.VisibleIndex = 0; BudgetSourceSelection.CheckMarkColumn.Width = 30; }
private bool FillField(string fieldid) { bool bResponse = false; //load data from the table into the forms for edit //DataTable dts = extMethods.LoadData(String.Format("select * from ViewBankBranch where BranchID ='{0}'", fieldid)); DataTable dts = (new Logic()).getSqlStatement((String.Format("select RevenueCode,RevenueName from viewRevenueCodeTaxPayerTypeRelation WHERE taxpayertypecode ='{0}'", fieldid))).Tables[0]; object objRevCode; if (dts != null && dts.Rows.Count > 0 && gridView4 != null && gridView4.RowCount > 0) { bResponse = true; for (int i = 0; i < gridView4.RowCount; i++) { objRevCode = gridView4.GetRowCellValue(i, "RevenueCode"); for (int j = 0; j < dts.Rows.Count; j++) { if ((string)objRevCode == (string)dts.Rows[j][0]) { selection.SelectRow(i, true); } } } //txtAddress.Text = dts.Rows[0]["Address"].ToString(); //txtBranchCode.Text = dts.Rows[0]["PlatFormCode"].ToString(); //txtBranchName.Text = dts.Rows[0]["BranchName"].ToString(); //txtEmail.Text = dts.Rows[0]["Email"].ToString(); //txtFax.Text = dts.Rows[0]["Fax"].ToString(); //txtPerson.Text = dts.Rows[0]["ContactPerson"].ToString(); //txtTelephone.Text = dts.Rows[0]["Telephone"].ToString(); //cboTown.Text = dts.Rows[0]["TownName"].ToString(); //cboBankName.Text = dts.Rows[0]["BankName"].ToString(); //txtCode.Text = dts.Rows[0]["BranchCode"].ToString(); } else { bResponse = false; } return(bResponse); }
private void MarkData(int InAgencyCode) { using (var ds = new System.Data.DataSet()) { using (SqlDataAdapter ada = new SqlDataAdapter(string.Format("SELECT RevenueCode FROM Receipt.tblRevenueReceiptException WHERE AgencyCode='{0}'", InAgencyCode), Logic.ConnectionString)) { ada.Fill(ds, "table"); } dts = ds.Tables[0]; } if (dts != null && dts.Rows.Count > 0 && gridView4 != null && gridView4.RowCount > 0) { for (int i = 0; i < gridView4.RowCount; i++) { objRevCode = gridView4.GetRowCellValue(i, "RevenueCode"); if (objRevCode != null) { for (int j = 0; j < dts.Rows.Count; j++) { string revCode = Convert.ToString(objRevCode); string revCode1 = Convert.ToString(dts.Rows[j][0]); if (revCode.Trim() == revCode1.Trim()) //if (object.Equals(objRevCode, dt.Rows[0])) { //gridView4.SelectRow(i); //selection.SelectRow(i, true); selection.SelectRow(i, true); } } } } } }
private bool FillField(int fieldid) { try { bool bResponse = false; //load data from the table into the forms for edit DataTable dtBanks = new DataTable(); DataTable dtBranch = new DataTable(); DataTable dtAgency = new DataTable(); DataTable dtRevenue = new DataTable(); DataTable dts = (new Logic()).getSqlStatement((String.Format("SELECT Name FROM Receipt.tblProfile WHERE ProfileID ='{0}'", fieldid))).Tables[0]; dtBanks = (new Logic()).getSqlStatement((String.Format("SELECT DISTINCT Bank as BankShortCode FROM Receipt.tblProfileCriteria WHERE ProfileID ='{0}'", fieldid))).Tables[0]; dtBranch = (new Logic()).getSqlStatement((String.Format("SELECT DISTINCT Bank as BankShortCode ,BankBranch as BranchCode FROM Receipt.tblProfileCriteria WHERE BankBranch IS NOT NULL AND ProfileID ='{0}'", fieldid))).Tables[0]; dtAgency = (new Logic()).getSqlStatement((String.Format("SELECT DISTINCT Agency as AgencyCode FROM Receipt.tblProfileCriteria WHERE ProfileID ='{0}'", fieldid))).Tables[0]; dtRevenue = (new Logic()).getSqlStatement((String.Format("SELECT DISTINCT Revenue as RevenueCode,AgencyCode as AgencyCode FROM Receipt.tblProfileCriteria JOIN Collection.tblRevenueType ON Revenue=RevenueCode WHERE Revenue IS NOT NULL AND ProfileID ='{0}'", fieldid))).Tables[0]; int k = 0; int l = 0; if (dts != null) { bResponse = true; txtName.Text = dts.Rows[0]["Name"].ToString(); txtName.Enabled = false; if (dtBanks != null && dtBanks.Rows.Count >= 1) { values = string.Empty; if (dtBanks.Rows[0]["BankShortCode"] != DBNull.Value) { foreach (DataRow item in dtBanks.Rows) { values += string.Format("{0}", item["BankShortCode"].ToString().Trim()); if (l + 1 < dtBanks.Rows.Count) { values += ","; } ++l; } cboBankEdt.SetEditValue(values.ToString()); //check bank branch if (dtBranch != null && dtBranch.Rows.Count >= 1) { if (dtBranch.Rows[0]["BranchCode"] != DBNull.Value) { for (int i = 0; i < gridView3.RowCount; i++) { object objbankCode = gridView5.GetRowCellValue(i, "BankShortCode"); object objBranchCode = gridView5.GetRowCellValue(i, "BranchCode"); for (int z = 0; z < dtBranch.Rows.Count; z++) { string Bankcode = Convert.ToString(objbankCode); string Branchcode = Convert.ToString(objBranchCode); string branchcode1 = Convert.ToString(dtBranch.Rows[z][1]); string BankCode1 = Convert.ToString(dtBranch.Rows[z][0]); if ((Bankcode.Trim() == BankCode1.Trim()) && (Branchcode.Trim() == branchcode1.Trim())) { selection.SelectRow(z, true); } } } } else { for (int i = 0; i < gridView3.RowCount; i++) { selection.SelectRow(i, true); } } } else { for (int i = 0; i < gridView3.RowCount; i++) { selection.SelectRow(i, true); } } } //for (int i = 0; i < gridView4.RowCount; i++) //{ //} //if (ds.Tables[0].Rows[0]["ControlNumber"] == DBNulesl.Value) } if (dtAgency != null && dtAgency.Rows.Count >= 1) { if (dtAgency.Rows[0]["AgencyCode"] != DBNull.Value) { values = string.Empty; foreach (DataRow item in dtAgency.Rows) { values += string.Format("{0}", item["AgencyCode"].ToString().Trim()); if (k + 1 < dtAgency.Rows.Count) { values += ","; } ++k; } cboAgencyTest.SetEditValue(values); for (int i = 0; i < gridView5.RowCount; i++) { selectiongrid.SelectRow(i, true); } } else { if (dtRevenue != null && dtRevenue.Rows.Count >= 1) { if (dtRevenue.Rows[0]["AgencyCode"] != DBNull.Value) { DataTable dtg = dtRevenue.DefaultView.ToTable(true, "AgencyCode"); cboAgencyTest.SetEditValue(dtg.Rows[0]["AgencyCode"].ToString()); } for (int i = 0; i < gridView5.RowCount; i++) { object objAgeCode = gridView5.GetRowCellValue(i, "AgencyCode"); object objRevCode = gridView5.GetRowCellValue(i, "RevenueCode"); for (int j = 0; j < dtRevenue.Rows.Count; j++) { string revCode = Convert.ToString(objRevCode); string Agcode = Convert.ToString(objAgeCode); string Agecode1 = Convert.ToString(dtRevenue.Rows[j][1]); string revCode1 = Convert.ToString(dtRevenue.Rows[j][0]); if ((Agcode.Trim() == Agecode1.Trim()) && (revCode.Trim() == revCode1.Trim())) { //selection.SelectRow(i, true); selectiongrid.SelectRow(j, true); } } } } } } //if (!string.IsNullOrEmpty(dts.Rows[0]["Agency"].ToString())) //{ // //cboAgencyTest.SetEditValue(dts.Rows[0]["Agency"].ToString()); // removeCombinedFlags(cboAgencyTest.Properties); //} //if (!string.IsNullOrEmpty(dts.Rows[0]["Revenue"].ToString())) //{ // cboRevenueEdt.SetEditValue(dts.Rows[0]["Revenue"].ToString()); //} //if (!string.IsNullOrEmpty(dts.Rows[0]["Bank"].ToString())) //{ // cboBankEdt.SetEditValue(dts.Rows[0]["Bank"].ToString()); //} //if (!string.IsNullOrEmpty(dts.Rows[0]["BankBranch"].ToString())) //{ // cboBranchesEdt.SetEditValue(dts.Rows[0]["BankBranch"].ToString()); //} } else { bResponse = false; } return(bResponse); } catch (Exception ex) { Tripous.Sys.ErrorBox(ex.Message.ToString()); return(false); } }
private void setReload() { //connect.connect.Close(); DataTable dt; using (var ds = new System.Data.DataSet()) { using (SqlDataAdapter ada = new SqlDataAdapter("SELECT RevenueCode,Description,Registration.tblAgency.AgencyCode,AgencyName FROM Collection.tblRevenueType INNER JOIN Registration.tblAgency ON Collection.tblRevenueType.AgencyCode = Registration.tblAgency.AgencyCode WHERE RevenueCode='100011004112001'", Logic.ConnectionString)) { ada.Fill(ds, "table"); } dt = ds.Tables[0]; gridControl1.DataSource = ds.Tables[0]; } gridView1.OptionsBehavior.Editable = false; gridView1.Columns["AgencyCode"].Visible = false; gridView1.Columns["RevenueCode"].Visible = false; gridView1.BestFitColumns(); if (isFirstGrid) { Label lbltext = new Label(); selection = new GridCheckMarksSelection(gridView1, ref lbltext); selection.CheckMarkColumn.VisibleIndex = 0; isFirstGrid = false; groupBox1.Text = lbltext.Text.Trim(); } using (SqlConnection connect = new SqlConnection(Logic.ConnectionString)) { connect.Open(); _command = new SqlCommand("dogetRevenueTemp", connect) { CommandType = CommandType.StoredProcedure }; using (System.Data.DataSet ds = new System.Data.DataSet()) { ds.Clear(); adp = new SqlDataAdapter(_command); adp.Fill(ds); connect.Close(); if (ds.Tables[0].Rows[0]["returnCode"].ToString() == "00") { if (ds.Tables[1].Rows.Count > 0) { //loope through the dataset to get for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { for (int h = 0; h < gridView1.DataRowCount; h++) { int rowHandle = h; //object obj = gridView1.GetRowCellValue(rowHandle, "RevenueCode"); //object bjt1 = ds.Tables[1].Rows[i]["RevenueCode"]; if (gridView1.GetRowCellValue(rowHandle, "RevenueCode").Equals(ds.Tables[1].Rows[i]["RevenueCode"])) { selection.SelectRow(rowHandle, true); ID = ds.Tables[1].Rows[i]["RevenueCode"].ToString(); boolIsUpdate = true; } else { break; } } } } else { boolIsUpdate = true; } } } //else //{ // gridControl1.DataSource = ds.Tables[1]; //} } }