public void Style_fixture() { var offers = new List <Offer>(); offers.Add(new Offer(new Price("тест"), 100) { IsGrouped = true, BuyingMatrixType = BuyingMatrixStatus.Denied, }); WpfTestHelper.WithWindow2(async w => { var resources = new ResourceDictionary(); StyleHelper.Reset(); StyleHelper.BuildStyles(resources); var grid = new DataGrid2(); grid.AutoGenerateColumns = false; grid.Columns.Add(new DataGridTextColumn { Binding = new Binding("ProductSynonym") }); grid.Columns.Add(new DataGridTextColumn { Binding = new Binding("OrderCount") }); w.Content = grid; StyleHelper.ApplyStyles(typeof(Offer), grid, resources); grid.ItemsSource = offers; await w.WaitIdle(); var cells = grid.Descendants <DataGridCell>().ToArray(); Assert.That(cells.Length, Is.GreaterThan(0)); foreach (var cell in cells) { Assert.AreEqual("#FFFF0000", cell.Background.ToString(), ((TextBlock)cell.Content).Text); } }); }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedItem.Text == "Food") { MultiView1.SetActiveView(View2); cmd.CommandText = "select *from food_tb"; DataGrid1.DataSource = db.getdata(cmd); DataGrid1.DataBind(); } else if (DropDownList1.SelectedItem.Text == "Hotel") { MultiView1.SetActiveView(View3); cmd.CommandText = "select *from Hotel_tb"; DataGrid2.DataSource = db.getdata(cmd); DataGrid2.DataBind(); } else if (DropDownList1.SelectedItem.Text == "Place") { MultiView1.SetActiveView(View4); cmd.CommandText = "select *from Place_tb"; DataGrid3.DataSource = db.getdata(cmd); DataGrid3.DataBind(); } else if (DropDownList1.SelectedItem.Text == "Others") { MultiView1.SetActiveView(View5); cmd.CommandText = "select *from Image_tb"; DataGrid4.DataSource = db.getdata(cmd); DataGrid4.DataBind(); } }
void BindGrid() { DataGrid1.DataSource = dtv1; DataGrid1.DataBind(); DataGrid2.DataSource = dtv2; DataGrid2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { using (SqlConnection connect = new SqlConnection("server=DESKTOP-NOQ9PCB\\MSSQLSERVER01;database=DxcTraining; integrated security=true")) { SqlDataAdapter sda = new SqlDataAdapter("select * from student1", connect); DataSet ds = new DataSet(); sda.Fill(ds); DataGrid1.DataSource = ds; DataGrid1.DataBind(); SqlDataAdapter sda1 = new SqlDataAdapter("select * from Employee2", connect); DataSet ds1 = new DataSet(); sda1.Fill(ds1); DataGrid2.DataSource = ds1; DataGrid2.DataBind(); SqlDataAdapter sda2 = new SqlDataAdapter("select * from IndianCricketTeam", connect); DataSet ds2 = new DataSet(); sda2.Fill(ds2); DataGrid3.DataSource = ds2; DataGrid3.DataBind(); SqlDataAdapter sda3 = new SqlDataAdapter("select * from IndianRailwaySystem1 ", connect); DataSet ds3 = new DataSet(); sda3.Fill(ds3); DataGrid4.DataSource = ds3; DataGrid4.DataBind(); SqlDataAdapter sda4 = new SqlDataAdapter("select * from BankTable", connect); DataSet ds4 = new DataSet(); sda4.Fill(ds4); DataGrid5.DataSource = ds4; DataGrid5.DataBind(); } }
private void DataGrid2_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e) { display2(); SqlCommand cmd = new SqlCommand("select * from adminbanner", con); cmd.CommandType = CommandType.Text; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "adminbanner"); con.Open(); DataView dv = new DataView(ds.Tables["adminbanner"]); if ((numberdiv % 2) == 0) { dv.Sort = e.SortExpression + " " + "ASC"; } else { dv.Sort = e.SortExpression + " " + "DESC"; } numberdiv++; DataGrid2.DataSource = dv; DataGrid2.DataBind(); }
private void BindStorage() { DataTable dtStorage = Helper.Query("select * from tbStorage where cnnCount>0 and cnvcStorageDeptID='" + ddlProduceDept.SelectedValue + "'"); DataGrid2.DataSource = dtStorage; DataGrid2.DataBind(); }
private void EstDeptStgDataBinding(int ver_id, int estterm_ref_id, int est_dept_ref_id) { Biz_PDTAndAHPStgEstDeptDatas pdtAhpEstDept = new Biz_PDTAndAHPStgEstDeptDatas(); DataSet ds = pdtAhpEstDept.GetPDTAndAHPEstDeptStgList(ver_id , estterm_ref_id , est_dept_ref_id , "Y"); DataGrid2.DataSource = ds; DataGrid2.DataBind(); lblStgCount.Text = ds.Tables[0].Rows.Count.ToString(); if (ds.Tables[0].Rows.Count <= 1) { DataGrid1.Visible = false; DataGrid3.Visible = false; iBtnSave.Visible = false; } else { DataGrid1.Visible = true; DataGrid3.Visible = true; iBtnSave.Visible = true; } }
public void Revert_value_on_incorrect_input() { var waybill = new Waybill(new Address("тест"), new Supplier()); var line = new WaybillLine(waybill); line.RetailCost = 150; waybill.AddLine(line); WpfTestHelper.WithWindow2(async w => { var grid = new DataGrid2(); grid.IsReadOnly = false; grid.AutoGenerateColumns = false; grid.Columns.Add(new DataGridTextColumnEx { Binding = new Binding("Product") }); grid.Columns.Add(new DataGridTextColumnEx { Binding = new Binding("RetailCost") }); w.Content = grid; grid.ItemsSource = waybill.Lines; await w.WaitIdle(); var cell = grid.Descendants <DataGridCell>() .First(x => x.Column == grid.Columns[1] && x.DataContext == line); Assert.IsTrue(cell.Focus()); cell.SendKey(Key.F2); Assert.IsTrue(cell.IsEditing); var input = cell.Descendants <TextBox>().First(); input.SendText("asd"); grid.SendKey(Key.Down); Assert.IsFalse(cell.IsEditing); Assert.AreEqual(150, line.RetailCost); }); }
public void Scroll_on_wheel() { var items = Enumerable.Range(1, 100).Select(i => Tuple.Create(i.ToString())).ToList(); WpfTestHelper.WithWindow2(async w => { var grid = new DataGrid2(); grid.AutoGenerateColumns = false; grid.Columns.Add(new DataGridTextColumn { Binding = new Binding("Item1") }); w.Content = grid; grid.RaiseEvent(new MouseWheelEventArgs(System.Windows.Input.Mouse.PrimaryDevice, 0, -System.Windows.Input.Mouse.MouseWheelDeltaForOneLine) { RoutedEvent = UIElement.PreviewMouseWheelEvent, Source = grid, }); grid.ItemsSource = items; await grid.WaitIdle(); grid.CurrentItem = items[0]; grid.CurrentColumn = grid.Columns[0]; grid.RaiseEvent(new MouseWheelEventArgs(System.Windows.Input.Mouse.PrimaryDevice, 0, -System.Windows.Input.Mouse.MouseWheelDeltaForOneLine) { RoutedEvent = UIElement.PreviewMouseWheelEvent, Source = grid, }); Assert.AreEqual("2", ((Tuple <string>)grid.CurrentItem).Item1); await w.WaitIdle(); }); }
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { id = e.Item.Cells[0].Text; if (e.CommandName == "su") { MultiView1.SetActiveView(View2); DataGrid2.DataSource = db.DataReturn("select * from surgeons where hospital_id='" + id + "'"); DataGrid2.DataBind(); } if (e.CommandName == "sr") { MultiView1.SetActiveView(View3); DataGrid3.DataSource = db.DataReturn("select * from surgeries inner join surgery_category on.surgeries.category_id=surgery_category.category_id where hospital_id='" + id + "'"); DataGrid3.DataBind(); } if (e.CommandName == "a") { string qry = "update login set user_type='hospital' where login_id='" + e.Item.Cells[1].Text + "'"; db.DataNonReturn(qry); Response.Write("<script>alert('Approved Successfully !!!');window.location='admin_hospitals.aspx'</script>"); } if (e.CommandName == "r") { string qry = "update login set user_type='Rejected' where login_id='" + e.Item.Cells[1].Text + "'"; db.DataNonReturn(qry); Response.Write("<script>alert('Rejected Successfully !!!');window.location='admin_hospitals.aspx'</script>"); } }
private void DataGrid2_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e) { //con = new SqlConnection("server=SUTHAHAR-F92F17\\TEST;database=sample;user id=sa;pwd=sukitha"); display2(); SqlCommand cmd = new SqlCommand("select * from adminradio", con); cmd.CommandType = CommandType.Text; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "adminradio"); con.Open(); DataView dv = new DataView(ds.Tables["adminradio"]); if ((numberdiv % 2) == 0) { dv.Sort = e.SortExpression + " " + "ASC"; } else { dv.Sort = e.SortExpression + " " + "DESC"; } numberdiv++; DataGrid2.DataSource = dv; DataGrid2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { //Establish the database connection using (SqlConnection Connect = new SqlConnection("data source=.;database=assignment;integrated security= SSPI")) { SqlDataAdapter SDA = new SqlDataAdapter("Select * from students", Connect); //to retrive the data from database- student created SqlDataAdapter SDA1 = new SqlDataAdapter("Select * from Employee", Connect); //to retrive the data from database- student created SqlDataAdapter SDA2 = new SqlDataAdapter("Select * from CricketTeam", Connect); //to retrive the data from database- student created SqlDataAdapter SDA3 = new SqlDataAdapter("Select * from IRS", Connect); //to retrive the data from database- student created SqlDataAdapter SDA4 = new SqlDataAdapter("Select * from Bank_EmployeeDetails", Connect); //to retrive the data from database- student created DataSet ds = new DataSet(); //to convert the data into the grid. DataSet ds1 = new DataSet(); //to convert the data into the grid. DataSet ds2 = new DataSet(); //to convert the data into the grid. DataSet ds3 = new DataSet(); //to convert the data into the grid. DataSet ds4 = new DataSet(); //to convert the data into the grid. SDA.Fill(ds); SDA1.Fill(ds1); SDA2.Fill(ds2); SDA3.Fill(ds3); SDA4.Fill(ds4); DataGrid1.DataSource = ds; DataGrid1.DataBind(); DataGrid2.DataSource = ds1; DataGrid2.DataBind(); DataGrid3.DataSource = ds2; DataGrid3.DataBind(); DataGrid4.DataSource = ds3; DataGrid4.DataBind(); DataGrid5.DataSource = ds4; DataGrid5.DataBind(); } }
protected void Grid_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { DataGrid2.CurrentPageIndex = e.NewPageIndex; if (!this.IsPostBack) { string constr = ConfigurationManager.ConnectionStrings["WebAppConnString"].ConnectionString; using (MySqlConnection con = new MySqlConnection(constr)) { using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM database.titre WHERE titre.codeuser='******' AND titre.numzone='C12' UNION SELECT * FROM database.detail WHERE detail.codeuser='******' AND detail.numzone='C12' ")) { using (MySqlDataAdapter sda = new MySqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); DataGrid2.DataSource = dt; DataGrid2.DataBind(); } } } } } }
protected void BindGrid2() { if (!this.IsPostBack) { string constr = ConfigurationManager.ConnectionStrings["WebAppConnString"].ConnectionString; using (MySqlConnection con = new MySqlConnection(constr)) { using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM database.activite WHERE activite.iduser='******' AND activite.nature='Arts ou artisanat'")) { using (MySqlDataAdapter sda = new MySqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); DataGrid2.DataSource = dt; DataGrid2.DataBind(); } } } } } }
public void BindData() { string s = "select Qry_Text,Qry_Sol from tblqrydetails where Qry_Sol is not null and Qry_sol not like ''"; ds = b.Ex_DRL(s); DataGrid2.DataSource = ds; DataGrid2.DataBind(); }
void grid2() { string b = "select * from fertilizerdetails"; DataTable dt = db.ret(b); DataGrid2.DataSource = dt; DataGrid2.DataBind(); }
public void BindGridP2() { //为Panel2的数据 DataSet ds2 = SqlHelper.ExecuteDs("SELECT * FROM HK_POLL_KEY WHERE SUBID='" + codelbl.Text + "' ORDER BY KEYID"); DataGrid2.DataSource = ds2; DataGrid2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "SELECT fault_prediction.mechine_id, fault_prediction.fault_id, mechine_management.mechine_name, fault_prediction.technician_id, employee_management.employee_name, fault_prediction.date, fault_prediction.time, fault_prediction.problem, fault_prediction.status FROM fault_prediction INNER JOIN mechine_management ON fault_prediction.mechine_id = mechine_management.mechine_id INNER JOIN employee_management ON fault_prediction.technician_id = employee_management.employee_id WHERE (fault_prediction.worker_id = 1)"; DataGrid2.DataSource = obj.getData(cmd); DataGrid2.DataBind(); MultiView1.SetActiveView(View1); }
private void loadNumber(string list_code) { MultiView2.ActiveViewIndex = 2; int list_id = int.Parse(list_code); data_table = data_file.GetActiveListNumbers(list_id); DataGrid2.DataSource = data_table; DataGrid2.DataBind(); }
public void DataBind2() { SqlDataAdapter apt = new SqlDataAdapter("select empid,empname from crm_empreg", con); DataSet ds = new DataSet(); apt.Fill(ds); DataGrid2.DataSource = ds; DataGrid2.DataBind(); }
void binddetailsgrid(int positionid) { string q = "select * from position where positionid=@pos"; SqlCommand cmd = new SqlCommand(q, connection); cmd.Parameters.AddWithValue("@pos", positionid); connection.Open(); DataGrid2.DataSource = cmd.ExecuteReader(); DataGrid2.DataBind(); connection.Close(); }
public System.Windows.Controls.DataGridRow GetRow(int index) { System.Windows.Controls.DataGridRow row = (System.Windows.Controls.DataGridRow)DataGrid2.ItemContainerGenerator.ContainerFromIndex(index); if (row == null) { // may be virtualized, bring into view and try again DataGrid2.ScrollIntoView(DataGrid2.Items[index]); row = (System.Windows.Controls.DataGridRow)DataGrid2.ItemContainerGenerator.ContainerFromIndex(index); } return(row); }
public void Apply_style_to_template_column() { Build(typeof(WaybillLine)); var grid = new DataGrid2(); var column = new DataGridTemplateColumn(); column.SetValue(FrameworkElement.NameProperty, "CertificateLink"); grid.Columns.Add(column); StyleHelper.ApplyStyles(typeof(WaybillLine), grid, resource); Assert.IsNotNull(column.CellStyle); }
private void GetByProductType() { if (cboSearchType0.SelectedValue == "0" || cboSearchType0.SelectedValue == "") { cboSearchType0.SelectedValue = "1"; } DataGrid2.DataSource = dh.GetByProductType(int.Parse(cboSearchType0.SelectedValue)); DataGrid2.DataBind(); Label5.Text = "Monthly Performance of: " + cboSearchType0.SelectedItem.ToString(); Label6.Text = "Top performing: " + cboSearchType0.SelectedItem.ToString(); }
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "view") { Session["msgid"] = e.Item.Cells[5].Text; to.Text = e.Item.Cells[0].Text.ToString(); MultiView1.SetActiveView(View2); string a = "select msg from message where fromid=" + e.Item.Cells[0].Text + ""; DataGrid2.DataSource = db.ret(a); DataGrid2.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MultiView1.SetActiveView(View2); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select * from auditorium "; DropDownList7.DataSource = a.getdata(cmd); DropDownList7.DataTextField = "aname"; DropDownList7.DataValueField = "aid"; DropDownList7.DataBind(); DropDownList7.Items.Insert(0, "--select--"); for (int i = 1; i <= 31; i++) { DropDownList1.Items.Add(i.ToString()); } DropDownList1.Items.Insert(0, "Day"); for (int i = 1; i <= 12; i++) { DropDownList2.Items.Add(i.ToString()); } DropDownList2.Items.Insert(0, "Month"); for (int i = 2018; i <= 2050; i++) { DropDownList3.Items.Add(i.ToString()); } DropDownList3.Items.Insert(0, "Year"); for (int i = 1; i <= 31; i++) { DropDownList4.Items.Add(i.ToString()); } DropDownList4.Items.Insert(0, "Day"); for (int i = 1; i <= 12; i++) { DropDownList5.Items.Add(i.ToString()); } DropDownList5.Items.Insert(0, "Month"); for (int i = 2018; i <= 2050; i++) { DropDownList6.Items.Add(i.ToString()); } DropDownList6.Items.Insert(0, "Year"); cmd.CommandText = "select * from bookingreg where uid=" + Session["id"] + " and status='pending'"; DataGrid2.DataSource = a.getdata(cmd); DataGrid2.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "update fault_prediction set time = '" + TextBox6.Text + "',status='process' where fault_id='" + Label1.Text + "'"; obj.execute(cmd); Response.Write("<script>alert('Time is Set')</script>"); cmd.CommandText = "SELECT fault_prediction.mechine_id, fault_prediction.fault_id, mechine_management.mechine_name, fault_prediction.technician_id, employee_management.employee_name, fault_prediction.date, fault_prediction.time, fault_prediction.problem, fault_prediction.status FROM fault_prediction INNER JOIN mechine_management ON fault_prediction.mechine_id = mechine_management.mechine_id INNER JOIN employee_management ON fault_prediction.technician_id = employee_management.employee_id WHERE (fault_prediction.worker_id = 1)"; DataGrid2.DataSource = obj.getData(cmd); DataGrid2.DataBind(); MultiView1.SetActiveView(View1); }
protected void DataGrid2_ItemCommand(object source, DataGridCommandEventArgs e) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "update fault_prediction set status='finish' where fault_id='" + e.Item.Cells[0].Text + "'"; obj.execute(cmd); Response.Write("<script>alert('Finish success')</script>"); cmd.CommandText = "SELECT fault_prediction.fault_id, mechine_management.mechine_name, employee_management.employee_name, fault_prediction.date, fault_prediction.time, fault_prediction.problem, fault_prediction.status, fault_prediction.mechine_id, fault_prediction.worker_id FROM fault_prediction INNER JOIN mechine_management ON fault_prediction.mechine_id = mechine_management.mechine_id INNER JOIN employee_management ON fault_prediction.worker_id = employee_management.employee_id WHERE (fault_prediction.technician_id = '" + Session["id"] + "') AND (fault_prediction.status = 'process')"; DataGrid2.DataSource = obj.getData(cmd); DataGrid2.DataBind(); MultiView1.SetActiveView(View1); }
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { id = Convert.ToInt32(e.Item.Cells[0].Text); if (e.CommandName == "v") { MultiView1.SetActiveView(View2); cmd = new SqlCommand(); dt = new DataTable(); cmd.CommandText = "select * from order_details od,product p where od.ormas_id='" + id + "' and od.product_id=p.product_id"; dt = con.data_return(cmd); DataGrid2.DataSource = dt; DataGrid2.DataBind(); } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { try { if (DropDownList1.SelectedValue != "0") { DataGrid2.DataSource = dh.GetsalesReport(DropDownList1.SelectedItem.ToString()); DataGrid2.DataBind(); } } catch (Exception ex) { Message(ex.Message, true); } }