private void btnView_Click(object sender, EventArgs e) { frmSearch view = new frmSearch(); Operation.gViewQuery = "select Booking.[Number] as [Booking No],Booking.[Date] as [Booking Date],Inquiry.[BkDate] as [Function Date]," + "Inquiry.[FuncType] as [Function Type],Booking.[Party],Booking.[Deposite],Booking.[PmtMode] from Booking" + " left join Inquiry on Inquiry.[Number]=Booking.[InqNo]"; Operation.Bindgrid(Operation.gViewQuery, view.dgvSearch); view.OrderByColoumn = "Booking No"; view.ShowDialog(); view.dgvSearch.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; if (Operation.ViewID != null && Operation.ViewID != string.Empty) { var dt = Operation.GetDataTable("Select * from Booking where Number='" + Operation.ViewID.ToString() + "'"); if (dt != null && dt.Rows.Count > 0) { lblBookingNo.Text = dt.Rows[0]["Number"].ToString(); dteBookingDate.Value = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()); lblId.Text = dt.Rows[0]["Number"].ToString(); cmbInquiryDetail.SelectedValue = dt.Rows[0]["InqNo"].ToString(); cmbInquiryDetail_Validated(null, null); txtAdvanceAmount.Text = dt.Rows[0]["Deposite"].ToString(); txtChequeNo.Text = dt.Rows[0]["ChequeNo"].ToString(); txtChequeBank.Text = dt.Rows[0]["ChequeBank"].ToString(); dtpChequeDate.Value = Convert.ToDateTime(dt.Rows[0]["ChequeDt"].ToString()); cmbPaymentBy.Text = dt.Rows[0]["PmtMode"].ToString(); } Operation.ViewID = ""; } }
private void btnView_Click(object sender, EventArgs e) { frmSearch view = new frmSearch(); Operation.gViewQuery = "select Number as [Inquiry No],Date as [Inquiry Date],Party,MobNo as [Mobile],BkDate as [Function Date],FuncType as [Function Type] from Inquiry"; Operation.Bindgrid(Operation.gViewQuery, view.dgvSearch); view.OrderByColoumn = "Inquiry No"; view.ShowDialog(); view.dgvSearch.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; if (Operation.ViewID != null && Operation.ViewID != string.Empty) { var dt = Operation.GetDataTable("Select * from Inquiry where Number='" + Operation.ViewID.ToString() + "'"); if (dt != null && dt.Rows.Count > 0) { lblInquiryNo.Text = dt.Rows[0]["Number"].ToString(); lblId.Text = dt.Rows[0]["Number"].ToString(); txtParty.Text = dt.Rows[0]["Party"].ToString(); txtGathering.Text = dt.Rows[0]["TotPerson"].ToString(); txtAddress.Text = dt.Rows[0]["Address"].ToString(); txtMobile.Text = dt.Rows[0]["MobNo"].ToString(); cmbPlot.Text = dt.Rows[0]["Plot"].ToString(); cmbTimingSlot.Text = dt.Rows[0]["TimeType"].ToString(); cmbFunctionType.Text = dt.Rows[0]["FuncType"].ToString(); dteBookingDate.Value = Convert.ToDateTime(dt.Rows[0]["BkDate"].ToString()); dteInquiryDate.Value = Convert.ToDateTime(dt.Rows[0]["Date"].ToString()); } Operation.ViewID = ""; } }