private void FillGrid() { DataSet dsAccName = ProjectFunctionsUtils.GetDataSet("Select AccCode,AccName,AccCodeBusy from ActMst"); DataSet ds = ProjectFunctionsUtils.GetDataSetBusy("Select Code as AccCodeBusy,Name as AccNameBusy,'' as AccCode,'' as AccName from Master1 where MasterType='2' "); if (ds.Tables[0].Rows.Count > 0) { dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { foreach (DataRow drActMst in dsAccName.Tables[0].Rows) { if (dr["AccCodeBusy"].ToString() == drActMst["AccCodeBusy"].ToString()) { dr["AccCode"] = drActMst["AccCode"].ToString(); dr["AccName"] = drActMst["AccName"].ToString(); } } } AccountGrid.DataSource = dt; AccountGridView.BestFitColumns(); } else { AccountGrid.DataSource = null; AccountGridView.BestFitColumns(); } }
//static string prevPage; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AccountGridView.Visible = false; // prevPage = Request.UrlReferrer.AbsolutePath; } if (IsPostBack) { if (usernamehidden.Value == null) { ErrorPanel.Visible = false; Hide.Visible = true; } else { //if (prevPage.Contains("LoginPage")) //{ AccountGridView.Visible = true; string query = "SELECT [ID], [JobTitle], [CompanyName], [HasApplied], [DateAppCloses], [DateInterview], [DateOfferDeadline] FROM [AppliCanEntries] WHERE [Enabled] = 1 AND [AccountUser] = '" + usernamehidden.Value + "'"; //AccountInfoSqlDataSource.SelectCommand = AccountInfoSqlDataSource.SelectCommand + " AND [AccountUser] = '"+ usernamehidden.Value + "'"; AccountInfoSqlDataSource.SelectCommand = query; AccountGridView.DataBind(); //AccountGridView.Visible = true; //} //else //{ //} } } }
private void BtnImport_Click(object sender, EventArgs e) { DataRow currentrow = AccountGridView.GetDataRow(AccountGridView.FocusedRowHandle); DataSet ds = ProjectFunctionsUtils.GetDataSetBusy("Select * from MasterAddressInfo where MasterCode='" + currentrow["AccCodeBusy"].ToString() + "'"); if (ds.Tables[0].Rows.Count > 0) { FrmAccountMstAddEdit frm = new FrmAccountMstAddEdit() { S1 = "&Add", Text = "Account Addition" }; frm.StartPosition = FormStartPosition.CenterScreen; // only name block DataSet dsNane = ProjectFunctionsUtils.GetDataSetBusy("Select Code ,Name from MASTER1 Where Code='" + currentrow["AccCodeBusy"].ToString() + "'"); frm.txtAccCodeBusy.Text = dsNane.Tables[0].Rows[0]["Code"].ToString(); frm.txtAccNameBusy.Text = dsNane.Tables[0].Rows[0]["Name"].ToString(); frm.txtAcName.Text = dsNane.Tables[0].Rows[0]["Name"].ToString(); frm.txtBillingName.Text = dsNane.Tables[0].Rows[0]["Name"].ToString(); // only name block //address block & others frm.txtAddress1.Text = ds.Tables[0].Rows[0]["Address1"].ToString(); frm.txtAddress2.Text = ds.Tables[0].Rows[0]["Address2"].ToString(); frm.txtAddress3.Text = ds.Tables[0].Rows[0]["Address3"].ToString(); frm.txtAddress4.Text = ds.Tables[0].Rows[0]["Address4"].ToString(); frm.txtZipCode.Text = ds.Tables[0].Rows[0]["PINCode"].ToString(); DataSet dsCity = ProjectFunctions.GetDataSet("SELECT CITYMASTER.CTSYSID, CITYMASTER.CTNAME,STATEMASTER.STNAME,STATEMASTER.UNDERRG FROM CITYMASTER INNER JOIN STATEMASTER ON CITYMASTER.UNDERSTID = STATEMASTER.STSYSID Where CITYMASTER.CTNAME like'%" + ds.Tables[0].Rows[0]["Station"].ToString() + "%'"); if (dsCity.Tables[0].Rows.Count > 0) { frm.txtCityCode.Text = dsCity.Tables[0].Rows[0]["CTSYSID"].ToString(); frm.txtCityName.Text = dsCity.Tables[0].Rows[0]["CTNAME"].ToString(); frm.txtState.Text = dsCity.Tables[0].Rows[0]["STNAME"].ToString(); frm.txtCountry.Text = dsCity.Tables[0].Rows[0]["UNDERRG"].ToString(); } frm.txtTel.Text = ds.Tables[0].Rows[0]["TelNo"].ToString() + "," + ds.Tables[0].Rows[0]["Mobile"].ToString(); frm.txtEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString(); frm.txtTinNo.Text = ds.Tables[0].Rows[0]["TINNo"].ToString(); frm.txtCstPst.Text = ds.Tables[0].Rows[0]["CST"].ToString(); frm.txtPanNo.Text = ds.Tables[0].Rows[0]["ITPAN"].ToString(); frm.txtGSTNo.Text = ds.Tables[0].Rows[0]["GSTNo"].ToString(); frm.txtWhatsAppNo.Text = ds.Tables[0].Rows[0]["WhatsAppNo"].ToString(); //address block frm.ShowDialog(Parent); FillGrid(); } }
private void HelpGrid_DoubleClick(object sender, EventArgs e) { HelpGridView.CloseEditor(); HelpGridView.UpdateCurrentRow(); DataRow row = HelpGridView.GetDataRow(HelpGridView.FocusedRowHandle); if (HelpGrid.Text == "AccCode" || HelpGrid.Text == "AccName") { if (HelpGridView.RowCount > 0) { AccountGridView.SetRowCellValue(RowIndex, AccountGridView.Columns["AccCode"], row["AccCode"].ToString()); AccountGridView.SetRowCellValue(RowIndex, AccountGridView.Columns["AccName"], row["AccName"].ToString()); panelControl2.Visible = false; AccountGridView.Focus(); AccountGridView.FocusedRowHandle = RowIndex; txtSearchBox.Text = string.Empty; } } }
private void RefreshTable() { AccountGridView.DataSource = AccountController.viewAllAccounts(); AccountGridView.DataBind(); }