private void Bindgrid4() { GridView4.DataSource = pwp.QueryWeekPlanDetail(new Guid(WeekPlanID.Text)); GridView4.DataBind(); UpdatePanel6.Update(); }
protected void Page_Load(object sender, EventArgs e) { SqlDataAdapter da; DataSet ds; SqlCommand cmd = new SqlCommand("Select * from Cust where Id='" + Session["id"].ToString() + "'", con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); Label10.Text = dr[6].ToString(); con.Close(); string b = Label10.Text; string s; if (b == "Normal") { s = "Select Item,Protine,Carbo from DietChart where PCat='L' AND CCat='M' AND Type='B'"; } else if (b == "Under Weight") { s = "Select Item,Protine,Carbo from DietChart where PCat='L' AND CCat='M' AND Type='B'"; } else { s = "Select Item,Protine,Carbo from DietChart where PCat='H' AND CCat='H' AND Type='B'"; } da = new SqlDataAdapter(s, con); ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); if (b == "Normal" || b == "Under Weight") { s = "Select Item,Protine,Carbo from DietChart where PCat='L' AND CCat='M' AND Type='L'"; } else { s = "Select Item,Protine,Carbo from DietChart where PCat='H' AND CCat='H' AND Type='L'"; } da = new SqlDataAdapter(s, con); ds = new DataSet(); da.Fill(ds); GridView2.DataSource = ds; GridView2.DataBind(); if (b == "Normal" || b == "Under Weight") { s = "Select Item,Protine,Carbo from DietChart where PCat='L' AND CCat='M' AND Type='S'"; } else { s = "Select Item,Protine,Carbo from DietChart where PCat='H' AND CCat='H' AND Type='S'"; } da = new SqlDataAdapter(s, con); ds = new DataSet(); da.Fill(ds); GridView3.DataSource = ds; GridView3.DataBind(); if (b == "Normal" || b == "Under Weight") { s = "Select Top 2 Item,Protine,Carbo from DietChart where PCat='L' AND CCat='M' AND Type='D'"; } else { s = "Select Top 2 Item,Protine,Carbo from DietChart where PCat='H' AND CCat='H' AND Type='D'"; } da = new SqlDataAdapter(s, con); ds = new DataSet(); da.Fill(ds); GridView4.DataSource = ds; GridView4.DataBind(); Label3.Text = Session["Break"].ToString(); Label5.Text = Session["Lunch"].ToString(); Label7.Text = Session["Snacks"].ToString(); Label9.Text = Session["Dinner"].ToString(); }
protected void Button2_Click1(object sender, EventArgs e) { TripleStore store = new TripleStore(); Graph g1 = new Graph(); g1.LoadFromFile(Server.MapPath("SVUModeling.rdf")); store.Add(g1); Label1.Text = "Economic Program Details"; Label1.Visible = true; GridView1.Visible = false; InMemoryDataset ds = new InMemoryDataset(store); //Get the Query processor ISparqlQueryProcessor processor = new LeviathanQueryProcessor(ds); //Use the SparqlQueryParser to give us a SparqlQuery object //Should get a Graph back from a CONSTRUCT query Label2.Text = "Economic Director Informations "; Label2.Visible = true; // to select the Economic Director Informations SparqlQueryParser sparqlparser = new SparqlQueryParser(); SparqlQuery query = sparqlparser.ParseFromString(@"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> prefix foaf: <http://xmlns.com/foaf/0.1/#> SELECT ?EconomicDirectorInfo WHERE { ?t owl:EconomicDirectorInfoProperty ?EconomicDirectorInfo }"); Object results = processor.ProcessQuery(query); DataTable DT2 = new DataTable(); SparqlResultSet rset = (SparqlResultSet)results; DT2 = FillDataTable(rset); GridView2.DataSource = DT2; GridView2.DataBind(); GridView2.Visible = true; //to retrival the Teachers Economic program Label3.Text = "Teachers Of Economic Program"; Label3.Visible = true; SparqlQueryParser sparqlparser2 = new SparqlQueryParser(); SparqlQuery query2 = sparqlparser.ParseFromString(@"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix foaf: <http://xmlns.com/foaf/0.1/#> prefix owl: <http://www.w3.org/2002/07/owl#> SELECT ?TeachersEconomic WHERE { ?t owl:TeachersOfEconomic ?TeachersEconomic }"); Object results2 = processor.ProcessQuery(query2); DataTable DT3 = new DataTable(); SparqlResultSet rset5 = (SparqlResultSet)results2; DT3 = FillDataTable(rset5); GridView3.DataSource = DT3; GridView3.DataBind(); GridView3.Visible = true; //to select Courses Of Economic Label4.Text = "Courses of Economic Program"; Label4.Visible = true; SparqlQueryParser sparqlparser4 = new SparqlQueryParser(); SparqlQuery query4 = sparqlparser.ParseFromString(@"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> SELECT ?CoursesEconomic WHERE { ?t owl:CoursesOfEconomic ?CoursesEconomic }"); Object results4 = processor.ProcessQuery(query4); DataTable DT4 = new DataTable(); SparqlResultSet rset6 = (SparqlResultSet)results4; DT4 = FillDataTable(rset6); GridView4.DataSource = DT4; GridView4.DataBind(); GridView4.Visible = true; }
protected void grdvw_List_RowEditing(object sender, GridViewEditEventArgs e) { strSelectedId = grdvw_List.Rows[e.NewEditIndex].Cells[1].Text; txt_ItemName.Text = grdvw_List.Rows[e.NewEditIndex].Cells[2].Text; if (grdvw_List.Rows[e.NewEditIndex].Cells[2].Text.Trim() != " ") { txt_AccessTime.Text = grdvw_List.Rows[e.NewEditIndex].Cells[4].Text; } else { txt_AccessTime.Text = ""; } txt_person0.Text = grdvw_List.Rows[e.NewEditIndex].Cells[3].Text; txt_ItemName.ReadOnly = true; txt_person0.ReadOnly = true; //备注绑定 //项目接收备注显示 string remarkstr = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='1' order by t_Y_Detail.id"; DataSet ds_Remark1 = new MyDataOp(remarkstr).CreateDataSet(); string strtemp = "select Name,UserID from t_R_UserInfo"; DataSet ds_User = new MyDataOp(strtemp).CreateDataSet(); foreach (DataRow dr in ds_Remark1.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView1.DataSource = ds_Remark1; GridView1.DataBind(); string remarkstr2 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='2' order by t_Y_Detail.id"; DataSet ds_Remark2 = new MyDataOp(remarkstr2).CreateDataSet(); foreach (DataRow dr in ds_Remark2.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView2.DataSource = ds_Remark2; GridView2.DataBind(); string remarkstr3 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='3' order by t_Y_Detail.id"; DataSet ds_Remark3 = new MyDataOp(remarkstr3).CreateDataSet(); foreach (DataRow dr in ds_Remark3.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView3.DataSource = ds_Remark3; GridView3.DataBind(); string remarkstr4 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='4' order by t_Y_Detail.id"; DataSet ds_Remark4 = new MyDataOp(remarkstr4).CreateDataSet(); foreach (DataRow dr in ds_Remark4.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView4.DataSource = ds_Remark4; GridView4.DataBind(); string remarkstr5 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='5' order by t_Y_Detail.id"; DataSet ds_Remark5 = new MyDataOp(remarkstr5).CreateDataSet(); foreach (DataRow dr in ds_Remark5.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView5.DataSource = ds_Remark5; GridView5.DataBind(); string remarkstr6 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='6' order by t_Y_Detail.id"; DataSet ds_Remark6 = new MyDataOp(remarkstr6).CreateDataSet(); foreach (DataRow dr in ds_Remark6.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView6.DataSource = ds_Remark6; GridView6.DataBind(); string remarkstr7 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='7' order by t_Y_Detail.id"; DataSet ds_Remark7 = new MyDataOp(remarkstr7).CreateDataSet(); foreach (DataRow dr in ds_Remark7.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView7.DataSource = ds_Remark7; GridView7.DataBind(); string remarkstr8 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='8' order by t_Y_Detail.id"; DataSet ds_Remark8 = new MyDataOp(remarkstr8).CreateDataSet(); foreach (DataRow dr in ds_Remark8.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView8.DataSource = ds_Remark8; GridView8.DataBind(); string remarkstr9 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='9' order by t_Y_Detail.id"; DataSet ds_Remark9 = new MyDataOp(remarkstr9).CreateDataSet(); foreach (DataRow dr in ds_Remark9.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView9.DataSource = ds_Remark9; GridView9.DataBind(); string remarkstr10 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='10' order by t_Y_Detail.id"; DataSet ds_Remark10 = new MyDataOp(remarkstr10).CreateDataSet(); foreach (DataRow dr in ds_Remark10.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView10.DataSource = ds_Remark10; GridView10.DataBind(); string remarkstr11 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='11' order by t_Y_Detail.id"; DataSet ds_Remark11 = new MyDataOp(remarkstr11).CreateDataSet(); foreach (DataRow dr in ds_Remark11.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView11.DataSource = ds_Remark11; GridView11.DataBind(); string remarkstr12 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='12' order by t_Y_Detail.id"; DataSet ds_Remark12 = new MyDataOp(remarkstr12).CreateDataSet(); foreach (DataRow dr in ds_Remark12.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView12.DataSource = ds_Remark12; GridView12.DataBind(); string remarkstr13 = "select CreateDate 备注时间,bz 备注及意见,userid 用户名 from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='13' order by t_Y_Detail.id"; DataSet ds_Remark13 = new MyDataOp(remarkstr13).CreateDataSet(); foreach (DataRow dr in ds_Remark13.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView13.DataSource = ds_Remark13; GridView13.DataBind(); //备注绑定 //有回退的,则显示回退备注,非回退,不显示 string backremarkstr = "select createdate 备注时间,t_Y_BackInfo.remark 备注及意见,userid 用户名 from t_Y_BackInfo inner join t_Y_FlowInfo on t_Y_BackInfo.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_BackInfo.functionid where t_Y_BackInfo.itemid='" + strSelectedId + "' and t_Y_BackInfo.functionid='15' order by t_Y_BackInfo.id"; // string backremarkstr = "select * from t_Y_BackInfo where itemid='" + strSelectedId + "' and functionid='2'"; DataSet ds_Remark_back = new MyDataOp(backremarkstr).CreateDataSet(); foreach (DataRow dr in ds_Remark_back.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView_back.DataSource = ds_Remark_back; GridView_back.DataBind(); //回退的数据编辑,显示前面的备注信息,只读 string remarkstr_now = "select ItemName 项目类型, name 阶段,CreateDate 备注时间,bz 备注及意见,userid 用户名,flag,t_Y_Detail.id from t_Y_Detail inner join t_Y_FlowInfo on t_Y_Detail.itemid=t_Y_FlowInfo.id inner join t_Y_FlowDetail on t_Y_FlowDetail.id= t_Y_Detail.statusid where t_Y_Detail.itemid='" + strSelectedId + "' and t_Y_Detail.statusid='14' order by t_Y_Detail.id"; DataSet ds_Remark_now = new MyDataOp(remarkstr_now).CreateDataSet(); foreach (DataRow dr in ds_Remark_now.Tables[0].Rows) { foreach (DataRow drr in ds_User.Tables[0].Rows) { if (dr["用户名"].ToString() == drr["UserID"].ToString()) { dr["用户名"] = drr["Name"].ToString(); } } } GridView_now.DataSource = ds_Remark_now; GridView_now.DataBind(); DataRow[] dr_remark = ds_Remark_now.Tables[0].Select("flag=0"); if (dr_remark.Length > 0) { txt_Remark_now.Text = dr_remark[0][3].ToString(); SelectedId = dr_remark[0][6].ToString(); } if (ds_Remark_back.Tables[0].Rows.Count > 0) { Panel_back.Visible = true; } else { Panel_back.Visible = false; } ds_Remark1.Dispose(); ds_Remark2.Dispose(); ds_Remark3.Dispose(); ds_Remark4.Dispose(); ds_Remark5.Dispose(); ds_Remark6.Dispose(); ds_Remark7.Dispose(); ds_Remark8.Dispose(); ds_Remark9.Dispose(); ds_Remark10.Dispose(); ds_Remark11.Dispose(); ds_Remark12.Dispose(); ds_Remark13.Dispose(); ds_Remark_back.Dispose(); ds_Remark_now.Dispose(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "showAddEdit();", true); }
protected void Page_Load(object sender, EventArgs e) { try { conn = new SqlConnection("Data Source=ROSTON-PC\\SQLEXPRESS;Initial Catalog=volcania;Integrated Security=True;Context Connection=False"); // conn = new SqlConnection("Data Source=190.190.200.100,1433; Network Library=DBMSSOCN;Initial Catalog=volcania;"); conn.Open(); bs = Session["bc"].ToString(); bs1 = Session["bc1"].ToString(); query = "SELECT * FROM bikecompare WHERE name='" + bs + "'"; cmd = new SqlCommand(query, conn); dr = cmd.ExecuteReader(); while (dr.Read()) { name = dr[0].ToString(); Label1.Text = dr[1].ToString(); //dr[2] for imag Label3.Text = dr[3].ToString(); Label4.Text = dr[4].ToString(); Label5.Text = dr[5].ToString(); Label6.Text = dr[6].ToString(); Label7.Text = dr[7].ToString(); } dr.Close(); query1 = "select * from bikecompare where name='" + bs1 + "'"; cmd1 = new SqlCommand(query1, conn); dr1 = cmd1.ExecuteReader(); while (dr1.Read()) { name1 = dr1[0].ToString(); Label2.Text = dr1[1].ToString(); //dr1[2] for image Label8.Text = dr1[3].ToString(); Label9.Text = dr1[4].ToString(); Label10.Text = dr1[5].ToString(); Label11.Text = dr1[6].ToString(); Label12.Text = dr1[7].ToString(); } dr1.Close(); cmd2 = new SqlCommand(query, conn); dr2 = cmd2.ExecuteReader(); GridView3.DataSource = dr2; GridView3.DataBind(); dr2.Close(); cmd3 = new SqlCommand(query1, conn); dr3 = cmd3.ExecuteReader(); GridView4.DataSource = dr3; GridView4.DataBind(); dr3.Close(); marquee = "<marquee bgcolor='blue'><h1><font color='white'>" + name + "</font></h1></marquee>"; Literal1.Text = marquee; marquee1 = "<marquee bgcolor='blue'><h1><font color='white'>" + name1 + "</font></h1></marquee>"; Literal2.Text = marquee1; } catch (Exception ae) { Label1.Text = "Error" + ae; } finally { conn.Close(); } }
protected void Button4_Click(object sender, EventArgs e) { try { int item = int.Parse(DropDownList4.SelectedValue); int ware = int.Parse(DropDownList5.SelectedValue); bool all = CheckBox1.Checked; DateTime dtf = DateTime.Parse(Request["txtDatePicker4"].ToString()); DateTime dtt = DateTime.Parse(Request["txtDatePicker5"].ToString()); //WH suplying report FriendsEntities ent = new FriendsEntities(); if (!all) { var res = from e1 in ent.Items join e2 in ent.Sup_Per_Item on e1.Item_Id equals e2.Sup_Per_Item_Id join c in ent.Suppliers on e2.Sup_Id equals c.Supplier_Id join ep in ent.Supply_Permission on e2.Sup_Per_Id equals ep.Sup_Per_Id join wh in ent.Warehouses on ep.Sup_Per_WH_Id equals wh.WH_Id where wh.WH_Id == ware && e2.Sup_Per_Item_Id == item && ep.Sup_Per_Date >= dtf && ep.Sup_Per_Date <= dtt select new { Sup_Per_Id = e2.Sup_Per_Id, WH_Name = wh.WH_Name, Sup_Per_Date = ep.Sup_Per_Date, Item_Name = e1.Item_Name, Sup_Per_Item_Quantity = e2.Sup_Per_Item_Quantity, Sup_Per_Item_Pro_Date = e2.Sup_Per_Item_Pro_Date, Sup_Per_Item_Validation = e2.Sup_Per_Item_Validation, Supplier_Name = c.Supplier_Name }; GridView3.DataSource = res; GridView3.DataBind(); //WH export report FriendsEntities ent2 = new FriendsEntities(); var res2 = from e1 in ent2.Items join e2 in ent2.Ex_Per_Item on e1.Item_Id equals e2.Ex_Per_Item_Id join c in ent2.Customers on e2.Cus_ID equals c.Customer_Id join ep in ent2.Export_Permission on e2.Ex_Per_Id equals ep.Ex_Per_Id join wh in ent2.Warehouses on ep.Ex_Per_WH_Id equals wh.WH_Id where wh.WH_Id == ware && e2.Ex_Per_Item_Id == item && ep.Ex_Per_Date >= dtf && ep.Ex_Per_Date <= dtt select new { Ex_Per_Id = e2.Ex_Per_Id, WH_Name = wh.WH_Name, Ex_Per_Date = ep.Ex_Per_Date, Item_Name = e1.Item_Name, Ex_Per_Item_Quantity = e2.Ex_Per_Item_Quantity, Customer_Name = c.Customer_Name }; GridView4.DataSource = res2; GridView4.DataBind(); } else { var res = from e1 in ent.Items join e2 in ent.Sup_Per_Item on e1.Item_Id equals e2.Sup_Per_Item_Id join c in ent.Suppliers on e2.Sup_Id equals c.Supplier_Id join ep in ent.Supply_Permission on e2.Sup_Per_Id equals ep.Sup_Per_Id join wh in ent.Warehouses on ep.Sup_Per_WH_Id equals wh.WH_Id where e2.Sup_Per_Item_Id == item && ep.Sup_Per_Date >= dtf && ep.Sup_Per_Date <= dtt select new { Sup_Per_Id = e2.Sup_Per_Id, WH_Name = wh.WH_Name, Sup_Per_Date = ep.Sup_Per_Date, Item_Name = e1.Item_Name, Sup_Per_Item_Quantity = e2.Sup_Per_Item_Quantity, Sup_Per_Item_Pro_Date = e2.Sup_Per_Item_Pro_Date, Sup_Per_Item_Validation = e2.Sup_Per_Item_Validation, Supplier_Name = c.Supplier_Name }; GridView3.DataSource = res; GridView3.DataBind(); //WH export report FriendsEntities ent2 = new FriendsEntities(); var res2 = from e1 in ent2.Items join e2 in ent2.Ex_Per_Item on e1.Item_Id equals e2.Ex_Per_Item_Id join c in ent2.Customers on e2.Cus_ID equals c.Customer_Id join ep in ent2.Export_Permission on e2.Ex_Per_Id equals ep.Ex_Per_Id join wh in ent2.Warehouses on ep.Ex_Per_WH_Id equals wh.WH_Id where e2.Ex_Per_Item_Id == item && ep.Ex_Per_Date >= dtf && ep.Ex_Per_Date <= dtt select new { Ex_Per_Id = e2.Ex_Per_Id, WH_Name = wh.WH_Name, Ex_Per_Date = ep.Ex_Per_Date, Item_Name = e1.Item_Name, Ex_Per_Item_Quantity = e2.Ex_Per_Item_Quantity, Customer_Name = c.Customer_Name }; GridView4.DataSource = res2; GridView4.DataBind(); } } catch { mpePopUp.Show(); Label2.Text = "try again"; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { table.Columns.Add("SINo"); table.Columns.Add("Route"); table.Columns.Add("Distance"); table.Columns.Add("Optimal Value"); DataRow row = table.NewRow(); row["SINo"] = Session["Sno"]; row["Route"] = Session["Route"]; row["Distance"] = Session["Distance"]; row["Optimal Value"] = Session["Optimal Value"]; table.Rows.Add(row); //for (int i = 0; i < FuzzyController.arryBestPath.Count; i++) //{ // string[] strd = FuzzyController.arryBestPath[i].ToString().Split('+'); // arryAdd.Add(float.Parse(strd[1])); //} //arryAdd.Sort(); //for (int i = 0; i < FuzzyController.arryBestPath.Count; i++) //{ // string[] strd = FuzzyController.arryBestPath[i].ToString().Split('+'); // //for (int j = 0; j < arryAdd.Count; j++) // //{ // if (strd[1] == arryAdd[i].ToString()) // { // string[] Route = strd[0].Split('_'); // string[] route = Route[0].Split('-'); // string R = " "; // for (int k = 1; k < route.Length - 1; k++) // { // R = R + "-" + route[k]; // } // row[0] = 1; // row[1] = R; // row[2] = route[route.Length - 1]; // row[3] = Route[1]; // // table1.Rows.Add(row); // } //} //GridView3.DataSource = table1; //GridView3.DataBind(); // DataRow row1 = table.NewRow(); // table.Clear(); // row1[0] = NetworkCondition.dstab.Rows[0].ItemArray[0]; // row1[1] = NetworkCondition.dstab.Rows[0].ItemArray[1]; // row1[2] = NetworkCondition.dstab.Rows[0].ItemArray[2]; ; // row1[3] = NetworkCondition.dstab.Rows[0].ItemArray[3]; ; // table.Rows.Add(row1); GridView4.DataSource = table; GridView4.DataBind(); } }
protected void Button3_Click(object sender, EventArgs e) { DataTable dt = controllerObj.reviews(DropDownList3.Text.ToString()); GridView4.DataBind(); }
protected void Button4_Click(object sender, EventArgs e) { GridView4.DataBind(); GridView5.DataBind(); }
protected void GridView4_Init(object sender, EventArgs e) { GridView4.DataSource = gridviewbind("全国信息学奥林匹克联赛"); GridView4.DataBind(); }
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) { GridView4.DataBind(); GridView5.DataBind(); }
protected void TrainingClassBind() { SqlConnection conn = new SqlConnection ("Server=DESKTOP-41H50KG\\SQLEXPRESS; Database=clubone; Uid=20201113; password=123456"); conn.Open(); SqlCommand cmd1 = new SqlCommand("select TrainingClass.className as className, Tutor.name as name, TrainingClass.timeSlot as timeSlot, TrainingClass.price as price, TrainingClass.tcID as tcID, TrainingClass.days as days from TrainingClass,Tutor where TrainingClass.tutorID = Tutor.tID and TrainingClass.days = @D", conn); cmd1.Parameters.AddWithValue("@D", "Monday"); SqlDataAdapter adapter1 = new SqlDataAdapter(cmd1); DataTable dt1 = new DataTable(); adapter1.Fill(dt1); GridView1.DataSource = dt1; GridView1.DataBind(); SqlCommand cmd2 = new SqlCommand("select TrainingClass.className as className, Tutor.name as name, TrainingClass.timeSlot as timeSlot, TrainingClass.price as price, TrainingClass.tcID as tcID, TrainingClass.days as days from TrainingClass,Tutor where TrainingClass.tutorID = Tutor.tID and TrainingClass.days = @D", conn); cmd2.Parameters.AddWithValue("@D", "Tuesday"); SqlDataAdapter adapter2 = new SqlDataAdapter(cmd2); DataTable dt2 = new DataTable(); adapter2.Fill(dt2); GridView2.DataSource = dt2; GridView2.DataBind(); SqlCommand cmd3 = new SqlCommand("select TrainingClass.className as className, Tutor.name as name, TrainingClass.timeSlot as timeSlot, TrainingClass.price as price, TrainingClass.tcID as tcID, TrainingClass.days as days from TrainingClass,Tutor where TrainingClass.tutorID = Tutor.tID and TrainingClass.days = @D", conn); cmd3.Parameters.AddWithValue("@D", "Wednesday"); SqlDataAdapter adapter3 = new SqlDataAdapter(cmd3); DataTable dt3 = new DataTable(); adapter3.Fill(dt3); GridView3.DataSource = dt3; GridView3.DataBind(); SqlCommand cmd4 = new SqlCommand("select TrainingClass.className as className, Tutor.name as name, TrainingClass.timeSlot as timeSlot, TrainingClass.price as price, TrainingClass.tcID as tcID, TrainingClass.days as days from TrainingClass,Tutor where TrainingClass.tutorID = Tutor.tID and TrainingClass.days = @D", conn); cmd4.Parameters.AddWithValue("@D", "Thursday"); SqlDataAdapter adapter4 = new SqlDataAdapter(cmd4); DataTable dt4 = new DataTable(); adapter4.Fill(dt4); GridView4.DataSource = dt4; GridView4.DataBind(); SqlCommand cmd5 = new SqlCommand("select TrainingClass.className as className, Tutor.name as name, TrainingClass.timeSlot as timeSlot, TrainingClass.price as price, TrainingClass.tcID as tcID, TrainingClass.days as days from TrainingClass,Tutor where TrainingClass.tutorID = Tutor.tID and TrainingClass.days = @D", conn); cmd5.Parameters.AddWithValue("@D", "Friday"); SqlDataAdapter adapter5 = new SqlDataAdapter(cmd5); DataTable dt5 = new DataTable(); adapter5.Fill(dt5); GridView5.DataSource = dt5; GridView5.DataBind(); SqlCommand cmd6 = new SqlCommand("select TrainingClass.className as className, Tutor.name as name, TrainingClass.timeSlot as timeSlot, TrainingClass.price as price, TrainingClass.tcID as tcID, TrainingClass.days as days from TrainingClass,Tutor where TrainingClass.tutorID = Tutor.tID and TrainingClass.days = @D", conn); cmd6.Parameters.AddWithValue("@D", "Saturday"); SqlDataAdapter adapter6 = new SqlDataAdapter(cmd6); DataTable dt6 = new DataTable(); adapter6.Fill(dt6); GridView6.DataSource = dt6; GridView6.DataBind(); SqlCommand cmd7 = new SqlCommand("select TrainingClass.className as className, Tutor.name as name, TrainingClass.timeSlot as timeSlot, TrainingClass.price as price, TrainingClass.tcID as tcID, TrainingClass.days as days from TrainingClass,Tutor where TrainingClass.tutorID = Tutor.tID and TrainingClass.days = @D", conn); cmd7.Parameters.AddWithValue("@D", "Sunday"); SqlDataAdapter adapter7 = new SqlDataAdapter(cmd7); DataTable dt7 = new DataTable(); adapter7.Fill(dt7); GridView7.DataSource = dt7; GridView7.DataBind(); }
protected void Search2_Click(object sender, EventArgs e) { GridView4.DataSource = me.QueryMaterial(TextBox4.Text, TextBox5.Text); GridView4.DataBind(); UpdatePanel6.Update(); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Modify") { var row = ((LinkButton) e.CommandSource).Parent.Parent as GridViewRow; GridView1.SelectedIndex = row.RowIndex; Label1.Text = "修改"; TextBox11.Text = row.Cells[1].Text; TextBox12.Text = row.Cells[2].Text; if (!row.Cells[4].Text.Contains("&")) { DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText(row.Cells[2].Text)); } TextBox13.Text = row.Cells[3].Text; if (row.Cells[5].ToolTip!="") { TextBox14.Text = row.Cells[5].ToolTip; } else { TextBox14.Text = row.Cells[5].Text; } ElementID.Text = e.CommandArgument.ToString(); Panel5.Visible = true; UpdatePanel5.Update(); } if (e.CommandName == "De") { int a = me.DeleteHSF(new Guid(e.CommandArgument.ToString())); ScriptManager.RegisterStartupScript(Page, typeof (Page), "alert", a > 0 ? "alert('删除成功!');" : "alert('失败了诶...');", true); bind(); } if (e.CommandName == "SetDetail") { HSFID.Text = e.CommandArgument.ToString(); Panel4.Visible = true; GridView3.DataSource = ele.Query("",new Guid(HSFID.Text)); GridView3.DataBind(); UpdatePanel4.Update(); } if (e.CommandName == "Details") { HSFID.Text = e.CommandArgument.ToString(); Panel3.Visible = true; GridView2.DataSource = me.QueryDetail(new Guid(HSFID.Text)); GridView2.DataBind(); UpdatePanel3.Update(); } if (e.CommandName == "copy") { HSFID.Text = e.CommandArgument.ToString(); GridView4.DataSource = me.QueryMaterial(TextBox4.Text, TextBox5.Text); GridView4.DataBind(); Panel3.Visible = false; Panel4.Visible = false; Panel5.Visible = false; Panel6.Visible = true; Panel7.Visible = true; UpdatePanel3.Update(); UpdatePanel4.Update(); UpdatePanel5.Update(); UpdatePanel6.Update(); } }
//初始化试卷,从数据库中将试题取出 protected void InitData() { DataBase DB = new DataBase(); int paperID = Convert.ToInt32(Request.QueryString["PaperID"].ToString()); SqlParameter[] Params1 = new SqlParameter[2]; Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID); //试卷编号 Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题"); //题目类型 DataSet ds1 = DB.GetDataSet("Proc_PaperDetail", Params1); GridView11.DataSource = ds1; GridView11.DataBind(); if (ds1.Tables[0].Rows.Count > 0) { ((Label)GridView11.HeaderRow.FindControl("Labelt2")).Text = ((Label)GridView11.Rows[0].FindControl("Labelm1")).Text; } SqlParameter[] Params2 = new SqlParameter[2]; Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID); //试卷编号 Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题"); //题目类型 DataSet ds2 = DB.GetDataSet("Proc_PaperDetail", Params2); GridView2.DataSource = ds2; GridView2.DataBind(); if (ds2.Tables[0].Rows.Count > 0) { ((Label)GridView2.HeaderRow.FindControl("Labelt5")).Text = ((Label)GridView2.Rows[0].FindControl("Labelm2")).Text; } SqlParameter[] Params3 = new SqlParameter[2]; Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID); //试卷编号 Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题"); //题目类型 DataSet ds3 = DB.GetDataSet("Proc_PaperDetail", Params3); GridView3.DataSource = ds3; GridView3.DataBind(); if (ds3.Tables[0].Rows.Count > 0) { ((Label)GridView3.HeaderRow.FindControl("Labelt8")).Text = ((Label)GridView3.Rows[0].FindControl("Labelm3")).Text; } SqlParameter[] Params4 = new SqlParameter[2]; Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID); //试卷编号 Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题"); //题目类型 DataSet ds4 = DB.GetDataSet("Proc_PaperDetail", Params4); GridView4.DataSource = ds4; GridView4.DataBind(); if (ds4.Tables[0].Rows.Count > 0) { ((Label)GridView4.HeaderRow.FindControl("Labelt11")).Text = ((Label)GridView4.Rows[0].FindControl("Labelm4")).Text; } SqlParameter[] Params5 = new SqlParameter[2]; Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperID); //试卷编号 Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "问答题"); //题目类型 DataSet ds5 = DB.GetDataSet("Proc_PaperDetail", Params5); GridView5.DataSource = ds5; GridView5.DataBind(); if (ds5.Tables[0].Rows.Count > 0) { ((Label)GridView5.HeaderRow.FindControl("Labelt14")).Text = ((Label)GridView5.Rows[0].FindControl("Labelm5")).Text; } }
protected void BtnAll_Click(object sender, EventArgs e) { GridView4.DataBind(); }
void loadData() { SqlConnection conn = new SqlConnection(constr); conn.Open(); string SqlStr1 = $"select [orderID] , [userID] ,[shopID] ,[orderTotalPrice] ,[shipAddress] ,[payMethod] , CONVERT(varchar(10), [payDate], 120 ) payDate,CONVERT(varchar(10), [signDate], 120 ) signDate,[tranStatus] from [new_order] where [userID]='{Request.Cookies["UID"].Value.Trim()}'"; SqlDataAdapter data1 = new SqlDataAdapter(SqlStr1, conn); DataSet dataset1 = new DataSet(); data1.Fill(dataset1, "new_order"); //绑定DataList控件 GridView1.DataSource = dataset1; GridView1.DataKeyNames = new string[] { "orderID" }; GridView1.DataBind(); string SqlStr2 = $"select [orderID] ,[userID] ,[shopID] ,[orderTotalPrice] ,[shipAddress] ,[payMethod] , CONVERT(varchar(10), [payDate], 120 ) payDate,CONVERT(varchar(10), [signDate], 120 ) signDate,[tranStatus] from [new_order] where tranStatus='待付款' and [userID]='{Request.Cookies["UID"].Value.Trim()}'"; SqlDataAdapter data2 = new SqlDataAdapter(SqlStr2, conn); DataSet dataset2 = new DataSet(); data2.Fill(dataset2, "new_order"); //绑定DataList控件 GridView2.DataSource = dataset2; GridView2.DataKeyNames = new string[] { "orderID" }; GridView2.DataBind(); string SqlStr3 = $"select [orderID] ,[userID] ,[shopID] ,[orderTotalPrice] ,[shipAddress] ,[payMethod] , CONVERT(varchar(10), [payDate], 120 ) payDate,CONVERT(varchar(10), [signDate], 120 ) signDate,[tranStatus] from [new_order] where tranStatus='待发货' and [userID]='{Request.Cookies["UID"].Value.Trim()}'"; SqlDataAdapter data3 = new SqlDataAdapter(SqlStr3, conn); DataSet dataset3 = new DataSet(); data3.Fill(dataset3, "new_order"); //绑定DataList控件 GridView3.DataSource = dataset3; GridView3.DataKeyNames = new string[] { "orderID" }; GridView3.DataBind(); string SqlStr4 = $"select [orderID] ,[userID] ,[shopID] ,[orderTotalPrice] ,[shipAddress] ,[payMethod] , CONVERT(varchar(10), [payDate], 120 ) payDate,CONVERT(varchar(10), [signDate], 120 ) signDate,[tranStatus] from [new_order] where tranStatus='退货/退款中' and [userID]='{Request.Cookies["UID"].Value.Trim()}'"; SqlDataAdapter data4 = new SqlDataAdapter(SqlStr4, conn); DataSet dataset4 = new DataSet(); data4.Fill(dataset4, "new_order"); //绑定DataList控件 GridView4.DataSource = dataset4; GridView4.DataKeyNames = new string[] { "orderID" }; GridView4.DataBind(); string SqlStr5 = $"select [orderID] ,[userID] ,[shopID] ,[orderTotalPrice] ,[shipAddress] ,[payMethod] , CONVERT(varchar(10), [payDate], 120 ) payDate,CONVERT(varchar(10), [signDate], 120 ) signDate,[tranStatus] from [new_order] where tranStatus='已完成' and [userID]='{Request.Cookies["UID"].Value.Trim()}'"; SqlDataAdapter data5 = new SqlDataAdapter(SqlStr5, conn); DataSet dataset5 = new DataSet(); data5.Fill(dataset5, "new_order"); //绑定DataList控件 GridView5.DataSource = dataset5; GridView5.DataKeyNames = new string[] { "orderID" }; GridView5.DataBind(); string SqlStr6 = $"select [orderID] ,[userID] ,[shopID] ,[orderTotalPrice] ,[shipAddress] ,[payMethod] , CONVERT(varchar(10), [payDate], 120 ) payDate,CONVERT(varchar(10), [signDate], 120 ) signDate,[tranStatus] from [new_order] where tranStatus='已取消' and [userID]='{Request.Cookies["UID"].Value.Trim()}'"; SqlDataAdapter data6 = new SqlDataAdapter(SqlStr6, conn); DataSet dataset6 = new DataSet(); data6.Fill(dataset6, "new_order"); //绑定DataList控件 GridView6.DataSource = dataset6; GridView6.DataKeyNames = new string[] { "orderID" }; GridView6.DataBind(); string SqlStr7 = $"select [orderID] ,[userID] ,[shopID] ,[orderTotalPrice] ,[shipAddress] ,[payMethod] , CONVERT(varchar(10), [payDate], 120 ) payDate,CONVERT(varchar(10), [signDate], 120 ) signDate,[tranStatus] from [new_order] where tranStatus='已退货/退款' and [userID]='{Request.Cookies["UID"].Value.Trim()}'"; SqlDataAdapter data7 = new SqlDataAdapter(SqlStr7, conn); DataSet dataset7 = new DataSet(); data7.Fill(dataset7, "new_order"); //绑定DataList控件 GridView7.DataSource = dataset7; GridView7.DataKeyNames = new string[] { "orderID" }; GridView7.DataBind(); conn.Close(); }
protected void BtnSearch_Click(object sender, EventArgs e) { string KeyWord = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxFirmName.Text)); string KeyWord1 = SystemSet.CheckMSSQLLike(SystemSet.ReplaceBlank(TxSpecialty.Text)); #region 搜尋條件 string x = "select * from FirmM where "; string xx = "依 "; int[] SelectCondition = new int[5]; for (int i = 0; i < 5; i++) { SelectCondition[i] = 0; } if (KeyWord.Trim() != "") { SelectCondition[1] = 1; } if (DDL_Select2.SelectedValue.ToString() != "0") { SelectCondition[2] = 1; } if (KeyWord1.Trim() != "") { SelectCondition[3] = 1; } if (DDL_Select4.SelectedValue.ToString() != "0") { SelectCondition[4] = 1; } for (int i = 1; i < 5; i++) { if (SelectCondition[i] != 0) { if (SelectCondition[0] != 0) { DropDownList myDDL = (DropDownList)Pnl_Search.FindControl("DDL_Op" + SelectCondition[0].ToString()); //MsgBox(myDDL.ID); x += myDDL.SelectedValue + " "; xx += myDDL.SelectedItem.Text + " "; } switch (i) { case 1: x += "Name like '%" + KeyWord.Trim() + "%' "; xx += "[廠商名稱]=(關鍵字)" + KeyWord.Trim() + " "; break; case 2: x += "Type ='" + DDL_Select2.SelectedValue.ToString() + "' "; xx += "[廠商類型]=" + DDL_Select2.SelectedValue.ToString() + " "; break; case 3: x += "SupportItem like '%" + KeyWord1.Trim() + "%' "; xx += "[廠商專長/供給材料]=(關鍵字)" + KeyWord1.Trim() + " "; break; case 4: x += "Location ='" + DDL_Select4.SelectedValue.ToString() + "' "; xx += "[所在縣市]=" + DDL_Select4.SelectedValue.ToString() + " "; break; } SelectCondition[0] = i; } } xx += "之搜尋結果"; if (SelectCondition[0] != 0) { SqlDataSource6.SelectCommand = x; } else { SqlDataSource6.SelectCommand = "select * from FirmM "; } GridView4.DataBind(); #endregion }
//初始化试卷,从数据库中将试题取出 protected void PaperData() { string userid = Request.QueryString["UserID"].ToString(); paperid = int.Parse(Request.QueryString["PaperID"].ToString()); DataBase DB = new DataBase(); DataSet ds = DB.GetDataSetSql("select PaperName,ExamTime from [UserAnswertb],[Paper] where[UserAnswertb].PaperID=[Paper].PaperID and UserID='" + userid + "' and [UserAnswertb].PaperID='" + paperid + "'"); DataRow[] row = ds.Tables[0].Select(); //获取试卷基本信息 lblExamtime.Text = row[0]["ExamTime"].ToString(); lblExamname.Text = row[0]["PaperName"].ToString(); //获取总分 ds = DB.GetDataSetSql("select Score from Scoretb where UserID='" + userid + "' and PaperID='" + paperid + "'"); DataRow[] rowSum = ds.Tables[0].Select(); sumScore.Text = rowSum[0]["Score"].ToString(); SqlParameter[] Params1 = new SqlParameter[3]; Params1[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params1[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "单选题"); Params1[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds1 = DB.GetDataSet("Proc_UserAnswertb", Params1); if (ds1.Tables[0].Rows.Count > 0) { GridView11.DataSource = ds1; GridView11.DataBind(); ((Label)GridView11.HeaderRow.FindControl("Label27")).Text = ((Label)GridView11.Rows[0].FindControl("Label4")).Text; } SqlParameter[] Params2 = new SqlParameter[3]; Params2[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params2[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "多选题"); Params2[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds2 = DB.GetDataSet("Proc_UserAnswertb", Params2); if (ds2.Tables[0].Rows.Count > 0) { GridView2.DataSource = ds2; GridView2.DataBind(); ((Label)GridView2.HeaderRow.FindControl("Label28")).Text = ((Label)GridView2.Rows[0].FindControl("Label8")).Text; } SqlParameter[] Params3 = new SqlParameter[3]; Params3[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params3[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "判断题"); Params3[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds3 = DB.GetDataSet("Proc_UserAnswertb", Params3); if (ds3.Tables[0].Rows.Count > 0) { GridView3.DataSource = ds3; GridView3.DataBind(); ((Label)GridView3.HeaderRow.FindControl("Label29")).Text = ((Label)GridView3.Rows[0].FindControl("Label12")).Text; } SqlParameter[] Params4 = new SqlParameter[3]; Params4[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params4[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "填空题"); Params4[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds4 = DB.GetDataSet("Proc_UserAnswertb", Params4); if (ds4.Tables[0].Rows.Count > 0) { GridView4.DataSource = ds4; GridView4.DataBind(); ((Label)GridView4.HeaderRow.FindControl("Label30")).Text = ((Label)GridView4.Rows[0].FindControl("Label17")).Text; } SqlParameter[] Params5 = new SqlParameter[3]; Params5[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); Params5[1] = DB.MakeInParam("@Type", SqlDbType.VarChar, 10, "问答题"); Params5[2] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); DataSet ds5 = DB.GetDataSet("Proc_UserAnswertb", Params5); if (ds5.Tables[0].Rows.Count > 0) { GridView5.DataSource = ds5; GridView5.DataBind(); ((Label)GridView5.HeaderRow.FindControl("Label31")).Text = ((Label)GridView5.Rows[0].FindControl("Label21")).Text; } if (GridView11.Rows.Count > 0) { int score1 = 0; int singlemark = int.Parse(((Label)GridView11.Rows[0].FindControl("Label4")).Text);//取出单选题的每题分值 foreach (GridViewRow dr in GridView11.Rows) { if (((Label)dr.FindControl("Label3")).Text.Trim() == "A") { ((RadioButton)dr.FindControl("RadioButton1")).Checked = true; } else if (((Label)dr.FindControl("Label3")).Text.Trim() == "B") { ((RadioButton)dr.FindControl("RadioButton2")).Checked = true; } else if (((Label)dr.FindControl("Label3")).Text.Trim() == "C") { ((RadioButton)dr.FindControl("RadioButton3")).Checked = true; } else if (((Label)dr.FindControl("Label3")).Text.Trim() == "D") { ((RadioButton)dr.FindControl("RadioButton4")).Checked = true; } if (((Label)dr.FindControl("Label3")).Text.Trim() == ((Label)dr.FindControl("Label23")).Text.Trim()) { score1 = score1 + singlemark; sinScore.Text = Convert.ToString(score1); //dr.Visible = false;//单选题 } else { dr.BackColor = System.Drawing.Color.LightPink;//错题以红色背景显示 } } } if (GridView2.Rows.Count > 0) { int score2 = 0; int multimark = int.Parse(((Label)GridView2.Rows[0].FindControl("Label8")).Text);//取出多选题每题分值 foreach (GridViewRow dr in GridView2.Rows) { if (((Label)dr.FindControl("Label7")).Text.Trim() == "A") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "B") { ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "C") { ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "D") { ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "AB") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "AC") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "AD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "BC") { ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "BD") { ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "CD") { ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABC") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ACD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == "ABCD") { ((CheckBox)dr.FindControl("CheckBox1")).Checked = true; ((CheckBox)dr.FindControl("CheckBox2")).Checked = true; ((CheckBox)dr.FindControl("CheckBox3")).Checked = true; ((CheckBox)dr.FindControl("CheckBox4")).Checked = true; } if (((Label)dr.FindControl("Label7")).Text.Trim() == ((Label)dr.FindControl("Label27")).Text.Trim()) { score2 = score2 + multimark; mulScore.Text = Convert.ToString(score2); } else { dr.BackColor = System.Drawing.Color.LightPink;//错题以红色背景显示 } } } if (GridView3.Rows.Count > 0) { int score3 = 0; int judgemark = int.Parse(((Label)GridView3.Rows[0].FindControl("Label12")).Text); //取出判断题每题分值 foreach (GridViewRow dr in GridView3.Rows) //对判断题每题进行判断用户选择答案 { try { if (bool.Parse(((Label)dr.FindControl("Label11")).Text.Trim())) { ((CheckBox)dr.FindControl("CheckBox5")).Checked = true; } else { ((CheckBox)dr.FindControl("CheckBox6")).Checked = true; } } catch { ((CheckBox)dr.FindControl("CheckBox5")).Checked = false; ((CheckBox)dr.FindControl("CheckBox6")).Checked = false; } if (((Label)dr.FindControl("Label11")).Text.Trim() == ((Label)dr.FindControl("Label41")).Text.Trim()) { score3 = score3 + judgemark; judScore.Text = Convert.ToString(score3); } else { dr.BackColor = System.Drawing.Color.LightPink;//错题以红色背景显示 } } } //计算总分 }
void PostDoosage() { GridView4.DataSource = ClassDataManager.LoadDosage(drugi); GridView4.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { string connectionString = ConfigurationManager.ConnectionStrings["conStr"].ToString(); SqlConnection con = new SqlConnection(connectionString); try { con.Open(); } catch (Exception) { con.Close(); return; throw; } int empID = int.Parse(TextBoxID.Text); string empName = TextBoxName.Text; string empTask = TextBoxTask.Text; int empSalary = int.Parse(TextBoxSalary.Text); string empPhone = TextBoxPhone.Text; string empAddress = null; string empEmail = null; string empShop = null; Nullable <int> empManagerID = null; string empBirth = null; string empLangs = null; string[] empLangArr = new string[10]; Nullable <int> day = null; Nullable <int> month = null; Nullable <int> year = null; int i; string sqlStrShopEmp = string.Empty; string sqlStrEmpLangs = string.Empty; string sqlStrPhoneNumbers = string.Empty; string sqlStrEmployee = "INSERT INTO Employee_T (PersonalID, EmployeeName, Task, Salary, EmployeeAddress, Email, Birth, ShopName, ManagerID) VALUES(" + empID + ", '" + empName + "', '" + empTask + "', " + empSalary + ", "; if (!string.IsNullOrEmpty(TextBoxAddress.Text)) { empAddress = TextBoxAddress.Text; sqlStrEmployee += "'" + empAddress + "', "; } else { sqlStrEmployee += "NULL, "; } if (!string.IsNullOrEmpty(TextBoxEmail.Text)) { empEmail = TextBoxEmail.Text; sqlStrEmployee += "'" + empEmail + "', "; } else { sqlStrEmployee += "NULL, "; } if (!string.IsNullOrEmpty(TextBoxBirth.Text)) { empBirth = TextBoxBirth.Text; sqlStrEmployee += "'" + empBirth + "', "; } else { sqlStrEmployee += "NULL, "; } if (!string.IsNullOrEmpty(TextBoxShop.Text)) { empShop = TextBoxShop.Text; sqlStrShopEmp = "INSERT INTO Employees_in_Shop_T (ShopName, PersonalID) VALUES('" + empShop + "', " + empID + ")"; sqlStrEmployee += "'" + empShop + "', "; } else { sqlStrEmployee += "NULL, "; } if (!string.IsNullOrEmpty(TextBoxManID.Text)) { empManagerID = int.Parse(TextBoxManID.Text); sqlStrEmployee += empManagerID + ");"; } else { sqlStrEmployee += "NULL);"; } SqlDataAdapter adapter1 = new SqlDataAdapter(); SqlCommand execEmp = new SqlCommand(sqlStrEmployee, con); adapter1.InsertCommand = new SqlCommand(sqlStrEmployee, con); adapter1.InsertCommand.ExecuteNonQuery(); execEmp.Dispose(); using (StringReader reader = new StringReader(empPhone)) { string line; while ((line = reader.ReadLine()) != null) { sqlStrPhoneNumbers = "INSERT INTO Employee_Phone_Number_T (PersonalID, PhoneNumber) VALUES(" + empID + ", '" + line + "')"; SqlDataAdapter adapter2 = new SqlDataAdapter(); SqlCommand execPhoneNumbers = new SqlCommand(sqlStrPhoneNumbers, con); adapter2.InsertCommand = new SqlCommand(sqlStrPhoneNumbers, con); adapter2.InsertCommand.ExecuteNonQuery(); execPhoneNumbers.Dispose(); } } if (!string.IsNullOrEmpty(sqlStrShopEmp)) { SqlCommand execShopEmp = new SqlCommand(sqlStrShopEmp, con); SqlDataAdapter adapter3 = new SqlDataAdapter(); adapter3.InsertCommand = new SqlCommand(sqlStrShopEmp, con); adapter3.InsertCommand.ExecuteNonQuery(); execShopEmp.Dispose(); } if (!string.IsNullOrEmpty(TextBoxLangs.Text)) { empLangs = TextBoxLangs.Text; using (StringReader reader = new StringReader(empLangs)) { string line; i = 0; while ((line = reader.ReadLine()) != null) { empLangArr[i] = line; i++; } } foreach (string s in empLangArr) { if (!string.IsNullOrEmpty(s)) { sqlStrEmpLangs = "INSERT INTO Employees_Language_T (PersonalID, Languages) VALUES(" + empID + ", '" + s + "')"; SqlCommand execEmpLangs = new SqlCommand(sqlStrEmpLangs, con); SqlDataAdapter adapter4 = new SqlDataAdapter(); adapter4.InsertCommand = new SqlCommand(sqlStrEmpLangs, con); adapter4.InsertCommand.ExecuteNonQuery(); execEmpLangs.Dispose(); } } } DataSet ds1 = new DataSet(); string sqlstr = "select * from Employee_T"; SqlDataAdapter da = new SqlDataAdapter(sqlstr, con); da.Fill(ds1); GridView2.DataSource = ds1; GridView2.DataBind(); DataSet ds2 = new DataSet(); sqlstr = "select * from Employee_Phone_Number_T"; da = new SqlDataAdapter(sqlstr, con); da.Fill(ds2); GridView3.DataSource = ds2; GridView3.DataBind(); DataSet ds3 = new DataSet(); sqlstr = "select * from Employees_Language_T"; da = new SqlDataAdapter(sqlstr, con); da.Fill(ds3); GridView4.DataSource = ds3; GridView4.DataBind(); DataSet ds4 = new DataSet(); sqlstr = "select * from Employees_in_Shop_T"; da = new SqlDataAdapter(sqlstr, con); da.Fill(ds4); GridView5.DataSource = ds4; GridView5.DataBind(); con.Close(); }
protected void DropDownList8_SelectedIndexChanged(object sender, EventArgs e) { Kinisi_Ensimou.DataBind(); GridView4.DataBind(); }
//显示页面内容 public void showmanage(string staue) { if (staue == "orderCar") { //modify by wangjh on 2011-06-08 begin // string T_SQL = @"select dbo.USER_Users.USERNAME, dbo.USER_Users.REALNAME, dbo.Project_CarList.CarName,dbo.Project_Apply_orderCar.StartTime,dbo.Project_Apply_orderCar.EndTime,dbo.Project_Apply.Status // from Project_Apply_orderCar join Project_Apply on Project_Apply.ID=Project_Apply_orderCar.ApplyID join Project_CarList on Project_Apply_orderCar.CarID=Project_CarList.ID join USER_Users on Project_Apply.ApplyUserID=USER_Users.ID // where Project_CarList.DELFLAG=0 and Project_Apply.DELFLAG=0 and (Project_Apply.Status=1 or Project_Apply.Status=0) // and '" + DateTime.Now + "'< Project_Apply_orderCar.EndTime order by Project_CarList.ID "; //和上面已注掉的SQL相比,下面的SQL去掉了“Project_CarList.DELFLAG=0 and” //因为在Project_CarList表中DELFLAG已经更改,不再作为删除标记了,是作为座位数的标记,如7,14就表示7个座和14个座 string T_SQL = @"select dbo.USER_Users.USERNAME, dbo.USER_Users.REALNAME, dbo.Project_CarList.CarName,dbo.Project_Apply_orderCar.StartTime,dbo.Project_Apply_orderCar.EndTime,dbo.Project_Apply.Status from Project_Apply_orderCar join Project_Apply on Project_Apply.ID=Project_Apply_orderCar.ApplyID join Project_CarList on Project_Apply_orderCar.CarID=Project_CarList.ID join USER_Users on Project_Apply.ApplyUserID=USER_Users.ID where Project_Apply.DELFLAG=0 and (Project_Apply.Status=1 or Project_Apply.Status=0) and '" + DateTime.Now + "'< Project_Apply_orderCar.EndTime order by Project_Apply_orderCar.StartTime DESC "; //modify by wangjh on 2011-06-08 end DataTable dt = new DataTable(); dt = pageControl.doSql(T_SQL).Tables[0]; GridView1.DataSource = dt; GridView1.DataBind(); if (GridView1.Rows.Count == 0) { Label6.Text = "对不起!没有预定车辆信息!"; GridView2.Visible = false; GridView1.Visible = false; GridView3.Visible = false; GridView4.Visible = false; } } else if (staue == "orderRoom") { string T_SQL = @"select RoomName,StartTime,EndTime,USERNAME,REALNAME,dbo.Project_Apply.Status from Project_Apply_orderRoom join Project_Apply on Project_Apply.ID=Project_Apply_orderRoom.ApplyID join Project_RoomList on Project_RoomList.ID=Project_Apply_orderRoom.RoomID join USER_Users on USER_Users.id=Project_Apply.ApplyUserID where Project_RoomList.DELFLAG=0 and Project_Apply.DELFLAG=0 and ( Project_Apply.Status=1 or Project_Apply.Status=0) and '" + DateTime.Now + "'< Project_Apply_orderRoom.EndTime order by StartTime DESC "; DataTable dt = new DataTable(); dt = pageControl.doSql(T_SQL).Tables[0]; GridView2.DataSource = dt; GridView2.DataBind(); if (GridView2.Rows.Count == 0) { Label6.Text = "对不起!没有预定会议室信息!"; GridView2.Visible = false; GridView1.Visible = false; GridView3.Visible = false; GridView4.Visible = false; } } else if (staue == "orderFood") { string T_SQL = @"select UserDatetime,USERNAME,REALNAME,OrderNum,dbo.Project_Apply.Status from Project_Apply_orderFood join Project_Apply on Project_Apply.ID=Project_Apply_orderFood.ApplyID join USER_Users on USER_Users.id=Project_Apply.ApplyUserID where Project_Apply.DELFLAG=0 and (Project_Apply.Status=1 or Project_Apply.Status=0) and '" + DateTime.Now + "'< UserDatetime order by UserDatetime"; DataTable dt = new DataTable(); dt = pageControl.doSql(T_SQL).Tables[0]; GridView3.DataSource = dt; GridView3.DataBind(); if (GridView3.Rows.Count == 0) { Label6.Text = "对不起!没有预定午餐信息!"; GridView2.Visible = false; GridView1.Visible = false; GridView3.Visible = false; GridView4.Visible = false; } } else if (staue == "orderSignet") { string T_SQL = @"select SignetName,Nums,USERNAME,REALNAME from Project_Apply_signet join Project_Apply on Project_Apply.ID=Project_Apply_signet.ApplyID join Project_SignetList on Project_SignetList.ID=Project_Apply_signet.SignetID join USER_Users on USER_Users.id=Project_Apply.ApplyUserID where Project_SignetList.DELFLAG=0 and Project_Apply.DELFLAG=0 and Project_Apply.Status=1"; DataTable dt = new DataTable(); dt = pageControl.doSql(T_SQL).Tables[0]; GridView4.DataSource = dt; GridView4.DataBind(); if (GridView4.Rows.Count == 0) { Label6.Text = "对不起!没有已申请用印的相关信息!"; GridView2.Visible = false; GridView1.Visible = false; GridView3.Visible = false; GridView4.Visible = false; } } else { Label6.Text = "对不起!没有信息!"; GridView2.Visible = false; GridView1.Visible = false; GridView3.Visible = false; GridView4.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(CS); con.Open(); Label1.Text = "All info about the employee with ID 8"; SqlCommand cmd1 = new SqlCommand("select * from employees where EmployeeID=8", con); GridView1.DataSource = cmd1.ExecuteReader(); GridView1.DataBind(); con.Close(); con.Open(); Label2.Text = "The list of first and last names of the employees from London"; SqlCommand cmd2 = new SqlCommand("select FirstName,LastName from employees where City='London'", con); GridView2.DataSource = cmd2.ExecuteReader(); GridView2.DataBind(); con.Close(); con.Open(); Label3.Text = "The list of first and last names of the employees whose first name begins with letter A"; SqlCommand cmd3 = new SqlCommand("select FirstName,LastName from employees where FirstName like 'A%' ", con); GridView3.DataSource = cmd3.ExecuteReader(); GridView3.DataBind(); con.Close(); con.Open(); Label4.Text = "The list of first, last names and ages of the employees whose age is greater than 55. The result should be sorted by last name"; SqlCommand cmd4 = new SqlCommand("select FirstName,LastName ,(CURRENT_TIMESTAMP-BirthDate)as ages from employees where (CURRENT_TIMESTAMP-BirthDate) > 55 order by LastName", con); GridView4.DataSource = cmd4.ExecuteReader(); GridView4.DataBind(); con.Close(); con.Open(); Label5.Text = "The count of employees from London"; SqlCommand cmd5 = new SqlCommand("select count(*) from employees where city='London'", con); GridView5.DataSource = cmd5.ExecuteReader(); GridView5.DataBind(); con.Close(); con.Open(); Label6.Text = "The greatest, the smallest and the average age among the employees from London"; SqlCommand cmd6 = new SqlCommand(" SELECT city,CONVERT(datetime,avg(CONVERT(INT, BirthDate)))as AVG,CONVERT(datetime,max(CONVERT(INT, BirthDate)))as MAX,CONVERT(datetime,min(CONVERT(INT, BirthDate)))as MIN from employees where city='London' group by city", con); GridView6.DataSource = cmd6.ExecuteReader(); GridView6.DataBind(); con.Close(); con.Open(); Label7.Text = "The greatest, the smallest and the average age of the employees for each city"; SqlCommand cmd7 = new SqlCommand(" SELECT CONVERT(datetime,avg(CONVERT(INT, BirthDate)))as AVG,CONVERT(datetime,max(CONVERT(INT, BirthDate)))as MAX,CONVERT(datetime,min(CONVERT(INT, BirthDate)))as MIN from employees", con); GridView7.DataSource = cmd7.ExecuteReader(); GridView7.DataBind(); con.Close(); con.Open(); Label8.Text = "The greatest, the smallest and the average age of the employees for each city"; SqlCommand cmd8 = new SqlCommand(" SELECT CONVERT(datetime,avg(CONVERT(INT, BirthDate)))as AVG,CONVERT(datetime,max(CONVERT(INT, BirthDate)))as MAX,CONVERT(datetime,min(CONVERT(INT, BirthDate)))as MIN from employees", con); GridView8.DataSource = cmd8.ExecuteReader(); GridView8.DataBind(); con.Close(); con.Open(); Label9.Text = "First, last names and dates of birth of the employees who celebrate their birthdays this month"; SqlCommand cmd9 = new SqlCommand("select FirstName,LastName,BirthDate from employees where MONTH(BirthDate)=MONTH(GETDATE())", con); GridView9.DataSource = cmd9.ExecuteReader(); GridView9.DataBind(); con.Close(); con.Open(); Label10.Text = "First and last names of the employees who used to serve orders shipped to Madrid"; SqlCommand cmd10 = new SqlCommand("select distinct FirstName,LastName,shipcity from employees inner join orders on employees.EmployeeID=orders.EmployeeID where shipcity='Madrid'", con); GridView10.DataSource = cmd10.ExecuteReader(); GridView10.DataBind(); con.Close(); con.Open(); Label11.Text = "First and last names of the employees who used to serve orders shipped to Madrid"; SqlCommand cmd11 = new SqlCommand("select distinct FirstName,LastName,shipcity from employees inner join orders on employees.EmployeeID=orders.EmployeeID where shipcity='Madrid'", con); GridView11.DataSource = cmd11.ExecuteReader(); GridView11.DataBind(); con.Close(); con.Open(); Label12.Text = "The count of orders made by each customer from France"; SqlCommand cmd12 = new SqlCommand("select count(*) from orders inner join customers on orders.shipcountry = customers.country where customers.country='France'", con); GridView12.DataSource = cmd12.ExecuteReader(); GridView12.DataBind(); con.Close(); con.Open(); Label13.Text = "The list of french customers’ names who used to order non-french products"; SqlCommand cmd13 = new SqlCommand("select distinct ContactName from Customers left join Orders on Customers.country <> Orders.ShipCountry where country='France'", con); GridView13.DataSource = cmd13.ExecuteReader(); GridView13.DataBind(); con.Close(); con.Open(); Label14.Text = "The total ordering sum calculated for each country of customer"; SqlCommand cmd14 = new SqlCommand("select count(orders.shipcountry),customers.country from orders inner join customers on orders.shipcountry=customers.country group by customers.country", con); GridView14.DataSource = cmd14.ExecuteReader(); GridView14.DataBind(); con.Close(); con.Open(); Label15.Text = "The list of cities where employees and customers are from and where orders have been made to. Duplicates should be eliminated."; SqlCommand cmd15 = new SqlCommand("SELECT distinct Orders.shipcity FROM((Orders INNER JOIN Customers ON Orders.shipcity = Customers.city) INNER JOIN employees ON Orders.shipcity = employees.city)", con); GridView15.DataSource = cmd15.ExecuteReader(); GridView15.DataBind(); con.Close(); }
protected void Page_Load(object sender, EventArgs e) { string connectionString = ConfigurationManager.ConnectionStrings["conStr"].ToString(); SqlConnection con = new SqlConnection(connectionString); try { con.Open(); } catch (Exception) { con.Close(); return; throw; } DataSet ds1 = new DataSet(); string sqlstr = "select * from Visitor_T"; SqlDataAdapter da1 = new SqlDataAdapter(sqlstr, con); da1.Fill(ds1); GridView1.DataSource = ds1; GridView1.DataBind(); DataSet ds2 = new DataSet(); sqlstr = "select * from Citizen_T"; SqlDataAdapter da2 = new SqlDataAdapter(sqlstr, con); da2.Fill(ds2); GridView2.DataSource = ds2; GridView2.DataBind(); con.Close(); DataSet ds3 = new DataSet(); sqlstr = "select * from Student_T"; SqlDataAdapter da3 = new SqlDataAdapter(sqlstr, con); da3.Fill(ds3); GridView3.DataSource = ds3; GridView3.DataBind(); con.Close(); DataSet ds4 = new DataSet(); sqlstr = "select * from Ticket_T"; da3 = new SqlDataAdapter(sqlstr, con); da3.Fill(ds4); GridView4.DataSource = ds4; GridView4.DataBind(); con.Close(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindData(); } if (!IsPostBack) { show_supplier(); show_customer(); show_employee(); if (User.Identity.IsAuthenticated) { SqlConnection con1 = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand cmd1 = new SqlCommand("select * from user_details where company_name='" + User.Identity.Name + "'", con1); SqlDataReader dr; con1.Open(); dr = cmd1.ExecuteReader(); if (dr.Read()) { company_id = Convert.ToInt32(dr["com_id"].ToString()); Label2.Text = dr["company_name"].ToString(); } con1.Close(); } SqlConnection con10 = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand cmd10 = new SqlCommand("select * from currentfinancialyear where no='1'", con10); SqlDataReader dr10; con10.Open(); dr10 = cmd10.ExecuteReader(); if (dr10.Read()) { Label1.Text = dr10["financial_year"].ToString(); } con10.Close(); } if (User.Identity.IsAuthenticated) { SqlConnection con1000 = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand cmd1000 = new SqlCommand("select * from user_details where company_name='" + User.Identity.Name + "'", con1000); SqlDataReader dr1000; con1000.Open(); dr1000 = cmd1000.ExecuteReader(); if (dr1000.Read()) { company_id = Convert.ToInt32(dr1000["com_id"].ToString()); SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand CMD = new SqlCommand("select * from pay_amount_status where Com_Id='" + company_id + "'", con); DataTable dt1 = new DataTable(); SqlDataAdapter da1 = new SqlDataAdapter(CMD); da1.Fill(dt1); GridView2.DataSource = dt1; GridView2.DataBind(); } con1000.Close(); } if (User.Identity.IsAuthenticated) { SqlConnection con1000 = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand cmd1000 = new SqlCommand("select * from user_details where company_name='" + User.Identity.Name + "'", con1000); SqlDataReader dr1000; con1000.Open(); dr1000 = cmd1000.ExecuteReader(); if (dr1000.Read()) { company_id = Convert.ToInt32(dr1000["com_id"].ToString()); SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand CMD = new SqlCommand("select * from receive_amount_status where Com_Id='" + company_id + "'", con); DataTable dt1 = new DataTable(); SqlDataAdapter da1 = new SqlDataAdapter(CMD); da1.Fill(dt1); GridView1.DataSource = dt1; GridView1.DataBind(); } con1000.Close(); } if (User.Identity.IsAuthenticated) { SqlConnection con1000 = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand cmd1000 = new SqlCommand("select * from user_details where company_name='" + User.Identity.Name + "'", con1000); SqlDataReader dr1000; con1000.Open(); dr1000 = cmd1000.ExecuteReader(); if (dr1000.Read()) { company_id = Convert.ToInt32(dr1000["com_id"].ToString()); SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand CMD = new SqlCommand("select * from Wendingdly_product_stock where Com_Id='" + company_id + "' ORDER BY wed_invoice asc", con); DataTable dt1 = new DataTable(); SqlDataAdapter da1 = new SqlDataAdapter(CMD); da1.Fill(dt1); GridView4.DataSource = dt1; GridView4.DataBind(); } con1000.Close(); } }
protected void Page_Load(object sender, EventArgs e) { Label1.Text = "there is three types of programs at Syrian Virtual University"; Label1.Visible = true; Graph g1 = new Graph(); g1.LoadFromFile(Server.MapPath("SVUModeling.rdf")); TripleStore store = new TripleStore(); store.Add(g1); //Assume that we fill our Store with data from somewhere //Create a dataset for our queries to operate over //We need to explicitly state our default graph or the unnamed graph is used //Alternatively you can set the second parameter to true to use the union of all graphs //as the default graph InMemoryDataset ds = new InMemoryDataset(store); //Get the Query processor ISparqlQueryProcessor processor = new LeviathanQueryProcessor(ds); //Use the SparqlQueryParser to give us a SparqlQuery object //Should get a Graph back from a CONSTRUCT query SparqlQueryParser sparqlparser = new SparqlQueryParser(); SparqlQuery query = sparqlparser.ParseFromString(@"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> SELECT ?ProgramName WHERE { ?t owl:StudyingAtSVU ?ProgramName }"); Object results = processor.ProcessQuery(query); DataTable DT1 = new DataTable(); SparqlResultSet rset = (SparqlResultSet)results; DT1 = FillDataTable(rset); GridView1.DataSource = DT1; GridView1.DataBind(); GridView1.Visible = true; // to select Bachelor Programs Label2.Text = "Bachelor Programs At SVU"; Label2.Visible = true; SparqlQueryParser sparqlparser2 = new SparqlQueryParser(); SparqlQuery query2 = sparqlparser.ParseFromString(@"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> SELECT ?BachelorPrograms WHERE { ?t owl:BachelorProgramAtSVU ?BachelorPrograms }"); Object results2 = processor.ProcessQuery(query2); DataTable DT2 = new DataTable(); SparqlResultSet rset2 = (SparqlResultSet)results2; DT2 = FillDataTable(rset2); GridView2.DataSource = DT2; GridView2.DataBind(); GridView2.Visible = true; // to select Master Programs Label3.Text = "Master Programs At SVU"; Label3.Visible = true; SparqlQueryParser sparqlparser3 = new SparqlQueryParser(); SparqlQuery query3 = sparqlparser.ParseFromString(@"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> SELECT ?MasterPrograms WHERE { ?t owl:MasterProgramAtSVU ?MasterPrograms }"); Object results3 = processor.ProcessQuery(query3); DataTable DT3 = new DataTable(); SparqlResultSet rset3 = (SparqlResultSet)results3; DT3 = FillDataTable(rset3); GridView3.DataSource = DT3; GridView3.DataBind(); GridView3.Visible = true; // to select Training Programs Label4.Text = "Training Programs At SVU"; Label4.Visible = true; SparqlQueryParser sparqlparser4 = new SparqlQueryParser(); SparqlQuery query4 = sparqlparser.ParseFromString(@"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> SELECT ?TrainingPrograms WHERE { ?t owl:TrainingProgramAtSVU ?TrainingPrograms }"); Object results4 = processor.ProcessQuery(query4); DataTable DT4 = new DataTable(); SparqlResultSet rset4 = (SparqlResultSet)results4; DT4 = FillDataTable(rset4); GridView4.DataSource = DT4; GridView4.DataBind(); GridView4.Visible = true; }
protected void NoneUpload_OnClick(object sender, EventArgs e) { Lib.DataUtility du = new Lib.DataUtility(); Dictionary <string, object> d = new Dictionary <string, object>(); try { d.Add("status", "104"); DataTable dt = du.getDataTableBysp("Race_SelectResult", d); // 104 未上傳免測 if (dt.Rows.Count == 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('目前沒有成績');", true); GridView4.DataBind(); } else { dt.TableName = "upload"; if (Lib.SysSetting.CourrentUploadMode() == Lib.SysSetting.UploadMode.Remote) { RemoteWS.WebService RemoteWS = new RemoteWS.WebService(); RemoteWS.Url = "http://" + Lib.SysSetting.GetRemoteIP() + "/WebService.asmx"; RemoteWS.Discover(); System.Threading.Thread.Sleep(2000); string msg = RemoteWS.InsertResult(dt); if (msg == "Done") { try { // // 上傳更新總部資料 // main.executeNonQueryByText("update result set height = @height, weight=@weight, BMI = @BMI, bodyfat = @bodyfat, sit_ups = @sit_ups, sit_ups_score = @sit_ups_score, push_ups = @push_ups, push_ups_score = @push_ups_score, run = @run, run_score = @run_score, status = @status where sid = @sid", list); // 更新鑑測站資料狀態 d.Clear(); d.Add("result", dt); int count = dt.Rows.Count; dt = du.getDataTableBysp("Race_UpdateResultAfterUpload", d); if (dt.Rows.Count == 1 && dt.Rows[0][0].ToString() == "Done") { Dictionary <string, object> d_log = new Dictionary <string, object>(); d_log.Add("acc", ((Lib.Center.Account_c)Session["account"]).Account); d_log.Add("name", ((Lib.Center.Account_c)Session["account"]).Name); d_log.Add("log", "上傳免測成績 " + count + " 筆"); d_log.Add("date", DateTime.Now); du.executeNonQueryByText("insert into log values (@acc,@name,@log,@date)", d_log); Account_c acc = (Account_c)Session["account"]; Lib.SysSetting.AddLog("成績上傳", acc.Account, "上傳免測成績 " + count + " 筆", DateTime.Now); dt.Dispose(); //list.Clear(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('上傳免測成績" + count + " 筆成功');", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('更新local資料庫成績失敗');", true); } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, sender.ToString()); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + ex.Message + "\");", true); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + msg + "\");", true); } } else { try { d.Clear(); d.Add("result", dt); int count = dt.Rows.Count; dt = du.getDataTableBysp("Race_UpdateResultAfterUpload", d); if (dt.Rows.Count == 1 && dt.Rows[0][0].ToString() == "Done") { Dictionary <string, object> d_log = new Dictionary <string, object>(); d_log.Add("acc", ((Lib.Center.Account_c)Session["account"]).Account); d_log.Add("name", ((Lib.Center.Account_c)Session["account"]).Name); d_log.Add("log", "上傳免測成績 " + count + " 筆"); d_log.Add("date", DateTime.Now); du.executeNonQueryByText("insert into log values (@acc,@name,@log,@date)", d_log); Account_c acc = (Account_c)Session["account"]; Lib.SysSetting.AddLog("成績上傳", acc.Account, "上傳免測成績 " + count + " 筆", DateTime.Now); dt.Dispose(); //list.Clear(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('上傳免測成績" + count + " 筆成功');", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('更新local資料庫成績失敗');", true); } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, sender.ToString()); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + ex.Message + "\");", true); } } } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, sender.ToString()); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert(\"" + ex.Message + "\");", true); } GridView4.DataBind(); Label1.Text = "免測成績共" + GridView4.Rows.Count.ToString() + "筆"; TabContainer1.ActiveTabIndex = 2; }
protected void Button4_Click(object sender, EventArgs e) { TripleStore store = new TripleStore(); Graph g1 = new Graph(); g1.LoadFromFile(Server.MapPath("SVUModeling.rdf")); store.Add(g1); InMemoryDataset ds = new InMemoryDataset(store); //Get the Query processor ISparqlQueryProcessor processor = new LeviathanQueryProcessor(ds); Label1.Text = "Law Program : BL Details"; Label1.Visible = true; GridView1.Visible = false; Label2.Text = "Law Informations "; Label2.Visible = true; // to select the LAW Director Informations SparqlQueryParser sparqlparser = new SparqlQueryParser(); SparqlQuery query = sparqlparser.ParseFromString(@"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix foaf: <http://xmlns.com/foaf/0.1/#> prefix owl: <http://www.w3.org/2002/07/owl#> SELECT ?LawDirectorInformation WHERE { ?t owl:LawDirectorInfoProperty ?LawDirectorInformation }"); Object results = processor.ProcessQuery(query); DataTable DT2 = new DataTable(); SparqlResultSet rset = (SparqlResultSet)results; DT2 = FillDataTable(rset); GridView2.DataSource = DT2; GridView2.DataBind(); GridView2.Visible = true; //to retrival the Teachers LAW program Label3.Text = "Teachers Of Law Program"; Label3.Visible = true; SparqlQueryParser sparqlparser3 = new SparqlQueryParser(); SparqlQuery query3 = sparqlparser.ParseFromString(@"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix foaf: <http://xmlns.com/foaf/0.1/#> prefix owl: <http://www.w3.org/2002/07/owl#> SELECT ?LawTeachers WHERE { ?t owl:TeachersOfLaw ?LawTeachers }"); Object results3 = processor.ProcessQuery(query3); DataTable DT3 = new DataTable(); SparqlResultSet rset3 = (SparqlResultSet)results3; DT3 = FillDataTable(rset3); GridView3.DataSource = DT3; GridView3.DataBind(); GridView3.Visible = true; //to select Courses Of LAW Label4.Text = "Courses of Law Program"; Label4.Visible = true; SparqlQueryParser sparqlparser4 = new SparqlQueryParser(); SparqlQuery query4 = sparqlparser.ParseFromString(@"prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix owl: <http://www.w3.org/2002/07/owl#> SELECT ?LawCourses WHERE { ?t owl:CoursesOfLaw ?LawCourses }"); Object results4 = processor.ProcessQuery(query4); DataTable DT4 = new DataTable(); SparqlResultSet rset4 = (SparqlResultSet)results4; DT4 = FillDataTable(rset4); GridView4.DataSource = DT4; GridView4.DataBind(); GridView4.Visible = true; }
protected void btnEmail_Click(object sender, EventArgs e) { strEmail = txtEmail.Text; DataSourceSelectArguments srUserID_IDStr = new DataSourceSelectArguments(); DataView dvUserID_IDStr = (DataView)SqlDataSource5.Select(srUserID_IDStr); if (dvUserID_IDStr.Count != 0) { strUserID_ID = dvUserID_IDStr[0][0].ToString(); } DataSourceSelectArguments srUserID_SSOStr = new DataSourceSelectArguments(); DataView dvUserID_SSOStr = (DataView)SqlDataSource14.Select(srUserID_SSOStr); if (dvUserID_SSOStr.Count != 0) { strUserID_SSO = dvUserID_SSOStr[0][0].ToString(); } DataSourceSelectArguments srTokenUser = new DataSourceSelectArguments(); DataView dvTokenUser = (DataView)SqlDataSource4.Select(srTokenUser); if (dvTokenUser.Count != 0) { strTokenUser = dvTokenUser[0][0].ToString(); } DataSourceSelectArguments srTokenPassStr = new DataSourceSelectArguments(); DataView dvTokenPassStr = (DataView)SqlDataSource12.Select(srTokenPassStr); if (dvTokenPassStr.Count != 0) { strTokenPass = dvTokenPassStr[0][0].ToString(); } DataSourceSelectArguments srOrgTempStr = new DataSourceSelectArguments(); DataView dvOrgTempStr = (DataView)SqlDataSource110.Select(srOrgTempStr); if (dvOrgTempStr.Count != 0) { strOrgTemp = dvOrgTempStr[0][0].ToString(); } DataSourceSelectArguments srOrgTempIDStr = new DataSourceSelectArguments(); DataView dvOrgTempIDStr = (DataView)SqlDataSource118.Select(srOrgTempIDStr); if (dvOrgTempIDStr.Count != 0) { strOrgTempID = dvOrgTempIDStr[0][0].ToString(); } DataSourceSelectArguments srOrgTempNameStr = new DataSourceSelectArguments(); DataView dvOrgTempNameStr = (DataView)SqlDataSource124.Select(srOrgTempNameStr); if (dvOrgTempNameStr.Count != 0) { strOrgTempName = dvOrgTempNameStr[0][0].ToString(); } DataSourceSelectArguments srOrgIDStr = new DataSourceSelectArguments(); DataView dvOrgIDStr = (DataView)SqlDataSource111.Select(srOrgIDStr); if (dvOrgIDStr.Count != 0) { strOrgID = dvOrgIDStr[0][0].ToString(); } DataSourceSelectArguments srOrgAccessRequestedStr = new DataSourceSelectArguments(); DataView dvOrgAccessRequestedStr = (DataView)SqlDataSource112.Select(srOrgAccessRequestedStr); if (dvOrgAccessRequestedStr.Count != 0) { strOrgAccessRequested = dvOrgAccessRequestedStr[0][0].ToString(); } DataSourceSelectArguments srOrgModAccessRequestedStr = new DataSourceSelectArguments(); DataView dvOrgModAccessRequestedStr = (DataView)SqlDataSource113.Select(srOrgModAccessRequestedStr); if (dvOrgModAccessRequestedStr.Count != 0) { strOrgModAccessRequested = dvOrgModAccessRequestedStr[0][0].ToString(); } DataSourceSelectArguments srOrgLicAccessRequestedStr = new DataSourceSelectArguments(); DataView dvOrgLicAccessRequestedStr = (DataView)SqlDataSource114.Select(srOrgLicAccessRequestedStr); if (dvOrgLicAccessRequestedStr.Count != 0) { strOrgLicAccessRequested = dvOrgLicAccessRequestedStr[0][0].ToString(); } DataSourceSelectArguments srOrgMembershipUserIDStr = new DataSourceSelectArguments(); DataView dvOrgMembershipUserIDStr = (DataView)SqlDataSource115.Select(srOrgMembershipUserIDStr); if (dvOrgMembershipUserIDStr.Count != 0) { strOrgMembershipUserID = dvOrgMembershipUserIDStr[0][0].ToString(); } DataSourceSelectArguments srUserPasswordExpiryDt = new DataSourceSelectArguments(); DataView dvUserPasswordExpiryDt = (DataView)SqlDataSource116.Select(srUserPasswordExpiryDt); if (dvUserPasswordExpiryDt.Count != 0) { strDateUserPasswordExpiry = dvUserPasswordExpiryDt[0][0].ToString(); } DataSourceSelectArguments srUserPasswordChangedDt = new DataSourceSelectArguments(); DataView dvUserPasswordChangedDt = (DataView)SqlDataSource126.Select(srUserPasswordChangedDt); if (dvUserPasswordChangedDt.Count != 0) { strDateUserPasswordChanged = dvUserPasswordChangedDt[0][0].ToString(); } DataSourceSelectArguments srUserPasswordResetTokenDt = new DataSourceSelectArguments(); DataView dvUserPasswordResetTokenDt = (DataView)SqlDataSource122.Select(srUserPasswordResetTokenDt); if (dvUserPasswordResetTokenDt.Count != 0) { strDatePasswordResetToken = dvUserPasswordResetTokenDt[0][0].ToString(); } DataSourceSelectArguments srDateRegisteredDt = new DataSourceSelectArguments(); DataView dvDateRegisteredDt = (DataView)SqlDataSource121.Select(srDateRegisteredDt); if (dvDateRegisteredDt.Count != 0) { strDateRegistered = dvDateRegisteredDt[0][0].ToString(); } DataSourceSelectArguments srUserTempDetailsStr = new DataSourceSelectArguments(); DataView dvUserTempDetailsStr = (DataView)SqlDataSource117.Select(srUserTempDetailsStr); if (dvUserTempDetailsStr.Count != 0) { strUserID_TempID = dvUserTempDetailsStr[0][0].ToString(); } DataSourceSelectArguments srOrganisationRequestStr = new DataSourceSelectArguments(); DataView dvOrganisationRequestStr = (DataView)SqlDataSource119.Select(srOrganisationRequestStr); if (dvOrganisationRequestStr.Count != 0) { strOrganisationRequest = dvOrganisationRequestStr[0][0].ToString(); } DataSourceSelectArguments srUserID_UPMStr = new DataSourceSelectArguments(); DataView dvUserID_UPMStr = (DataView)SqlDataSource120.Select(srUserID_UPMStr); if (dvUserID_UPMStr.Count != 0) { strUserID_UPM = dvUserID_UPMStr[0][0].ToString(); } DataSourceSelectArguments srEventTypeRejectedStr = new DataSourceSelectArguments(); DataView dvEventTypeRejectedStr = (DataView)SqlDataSource123.Select(srEventTypeRejectedStr); if (dvEventTypeRejectedStr.Count != 0) { strEventTypeRejected = dvEventTypeRejectedStr[0][0].ToString(); } dtDateToday = DateTime.Now; /* * Password expiry notification and countdown * */ dtDateUserPasswordExpiry = null; if (!string.IsNullOrEmpty(strDateUserPasswordExpiry)) { dtDateUserPasswordExpiry = DateTime.ParseExact(strDateUserPasswordExpiry, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture); dtDateUserPasswordExpiryForSubtraction = DateTime.ParseExact(strDateUserPasswordExpiry, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture); } if (dtDateUserPasswordExpiry != null && dtDateToday > dtDateUserPasswordExpiry && strOrgID != "7c310be0-c20f-de11-b526-0022642a33b2") { divPasswordExpiry.Visible = true; lblPasswordExpiry.Text = "EDEN password has expired"; lblPasswordExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divPasswordExpiry.Visible = false; } /* * Registration expiry * */ if (!string.IsNullOrEmpty(strDateRegistered)) { dtDateRegistered = DateTime.ParseExact(strDateRegistered, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture); tsDateRegistrationValidTimeRemaining = dtDateRegistered.AddHours(+24).Subtract(DateTime.Now); } if (strUserID_SSO == null && dtDateRegistered != null && strDateRegistered != null && dtDateRegistered < DateTime.Now.AddHours(-24)) { divRegistrationExpiry.Visible = true; lblRegistrationExpiry.Text = "<i>Registration token has expired.</i> <br />- User's registration must be deleted to allow re-registration"; lblRegistrationExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divRegistrationExpiry.Visible = false; } if (strUserID_SSO == null && dtDateRegistered != null && strDateRegistered != null && dtDateRegistered > DateTime.Now.AddHours(-24)) { divRegistrationExpiry.Visible = true; lblRegistrationExpiry.Text = "Registration token is valid.<br />- The account verification link can be copied and emailed to the user if the notification has been blocked or re-routed. <br/>- This link is valid until " + dtDateRegistered.AddHours(+24) + ". Remaining time: <b>" + tsDateRegistrationValidTimeRemaining.ToString(@"hh\:mm") + "</b> hours"; lblRegistrationExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } else { divRegistrationExpiry.Visible = false; } if (dtDateRegistered == null) { divRegistrationExpiry.Visible = false; } if (strUserID_SSO != null) { divRegistrationExpiry.Visible = false; } /* * Password reset token expiry * */ //dtDatePasswordResetToken=''; if (!string.IsNullOrEmpty(strDatePasswordResetToken)) { dtDatePasswordResetToken = DateTime.ParseExact(strDatePasswordResetToken, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture); tsDatePasswordResetTokenTimeRemaining = dtDatePasswordResetToken.AddHours(+24).Subtract(DateTime.Now); } if (strUserID_SSO != null && dtDatePasswordResetToken != null && strDatePasswordResetToken != null && dtDatePasswordResetToken < DateTime.Now.AddHours(-24)) { divPasswordResetTokenExpiry.Visible = true; lblPasswordResetTokenExpiry.Text = "<br /><i>Password reset token has expired.</i> <br />- The user will need to be begin the password reset process again and generate a new token."; lblPasswordResetTokenExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divPasswordResetTokenExpiry.Visible = false; } if (strUserID_SSO != null && dtDatePasswordResetToken != null && dtDatePasswordResetToken > DateTime.Now.AddHours(-24)) { divPasswordResetTokenExpiry.Visible = true; lblPasswordResetTokenExpiry.Text = "<br />Password reset token is valid.<br />- The password reset token can be copied and emailed to the user.<br/>- This token is valid until " + dtDatePasswordResetToken.AddHours(+24) + ". Remaining time: <b>" + tsDatePasswordResetTokenTimeRemaining.ToString(@"hh\:mm") + "</b> hours (after which the user will need to be begin the password reset process again and generate a new token)."; lblPasswordResetTokenExpiry.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } if (dtDatePasswordResetToken == null) { divPasswordResetTokenExpiry.Visible = false; } if (strUserID_ID == null && strUserID_SSO == null && strUserID_TempID == null && strOrgID == null && strOrgTemp == null && strOrgTempID == null && strTokenUser == null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divEmailNotFound.Visible = true; lblEmailNotFound.Text = "Email address not found"; lblEmailNotFound.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divEmailNotFound.Visible = false; } if (strUserID_ID != null && strUserID_SSO == null && strUserID_TempID == null && strOrgID == null && strOrgTemp == null && strOrgTempID == null && strTokenUser != null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divUserNoConfirmationClicked.Visible = true; lblUserNoConfirmationClicked.Text = "Status: User has not clicked confirmation email and signed in"; lblUserNoConfirmationClicked.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserNoConfirmationClicked.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID == null && strOrgID == null && strOrgTemp == null && strOrgTempID == null && strTokenUser != null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divUserConfirmSignedNoStep1.Visible = true; lblUserConfirmSignedNoStep1.Text = "Status: EDEN Portal Access Request - Step 1: User has clicked confirmation email, but has not selected an organisation"; lblUserConfirmSignedNoStep1.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserConfirmSignedNoStep1.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID == null && strOrgID == null && strOrgTemp == null && strOrgTempID != null && strTokenUser != null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divUserConfirmSignedStep2.Visible = true; divUserConfirmTempOrgDetails.Visible = true; lblUserConfirmSignedStep2.Text = "Status: EDEN Portal Access Request - Step 2: User has selected an organisation, but has not yet added their personal and contact details"; lblUserConfirmSignedStep2.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserConfirmSignedStep2.Visible = false; divUserConfirmTempOrgDetails.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID == null && strOrgID == null && strOrgTemp != null && strTokenUser != null ) { divUserConfirmSignedLAStep2.Visible = true; divUserConfirmTempOrgDetails.Visible = true; lblUserConfirmSignedLAStep2.Text = "Status: EDEN Portal Access Request - Step 2: User has selected an organisation, but has not yet added their personal and contact details"; lblUserConfirmSignedLAStep2.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserConfirmSignedLAStep2.Visible = false; divUserConfirmTempOrgDetails.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strOrgID == null && strOrgTemp == null && strOrgTempID != null && strOrgAccessRequested == null && strTokenUser != null && strOrgMembershipUserID == null && strEventTypeRejected != "Organisation Membership Request Rejected" ) { divUserConfirmSignedStep3.Visible = true; divUserConfirmTempOrgDetails.Visible = true; lblUserConfirmSignedStep3.Text = "Status: EDEN Portal Access Request - Step 3: User has selected an organisation, but has not yet selected a module and submitted the access request"; lblUserConfirmSignedStep3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserConfirmSignedStep3.Visible = false; divUserConfirmTempOrgDetails.Visible = false; } //if (strUserID_SSO != null && strOrgID == null && strUserID_TempID != null && strOrgTemp != null && strOrgAccessRequested == null) if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strOrgID == null && strOrgTemp != null && strOrgAccessRequested == null && strTokenUser != null && strOrgMembershipUserID == null && strOrganisationRequest == null && strEventTypeRejected == null ) { divUserConfirmSignedLAStep3.Visible = true; divUserConfirmTempOrgDetails.Visible = true; lblUserConfirmSignedLAStep3.Text = "Status: EDEN Portal Access Request - Step 3: User has selected an organisation, but has not yet selected a module and submitted the access request"; lblUserConfirmSignedLAStep3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserConfirmSignedLAStep3.Visible = false; divUserConfirmTempOrgDetails.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strOrgID == null && strOrgTemp != null && strOrgAccessRequested == null && strTokenUser != null && strOrgMembershipUserID == null && strOrganisationRequest != null ) { divUserNewOrgCreate.Visible = true; lblUserNewOrgCreate.Text = "Status: User has selected a module and requested to register a <i>new</i> organisation on EDEN. The request is now with the EPA for approval"; lblUserNewOrgCreate.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } else { divUserNewOrgCreate.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strOrgID == null && strOrgTemp == null && strOrgTempID != null && strOrgAccessRequested != null && strTokenUser != null && strOrgMembershipUserID == null ) { divUserRegCompleteNoApproval.Visible = true; divUserConfirmTempOrgDetails.Visible = true; lblUserRegCompleteNoApproval.Text = "Status: User has selected an organisation, selected a module and submitted the access request. The org admin(s) can now process this request"; lblUserRegCompleteNoApproval.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } else { divUserRegCompleteNoApproval.Visible = false; divUserConfirmTempOrgDetails.Visible = false; } //if (strUserID_SSO != null && strOrgID == null && strUserID_TempID != null && strOrgTemp != null && strOrgAccessRequested != null) if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strOrgID == null && strOrgTemp != null && strOrgAccessRequested != null && strTokenUser != null && strOrgMembershipUserID == null ) { divUserRegCompleteNoApprovalLA.Visible = true; lblUserRegCompleteNoApprovalLA.Text = "Status: User has selected an organisation, selected a module and submitted the access request. The org admin(s) can now process this request"; lblUserRegCompleteNoApprovalLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } else { divUserRegCompleteNoApprovalLA.Visible = false; } if (strOrgModAccessRequested != null && strOrgID != null) { divModuleAccessPending.Visible = true; lblModuleAccessPending.Text = "Status: One or more module access requests by this user currently Pending Approval"; lblModuleAccessPending.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divModuleAccessPending.Visible = false; } if (strOrgID != null) { divUserConfirmSignedNoStep1.Visible = false; } if (strUserID_TempID != null) { divPasswordExpiry.Visible = false; } if (strOrgModAccessRequested != null && strOrgLicAccessRequested != null) { GridView16.Visible = true; GridView17.Visible = false; } if (strOrgModAccessRequested == strOrgLicAccessRequested) { GridView16.Visible = true; GridView17.Visible = true; } if (strOrgMembershipUserID == null) { GridView23.Visible = true; } else { GridView23.Visible = false; } if (strOrgMembershipUserID == null) { GridView22.Visible = true; } else { GridView22.Visible = false; } if (strUserID_SSO == null & strTokenUser != null) { divVerificationLink.Visible = true; } else { divVerificationLink.Visible = false; } if (strUserID_SSO != null) { divVerificationLink.Visible = false; } if (strUserID_SSO != null) { divUserExternalLinks.Visible = true; } else { divUserExternalLinks.Visible = false; } if (strTokenPass == null) { divPasswordReset.Visible = false; } else { divPasswordReset.Visible = true; } /* * EPA Users */ if (strUserID_ID == null && strUserID_SSO != null && strUserID_TempID == null && strUserID_UPM != null && strOrgID == null && strOrgTemp == null && strOrgTempID == null && strTokenUser == null && strTokenPass == null && strOrgAccessRequested == null && strOrgModAccessRequested == null && strOrgLicAccessRequested == null && strOrgMembershipUserID == null && strOrganisationRequest == null && strEventTypeRejected == null ) { divUserEPAStep1.Visible = true; lblUserEPAStep1.Text = "Status: EDEN Portal Access Request - Step 1: EPA user has signed up, but has not selected an organisation"; lblUserEPAStep1.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserEPAStep1.Visible = false; } if (strUserID_ID == null && strUserID_SSO != null && strUserID_TempID == null && strUserID_UPM != null && strOrgTemp != null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divUserEPAStep2.Visible = true; lblUserEPAStep2.Text = "Status: EDEN Portal Access Request - Step 2: EPA user has selected organisation, but has not yet added their personal and contact details"; lblUserEPAStep2.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserEPAStep2.Visible = false; } if (strUserID_ID == null && strUserID_SSO != null && strUserID_TempID != null && strUserID_UPM != null && strOrgTemp != null && strOrgAccessRequested == null && strOrgMembershipUserID == null ) { divUserEPAStep3.Visible = true; lblUserEPAStep3.Text = "Status: EDEN Portal Access Request - Step 3: EPA user has added their personal and contact details, but has not yet selected a module"; lblUserEPAStep3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserEPAStep3.Visible = false; } if (strUserID_ID == null && strUserID_SSO != null && strUserID_TempID != null && strUserID_UPM != null && strOrgTemp != null && strOrgAccessRequested != null ) { divUserRegCompleteNoApprovalEPA.Visible = true; lblUserRegCompleteNoApprovalEPA.Text = "EPA user has selected an organisation, selected a module and submitted the access request. The EPA org admin(s) can now process this request"; lblUserRegCompleteNoApprovalEPA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#4d9900"); } else { divUserRegCompleteNoApprovalEPA.Visible = false; } if (strUserID_ID == null && strUserID_SSO != null && strUserID_TempID == null && strUserID_UPM != null && strOrgID == null && strOrgTemp == null && strOrgTempID == null && strTokenUser == null && strTokenPass == null && strOrgAccessRequested == null && strOrgModAccessRequested == null && strOrgLicAccessRequested == null && strOrgMembershipUserID == null && strOrganisationRequest == null && strEventTypeRejected == "Organisation Rejected" ) { divUserRejectedLA.Visible = true; lblUserRejectedLA.Text = "Status: User has signed up, but the organisation has been <b>rejected</b><br /> - This email address must be manually deleted from the SSO to be used again to register."; lblUserRejectedLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserRejectedLA.Visible = false; } if (strUserID_ID != null && strUserID_SSO != null && strUserID_TempID != null && strEventTypeRejected == "Organisation Rejected" ) { divOrgRejected.Visible = true; lblOrgRejected.Text = "Status: User has signed up, but the <b>organisation creation request</b> has been <b>rejected</b><br /> - This email address must be manually deleted from the SSO to be used again to register."; lblOrgRejected.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divOrgRejected.Visible = false; } if ( strEventTypeRejected == "Organisation Membership Request Rejected" ) { divUserRejectedLA.Visible = true; lblUserRejectedLA.Text = "Status: User has signed up, but the <b>organisation membership request</b> has been <b>rejected</b><br /> - This email address must be manually deleted from the SSO to be used again to register."; lblUserRejectedLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserRejectedLA.Visible = false; } if ( strEventTypeRejected == "Module Authorisation Rejected" ) { divUserRejectedLA.Visible = true; lblUserRejectedLA.Text = "Status: User's organisation access has been approved, but a module authorisation request has been rejected. (This may have been rectified - please check the notifications below).<br />"; lblUserRejectedLA.ForeColor = System.Drawing.ColorTranslator.FromHtml("#E60000"); } else { divUserRejectedLA.Visible = false; } tsDatePasswordExpiryLessDatePasswordReset = dtDateUserPasswordExpiryForSubtraction - dtDatePasswordResetToken; int passwordReset_Expiry_DifferenceInDays = tsDatePasswordExpiryLessDatePasswordReset.Days; if (tsDatePasswordExpiryLessDatePasswordReset.Days == 90) { divPasswordResetTokenExpiry.Visible = false; } divTokens.Visible = true; divSeperatorCurrent.Visible = true; divSeperatorPending.Visible = true; divSeperatorLicences.Visible = true; divSeperatorTokens.Visible = true; txtCopyVerificationLink.Text = "https://account.edenireland.ie/signup/confirmemail?userId=" + strUserID_ID + "&token=" + strTokenUser; txtCopyPasswordResetLink.Text = "https://account.edenireland.ie/passwordreset/resetpassword?userId=" + strUserID_SSO + "&token=" + strTokenPass; GridView1.DataBind(); GridView2.DataBind(); GridView3.DataBind(); GridView4.DataBind(); GridView5.DataBind(); GridView6.DataBind(); GridView7.DataBind(); GridView8.DataBind(); GridView9.DataBind(); GridView10.DataBind(); GridView11.DataBind(); GridView12.DataBind(); GridView13.DataBind(); GridView14.DataBind(); GridView15.DataBind(); GridView16.DataBind(); GridView17.DataBind(); GridView18.DataBind(); GridView19.DataBind(); GridView20.DataBind(); GridView21.DataBind(); GridView22.DataBind(); GridView23.DataBind(); GridView24.DataBind(); }