protected void sign_Click(object sender, EventArgs e) { SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["OnlineCourseConnectionString"].ConnectionString); try { connection.Open(); string sql = "UPDATE Users SET Cash = Cash + 50 WHERE UserID={0}"; sql = string.Format(sql, Session["UserID"]); SqlCommand command = new SqlCommand(sql, connection); command.ExecuteNonQuery(); HttpCookie signed = new HttpCookie("Signed"); signed.Value = "1"; signed.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(signed); DetailsView.DataBind(); Response.Write("<script>alert('签到成功!');</script>"); } catch (Exception) { Response.Write("<script>alert('签到失败!');</script>"); } finally { connection.Close(); } }
public static void DetailsView_Applview(DetailsView personalinfo, DetailsView purpose, DetailsView payment, string FileNumber, GridView hischool, GridView college, GridView service1grid, GridView addongrid, GridView copychargergrid, int Customer_Id, GridView deliverydetails, GridView fax_grid, GridView fax_details, GridView Email_grid, GridView email_details, DetailsView senderinfo) { string strSQL = "SELECT cc_clientdataset.applicant.FirstName, cc_clientdataset.applicant.MiddleName, cc_clientdataset.applicant.LastName,cc_clientdataset.applicant.FirstName+' '+ cc_clientdataset.applicant.MiddleName+' '+ cc_clientdataset.applicant.LastName AS Name, cc_clientdataset.applicant.Gender, cc_clientdataset.applicant.otherFirstName+' '+cc_clientdataset.applicant.otherMiddleName+' '+cc_clientdataset.applicant.otherLastName AS othername, cc_clientdataset.applicant.DateOfBirth, cc_clientdataset.applicant.Addressline1,cc_clientdataset.applicant.Addressline2, cc_clientdataset.applicant.City,cc_clientdataset.applicant.FileNumber,cc_clientdataset.applicant.PreviousCredential_id, countries.Name AS country,countries_1.Name AS CountryBirth, cc_clientdataset.applicant.State_or_province, cc_clientdataset.applicant.Zip_or_PostalCode,cc_clientdataset.applicant.Paymentmode,cc_clientdataset.applicant.Paymentstatus,cc_clientdataset.applicant.Authorizecode,cc_clientdataset.applicant.Transactioncode, cc_clientdataset.applicant.HomePhone, cc_clientdataset.applicant.WorkPhone, cc_clientdataset.applicant.MobilePhone, cc_clientdataset.applicant.Email,cc_clientdataset.evaluation_purpose.Evaluation_Name, cc_clientdataset.evaluation_request.[Eval_institution],cc_clientdataset.evaluation_request.[Eval_organization],cc_clientdataset.evaluation_request.[Eval_Attorney],cc_clientdataset.evaluation_request.[Eval_Board],cc_clientdataset.evaluation_request.[Eval_State],cc_clientdataset.evaluation_request.[Eval_Military_Recruiter],cc_clientdataset.evaluation_request.[Eval_other],cc_clientdataset.evaluation_request.[Senders_Name],cc_clientdataset.evaluation_request.[Senders_Contact],cc_clientdataset.evaluation_request.[Purpose_Notes],cc_clientdataset.evaluation_request.id FROM cc_clientdataset.applicant INNER JOIN cc_clientdataset.evaluation_request ON cc_clientdataset.applicant.id = cc_clientdataset.evaluation_request.Applicant_Id LEFT JOIN cc_masterdataset.countries ON cc_clientdataset.applicant.CountryId = cc_masterdataset.countries.ID INNER JOIN cc_clientdataset.evaluation_purpose ON cc_clientdataset.evaluation_request.Purpose_Id = cc_clientdataset.evaluation_purpose.id INNER JOIN cc_masterdataset.countries countries_1 ON cc_clientdataset.applicant.Countryofbirth = countries_1.ID where cc_clientdataset.applicant.FileNumber='" + FileNumber + "'"; DataSet ds = GetDataSet(strSQL); if (ds.Tables[0].Rows.Count > 0) { personalinfo.DataSource = ds; personalinfo.DataBind(); purpose.DataSource = ds; purpose.DataBind(); senderinfo.DataSource = ds; senderinfo.DataBind(); payment.DataSource = ds; payment.DataBind(); Grid_hischoolgrid(hischool, Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString())); Grid_univgrid(college, Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString())); Grid_service1grid(service1grid, Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString())); Grid_copycharger(copychargergrid, Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString()), "Additional", Customer_Id); Grid_addonsservice(addongrid, Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString())); Grid_Fax(fax_grid, Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString()), "Fax", Customer_Id); Grid_Email(Email_grid, Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString()), "Email", Customer_Id); Grid_deliveryinfo(deliverydetails, Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString())); Grid_faxgrid(fax_details, Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString())); Grid_emailgrid(email_details, Convert.ToInt32(ds.Tables[0].Rows[0]["id"].ToString())); } }
public void detail(string tbnm, string colnm, string val, DetailsView dtl) { da = new SqlDataAdapter("select * from " + tbnm + " where " + colnm + "=" + val + "", con); da.Fill(ds); dtl.DataSource = ds; dtl.DataBind(); }
public void FillDetailsView(string querystr, DetailsView list) { DataTable dt = GetDataTable(querystr); list.DataSource = dt; list.DataBind(); }
public void FillDetailsView(string str, DetailsView grd) { DataTable dt = new DataTable(); dt = selectQuery(str); grd.DataSource = dt; grd.DataBind(); }
public static void Select_AppSettings(DetailsView commongrid, string Id) { string strSQL = "Select * from cc_masterdataset.customersettings where Id=" + Id; DataSet ds = GetDataSet(strSQL); commongrid.DataSource = ds; commongrid.DataBind(); }
private void DetailsView_DataBind() { //Set datasource (IList, DataTable, DataView, LINQ Object) _detailsView.DataSource = _list; //Bind gridview _detailsView.DataBind(); }
public void FillGridView(string sel, DetailsView detailsview) { DataTable dt = new DataTable(); dt = selectQuery(sel); detailsview.DataSource = dt; detailsview.DataBind(); //throw new NotImplementedException(); }
/// <summary> /// Control how the DetailsView is handled for each individual section /// This providers a much higher level of validation and security /// Also allows for full customization of what the update command does /// http://www.c-sharpcorner.com/uploadfile/raj1979/using-Asp-Net-detailsview-control-without-sqldatasource/ /// </summary> /// <param name="UserID"></param> #region Details View Handling /// <summary> /// Get the data /// </summary> /// <param name="UserID"></param> protected void DetailsView_Data(Int32 DonationID, Int32 DonorID, DetailsView dv) { #region SQL Connection using (SqlConnection con = new SqlConnection(sqlStr)) { #region SQL Command using (SqlCommand cmd = new SqlCommand("", con)) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.CommandTimeout = 600; String cmdText = ""; if (dv.ID == "DetailsView1") { cmdText = "[dbo].[portal_donation_search_get_details]"; } if (dv.ID == "DetailsView2") { cmdText = "[dbo].[portal_donation_search_get_donor]"; } if (dv.ID == "DetailsView3") { cmdText = "[dbo].[portal_donation_search_get_tribute]"; } if (dv.ID == "DetailsView4") { cmdText = "[dbo].[portal_donation_search_get_payment]"; } if (dv.ID == "DetailsView5") { cmdText = "[dbo].[portal_donation_search_get_contact]"; } cmd.CommandText = cmdText; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Clear(); #region SQL Parameters cmd.Parameters.Add(new SqlParameter("@SP_DonationID", DonationID)); cmd.Parameters.Add(new SqlParameter("@SP_DonorID", DonorID)); #endregion SQL Parameters #region SQL Processing SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); dv.DataSource = dt; //DetailsView1.DataSource = dt; dv.DataBind(); //DetailsView1.DataBind(); dtlLabel.Text += "<br />" + dv.ID; #endregion SQL Processing } #endregion SQL Command } #endregion SQL Connection }
/// <summary> /// Handles the SelectedIndexChanged event of the OrdersGridView control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void OrdersGridView_SelectedIndexChanged(object sender, EventArgs e) { GridView ordersGrid = (GridView)LoginView.FindControl("OrdersGridView"); DetailsView billingDetails = (DetailsView)LoginView.FindControl("BillingDetails"); DetailsView shippingDetails = (DetailsView)LoginView.FindControl("ShippingDetails"); Panel orderDetailsPanel = (Panel)LoginView.FindControl("OrderDetailsPanel"); Label statusLbl = (Label)LoginView.FindControl("StatusLabel"); Label orderNumberLbl = (Label)LoginView.FindControl("GoogleOrderNumberLabel"); Label fulfillmentLbl = (Label)LoginView.FindControl("FulfillmentLabel"); Label financialLbl = (Label)LoginView.FindControl("FinancialLabel"); Label totalAmountLbl = (Label)LoginView.FindControl("TotalAmountLabel"); Label taxLbl = (Label)LoginView.FindControl("TaxLabel"); Label chargedAmountLbl = (Label)LoginView.FindControl("ChargedAmountLabel"); Label dateLbl = (Label)LoginView.FindControl("DateLabel"); GridView orderItemsGrid = (GridView)LoginView.FindControl("OrderItemsGridView"); Button cancelBtn = (Button)LoginView.FindControl("CancelButton"); orderDetailsPanel.Visible = true; ordersGrid.Visible = false; long dataKey = (long)ordersGrid.SelectedDataKey.Value; List <order> source = Orders.Orders.GetOrderDetails(dataKey); List <order_item> items = Orders.Orders.GetItems(source[0].order_id); List <customer> customerDetails = Orders.Orders.GetCustomerDetails(dataKey); if (source[0].status != "TEMP") { if (source[0].status == "CANCELLED" || source[0].status == "CANCELLED_BY_GOOGLE") { cancelBtn.Enabled = false; } else { cancelBtn.Enabled = true; } orderNumberLbl.Text = dataKey.ToString(); financialLbl.Text = source[0].status; fulfillmentLbl.Text = source[0].shipping_status; taxLbl.Text = source[0].tax.ToString(); totalAmountLbl.Text = source[0].total.ToString(); chargedAmountLbl.Text = source[0].charged_amount.ToString(); dateLbl.Text = source[0].order_date.ToShortDateString(); billingDetails.DataSource = customerDetails; billingDetails.DataBind(); shippingDetails.DataSource = source; shippingDetails.DataBind(); orderItemsGrid.DataSource = items; orderItemsGrid.DataBind(); } else { statusLbl.Text = "No details available!"; } }
private void InitDvMessageTypes(IList <MessageType> dataSource) { const string dvMessagesTypeTxtName = "txtName"; const string dvMessagesTypeTxtNameBindingName = "Name"; const string dvMessagesTypeTxtDescription = "txtDescription"; const string dvMessagesTypeTxtDescriptionBindingName = "Description"; const string dvMessagesTypeDdlThreshold = "ddlThreshold"; const string dvMessagesTypeDdlThresholdBindingName = "Threshold"; const string dvMessagesTypeDdlPriority = "ddlPriority"; const string dvMessagesTypeDdlPriorityBindingName = "Priority"; const string dvMessagesTypeDdlIsActive = "ddlIsActive"; const string dvMessagesTypeDdlIsActiveBindingName = "IsActive"; _dvMessageTypes.ChangeMode(DetailsViewMode.Edit); var txtName = CreateTextBox(dvMessagesTypeTxtName, dvMessagesTypeTxtNameBindingName); var txtNameField = CreateTemplateField(txtName); _dvMessageTypes.Fields.Add(txtNameField); var txtDescription = CreateTextBox(dvMessagesTypeTxtDescription, dvMessagesTypeTxtDescriptionBindingName); var txtDescriptionField = CreateTemplateField(txtDescription); _dvMessageTypes.Fields.Add(txtDescriptionField); var dropDownDataSource = new List <bool> { false, true }; var ddlThreshold = CreateDropdownList(dvMessagesTypeDdlThreshold, dvMessagesTypeDdlThresholdBindingName, dropDownDataSource); var ddlThresholdField = CreateTemplateField(ddlThreshold); _dvMessageTypes.Fields.Add(ddlThresholdField); var ddlPriority = CreateDropdownList(dvMessagesTypeDdlPriority, dvMessagesTypeDdlPriorityBindingName, dropDownDataSource); var ddlPriorityField = CreateTemplateField(ddlPriority); _dvMessageTypes.Fields.Add(ddlPriorityField); var ddlIsActive = CreateDropdownList(dvMessagesTypeDdlIsActive, dvMessagesTypeDdlIsActiveBindingName, dropDownDataSource); var ddlIsActiveField = CreateTemplateField(ddlIsActive); _dvMessageTypes.Fields.Add(ddlIsActiveField); _dvMessageTypes.DataKeyNames = new[] { nameof(MessageType.MessageTypeID) }; _dvMessageTypes.DataSource = dataSource.ToList(); _dvMessageTypes.DataBind(); }
/// <summary> /// Điền dữ liệu vào DetailsView web control /// </summary> /// <param name="dtView">Tên control DetailsView</param> /// <param name="objDataSource">Một đối tượng DataSource(DataTable, DataSet, List)</param> public void FillData(DetailsView dtView, Object objDataSource) { if (objDataSource != null) { dtView.DataSource = objDataSource; } else { dtView.DataSource = null; } dtView.DataBind(); }
/// <summary> /// Handles the SelectedIndexChanged event of the OrdersGridView control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void OrdersGridView_SelectedIndexChanged(object sender, EventArgs e) { GridView ordersGrid = (GridView)LoginView.FindControl("OrdersGridView"); DetailsView billingDetails = (DetailsView)LoginView.FindControl("BillingDetails"); DetailsView shippingDetails = (DetailsView)LoginView.FindControl("ShippingDetails"); Panel orderDetailsPanel = (Panel)LoginView.FindControl("OrderDetailsPanel"); Label statusLbl = (Label)LoginView.FindControl("StatusLabel"); Label orderNumberLbl = (Label)LoginView.FindControl("GoogleOrderNumberLabel"); Label fulfillmentLbl = (Label)LoginView.FindControl("FulfillmentLabel"); Label financialLbl = (Label)LoginView.FindControl("FinancialLabel"); Label totalAmountLbl = (Label)LoginView.FindControl("TotalAmountLabel"); Label shippingLbl = (Label)LoginView.FindControl("ShippingLabel"); Label taxLbl = (Label)LoginView.FindControl("TaxLabel"); Label refundLbl = (Label)LoginView.FindControl("RefundLabel"); Label chargedAmountLbl = (Label)LoginView.FindControl("ChargedAmountLabel"); Label dateLbl = (Label)LoginView.FindControl("DateLabel"); GridView orderItemsGrid = (GridView)LoginView.FindControl("OrderItemsGridView"); orderDetailsPanel.Visible = true; ordersGrid.Visible = false; long dataKey = (long)ordersGrid.SelectedDataKey.Value; List <order> source = Orders.Orders.GetOrderDetails(dataKey); List <order_item> items = Orders.Orders.GetItems(source[0].order_id); List <customer> customerDetails = Orders.Orders.GetCustomerDetails(dataKey); if (source[0].status != "TEMP") { orderNumberLbl.Text = dataKey.ToString(); financialLbl.Text = source[0].status; fulfillmentLbl.Text = source[0].shipping_status; shippingLbl.Text = source[0].shipping.ToString(); taxLbl.Text = source[0].tax.ToString(); totalAmountLbl.Text = source[0].total.ToString(); chargedAmountLbl.Text = source[0].charged_amount.ToString(); dateLbl.Text = source[0].order_date.ToShortDateString(); billingDetails.DataSource = customerDetails; billingDetails.DataBind(); shippingDetails.DataSource = source; shippingDetails.DataBind(); orderItemsGrid.DataSource = items; orderItemsGrid.DataBind(); if (source[0].sub_total + source[0].charged_amount != source[0].total) { decimal temp = source[0].total - Math.Abs(source[0].sub_total - source[0].charged_amount.Value); refundLbl.Text = temp.ToString(); } } else { statusLbl.Text = "No details available!"; } }
public void findOne(int id, DetailsView detailsView) { string query = "select * from Product where Id=@id"; var command = new SqlCommand(query, connect.setConnect()); command.Parameters.AddWithValue("@id", id); var sqlda = new SqlDataAdapter(command); var ds = new DataSet(); sqlda.Fill(ds, "Product"); detailsView.DataSource = ds.Tables["Product"]; detailsView.DataBind(); }
protected void btnClientEMBGSearch_Click(object sender, EventArgs e) { Panel pnlClient = PoliciesDetailsView.FindControl("pnlClient") as Panel; DetailsView clientDetailsView = pnlClient.FindControl("ClientDetailsView") as DetailsView; ObjectDataSource clientdvDataSource = pnlClient.FindControl("ClientdvDataSource") as ObjectDataSource; if (PoliciesDetailsView.SelectedValue != null) { int policyItemID = Convert.ToInt32(PoliciesDetailsView.SelectedValue); PolicyItem policyItem = PolicyItem.Get(policyItemID); string clientEMBG = policyItem.Policy.Client.EMBG; pnlClient.Visible = true; clientdvDataSource.SelectParameters.Clear(); clientdvDataSource.SelectParameters.Add("embg", clientEMBG); clientDetailsView.DataBind(); } else { pnlClient.Visible = false; clientdvDataSource.SelectParameters.Clear(); clientDetailsView.DataBind(); } }
public static void TConexionDetailView(string aSP, DetailsView Detail) { string CadConexion = WebConfigurationManager.ConnectionStrings["sql_conexion"].ToString(); SqlConnection Conexion = new SqlConnection(CadConexion); SqlDataAdapter aSDA = new SqlDataAdapter(aSP, Conexion); aSDA.SelectCommand.CommandType = CommandType.StoredProcedure; DataSet aDS = new DataSet(); aSDA.Fill(aDS); Detail.DataSource = aDS.Tables[0].DefaultView; Detail.DataBind(); }
public void detailsview(string sql, DetailsView dv) { con.Close(); con.Open(); DataTable dt = new DataTable(); cmd = new SqlCommand(sql, con); da = new SqlDataAdapter(cmd); da.Fill(dt); if (dt.Rows.Count > 0) { dv.DataSource = dt; dv.DataBind(); } }
/// <summary> /// Điền dữ liệu vào DetailsView web control /// </summary> /// <param name="dtView">Tên control DetailsView</param> /// <param name="objDataSource">Một đối tượng DataSource(DataTable, DataSet, List)</param> /// <param name="pageCount">Số button hiển thị</param> /// <param name="pageButton">Kiểu button để hiển thị</param> public void FillData(DetailsView dtView, Object objDataSource, Int32 pageCount, PagerButtons pageButton) { dtView.AllowPaging = true; if (objDataSource != null) { dtView.PagerSettings.PageButtonCount = pageCount; dtView.PagerSettings.Mode = pageButton; dtView.DataSource = objDataSource; } else { dtView.DataSource = null; } dtView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bind(); } D = new DemoEntities(); var V = from O in D.OrderInfoes select O; GridView.DataSource = V.ToList(); GridView.DataBind(); DetailsView.DataSource = V.ToList(); DetailsView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { mm = (MinMaster)Master; if (Page.RouteData.Values.ContainsKey("projectId") && Int32.Parse(Page.RouteData.Values["projectId"] as string) > 0) { DeleteButton.Visible = true; DetailsView.DefaultMode = DetailsViewMode.Edit; int idProject = Int32.Parse(Page.RouteData.Values["projectId"] as string); project = mm.SysDriver.GetProject(idProject); if (!Page.IsPostBack) { DetailsView.DataSource = new CE.Project[] { project }; DetailsView.DataBind(); } } }
protected void BindDetailsview() { DataSet ds = new DataSet(); string s1 = ConfigurationManager.ConnectionStrings["Connection"].ToString(); using (SqlConnection con = new SqlConnection(s1)) { con.Open(); SqlCommand cmd = new SqlCommand("select Name,Gender,Phnum,email,Addres from registrationdetailstable where email = '" + Session["Useremail"] + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); con.Close(); DetailsView.DataSource = ds; DetailsView.DataBind(); } }
protected PdfPTable GetDetailsViewAsPdfTable(DetailsView dv) { dv.DataBind(); PdfPTable teibol = new PdfPTable(2); foreach (DetailsViewRow row in dv.Rows) { PdfPCell celda = PdfCreator.getCellWithFormat(row.Cells[0].Text.ToUpper(), true, Element.ALIGN_LEFT, new iTextSharp.text.BaseColor(row.Cells[0].ForeColor)); //celda.BackgroundColor = new iTextSharp.text.BaseColor(row.Cells[0].BackColor); teibol.AddCell(celda); celda = PdfCreator.getCellWithFormat(row.Cells[1].Text.ToUpper(), true, Element.ALIGN_LEFT, new iTextSharp.text.BaseColor(row.Cells[1].ForeColor)); //celda.BackgroundColor = new iTextSharp.text.BaseColor(row.Cells[1].BackColor); celda.HorizontalAlignment = row.Cells[1].HorizontalAlign == HorizontalAlign.Right ? Element.ALIGN_RIGHT : Element.ALIGN_LEFT; teibol.AddCell(celda); } return(teibol); }
protected PdfPTable GetProveedorDetailsViewAsPdfTable(DetailsView dv) { dv.DataBind(); PdfPTable teibol = new PdfPTable(2); PdfPCell celdaHeader = PdfCreator.getCellWithFormat("PROVEEDOR", true, Element.ALIGN_CENTER); celdaHeader.Colspan = 2; teibol.AddCell(celdaHeader); foreach (DetailsViewRow row in dv.Rows) { PdfPCell celda = PdfCreator.getCellWithFormat(row.Cells[0].Text.ToUpper(), true, Element.ALIGN_LEFT, new iTextSharp.text.BaseColor(row.Cells[0].ForeColor)); //celda.BackgroundColor = new iTextSharp.text.BaseColor(row.Cells[0].BackColor); teibol.AddCell(celda); celda = PdfCreator.getCellWithFormat(row.Cells[1].Text.ToUpper(), true, Element.ALIGN_LEFT, new iTextSharp.text.BaseColor(row.Cells[1].ForeColor)); //celda.BackgroundColor = new iTextSharp.text.BaseColor(row.Cells[1].BackColor); teibol.AddCell(celda); } return(teibol); }
public static void TConexionDetailView(string aSP, DetailsView Detail, string aParametro) { string CadConexion = WebConfigurationManager.ConnectionStrings["sql_conexion"].ToString(); SqlConnection Conexion = new SqlConnection(CadConexion); SqlDataAdapter aSDA = new SqlDataAdapter(aSP, Conexion); aSDA.SelectCommand.CommandType = CommandType.StoredProcedure; aSDA.SelectCommand.Parameters.Add(new SqlParameter("@parametro", SqlDbType.VarChar, 50)); aSDA.SelectCommand.Parameters["@parametro"].Value = aParametro; DataSet aDS = new DataSet(); aSDA.Fill(aDS); Detail.DataSource = aDS.Tables[0].DefaultView; Detail.DataBind(); }
private void BindDetails() { String PlayerName = (String)Session["PlayerDetailsName"]; SqlCommand command = new SqlCommand(); command.CommandText = "SelectPlayerDetails"; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("Name", SqlDbType.NVarChar); command.Parameters["Name"].Value = PlayerName; DataConnection myConnection = new DataConnection(); try { DetailsView.DataSource = myConnection.ExecuteCommand(command); DetailsView.DataKeyNames = new string[] { "PlayerName" }; DetailsView.DataBind(); } finally { myConnection.CloseConection(); } }
private void BindDetails() { int clubId = (int)Session["ClubDetailsId"]; SqlCommand command = new SqlCommand(); command.CommandText = "SelectClub"; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("RegID", SqlDbType.Int); command.Parameters["RegID"].Value = clubId; DataConnection myConnection = new DataConnection(); try { DetailsView.DataSource = myConnection.ExecuteCommand(command); DetailsView.DataKeyNames = new string[] { "RegNum" }; DetailsView.DataBind(); } finally { myConnection.CloseConection(); } }
/// <summary> /// Control how the DetailsView is handled for each individual section /// This providers a much higher level of validation and security /// Also allows for full customization of what the update command does /// http://www.c-sharpcorner.com/uploadfile/raj1979/using-Asp-Net-detailsview-control-without-sqldatasource/ /// </summary> /// <param name="UserID"></param> #region Details View Handling /// <summary> /// Get the data /// </summary> /// <param name="UserID"></param> protected void DetailsView_Data(Int32 CallID, Int32 DonorID, DetailsView dv) { #region SQL Connection using (SqlConnection con = new SqlConnection(sqlStr)) { #region SQL Command using (SqlCommand cmd = new SqlCommand("", con)) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.CommandTimeout = 600; String cmdText = ""; if (dv.ID == "dvCallDetails") { cmdText = "[dbo].[portal_call_search_get_details]"; } if (dv.ID == "dvDonorDetails") { cmdText = "[dbo].[portal_call_search_get_donor]"; } if (dv.ID == "dvTributeDetails") { cmdText = "[dbo].[portal_call_search_get_tribute]"; } if (dv.ID == "dvPaymentDetails") { cmdText = "[dbo].[portal_call_search_get_payment]"; } if (dv.ID == "dvContactDetails") { cmdText = "[dbo].[portal_call_search_get_contact]"; } if (dv.ID == "dvRefundDetails") { cmdText = "[dbo].[portal_call_search_get_refund]"; } if (dv.ID == "dvADUFile") { cmdText = "[dbo].[portal_call_search_get_adufile]"; } if (dv.ID == "dvRemoveDetails") { cmdText = "[dbo].[portal_call_search_get_remove]"; } cmd.CommandText = cmdText; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Clear(); #region SQL Parameters cmd.Parameters.Add(new SqlParameter("@sp_callid", CallID)); if (dv.ID == "dvPaymentDetails") { if (GridView1.SelectedDataKey.Values[1].ToString().Length > 0) { Int32 cbid = Convert.ToInt32(GridView1.SelectedDataKey.Values[1].ToString()); cmd.Parameters.Add(new SqlParameter("@sp_cbid", cbid)); } } #endregion SQL Parameters #region SQL Processing SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); dv.DataSource = dt; //dvCallDetails.DataSource = dt; dv.DataBind(); //dvCallDetails.DataBind(); dtlLabel.Text += "<br />" + dv.ID; #endregion SQL Processing } #endregion SQL Command } #endregion SQL Connection }
/// <summary> /// Gets the details. /// </summary> private void GetDetails() { LotusDataContext db = new LotusDataContext(); var source1 = from b in db.bookings join p in db.pages on b.page_id equals p.page_id where (b.id == int.Parse(ResultsGridView.SelectedDataKey.Value.ToString())) orderby b.id descending select new { ID = b.id, User = b.user_name, Service = p.title, Date = b.submited_date.ToString(), Status = b.status }; var s = from d in db.form_datas join p in db.form_field_definitions on d.form_field_definition_id equals p.form_field_definition_id where (d.form_data_id == int.Parse(ResultsGridView.SelectedDataKey.Value.ToString())) orderby d.form_data_id descending select new { p.form_field_name, p.input_type, d.value1, d.value2, d.value3, d.value4, d.value5, d.value6 }; DataTable table = new DataTable(); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Value", typeof(string)); foreach (var item in s) { if (item.input_type != "header" && item.input_type != "lblNoName" && item.input_type != "label") { DataRow dr = table.NewRow(); dr["Name"] = item.form_field_name; if (item.value1 != null) { dr["Value"] = item.value1.ToString(); } else if (item.value2 != null) { dr["Value"] = item.value2.ToString(); } else if (item.value3 != null) { dr["Value"] = item.value3.ToString(); } else if (item.value4 != null) { dr["Value"] = item.value4.ToString(); } else if (item.value5 != null) { dr["Value"] = item.value5.ToString(); } else if (item.value6 != null) { dr["Value"] = item.value6.Value.ToShortDateString(); } table.Rows.Add(dr); } } DataView dv = new DataView(table); DetailsGridView.DataSource = dv; DetailsGridView.DataBind(); DetailsView.DataSource = source1; DetailsView.DataBind(); if (DetailsView.Rows[2].Cells[1].Text == "Taxi") { ChatButton.Visible = true; //bookingId = ResultsGridView.SelectedDataKey.Value.ToString(); //string query = EncodingDecoding.EncodeMd5(bookingId); //string value = string.Format("window.open('chat.aspx?ChatID={0}',null,'height=400, width=430, left=200, top=150, status= no, resizable= no, scrollbars=no, toolbar=no, location=no, menubar=no ');", query); //ChatButton.Attributes.Add("onclick", value); } else { ChatButton.Visible = false; } DetailsPanel.Visible = true; ResultsGridView.Visible = false; OperatorRadioButtonList.Visible = false; }
protected void DetailsView_DataExchange_Data(Int32 interactionid, DetailsView dv) { #region SQL Connection using (SqlConnection con = new SqlConnection(sqlStrDE)) { #region SQL Command using (SqlCommand cmd = new SqlCommand("", con)) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.CommandTimeout = 600; String cmdText = ""; #region dvAgentScript if (dv.ID == "dvAgentScript") { cmdText = @" SELECT TOP (@sp_top) [i].[companyid] ,[i].[interactionid] ,[ia].[interactionid] [ia_interactionid] ,[fc].[interactionid] [fc_interactionid] ,[fca].[stationid] [agent_stationid] ,[fa].[five9id] [agent_five9id] ,[fa].[fullname] [agent_fullname] ,[fca].[stationtype] [agent_stationtype] ,[fa].[username] [agent_username] ,[i].[originator] -- ani ,[fct].[bill_time] ,[fc].[callid] [five9_callid] ,[fic].[five9id] [five9_campaignid] ,[fic].[name] [five9_campaign] ,'' [comments] ,[fid].[five9id] [five9_dispositionid] ,[fid].[name] [five9_disposition] ,[i].[destinator] -- dnis ,REPLACE(REPLACE(REPLACE(REPLACE(CONVERT(varchar,[fc].[dateend],121),'-',''),':',''),' ',''),'.','') [dateend] ,[fct].[handle_time] ,[fct].[hold_time] ,[fct].[length] ,[fim].[name] [five9_mediatype] ,[fct].[park_time] ,[fct].[queue_time] ,[fc].[sessionid] ,[fis].[five9id] [five9_skillid] ,[fis].[name] [five9_skill] --,[fc].[datestart] ,REPLACE(REPLACE(REPLACE(REPLACE(CONVERT(varchar,[fc].[datestart],121),'-',''),':',''),' ',''),'.','') [datestart] ,'' [tcpa_date_of_consent] ,[fit].[five9id] [five9_typeid] ,[fit].[name] [five9_type] ,[fct].[wrapup_time] FROM [dbo].[interactions] [i] WITH(NOLOCK) LEFT OUTER JOIN [dbo].[interactions_arc] [ia] WITH(NOLOCK) ON [ia].[companyid] = [i].[companyid] AND [ia].[interactionid] = [i].[interactionid] LEFT OUTER JOIN [dbo].[five9_call] [fc] WITH(NOLOCK) ON [fc].[companyid] = [i].[companyid] AND [fc].[interactionid] = [i].[interactionid] LEFT OUTER JOIN [dbo].[five9_item] [fic] WITH(NOLOCK) ON [fic].[typeid] = 101000000 AND [fic].[itemid] = [fc].[campaignid] LEFT OUTER JOIN [dbo].[five9_item] [fis] WITH(NOLOCK) ON [fis].[typeid] = 102000000 AND [fis].[itemid] = [fc].[skillid] LEFT OUTER JOIN [dbo].[five9_call_agent] [fca] WITH(NOLOCK) ON [fca].[companyid] = [i].[companyid] AND [fca].[interactionid] = [i].[interactionid] LEFT OUTER JOIN [dbo].[five9_agent] [fa] WITH(NOLOCK) ON [fa].[agentid] = [fca].[agentid] LEFT OUTER JOIN [dbo].[five9_call_time] [fct] WITH(NOLOCK) ON [fct].[companyid] = [i].[companyid] AND [fct].[interactionid] = [i].[interactionid] LEFT OUTER JOIN [dbo].[five9_call_disposition] [fcd] WITH(NOLOCK) ON [fcd].[companyid] = [i].[companyid] AND [fcd].[interactionid] = [i].[interactionid] LEFT OUTER JOIN [dbo].[five9_item] [fid] WITH(NOLOCK) ON [fid].[typeid] = 103000000 AND [fid].[itemid] = [fcd].[dispositionid] LEFT OUTER JOIN [dbo].[five9_item] [fim] WITH(NOLOCK) ON [fim].[typeid] = 107000000 AND [fim].[itemid] = [fc].[mediatypeid] LEFT OUTER JOIN [dbo].[five9_item] [fit] WITH(NOLOCK) ON [fit].[typeid] = 104000000 AND [fit].[itemid] = [fc].[typeid] WHERE 1=1 AND [i].[interactionid] = @sp_interactionid ORDER BY [i].[interactionid] DESC, [fcd].[datecreated] DESC "; } #endregion dvAgentScript #region dvInteraction if (dv.ID == "dvInteraction") { cmdText = @" SELECT TOP (@sp_top) [i].[companyid] ,[i].[interactionid] ,[fc].[callid] [five9_callid] ,[ia].[callid] [arc_callid] ,[fic].[name] [campaign] ,[fis].[name] [skill] ,[ia].[dispositionname] [arc_disposition] ,[fa].[fullname] [agent_fullname] ,[fca].[agentid] ,[i].[originator] ,[i].[destinator] ,[fc].[datestart] ,[fc].[dateend] ,[fc].[sessionid] FROM [dbo].[interactions] [i] WITH(NOLOCK) LEFT OUTER JOIN [dbo].[interactions_arc] [ia] WITH(NOLOCK) ON [ia].[companyid] = [i].[companyid] AND [ia].[interactionid] = [i].[interactionid] JOIN [dbo].[five9_call] [fc] WITH(NOLOCK) ON [fc].[companyid] = [i].[companyid] AND [fc].[interactionid] = [i].[interactionid] JOIN [dbo].[five9_item] [fic] WITH(NOLOCK) ON [fic].[typeid] = 101000000 AND [fic].[itemid] = [fc].[campaignid] JOIN [dbo].[five9_item] [fis] WITH(NOLOCK) ON [fis].[typeid] = 102000000 AND [fis].[itemid] = [fc].[skillid] LEFT OUTER JOIN [dbo].[five9_call_agent] [fca] WITH(NOLOCK) ON [fca].[companyid] = [i].[companyid] AND [fca].[interactionid] = [i].[interactionid] LEFT OUTER JOIN [dbo].[five9_agent] [fa] WITH(NOLOCK) ON [fa].[agentid] = [fca].[agentid] WHERE 1=1 AND [i].[interactionid] = @sp_interactionid ORDER BY [i].[interactionid] DESC "; } #endregion #region dvInteractionDetails if (dv.ID == "dvInteractionDetails") { cmdText = @" SELECT TOP (@sp_top) [i].[companyid] ,[i].[interactionid] ,[fc].[callid] [five9_callid] ,[ia].[callid] [arc_callid] ,[fic].[name] [campaign] ,[fis].[name] [skill] ,[ia].[dispositionname] [arc_disposition] ,[fa].[fullname] [agent_fullname] ,[i].[originator] ,[i].[destinator] ,[fc].[datestart] ,[fc].[dateend] ,[fc].[sessionid] FROM [dbo].[interactions] [i] WITH(NOLOCK) LEFT OUTER JOIN [dbo].[interactions_arc] [ia] WITH(NOLOCK) ON [ia].[companyid] = [i].[companyid] AND [ia].[interactionid] = [i].[interactionid] JOIN [dbo].[five9_call] [fc] WITH(NOLOCK) ON [fc].[companyid] = [i].[companyid] AND [fc].[interactionid] = [i].[interactionid] JOIN [dbo].[five9_item] [fic] WITH(NOLOCK) ON [fic].[typeid] = 101000000 AND [fic].[itemid] = [fc].[campaignid] JOIN [dbo].[five9_item] [fis] WITH(NOLOCK) ON [fis].[typeid] = 102000000 AND [fis].[itemid] = [fc].[skillid] LEFT OUTER JOIN [dbo].[five9_call_agent] [fca] WITH(NOLOCK) ON [fca].[companyid] = [i].[companyid] AND [fca].[interactionid] = [i].[interactionid] LEFT OUTER JOIN [dbo].[five9_agent] [fa] WITH(NOLOCK) ON [fa].[agentid] = [fca].[agentid] WHERE 1=1 AND [i].[interactionid] = @sp_interactionid ORDER BY [i].[interactionid] DESC "; } #endregion cmd.CommandText = cmdText; cmd.CommandType = CommandType.Text; cmd.Parameters.Clear(); #region SQL Parameters cmd.Parameters.Add("@sp_interactionid", SqlDbType.Int).Value = interactionid; cmd.Parameters.Add("@sp_top", SqlDbType.Int).Value = 1; #endregion SQL Parameters #region SQL Processing SqlDataAdapter ad = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); ad.Fill(dt); dv.DataSource = dt; dv.DataBind(); #endregion SQL Processing } #endregion SQL Command } #endregion SQL Connection }
/// <summary> /// Handles the SelectedIndexChanged event of the ArchivesGridView control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void ArchivesGridView_SelectedIndexChanged(object sender, EventArgs e) { LotusDataContext db = new LotusDataContext(); var source1 = from b in db.bookings join p in db.pages on b.page_id equals p.page_id where (b.id == int.Parse(ArchivesGridView.SelectedDataKey.Value.ToString())) orderby b.id descending select new { ID = b.id, User = b.user_name, Service = p.title, Date = b.submited_date.ToString(), Status = b.status }; var s = from d in db.form_datas join p in db.form_field_definitions on d.form_field_definition_id equals p.form_field_definition_id where (d.form_data_id == int.Parse(ArchivesGridView.SelectedDataKey.Value.ToString())) orderby d.form_data_id descending select new { p.form_field_name, p.input_type, d.value1, d.value2, d.value3, d.value4, d.value5, d.value6 }; DataTable table = new DataTable(); table.Columns.Add("Name", typeof(string)); table.Columns.Add("Value", typeof(string)); foreach (var item in s) { if (item.input_type != "header" && item.input_type != "lblNoName" && item.input_type != "label") { DataRow dr = table.NewRow(); dr["Name"] = item.form_field_name; if (item.value1 != null) { dr["Value"] = item.value1.ToString(); } else if (item.value2 != null) { dr["Value"] = item.value2.ToString(); } else if (item.value3 != null) { dr["Value"] = item.value3.ToString(); } else if (item.value4 != null) { dr["Value"] = item.value4.ToString(); } else if (item.value5 != null) { dr["Value"] = item.value5.ToString(); } else if (item.value6 != null) { dr["Value"] = item.value6.Value.ToShortDateString(); } table.Rows.Add(dr); } } DataView dv = new DataView(table); DetailsGridView.DataSource = dv; DetailsGridView.DataBind(); DetailsView.DataSource = source1; DetailsView.DataBind(); DetailsPanel.Visible = true; ArchivesPanel.Visible = false; if (DetailsView.Rows[2].Cells[1].Text == "Taxi") { ChatLogButton.Visible = true; } OperatorRadioButtonList.Visible = false; }