protected void GridView3_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView3.PageIndex = e.NewPageIndex; GridView3.DataSource = ds; GridView3.DataBind(); }
private void Get_UsedRatechartDetailsAgentwise() { try { dtm = DateTime.ParseExact(txt_FromDate.Text, "dd/MM/yyyy", null); dtm1 = DateTime.ParseExact(txt_ToDate.Text, "dd/MM/yyyy", null); string d1 = dtm.ToString("MM/dd/yyyy"); string d2 = dtm1.ToString("MM/dd/yyyy"); dt = null; int count = 0; DataTable dts = new DataTable(); String dbConnStr = ConfigurationManager.ConnectionStrings["AMPSConnectionString"].ConnectionString; SqlConnection conn = null; using (conn = new SqlConnection(dbConnStr)) { SqlCommand sqlCmd = new SqlCommand("dbo.[Get_UsedRatechartDetails]"); conn.Open(); sqlCmd.Connection = conn; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@spccode", ccode); sqlCmd.Parameters.AddWithValue("@sppcode", ddl_PlantName.SelectedItem.Value); sqlCmd.Parameters.AddWithValue("@spfrmdate", d1.Trim()); sqlCmd.Parameters.AddWithValue("@sptodate", d2.Trim()); sqlCmd.Parameters.AddWithValue("@spratechartmodeltype", 3); sqlCmd.Parameters.AddWithValue("@spcount", 0); SqlDataAdapter da = new SqlDataAdapter(sqlCmd); da.Fill(dts); // DataTable ksdt = new DataTable(); DataColumn ksdc = null; DataRow ksdr = null; int counts = dts.Rows.Count; // START ADDING COLUMN if (counts > 0) { Image1.Visible = true; Label6.Visible = true; Label7.Visible = true; Label7.Text = "From :" + txt_FromDate.Text.Trim() + " To :" + txt_ToDate.Text.Trim(); Label8.Visible = true; Label8.Text = ddl_PlantName.SelectedItem.Text.Trim(); ksdc = new DataColumn("From"); ksdt.Columns.Add(ksdc); ksdc = new DataColumn("To"); ksdt.Columns.Add(ksdc); ksdc = new DataColumn("Rate"); ksdt.Columns.Add(ksdc); ksdc = new DataColumn("Comm"); ksdt.Columns.Add(ksdc); ksdc = new DataColumn("Bonus"); ksdt.Columns.Add(ksdc); } // END ADDING COLUMN // START ADDING ROWS if (counts > 0) { object id2; id2 = 0; int idd2 = Convert.ToInt32(id2); foreach (DataRow dr2 in dts.Rows) { object id1; id1 = dr2[0].ToString().Trim(); int idd1 = Convert.ToInt32(id1); if (idd1 == idd2) { } else { int cc = 0; foreach (DataRow dr3 in dts.Rows) { object id3; id3 = dr3[0].ToString().Trim(); int idd3 = Convert.ToInt32(id3); if (idd1 == idd3) { if (cc == 0) { ksdr = ksdt.NewRow(); ksdr[cc] = dr3[1].ToString(); cc++; ksdr[cc] = dr3[2].ToString(); cc++; ksdr[cc] = dr3[3].ToString(); cc++; ksdr[cc] = dr3[4].ToString(); cc++; ksdr[cc] = dr3[5].ToString(); ksdt.Rows.Add(ksdr); ksdr = ksdt.NewRow(); cc = 0; ksdr[cc] = dr3[6].ToString(); cc++; ksdr[cc] = dr3[7].ToString(); cc++; ksdr[cc] = dr3[8].ToString(); cc++; ksdr[cc] = dr3[9].ToString(); cc++; ksdr[cc] = dr3[10].ToString(); ksdt.Rows.Add(ksdr); } else { ksdr = ksdt.NewRow(); cc = 0; ksdr[cc] = dr3[6].ToString(); cc++; ksdr[cc] = dr3[7].ToString(); cc++; ksdr[cc] = dr3[8].ToString(); cc++; ksdr[cc] = dr3[9].ToString(); cc++; ksdr[cc] = dr3[10].ToString(); ksdt.Rows.Add(ksdr); } idd2 = idd3; } } } } } // END ADDING ROWS GridView3.DataSource = ksdt; GridView3.DataBind(); CallGridcolor(dts, 3); } } catch (Exception ex) { Lbl_Errormsg.Visible = true; Lbl_Errormsg.Text = ex.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 ddlOrderBy_SelectedIndexChanged(object sender, EventArgs e) //{ // OrganizationSearchDiv.Visible = false; // gridSearch.DataBind(); // System.Data.SqlClient.SqlConnection sc = new System.Data.SqlClient.SqlConnection(); // String cs = ConfigurationManager.ConnectionStrings["WildTekConnectionString"].ConnectionString; // sc.ConnectionString = cs; // sc.Open(); // System.Data.SqlClient.SqlCommand search = new System.Data.SqlClient.SqlCommand(); // search.Connection = sc; // SqlConnection con = new SqlConnection(cs); // int orderType = ddlOrderBy.SelectedIndex; // switch (orderType) // { // case 0: // OrganizationSearchDiv.Visible = false; // break; // case 1: // DataTable dt1 = new DataTable(); // SqlDataAdapter adapt1 = new SqlDataAdapter(("Select OrgName, StreetAddress, City, County, State, PostalCode From Organization Order by OrgName;"), con); // adapt1.Fill(dt1); // GridView1.DataSource = dt1; // GridView1.DataBind(); // break; // case 2: // DataTable dt2 = new DataTable(); // SqlDataAdapter adapt2 = new SqlDataAdapter(("Select OrgName, StreetAddress, City, County, State, PostalCode From Organization Order by City;"), con); // adapt2.Fill(dt2); // GridView1.DataSource = dt2; // GridView1.DataBind(); // break; // case 3: // DataTable dt3 = new DataTable(); // SqlDataAdapter adapt3 = new SqlDataAdapter(("Select OrgName, StreetAddress, City, County, State, PostalCode From Organization Order by County;"), con); // adapt3.Fill(dt3); // GridView1.DataSource = dt3; // GridView1.DataBind(); // break; // } //} protected void btnAddContact_Click(object sender, EventArgs e) { System.Data.SqlClient.SqlConnection sc = new System.Data.SqlClient.SqlConnection(); // sc.ConnectionString = @"Server=localhost;Database=WildTek;Trusted_Connection=Yes;"; String cs = ConfigurationManager.ConnectionStrings["WildTekConnectionString"].ConnectionString; sc.ConnectionString = cs; System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand(); System.Data.SqlClient.SqlCommand pullOrgID = new System.Data.SqlClient.SqlCommand(); sc.Open(); insert.Connection = sc; pullOrgID.Connection = sc; //call read array SqlConnection con = new SqlConnection(cs); con.Open(); //ddlOrg.Items.Clear(); //if (con.State == System.Data.ConnectionState.Open) //{ // string read = "Select OrgID, OrgName from Organization"; // SqlCommand cmd = new SqlCommand(read, con); // SqlDataReader myRead = cmd.ExecuteReader(); // ddlOrg.Items.Add(new ListItem("--Select Organization--", "0")); // while (myRead.Read()) // { // ddlOrg.Items.Add(new ListItem(myRead["OrgName"].ToString(), myRead["OrgID"].ToString())); // } //} String contactFirstName = txtContactFirstName.Text; String contactLastName = txtContactLastName.Text; String contactEmail = txtContactEmail.Text; pullOrgID.CommandText = "SELECT OrgID From Organization WHERE OrgName = @OrgName"; pullOrgID.Parameters.AddWithValue("@OrgName", ddlOrg.SelectedItem.Text); int tempOrgID = (int)pullOrgID.ExecuteScalar(); insert.CommandText = "insert into ContactInformation (contactFirstName, contactLastName, contactEmail, PrimaryContact, OrgID, LastUpdated, LastUpdatedBy) values (@contactFN, @contactLN, @contactEmail, @primaryContact, @OrgID, @LastUpdated, @LastUpdatedBy)"; insert.Parameters.AddWithValue("@contactFN", contactFirstName); insert.Parameters.AddWithValue("@contactLN", contactLastName); insert.Parameters.AddWithValue("@contactEmail", contactEmail); insert.Parameters.AddWithValue("@PrimaryContact", "N"); insert.Parameters.AddWithValue("@OrgID", tempOrgID); insert.Parameters.AddWithValue("@LastUpdated", DateTime.Now); insert.Parameters.AddWithValue("@LastUpdatedBy", HttpUtility.HtmlEncode(Session["USER_ID"])); insert.ExecuteNonQuery(); txtContactFirstName.Text = ""; txtContactLastName.Text = ""; txtContactEmail.Text = ""; ddlOrg.ClearSelection(); con.Close(); sc.Close(); GridView3.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); sb.Append(" select A.STOCK_CODE "); sb.Append(" ,B.DESC_ "); sb.Append(" ,A.ACTION "); sb.Append(" ,A.FUND_NAME "); sb.Append(" ,A.WORK_DTTS "); sb.Append(" ,to_char(T.BUY_DTTS,'yyyymmdd') BUY_DTTS "); sb.Append(" ,T.BUY_POINT "); sb.Append(" ,to_char(T.SELL_DTTS,'yyyymmdd') SELL_DTTS "); sb.Append(" ,T.SELL_POINT "); sb.Append(" ,(round(nvl(sell_point,FNCURPRICESTOCKCUR_STOCKCODE(stockcode))/buy_point*100,2))-100-0.33 rate "); sb.Append(" from ORDER_STOCK_FUND_ACTION a "); sb.Append(" left outer join CONFIG_MST_CYBOSPLUS b on A.STOCK_CODE=B.VALUE "); sb.Append(" left outer join TRADE_HST t on A.STOCK_CODE=T.STOCKCODE and A.FUND_NAME= T.BUY_METHOD and A.WORK_DTTS = to_char(decode(A.ACTION,'SELL',T.SELL_DTTS,T.BUY_DTTS),'yyyymmdd') "); sb.Append(" where 1=1 "); if (DropDownList3.SelectedValue != "ALL") { sb.AppendFormat(" and A.STOCK_CODE='{0}' ", DropDownList3.SelectedValue); } if (DropDownList4.SelectedValue != "ALL") { sb.AppendFormat(" and A.ACTION='{0}' ", DropDownList4.SelectedValue); } if (DropDownList5.SelectedValue != "ALL") { sb.AppendFormat(" and A.FUND_NAME='{0}' ", DropDownList5.SelectedValue); } if (DropDownList6.SelectedValue != "ALL") { sb.AppendFormat(" and A.WORK_DTTS='{0}' ", DropDownList6.SelectedValue); } if (DropDownList7.SelectedValue != "ALL") { sb.AppendFormat(" and T.FINISHED='{0}' ", DropDownList7.SelectedValue); } sb.Append(" order by A.WORK_DTTS desc,A.FUND_NAME,A.ACTION "); SqlDataSource5.SelectCommand = sb.ToString(); GridView3.DataBind(); if (DropDownList1.SelectedValue == "ALL") { if (DropDownList2.SelectedValue == "ALL") { SqlDataSource1.SelectCommand = @"select T.BUY_METHOD FUND_NAME ,MAX(F.FUND_DESC) FUND_DESC ,T.STOCKCODE ,max(C.DESC_) STOCKNAME ,T.FINISHED ,count(*) count ,sum((buy_point*volume)*(((round(nvl(sell_point,FNCURPRICESTOCKCUR_STOCKCODE(stockcode))/buy_point*100,2))-100-0.33)/100)) earnmoney ,sum((round(nvl(sell_point,FNCURPRICESTOCKCUR_STOCKCODE(stockcode))/buy_point*100,2))-100-0.33) rate from TRADE_HST t join FUND_MST f on T.BUY_METHOD=F.FUND_NAME join CONFIG_MST_CYBOSPLUS c on T.STOCKCODE=C.VALUE where instr(T.BUY_METHOD,'FUND')>0 group by T.BUY_METHOD,T.STOCKCODE,T.FINISHED order by T.BUY_METHOD,T.STOCKCODE,T.FINISHED"; } else { SqlDataSource1.SelectCommand = @"select T.BUY_METHOD FUND_NAME ,MAX(F.FUND_DESC) FUND_DESC ,T.STOCKCODE ,max(C.DESC_) STOCKNAME ,T.FINISHED ,count(*) count ,sum((buy_point*volume)*(((round(nvl(sell_point,FNCURPRICESTOCKCUR_STOCKCODE(stockcode))/buy_point*100,2))-100-0.33)/100)) earnmoney ,sum((round(nvl(sell_point,FNCURPRICESTOCKCUR_STOCKCODE(stockcode))/buy_point*100,2))-100-0.33) rate from TRADE_HST t join FUND_MST f on T.BUY_METHOD=F.FUND_NAME join CONFIG_MST_CYBOSPLUS c on T.STOCKCODE=C.VALUE where instr(T.BUY_METHOD,'FUND')>0 and T.BUY_METHOD = '" + DropDownList2.SelectedValue + "' " + " group by T.BUY_METHOD,T.STOCKCODE,T.FINISHED " + " order by T.BUY_METHOD,T.STOCKCODE,T.FINISHED "; } } else { if (DropDownList2.SelectedValue == "ALL") { SqlDataSource1.SelectCommand = @"select T.BUY_METHOD FUND_NAME ,MAX(F.FUND_DESC) FUND_DESC ,T.STOCKCODE ,max(C.DESC_) STOCKNAME ,T.FINISHED ,count(*) count ,sum((buy_point*volume)*(((round(nvl(sell_point,FNCURPRICESTOCKCUR_STOCKCODE(stockcode))/buy_point*100,2))-100-0.33)/100)) earnmoney ,sum((round(nvl(sell_point,FNCURPRICESTOCKCUR_STOCKCODE(stockcode))/buy_point*100,2))-100-0.33) rate from TRADE_HST t join FUND_MST f on T.BUY_METHOD=F.FUND_NAME join CONFIG_MST_CYBOSPLUS c on T.STOCKCODE=C.VALUE where instr(T.BUY_METHOD,'FUND')>0 and T.FINISHED='" + DropDownList1.SelectedValue + "'" + " group by T.BUY_METHOD,T.STOCKCODE,T.FINISHED " + " order by T.BUY_METHOD,T.STOCKCODE,T.FINISHED "; } else { SqlDataSource1.SelectCommand = @"select T.BUY_METHOD FUND_NAME ,MAX(F.FUND_DESC) FUND_DESC ,T.STOCKCODE ,max(C.DESC_) STOCKNAME ,T.FINISHED ,count(*) count ,sum((buy_point*volume)*(((round(nvl(sell_point,FNCURPRICESTOCKCUR_STOCKCODE(stockcode))/buy_point*100,2))-100-0.33)/100)) earnmoney ,sum((round(nvl(sell_point,FNCURPRICESTOCKCUR_STOCKCODE(stockcode))/buy_point*100,2))-100-0.33) rate from TRADE_HST t join FUND_MST f on T.BUY_METHOD=F.FUND_NAME join CONFIG_MST_CYBOSPLUS c on T.STOCKCODE=C.VALUE where instr(T.BUY_METHOD,'FUND')>0 and T.FINISHED='" + DropDownList1.SelectedValue + "'" + " and T.BUY_METHOD = '" + DropDownList2.SelectedValue + "' " + " group by T.BUY_METHOD,T.STOCKCODE,T.FINISHED " + " order by T.BUY_METHOD,T.STOCKCODE,T.FINISHED "; } } GridView1.DataBind(); }
protected void odswiez() { string yyx = (string)Session["id_dzialu"]; id_dzialu.Text = (string)Session["txt_dzialu"]; string txt = string.Empty; // cl.deleteRowTable(); txt = txt + cl.clear_maim_db(); try { DataTable tabelka01 = dr.generuj_dane_do_tabeli_wierszy2018(Date1.Date, Date2.Date, (string)Session["id_dzialu"], 1, 20, 20, tenPlik); //row 1 LB_12.Text = tabelka01.Rows[0][1].ToString().Trim(); LB_13.Text = tabelka01.Rows[0][2].ToString().Trim(); LB_14.Text = tabelka01.Rows[0][3].ToString().Trim(); LB_15.Text = tabelka01.Rows[0][4].ToString().Trim(); //row 2 LB_22.Text = tabelka01.Rows[1][1].ToString().Trim(); LB_23.Text = tabelka01.Rows[1][2].ToString().Trim(); LB_24.Text = tabelka01.Rows[1][3].ToString().Trim(); LB_25.Text = tabelka01.Rows[1][4].ToString().Trim(); /* LB_26.Text = tabelka01.Rows[1][5].ToString().Trim(); * LB_27.Text = tabelka01.Rows[1][6].ToString().Trim(); * LB_28.Text = tabelka01.Rows[1][7].ToString().Trim(); * LB_29.Text = tabelka01.Rows[1][8].ToString().Trim(); * LB_210.Text = tabelka01.Rows[1][9].ToString().Trim(); * LB_211.Text = tabelka01.Rows[1][10].ToString().Trim(); * LB_212.Text = tabelka01.Rows[1][11].ToString().Trim(); * LB_213.Text = tabelka01.Rows[1][12].ToString().Trim(); * LB_214.Text = tabelka01.Rows[1][13].ToString().Trim(); * LB_215.Text = tabelka01.Rows[1][14].ToString().Trim(); * LB_216.Text = tabelka01.Rows[1][15].ToString().Trim(); * LB_217.Text = tabelka01.Rows[1][16].ToString().Trim(); * LB_218.Text = tabelka01.Rows[1][17].ToString().Trim(); * LB_219.Text = tabelka01.Rows[1][18].ToString().Trim(); * LB_220.Text = tabelka01.Rows[1][19].ToString().Trim();*/ //row 3 LB_32.Text = tabelka01.Rows[2][1].ToString().Trim(); LB_33.Text = tabelka01.Rows[2][2].ToString().Trim(); LB_34.Text = tabelka01.Rows[2][3].ToString().Trim(); LB_35.Text = tabelka01.Rows[2][4].ToString().Trim(); /* LB_36.Text = tabelka01.Rows[2][5].ToString().Trim(); * LB_37.Text = tabelka01.Rows[2][6].ToString().Trim(); * LB_38.Text = tabelka01.Rows[2][7].ToString().Trim(); * LB_39.Text = tabelka01.Rows[2][8].ToString().Trim(); * LB_310.Text = tabelka01.Rows[2][9].ToString().Trim(); * LB_311.Text = tabelka01.Rows[2][10].ToString().Trim(); * LB_312.Text = tabelka01.Rows[2][11].ToString().Trim(); * LB_313.Text = tabelka01.Rows[2][12].ToString().Trim(); * LB_314.Text = tabelka01.Rows[2][13].ToString().Trim(); * LB_315.Text = tabelka01.Rows[2][14].ToString().Trim(); * LB_316.Text = tabelka01.Rows[2][15].ToString().Trim(); * LB_317.Text = tabelka01.Rows[2][16].ToString().Trim(); * LB_318.Text = tabelka01.Rows[2][17].ToString().Trim(); * LB_319.Text = tabelka01.Rows[2][18].ToString().Trim(); * LB_320.Text = tabelka01.Rows[2][19].ToString().Trim();*/ //row 4 LB_42.Text = tabelka01.Rows[3][1].ToString().Trim(); LB_43.Text = tabelka01.Rows[3][2].ToString().Trim(); LB_44.Text = tabelka01.Rows[3][3].ToString().Trim(); LB_45.Text = tabelka01.Rows[3][4].ToString().Trim(); /* LB_46.Text = tabelka01.Rows[3][5].ToString().Trim(); * LB_47.Text = tabelka01.Rows[3][6].ToString().Trim(); * LB_48.Text = tabelka01.Rows[3][7].ToString().Trim(); * LB_49.Text = tabelka01.Rows[3][8].ToString().Trim(); * LB_410.Text = tabelka01.Rows[3][9].ToString().Trim(); * LB_411.Text = tabelka01.Rows[3][10].ToString().Trim(); * LB_412.Text = tabelka01.Rows[3][11].ToString().Trim(); * LB_413.Text = tabelka01.Rows[3][12].ToString().Trim(); * LB_414.Text = tabelka01.Rows[3][13].ToString().Trim(); * LB_415.Text = tabelka01.Rows[3][14].ToString().Trim(); * LB_416.Text = tabelka01.Rows[3][15].ToString().Trim(); * LB_417.Text = tabelka01.Rows[3][16].ToString().Trim(); * LB_418.Text = tabelka01.Rows[3][17].ToString().Trim(); * LB_419.Text = tabelka01.Rows[3][18].ToString().Trim(); * LB_420.Text = tabelka01.Rows[3][19].ToString().Trim();*/ //row 5 LB_52.Text = tabelka01.Rows[4][1].ToString().Trim(); LB_53.Text = tabelka01.Rows[4][2].ToString().Trim(); LB_54.Text = tabelka01.Rows[4][3].ToString().Trim(); LB_55.Text = tabelka01.Rows[4][4].ToString().Trim(); /* LB_56.Text = tabelka01.Rows[4][5].ToString().Trim(); * LB_57.Text = tabelka01.Rows[4][6].ToString().Trim(); * LB_58.Text = tabelka01.Rows[4][7].ToString().Trim(); * LB_59.Text = tabelka01.Rows[4][8].ToString().Trim(); * LB_510.Text = tabelka01.Rows[4][9].ToString().Trim(); * LB_511.Text = tabelka01.Rows[4][10].ToString().Trim(); * LB_512.Text = tabelka01.Rows[4][11].ToString().Trim(); * LB_513.Text = tabelka01.Rows[4][12].ToString().Trim(); * LB_514.Text = tabelka01.Rows[4][13].ToString().Trim(); * LB_515.Text = tabelka01.Rows[4][14].ToString().Trim(); * LB_516.Text = tabelka01.Rows[4][15].ToString().Trim(); * LB_517.Text = tabelka01.Rows[4][16].ToString().Trim(); * LB_518.Text = tabelka01.Rows[4][17].ToString().Trim(); * LB_519.Text = tabelka01.Rows[4][18].ToString().Trim(); * LB_520.Text = tabelka01.Rows[4][19].ToString().Trim();*/ //row 6 LB_62.Text = tabelka01.Rows[5][1].ToString().Trim(); LB_63.Text = tabelka01.Rows[5][2].ToString().Trim(); LB_64.Text = tabelka01.Rows[5][3].ToString().Trim(); LB_65.Text = tabelka01.Rows[5][4].ToString().Trim(); /* LB_66.Text = tabelka01.Rows[5][5].ToString().Trim(); * LB_67.Text = tabelka01.Rows[5][6].ToString().Trim(); * LB_68.Text = tabelka01.Rows[5][7].ToString().Trim(); * LB_69.Text = tabelka01.Rows[5][8].ToString().Trim(); * LB_610.Text = tabelka01.Rows[5][9].ToString().Trim(); * LB_611.Text = tabelka01.Rows[5][10].ToString().Trim(); * LB_612.Text = tabelka01.Rows[5][11].ToString().Trim(); * LB_613.Text = tabelka01.Rows[5][12].ToString().Trim(); * LB_614.Text = tabelka01.Rows[5][13].ToString().Trim(); * LB_615.Text = tabelka01.Rows[5][14].ToString().Trim(); * LB_616.Text = tabelka01.Rows[5][15].ToString().Trim(); * LB_617.Text = tabelka01.Rows[5][16].ToString().Trim(); * LB_618.Text = tabelka01.Rows[5][17].ToString().Trim(); * LB_619.Text = tabelka01.Rows[5][18].ToString().Trim(); * LB_620.Text = tabelka01.Rows[5][19].ToString().Trim();*/ //row 7 LB_72.Text = tabelka01.Rows[6][1].ToString().Trim(); LB_73.Text = tabelka01.Rows[6][2].ToString().Trim(); LB_74.Text = tabelka01.Rows[6][3].ToString().Trim(); LB_75.Text = tabelka01.Rows[6][4].ToString().Trim(); /* LB_76.Text = tabelka01.Rows[6][5].ToString().Trim(); * LB_77.Text = tabelka01.Rows[6][6].ToString().Trim(); * LB_78.Text = tabelka01.Rows[6][7].ToString().Trim(); * LB_79.Text = tabelka01.Rows[6][8].ToString().Trim(); * LB_710.Text = tabelka01.Rows[6][9].ToString().Trim(); * LB_711.Text = tabelka01.Rows[6][10].ToString().Trim(); * LB_712.Text = tabelka01.Rows[6][11].ToString().Trim(); * LB_713.Text = tabelka01.Rows[6][12].ToString().Trim(); * LB_714.Text = tabelka01.Rows[6][13].ToString().Trim(); * LB_715.Text = tabelka01.Rows[6][14].ToString().Trim(); * LB_716.Text = tabelka01.Rows[6][15].ToString().Trim(); * LB_717.Text = tabelka01.Rows[6][16].ToString().Trim(); * LB_718.Text = tabelka01.Rows[6][17].ToString().Trim(); * LB_719.Text = tabelka01.Rows[6][18].ToString().Trim(); * LB_720.Text = tabelka01.Rows[6][19].ToString().Trim();*/ //row 8 LB_82.Text = tabelka01.Rows[7][1].ToString().Trim(); LB_83.Text = tabelka01.Rows[7][2].ToString().Trim(); LB_84.Text = tabelka01.Rows[7][3].ToString().Trim(); LB_85.Text = tabelka01.Rows[7][4].ToString().Trim(); /* LB_86.Text = tabelka01.Rows[7][5].ToString().Trim(); * LB_87.Text = tabelka01.Rows[7][6].ToString().Trim(); * LB_88.Text = tabelka01.Rows[7][7].ToString().Trim(); * LB_89.Text = tabelka01.Rows[7][8].ToString().Trim(); * LB_810.Text = tabelka01.Rows[7][9].ToString().Trim(); * LB_811.Text = tabelka01.Rows[7][10].ToString().Trim(); * LB_812.Text = tabelka01.Rows[7][11].ToString().Trim(); * LB_813.Text = tabelka01.Rows[7][12].ToString().Trim(); * LB_814.Text = tabelka01.Rows[7][13].ToString().Trim(); * LB_815.Text = tabelka01.Rows[7][14].ToString().Trim(); * LB_816.Text = tabelka01.Rows[7][15].ToString().Trim(); * LB_817.Text = tabelka01.Rows[7][16].ToString().Trim(); * LB_818.Text = tabelka01.Rows[7][17].ToString().Trim(); * LB_819.Text = tabelka01.Rows[7][18].ToString().Trim(); * LB_820.Text = tabelka01.Rows[7][19].ToString().Trim();*/ //row 9 LB_92.Text = tabelka01.Rows[8][1].ToString().Trim(); LB_93.Text = tabelka01.Rows[8][2].ToString().Trim(); LB_94.Text = tabelka01.Rows[8][3].ToString().Trim(); LB_95.Text = tabelka01.Rows[8][4].ToString().Trim(); /* LB_96.Text = tabelka01.Rows[8][5].ToString().Trim(); * LB_97.Text = tabelka01.Rows[8][6].ToString().Trim(); * LB_98.Text = tabelka01.Rows[8][7].ToString().Trim(); * LB_99.Text = tabelka01.Rows[8][8].ToString().Trim(); * LB_910.Text = tabelka01.Rows[8][9].ToString().Trim(); * LB_911.Text = tabelka01.Rows[8][10].ToString().Trim(); * LB_912.Text = tabelka01.Rows[8][11].ToString().Trim(); * LB_913.Text = tabelka01.Rows[8][12].ToString().Trim(); * LB_914.Text = tabelka01.Rows[8][13].ToString().Trim(); * LB_915.Text = tabelka01.Rows[8][14].ToString().Trim(); * LB_916.Text = tabelka01.Rows[8][15].ToString().Trim(); * LB_917.Text = tabelka01.Rows[8][16].ToString().Trim(); * LB_918.Text = tabelka01.Rows[8][17].ToString().Trim(); * LB_919.Text = tabelka01.Rows[8][18].ToString().Trim(); * LB_920.Text = tabelka01.Rows[8][19].ToString().Trim();*/ //row10 LB_102.Text = tabelka01.Rows[9][1].ToString().Trim(); LB_103.Text = tabelka01.Rows[9][2].ToString().Trim(); LB_104.Text = tabelka01.Rows[9][3].ToString().Trim(); LB_105.Text = tabelka01.Rows[9][4].ToString().Trim(); /* LB_106.Text = tabelka01.Rows[9][5].ToString().Trim(); * LB_107.Text = tabelka01.Rows[9][6].ToString().Trim(); * LB_108.Text = tabelka01.Rows[9][7].ToString().Trim(); * LB_109.Text = tabelka01.Rows[9][8].ToString().Trim(); * LB_1010.Text = tabelka01.Rows[9][9].ToString().Trim(); * LB_1011.Text = tabelka01.Rows[9][10].ToString().Trim(); * LB_1012.Text = tabelka01.Rows[9][11].ToString().Trim(); * LB_1013.Text = tabelka01.Rows[9][12].ToString().Trim(); * LB_1014.Text = tabelka01.Rows[9][13].ToString().Trim(); * LB_1015.Text = tabelka01.Rows[9][14].ToString().Trim(); * LB_1016.Text = tabelka01.Rows[9][15].ToString().Trim(); * LB_1017.Text = tabelka01.Rows[9][16].ToString().Trim(); * LB_1018.Text = tabelka01.Rows[9][17].ToString().Trim(); * LB_1019.Text = tabelka01.Rows[9][18].ToString().Trim(); * LB_1020.Text = tabelka01.Rows[9][19].ToString().Trim();*/ //row11 LB_11_2.Text = tabelka01.Rows[10][1].ToString().Trim(); LB_11_3.Text = tabelka01.Rows[10][2].ToString().Trim(); LB_11_4.Text = tabelka01.Rows[10][3].ToString().Trim(); LB_11_5.Text = tabelka01.Rows[10][4].ToString().Trim(); //row12 LB_122.Text = tabelka01.Rows[11][1].ToString().Trim(); LB_123.Text = tabelka01.Rows[11][2].ToString().Trim(); LB_124.Text = tabelka01.Rows[11][3].ToString().Trim(); LB_125.Text = tabelka01.Rows[11][4].ToString().Trim(); /* LB_126.Text = tabelka01.Rows[11][5].ToString().Trim(); * LB_127.Text = tabelka01.Rows[11][6].ToString().Trim(); * LB_128.Text = tabelka01.Rows[11][7].ToString().Trim(); * LB_129.Text = tabelka01.Rows[11][8].ToString().Trim(); * LB_1210.Text = tabelka01.Rows[11][9].ToString().Trim(); * LB_1211.Text = tabelka01.Rows[11][10].ToString().Trim(); * LB_1212.Text = tabelka01.Rows[11][11].ToString().Trim(); * LB_1213.Text = tabelka01.Rows[11][12].ToString().Trim(); * LB_1214.Text = tabelka01.Rows[11][13].ToString().Trim(); * LB_1215.Text = tabelka01.Rows[11][14].ToString().Trim(); * LB_1216.Text = tabelka01.Rows[11][15].ToString().Trim(); * LB_1217.Text = tabelka01.Rows[11][16].ToString().Trim(); * LB_1218.Text = tabelka01.Rows[11][17].ToString().Trim(); * LB_1219.Text = tabelka01.Rows[11][18].ToString().Trim(); * LB_1220.Text = tabelka01.Rows[11][19].ToString().Trim();*/ //row13 LB_132.Text = tabelka01.Rows[12][1].ToString().Trim(); LB_133.Text = tabelka01.Rows[12][2].ToString().Trim(); LB_134.Text = tabelka01.Rows[12][3].ToString().Trim(); LB_135.Text = tabelka01.Rows[12][4].ToString().Trim(); /* LB_136.Text = tabelka01.Rows[12][5].ToString().Trim(); * LB_137.Text = tabelka01.Rows[12][6].ToString().Trim(); * LB_138.Text = tabelka01.Rows[12][7].ToString().Trim(); * LB_139.Text = tabelka01.Rows[12][8].ToString().Trim(); * LB_1310.Text = tabelka01.Rows[12][9].ToString().Trim(); * LB_1311.Text = tabelka01.Rows[12][10].ToString().Trim(); * LB_1312.Text = tabelka01.Rows[12][11].ToString().Trim(); * LB_1313.Text = tabelka01.Rows[12][12].ToString().Trim(); * LB_1314.Text = tabelka01.Rows[12][13].ToString().Trim(); * LB_1315.Text = tabelka01.Rows[12][14].ToString().Trim(); * LB_1316.Text = tabelka01.Rows[12][15].ToString().Trim(); * LB_1317.Text = tabelka01.Rows[12][16].ToString().Trim(); * LB_1318.Text = tabelka01.Rows[12][17].ToString().Trim(); * LB_1319.Text = tabelka01.Rows[12][18].ToString().Trim(); * LB_1320.Text = tabelka01.Rows[12][19].ToString().Trim();*/ //row14 LB_142.Text = tabelka01.Rows[13][1].ToString().Trim(); LB_143.Text = tabelka01.Rows[13][2].ToString().Trim(); LB_144.Text = tabelka01.Rows[13][3].ToString().Trim(); LB_145.Text = tabelka01.Rows[13][4].ToString().Trim(); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 2, Date1.Date, Date2.Date); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 3, Date1.Date, Date2.Date); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 4, Date1.Date, Date2.Date); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 5, Date1.Date, Date2.Date); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 7, Date1.Date, Date2.Date); } #pragma warning disable CS0168 // The variable 'ex' is declared but never used catch (Exception ex) #pragma warning restore CS0168 // The variable 'ex' is declared but never used { } // dopasowanie opisów makeLabels(); GridView1.DataBind(); GridView2.DataBind(); GridView3.DataBind(); //GridView4.DataBind(); try { Label11.Visible = cl.debug(int.Parse(yyx)); } catch { Label11.Visible = false; } Label11.Text = txt; Label3.Text = cl.nazwaSadu((string)Session["id_dzialu"]); }
protected void Button3_Click(object sender, EventArgs e) { int Reserver_Count = 0; if (FileUpload1.HasFile) { if (Session["account"] != null) { if (Lib.SysSetting.CheckYear(Convert.ToDateTime(datehide.Value))) { string _OP = ((Lib.Account)Session["account"]).AccountName; string _date = datehide.Value; Lib.DataUtility dux = new Lib.DataUtility(); Dictionary <string, object> d = new Dictionary <string, object>(); d.Add("account", _OP); d.Add("center_name", centerhide.Value); DataTable unit_code = dux.getDataTableByText("select unit_code,(select c.center_code from Center c where c.center_name = @center_name) as center_code from Account where account = @account", d); string _unit_code = unit_code.Rows[0]["unit_code"].ToString(); string _center = unit_code.Rows[0]["center_code"].ToString(); HttpPostedFile file = FileUpload1.PostedFile; StreamReader reader = new StreamReader(file.InputStream); Lib.DataUtility du = new Lib.DataUtility(); int count = 0; List <SqlParameter> list = new List <SqlParameter>(); #region 宣告 DataTable() DataTable CanAccess = new DataTable(); DataTable DenyAccess = new DataTable(); DataTable AgainAccess = new DataTable(); DataTable NoSameUnit = new DataTable(); DataTable Qualified = new DataTable(); DataTable BeReserved = new DataTable(); #endregion #region 宣告CanAccess資料表欄位 //insert into result (id,name,age,birth,gender,unit_code,rank_code,date,center_code,status,op_id) CanAccess.Columns.Add("身份證"); CanAccess.Columns.Add("姓名"); CanAccess.Columns.Add("生日"); CanAccess.Columns.Add("性別"); CanAccess.Columns.Add("單位代碼"); CanAccess.Columns.Add("軍階代碼"); CanAccess.Columns.Add("預約日期"); CanAccess.Columns.Add("鑑測站代碼"); CanAccess.Columns.Add("Mail"); CanAccess.Columns.Add("海外人員"); CanAccess.Columns.Add("團報者帳號"); #endregion #region 宣告DenyAccess資料表欄位 DenyAccess.Columns.Add("身份證"); DenyAccess.Columns.Add("姓名"); DenyAccess.Columns.Add("生日"); DenyAccess.Columns.Add("性別"); DenyAccess.Columns.Add("單位代碼"); DenyAccess.Columns.Add("軍階代碼"); DenyAccess.Columns.Add("預約日期"); DenyAccess.Columns.Add("鑑測站代碼"); DenyAccess.Columns.Add("Mail"); DenyAccess.Columns.Add("海外人員"); DenyAccess.Columns.Add("團報者帳號"); DenyAccess.Columns.Add("報進失敗說明"); #endregion #region 宣告AgainAccess資料表欄位 AgainAccess.Columns.Add("身份證"); AgainAccess.Columns.Add("姓名"); AgainAccess.Columns.Add("生日"); AgainAccess.Columns.Add("性別"); AgainAccess.Columns.Add("單位代碼"); AgainAccess.Columns.Add("軍階代碼"); AgainAccess.Columns.Add("預約日期"); AgainAccess.Columns.Add("鑑測站代碼"); AgainAccess.Columns.Add("Mail"); AgainAccess.Columns.Add("海外人員"); AgainAccess.Columns.Add("團報者帳號"); #endregion #region 宣告NoSameUnit資料表欄位 NoSameUnit.Columns.Add("身份證"); NoSameUnit.Columns.Add("姓名"); NoSameUnit.Columns.Add("生日"); NoSameUnit.Columns.Add("性別"); NoSameUnit.Columns.Add("單位代碼"); NoSameUnit.Columns.Add("軍階代碼"); NoSameUnit.Columns.Add("預約日期"); NoSameUnit.Columns.Add("鑑測站代碼"); NoSameUnit.Columns.Add("Mail"); NoSameUnit.Columns.Add("海外人員"); NoSameUnit.Columns.Add("團報者帳號"); #endregion #region 宣告Qualified資料表欄位 Qualified.Columns.Add("身份證"); Qualified.Columns.Add("姓名"); Qualified.Columns.Add("生日"); Qualified.Columns.Add("性別"); Qualified.Columns.Add("單位代碼"); Qualified.Columns.Add("軍階代碼"); Qualified.Columns.Add("預約日期"); Qualified.Columns.Add("鑑測站代碼"); Qualified.Columns.Add("Mail"); Qualified.Columns.Add("海外人員"); Qualified.Columns.Add("團報者帳號"); #endregion #region 宣告BeReserved資料表欄位 BeReserved.Columns.Add("身份證"); BeReserved.Columns.Add("姓名"); BeReserved.Columns.Add("生日"); BeReserved.Columns.Add("性別"); BeReserved.Columns.Add("單位代碼"); BeReserved.Columns.Add("軍階代碼"); BeReserved.Columns.Add("預約日期"); BeReserved.Columns.Add("鑑測站代碼"); BeReserved.Columns.Add("Mail"); BeReserved.Columns.Add("海外人員"); BeReserved.Columns.Add("團報者帳號"); #endregion CultureInfo ci_en = new CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture = ci_en; //資料庫中存放的datetime為西元時區,所以需將時區變更為en-US DateTime reserveDate = Lib.SysSetting.ToWorldDate(datehide.Value); DateTime firstday = new DateTime(reserveDate.Year, 1, 1); DateTime lastday = new DateTime(reserveDate.Year, 12, 31); DateTime Start = new DateTime(reserveDate.Year, reserveDate.Month, 1); DateTime End = Start.AddMonths(1).AddDays(-1); DateTime Checkover = reserveDate.AddDays(-30); try { while (reader.Peek() >= 0) { Reserver_Count++; string result = reader.ReadLine(); try { string[] operater = { "," }; string[] info = result.Split(operater, StringSplitOptions.None); if (info[0] != "身分證字號") { //string string _gender = ""; char[] _id = info[0].ToCharArray(); if (_id[1] == '1') { _gender = "M"; } if (_id[1] == '2') { _gender = "F"; } #region New SqlParameter SqlParameter p1 = new SqlParameter("message", SqlDbType.NVarChar, 50); SqlParameter p2 = new SqlParameter("id", info[0]); SqlParameter p3 = new SqlParameter("gender", _gender); SqlParameter p4 = new SqlParameter("birth", Lib.SysSetting.ToWorldDate(info[2])); SqlParameter p5 = new SqlParameter("name", info[1]); SqlParameter p6 = new SqlParameter("unit_code", info[4]); SqlParameter p7 = new SqlParameter("rank_code", info[5]); SqlParameter p8 = new SqlParameter("mail", info[3]); SqlParameter p9 = new SqlParameter("oversea", "0"); SqlParameter p10 = new SqlParameter("reserveDate", reserveDate); SqlParameter p11 = new SqlParameter("center_code", _center); SqlParameter p12 = new SqlParameter("op_id", _OP); SqlParameter p13 = new SqlParameter("start", Start); SqlParameter p14 = new SqlParameter("end", End); SqlParameter p15 = new SqlParameter("checkover", Checkover); SqlParameter p16 = new SqlParameter("firstday", firstday); SqlParameter p17 = new SqlParameter("lastday", lastday); #endregion p1.Direction = ParameterDirection.Output; int age_check = Lib.SysSetting.ConvertAge(Lib.SysSetting.ToWorldDate(info[2]), reserveDate); if (info[0].Length == 10) { if (info[4] == _unit_code) { if (age_check >= 18) { list.Clear(); #region List.Add SqlParameter list.Add(p1); list.Add(p2); list.Add(p3); list.Add(p4); list.Add(p5); list.Add(p6); list.Add(p7); list.Add(p8); list.Add(p9); list.Add(p10); list.Add(p11); list.Add(p12); list.Add(p13); list.Add(p14); list.Add(p15); list.Add(p16); list.Add(p17); #endregion SqlParameter[] sqls = list.ToArray(); du.executeNonQueryBysp("AddPlayerByTeam", sqls); if (p1.Value.ToString() == "canreserve") { CanAccess.Rows.Add(info[0], info[1], Lib.SysSetting.ToWorldDate(info[2]), _gender, info[4], info[5], reserveDate, _center, info[3], "0", _OP); } if (p1.Value.ToString() == "noreserve") { DenyAccess.Rows.Add(info[0], info[1], Lib.SysSetting.ToWorldDate(info[2]), _gender, info[4], info[5], reserveDate, _center, info[3], "0", _OP, "此月份已測驗,請報進其他月份"); } if (p1.Value.ToString() == "againreserve") { DenyAccess.Rows.Add(info[0], info[1], Lib.SysSetting.ToWorldDate(info[2]), _gender, info[4], info[5], reserveDate, _center, info[3], "0", _OP, "您為30天內補測人員,請使用個人報進"); } if (p1.Value.ToString() == "bereserve") { DenyAccess.Rows.Add(info[0], info[1], Lib.SysSetting.ToWorldDate(info[2]), _gender, info[4], info[5], reserveDate, _center, info[3], "0", _OP, "您已有1筆預約,本次報進失敗"); } if (p1.Value.ToString() == "beok") { DenyAccess.Rows.Add(info[0], info[1], Lib.SysSetting.ToWorldDate(info[2]), _gender, info[4], info[5], reserveDate, _center, info[3], "0", _OP, "您已經是合格人員,本次報進失敗"); } } else { DenyAccess.Rows.Add(info[0], info[1], Lib.SysSetting.ToWorldDate(info[2]), _gender, info[4], info[5], reserveDate, _center, info[3], "0", _OP, "生日請使用民國格式"); } } else { DenyAccess.Rows.Add(info[0], info[1], Lib.SysSetting.ToWorldDate(info[2]), _gender, info[4], info[5], reserveDate, _center, info[3], "0", _OP, "單位代碼錯誤"); } } else { error_format.Text = error_format.Text + info[0] + "," + info[1] + "<br/>"; } } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); error_format.Text = error_format.Text + result + "<br/>"; } } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('資料格式不符 , 請重新檢查');", true); } #region 控制資料表的顯示,且將允許報名的資料做報名的動作 ci_en = new CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture = ci_en; //資料庫中存放的datetime為西元時區,所以需將時區變更為en-US if (CanAccess.Rows.Count > 0) { list.Clear(); Lib.DataUtility _du = new Lib.DataUtility(); string _v = CanAccess.Rows[0]["預約日期"].ToString(); SqlParameter pp1 = new SqlParameter("message", SqlDbType.NVarChar, 50); SqlParameter pp2 = new SqlParameter("center_code", _center); SqlParameter pp3 = new SqlParameter("date", Convert.ToDateTime(_v)); SqlParameter pp4 = new SqlParameter("wanted", CanAccess.Rows.Count); list.Add(pp1); list.Add(pp2); list.Add(pp3); list.Add(pp4); SqlParameter[] sqlss = list.ToArray(); pp1.Direction = ParameterDirection.Output; _du.executeNonQueryBysp("CheckCenterLimit", sqlss); if (pp1.Value.ToString() == "No") { Re_Success_Count.Text = "0人"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('餘額不足 , 無法預約');", true); } else if (pp1.Value.ToString() == "Yes") //pp1.Value.ToString() == "Yes" { Lib.DataUtility _DataUtility = new Lib.DataUtility(); SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MainDB"].ConnectionString); conn.Open(); SqlCommand comm = conn.CreateCommand(); SqlTransaction trans; trans = conn.BeginTransaction("mytrans"); comm.Connection = conn; comm.Transaction = trans; try { for (int i = 0; i < CanAccess.Rows.Count; i++) { try { comm.Parameters.Clear(); SqlParameter _p1 = new SqlParameter("id", CanAccess.Rows[i]["身份證"]); SqlParameter _p2 = new SqlParameter("gender", CanAccess.Rows[i]["性別"]); SqlParameter _p3 = new SqlParameter("birth", Convert.ToDateTime(CanAccess.Rows[i]["生日"])); //不能複蓋 SqlParameter _p4 = new SqlParameter("name", CanAccess.Rows[i]["姓名"]); //不能覆蓋 SqlParameter _p5 = new SqlParameter("unit_code", CanAccess.Rows[i]["單位代碼"]); SqlParameter _p6 = new SqlParameter("rank_code", CanAccess.Rows[i]["軍階代碼"]); SqlParameter _p7 = new SqlParameter("mail", CanAccess.Rows[i]["Mail"]);//不能覆蓋 SqlParameter _p8 = new SqlParameter("oversea", CanAccess.Rows[i]["海外人員"]); SqlParameter _p9 = new SqlParameter("reserveDate", Convert.ToDateTime(CanAccess.Rows[i]["預約日期"])); SqlParameter _p10 = new SqlParameter("center_code", CanAccess.Rows[i]["鑑測站代碼"]); SqlParameter _p11 = new SqlParameter("op_id", CanAccess.Rows[i]["團報者帳號"]); SqlParameter _p12 = new SqlParameter("age", Lib.SysSetting.ConvertAge(Convert.ToDateTime(CanAccess.Rows[i]["生日"]), Convert.ToDateTime(CanAccess.Rows[i]["預約日期"]))); comm.Parameters.Add(_p1); comm.Parameters.Add(_p2); //如果改Rresult不依據player資料則上面二個不mark comm.Parameters.Add(_p3); comm.Parameters.Add(_p4); comm.Parameters.Add(_p5); comm.Parameters.Add(_p6); comm.Parameters.Add(_p7); comm.Parameters.Add(_p8); comm.Parameters.Add(_p9); comm.Parameters.Add(_p10); comm.Parameters.Add(_p11); comm.Parameters.Add(_p12); //2016-12-8最終大改版 一隻sp作掉 comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Ex106_TeamReserve"; comm.ExecuteNonQuery(); //以上大改版,三行解決 //comm.CommandType = CommandType.Text; //comm.CommandTyp = CommandType.StoredProcedure; //-----------版本1:團報時Result依照player資料為主------------ //2016-12-6,測試把player的資料放到result //comm.Parameters.AddWithValue("id", CanAccess.Rows[i]["身份證"].ToString()); //comm.CommandText = "select top 1 id,name,birth from player where id=@id"; //DataTable dt1 = new DataTable(); //dt1.Load(comm.ExecuteReader()); //if (dt1.Rows.Count > 0)//有此id,更新資料 //{ // comm.CommandText = "update Player set unit_code=@unit_code,rank_code=@rank_code,oversea=@oversea"; // comm.ExecuteNonQuery(); // //更新player資料測試 // if (!string.IsNullOrEmpty(dt1.Rows[0]["birth"].ToString()))//值不是空的才把player資料覆蓋過來 // _p3 = new SqlParameter("birth", Convert.ToDateTime(dt1.Rows[0]["birth"]));//不能複蓋 // if (!string.IsNullOrEmpty(dt1.Rows[0]["name"].ToString()))//值不是空的才把player資料覆蓋過來 // _p4 = new SqlParameter("name", dt1.Rows[0]["name"]);//不能覆蓋 // comm.Parameters.Add(_p3); // comm.Parameters.Add(_p4); //} //else//無此id,直接新增 //{ // comm.Parameters.Add(_p3); // comm.Parameters.Add(_p4); // comm.CommandText = "insert into player (id,gender,birth,name,unit_code,rank_code,mail,oversea) values (@id,@gender,@birth,@name,@unit_code,@rank_code,@mail,@oversea)"; // comm.ExecuteNonQuery(); //} //-----------------以上為版本1--------------------- //------------版本2:Result資料依照團報資料,Player一樣不覆蓋-------- ////先mark,測試如果player有資料就直接抓來用 ////2016-9-5更新較佳的方法(IF EXISTS ELSE) ////直接用sql判斷是否有該比資料,如果有就只更新單位、級職代碼,若沒有就新增一筆帳號。 //comm.CommandText = "IF EXISTS (select * from Player where id=@id) update Player set unit_code=@unit_code,rank_code=@rank_code where id=@id ELSE insert into Player (id,name,gender,birth,mail,unit_code,rank_code,oversea) values(@id,@name,@gender,@birth,@mail,@unit_code,@rank_code,@oversea)"; //comm.ExecuteNonQuery(); ////以上先mark //原本處理Player表格方式先刪除資料再重新塞入資料(舊版-先mark) //comm.CommandText = "delete from player where id = @id"; //comm.ExecuteNonQuery(); //comm.CommandText = "insert into player (id,gender,birth,name,unit_code,rank_code,mail,oversea) values (@id,@gender,@birth,@name,@unit_code,@rank_code,@mail,@oversea)"; //comm.ExecuteNonQuery(); //----------------以上為版本2-------------------- //處理Result表格(保留) //comm.CommandText = "delete from result where id = @id and date = @reserveDate"; //comm.ExecuteNonQuery(); //comm.CommandText = "insert into result (id,name,age,birth,gender,unit_code,rank_code,date,center_code,status,op_id) values(@id,@name,@age,@birth,@gender,@unit_code,@rank_code,@reserveDate,@center_code,'000',@op_id) "; //comm.ExecuteNonQuery(); } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); error_format.Text = error_format.Text + CanAccess.Rows[i]["身份證"] + "," + CanAccess.Rows[i]["姓名"] + "<br/>"; CanAccess.Rows.RemoveAt(i); i--; } } list.Clear(); string _vv = CanAccess.Rows[0]["預約日期"].ToString(); DataTable dt_reserved = new DataTable(); comm.Parameters.Clear(); comm.Parameters.Add("center_code", _center); comm.Parameters.Add("date", Convert.ToDateTime(_vv)); comm.CommandType = CommandType.StoredProcedure; comm.CommandText = "Ex102_GetCenterLimit"; dt_reserved.Load(comm.ExecuteReader()); //comm.CommandText = "select count (id) as reserved,(select limit from center where center_code = @center_code) as limit from result where center_code = @center_code and date = @date"; //dt_reserved.Load(comm.ExecuteReader()); //if (((Convert.ToInt32(dt_reserved.Rows[0]["limit"].ToString()) - Convert.ToInt32(dt_reserved.Rows[0]["reserved"].ToString())) >= 0)) if (Convert.ToInt32(dt_reserved.Rows[0]["allow"]) >= 0) { trans.Commit(); trans.Dispose(); conn.Close(); #region 寫Log CultureInfo ci = new CultureInfo("zh-TW"); Thread.CurrentThread.CurrentCulture = ci; #endregion //寫入Result //使用迴圈一筆一筆寫入 //資料來源為CanAccess #region 通知受測人員 string cwd = System.IO.Directory.GetCurrentDirectory(); string dd = Server.MapPath(Request.ApplicationPath); string _detailtable = ""; for (int i = 0; i < CanAccess.Rows.Count; i++) { _detailtable = _detailtable + "<tr><td>" + CanAccess.Rows[i]["姓名"] + "</td><td>" + CanAccess.Rows[i]["身份證"] + "</td><td>" + Lib.SysSetting.ToRocDateFormat(CanAccess.Rows[i]["生日"].ToString().Remove(9)) + "</td><td>" + CanAccess.Rows[i]["軍階代碼"] + "</td><td>" + CanAccess.Rows[i]["Mail"] + "</td></tr>"; MailMessage _MailToUser = new MailMessage(); StreamReader _MailContentToUser = new StreamReader(dd + "\\Mail\\TeamReserveUser.txt"); //_MailToUser.Body = _MailContent.ReadToEnd().Replace("%detail%", _detailtable); _MailToUser.Body = _MailContentToUser.ReadToEnd(); _MailToUser.Body = _MailToUser.Body.Replace("%date%", datehide.Value); _MailToUser.Body = _MailToUser.Body.Replace("%location%", centerhide.Value); Lib.SysSetting.SaveLetter(CanAccess.Rows[i]["Mail"] + "@webmail.mil.tw", "國軍基本體能鑑測網", _MailToUser.Body, "報進成功通知信", "00"); } #endregion #region 通知團報負責人 MailMessage _Mail = new MailMessage(); StreamReader _MailContent = new StreamReader(dd + "\\Mail\\TeamReserveManger.txt"); _Mail.Body = _MailContent.ReadToEnd().Replace("%detail%", _detailtable); _Mail.Body = _Mail.Body.Replace("%date%", datehide.Value); _Mail.Body = _Mail.Body.Replace("%location%", centerhide.Value); _Mail.Body = _Mail.Body.Replace("%total%", CanAccess.Rows.Count.ToString()); Lib.SysSetting.SaveLetter(((Lib.Account)Session["account"]).Mail + "@webmail.mil.tw", "國軍基本體能鑑測網", _Mail.Body, "報進成功通知信", "00"); Lib.SysSetting.AddLog("團體報進", _OP, "報進成功 , 日期:" + datehide.Value + " , 地點:" + centerhide.Value + " , 預約人數" + CanAccess.Rows.Count + "人", System.DateTime.Now); #endregion CanAccess.Columns.Remove("鑑測站代碼"); CanAccess.Columns.Remove("海外人員"); CanAccess.Columns.Remove("團報者帳號"); CanAccess.Columns.Remove("預約日期"); GridView1.DataSource = CanAccess; GridView1.DataBind(); GridView1.Visible = true; Re_Success_Count.Text = CanAccess.Rows.Count.ToString() + "人"; } else { trans.Rollback(); trans.Dispose(); conn.Close(); Re_Success_Count.Text = "0人"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('餘額不足 , 無法預約');", true); } } catch (Exception ex) { Lib.SysSetting.ExceptionLog(ex.GetType().ToString(), ex.Message, this.ToString()); trans.Rollback(); trans.Dispose(); conn.Close(); Re_Success_Count.Text = "0人"; } } } DenyAccess.Columns.Remove("鑑測站代碼"); DenyAccess.Columns.Remove("海外人員"); DenyAccess.Columns.Remove("團報者帳號"); DenyAccess.Columns.Remove("預約日期"); GridView3.DataSource = DenyAccess; GridView3.DataBind(); GridView3.Visible = true; CultureInfo cii = new CultureInfo("zh-TW"); Thread.CurrentThread.CurrentCulture = cii; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "$.unblockUI();$('#aspnetForm')[0].submit();", true); Re_fail_Count.Text = DenyAccess.Rows.Count.ToString() + "人"; Re_Count.Text = (Reserver_Count - 1).ToString(); this.SuccessDetails.Style.Value = ""; this.failDatails.Style.Value = ""; this.OrderStep1.Style.Value = "display:none"; this.SureOrder.Style.Value = "display:none"; this.SureTimeAndPlace.Style.Value = "display:none"; this.Result.Style.Value = ""; this.Div2.Style.Value = ""; this.ReturnStep1.Style.Value = ""; Re_surecenter.Text = centerhide.Value; Re_suredate.Text = datehide.Value; #endregion } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('此年度目前不開放報進 , 開放時系統將會公告');", true); } } } }
protected void searchprotype_Click(object sender, EventArgs e) { GridView3.DataSource = lpp.Query_ProType(TextBox1.Text, TextBox2.Text); GridView3.DataBind(); }
protected void ChooseProType_Click(object sender, EventArgs e) { Panel1.Visible = true; GridView3.DataSource = lpp.Query_ProType(TextBox1.Text, TextBox2.Text); GridView3.DataBind(); }
protected void btnEdit_Click(object sender, EventArgs e) { LinkButton b = (LinkButton)sender; GridViewRow row = (GridViewRow)b.NamingContainer; if (row != null) { int index = row.RowIndex; //gets the row index selected int id = Convert.ToInt32(GridView1.DataKeys[index].Value.ToString()); string condition = " where Sof_slNo='" + id + "'"; // string condition = " where userId='" + userId + "'"; DataTable dt = oITAssetMonitoringDLL.GetSoftware(condition); if (dt.Rows.Count > 0) { sofSLLabel.Text = id.ToString(); nameTextBox.Text = dt.Rows[0]["Sof_Name"].ToString(); try { ServerDropDownList.SelectedValue = dt.Rows[0]["Sof_Ser_slNo"].ToString(); } catch { } Sof_TypeTextBox.Text = dt.Rows[0]["Sof_Type"].ToString(); EndUserTextBox.Text = dt.Rows[0]["Sof_EndUser"].ToString(); BenifitiaryUserTextBox.Text = dt.Rows[0]["Sof_BenifitiaryUser"].ToString(); CurrentVirsionTextBox.Text = dt.Rows[0]["Sof_CurrentVirsion"].ToString(); HostedLocationTextBox.Text = dt.Rows[0]["Sof_HostedLocation"].ToString(); if (string.IsNullOrEmpty(dt.Rows[0]["Sof_WorkOrder_Date"].ToString())) { WorkOrder_DateTextBox.Text = ""; } else { WorkOrder_DateTextBox.Text = Convert.ToDateTime(dt.Rows[0]["Sof_WorkOrder_Date"].ToString()).ToString("yyyy-MM-dd"); } //WorkOrder_DateTextBox.Text= dt.Rows[0]["Sof_WorkOrder_Date"].ToString()== null ? "" : Convert.ToDateTime(dt.Rows[0]["Sof_WorkOrder_Date"].ToString()).ToString("yyyy-MM-dd"); WorOrder_NoTextBox.Text = dt.Rows[0]["Sof_WorkOrder_No"].ToString(); if (string.IsNullOrEmpty(dt.Rows[0]["Sof_Receive_Date"].ToString())) { Receive_DateTextBox.Text = ""; } else { Receive_DateTextBox.Text = Convert.ToDateTime(dt.Rows[0]["Sof_Receive_Date"].ToString()).ToString("yyyy-MM-dd"); } //Receive_DateTextBox.Text = dt.Rows[0]["Sof_Receive_Date"].ToString() == null ? "" : Convert.ToDateTime(dt.Rows[0]["Sof_Receive_Date"].ToString()).ToString("yyyy-MM-dd"); //underAMCCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_UnderAMC"].ToString()); if (string.IsNullOrEmpty(dt.Rows[0]["Sof_UnderAMC"].ToString())) { underAMCCheckBox.Checked = false; } else { underAMCCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_UnderAMC"].ToString()); } if (string.IsNullOrEmpty(dt.Rows[0]["Sof_Last_Renew_Date"].ToString())) { Last_Renew_DateTextBox.Text = ""; } else { Last_Renew_DateTextBox.Text = Convert.ToDateTime(dt.Rows[0]["Sof_Last_Renew_Date"].ToString()).ToString("yyyy-MM-dd"); } //Last_Renew_DateTextBox.Text =dt.Rows[0]["Sof_Last_Renew_Date"].ToString()== null ? "" : Convert.ToDateTime(dt.Rows[0]["Sof_Last_Renew_Date"].ToString()).ToString("yyyy-MM-dd"); if (string.IsNullOrEmpty(dt.Rows[0]["Sof_Next_Renew_Date"].ToString())) { Next_Renew_DateTextBox.Text = ""; } else { Next_Renew_DateTextBox.Text = Convert.ToDateTime(dt.Rows[0]["Sof_Next_Renew_Date"].ToString()).ToString("yyyy-MM-dd"); } // Next_Renew_DateTextBox.Text = dt.Rows[0]["Sof_Last_Renew_Date"].ToString() == null ? "" : Convert.ToDateTime(dt.Rows[0]["Sof_Next_Renew_Date"].ToString()).ToString("yyyy-MM-dd"); //employeeDropDownList.SelectedValue = dt.Rows[0]["Sof_UAT_Person"].ToString(); NetworkGatewayTextBox.Text = dt.Rows[0]["Sof_NetworkGateway"].ToString(); if (string.IsNullOrEmpty(dt.Rows[0]["Sof_IsHosted"].ToString())) { IsHostedCheckBox.Checked = false; } else { IsHostedCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_IsHosted"].ToString()); } if (string.IsNullOrEmpty(dt.Rows[0]["Sof_BlackboxTest"].ToString())) { BlackboxTestCheckBox.Checked = false; } else { BlackboxTestCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_BlackboxTest"].ToString()); } if (string.IsNullOrEmpty(dt.Rows[0]["Sof_WhiteboxTest"].ToString())) { WhiteboxTestCheckBox.Checked = false; } else { WhiteboxTestCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_WhiteboxTest"].ToString()); } if (string.IsNullOrEmpty(dt.Rows[0]["Sof_Vernability"].ToString())) { VernabilityCheckBox.Checked = false; } else { VernabilityCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_Vernability"].ToString()); } if (string.IsNullOrEmpty(dt.Rows[0]["Sof_PenitrationTest"].ToString())) { PenitrationTestCheckBox.Checked = false; } else { Convert.ToBoolean(dt.Rows[0]["Sof_PenitrationTest"].ToString()); } if (string.IsNullOrEmpty(dt.Rows[0]["Sof_OperationalManual"].ToString())) { OperationalManualCheckBox.Checked = false; } else { OperationalManualCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_OperationalManual"].ToString()); } //IsHostedCheckBox.Checked =Convert.ToBoolean(dt.Rows[0]["Sof_IsHosted"].ToString()); // BlackboxTestCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_BlackboxTest"].ToString()); // WhiteboxTestCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_WhiteboxTest"].ToString()); //VernabilityCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_Vernability"].ToString()); //PenitrationTestCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_PenitrationTest"].ToString()); // OperationalManualCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["Sof_OperationalManual"].ToString()); PortTextBox.Text = dt.Rows[0]["Sof_Port"].ToString(); ScemaNameTextBox.Text = dt.Rows[0]["Sof_ScemaName"].ToString(); try { vendorDropDownList.SelectedValue = dt.Rows[0]["Sof_V_slNo"].ToString(); } catch { } try { resPonsibleDropDownList.SelectedValue = dt.Rows[0]["Sof_Res_Person"].ToString(); } catch { } remarksTextBox.Text = dt.Rows[0]["Remarks"].ToString(); if (string.IsNullOrEmpty(dt.Rows[0]["Sof_UAT_Date"].ToString())) { UATsignDateTextBox.Text = ""; } else { Convert.ToDateTime(dt.Rows[0]["Sof_UAT_Date"].ToString()).ToString("yyyy-MM-dd"); } ViewState["id"] = id; DataTable dtCurrentTable = oITAssetMonitoringDLL.GetSof_UAT_Person(" Where Sof_UAT_Person.Sof_slNo=" + id + ""); ViewState["CurrentTable"] = dtCurrentTable; if (dtCurrentTable.Rows.Count > 0) { //Re bind the GridView for the updated data GridView2.DataSource = dtCurrentTable; GridView2.DataBind(); } else { SetInitialRow(); GridView2.DataSource = dtCurrentTable; GridView2.DataBind(); } DataTable dtCurrentTable1 = oITAssetMonitoringDLL.GetSof_FallBack_Person(" Where Sof_FallBack_Person.Sof_slNo=" + id + ""); ViewState["CurrentTable1"] = dtCurrentTable1; if (dtCurrentTable1.Rows.Count > 0) { //Re bind the GridView for the updated data GridView3.DataSource = dtCurrentTable1; GridView3.DataBind(); } else { SetInitialRow1(); GridView3.DataSource = dtCurrentTable1; GridView3.DataBind(); } //(DataTable)ViewState["CurrentTable"]; addButton.Text = "Update"; } } }
protected void BindGridView() { string sqlText = "select g.dba_name as shipper_name, c.dba_name as customer_name, a.customer_acct as customer_no, e.auto_uid as so_uid ,g.dba_name as shipout_name, d.history_type as history_type, " + " a.*,d.so_num as so_no,(e.shipout_date - 1 ) as shipout_date ,d.item_piece_shipout as item_shipout,d.item_piece_remain as item_remain,e.consignee_acct as shipout_acct " + " ,(d.item_piece_remain + d.item_piece_shipout) as remain_QTY , e.PO_NO as PONO, e.customer_ref_no as customer_ref from warehouse_receipt a left join organization b " + " on (a.elt_account_number=b.elt_account_number and a.shipper_acct = b.org_account_number) " + " left join organization c " + " on (a.elt_account_number=c.elt_account_number and a.customer_acct = c.org_account_number) " + " left join warehouse_history d " + " on (a.elt_account_number=c.elt_account_number and a.wr_num = d.wr_num) " + " left join warehouse_shipout e " + " on (a.elt_account_number=c.elt_account_number and d.so_num = e.so_num) " + " left join organization g " + " on (a.elt_account_number=g.elt_account_number and e.consignee_acct = g.org_account_number)" + " where a.elt_account_number=" + elt_account_number + " AND ISNULL(a.job_status,'Pending')='Pending'" + " and ISNULL(d.so_num, '') <>'' and a.customer_acct >'0' and isNUll(a.customer_acct,'0') <> '0'"; string sqlText3 = "select b.dba_name as shipper_name, c.dba_name as customer_name, a.customer_acct as customer_no, e.auto_uid as so_uid, d.history_type as history_type," + " a.*,d.so_num as so_no,(e.shipout_date-1) as shipout_date ,d.item_piece_shipout as item_shipout,d.item_piece_remain as item_remain" + " ,(d.item_piece_remain + d.item_piece_shipout) as remain_QTY , e.PO_NO as PONO, e.customer_ref_no as customer_ref from warehouse_receipt a left join organization b " + " on (a.elt_account_number=b.elt_account_number and a.shipper_acct = b.org_account_number) " + " left join organization c " + " on (a.elt_account_number=c.elt_account_number and a.customer_acct = c.org_account_number) " + " left join warehouse_history d " + " on (a.elt_account_number=c.elt_account_number and a.wr_num = d.wr_num) " + " left join warehouse_shipout e " + " on (a.elt_account_number=c.elt_account_number and d.so_num = e.so_num) " + " where a.elt_account_number=" + elt_account_number + " AND ISNULL(a.job_status,'Pending')='Pending'"; string sqlText2 = "select b.dba_name as shipper_name, c.dba_name as customer_name, b.dba_name as received_name," + " a.* from warehouse_receipt a left join organization b " + " on (a.elt_account_number=b.elt_account_number and a.shipper_acct = b.org_account_number) " + " left join organization c " + " on (a.elt_account_number=c.elt_account_number and a.customer_acct = c.org_account_number) "; if (lstShipOut.Text != "" || txtCustomerRef2.Text != "" || txtPO2.Text != "") { sqlText2 = sqlText2 + " left join warehouse_history d " + " on (a.elt_account_number=c.elt_account_number and a.wr_num = d.wr_num) " + " left join warehouse_shipout e " + " on (a.elt_account_number=c.elt_account_number and d.so_num = e.so_num) "; } sqlText2 = sqlText2 + " where a.elt_account_number=" + elt_account_number + " AND ISNULL(a.job_status,'Pending')='Pending'" + " AND a.item_piece_remain>=0 and a.item_piece_origin > 0"; string sqlText4 = "SELECT distinct c.dba_name as customer_name,a.customer_acct as customer_no from warehouse_receipt a left join organization b " + " on (a.elt_account_number=b.elt_account_number and a.shipper_acct = b.org_account_number) " + " left join organization c " + " on (a.elt_account_number=c.elt_account_number and a.customer_acct = c.org_account_number) " + " left join warehouse_history d " + " on (a.elt_account_number=c.elt_account_number and a.wr_num = d.wr_num) " + " left join warehouse_shipout e " + " on (a.elt_account_number=c.elt_account_number and d.so_num = e.so_num) " + " left join organization g " + " on (a.elt_account_number=g.elt_account_number and e.consignee_acct = g.org_account_number)" + " where a.elt_account_number=" + elt_account_number + " AND ISNULL(a.job_status,'Pending')='Pending'" + " and ISNULL(d.so_num, '') <>'' and a.customer_acct >'0' and isNUll(a.customer_acct,'0') <> '0'"; string sqlText5 = "SELECT distinct c.dba_name as customer_name,a.customer_acct as customer_no from warehouse_receipt a left join organization b " + " on (a.elt_account_number=b.elt_account_number and a.shipper_acct = b.org_account_number) " + " left join organization c " + " on (a.elt_account_number=c.elt_account_number and a.customer_acct = c.org_account_number) "; if (lstShipOut.Text != "" || txtCustomerRef2.Text != "" || txtPO2.Text != "") { sqlText5 = sqlText5 + " left join warehouse_history d " + " on (a.elt_account_number=c.elt_account_number and a.wr_num = d.wr_num) " + " left join warehouse_shipout e " + " on (a.elt_account_number=c.elt_account_number and d.so_num = e.so_num) "; } sqlText5 = sqlText5 + " where a.elt_account_number=" + elt_account_number + " AND ISNULL(a.job_status,'Pending')='Pending'"; sqlText = SQLSetFilter(sqlText); // out sqlText2 = SQLSetFilterWRIn(sqlText2); // in //sqlText3 = SQLSetFilterWRIn(sqlText3); // in out //sqlText4 = SQLSetFilterWRIn(sqlText4); //in customer Sort //sqlText5 = SQLSetFilterWRIn(sqlText5);//out customer Sort try { if (check1.Checked == true) { if (sortby == "") { if (sortwayB.Text.ToString() == "") { sortby = "customer_name"; } else { sortby = sortwayB.Text.ToString(); } } else { sortwayB.Text = sortby.ToString(); if (sortby.ToString() == sortway.Text) { sortway.Text = ""; } else { sortway.Text = sortby.ToString(); } } if (sortby2 == "") { if (sortway2B.Text.ToString() == "") { sortby2 = "customer_name"; } else { sortby2 = sortway2B.Text.ToString(); } } else { sortway2B.Text = sortby2.ToString(); if (sortby2.ToString() == sortway2.Text) { sortway2.Text = ""; } else { sortway2.Text = sortby2.ToString(); } } sqlText = sqlText + " order by " + sortby2; sqlText2 = sqlText2 + " order by " + sortby; sqlText3 = sqlText3 + " order by customer_name,d.wr_num"; sqlText4 = sqlText4 + " order by customer_name"; sqlText5 = sqlText5 + " order by customer_name"; if (sortby.ToString() == sortway.Text) { sqlText2 = sqlText2 + " DESC"; } if (sortby2.ToString() == sortway2.Text) { sqlText = sqlText + " DESC"; } //clearup sortby = ""; sortby2 = ""; } else { if (sortby == "") { if (sortwayB.Text.ToString() == "") { sortby = "a.wr_num"; } else { sortby = sortwayB.Text.ToString(); } } else { sortwayB.Text = sortby.ToString(); if (sortby.ToString() == sortway.Text) { sortway.Text = ""; } else { sortway.Text = sortby.ToString(); } } if (sortby2 == "") { if (sortway2B.Text.ToString() == "") { sortby2 = "d.so_num"; } else { sortby2 = sortway2B.Text.ToString(); } } else { sortway2B.Text = sortby2.ToString(); if (sortby2.ToString() == sortway2.Text) { sortway2.Text = ""; } else { sortway2.Text = sortby2.ToString(); } } sqlText = sqlText + " order by " + sortby2; sqlText2 = sqlText2 + " order by " + sortby; sqlText3 = sqlText3 + " order by d.so_num,d.wr_num"; sqlText4 = sqlText4 + " order by customer_name"; sqlText5 = sqlText5 + " order by customer_name"; if (sortby.ToString() == sortway.Text) { sqlText2 = sqlText2 + " DESC"; } if (sortby2.ToString() == sortway2.Text) { sqlText = sqlText + " DESC"; } sortby = ""; sortby2 = ""; } Session["WrOutSQL"] = sqlText; Session["WrInSQL"] = sqlText2; Session["WrInOutSQL"] = sqlText3; Session["CustomerSQL"] = sqlText4; Session["CustomerSQL2"] = sqlText5; MakeDataSet("WrOutTable", sqlText); MakeDataSet("WrInTable", sqlText2); MakeDataSet("WrInOutTable", sqlText3); if (check1.Checked == true && nextpage == null) { MakeDataSet("CustomerTable", sqlText4); FormatDataTable("CustomerTable"); MakeDataSet("CustomerTable2", sqlText5); FormatDataTable("CustomerTable2"); } //try //{ if (ds.Tables["WrOutTable"].Rows.Count == 0) { MakeEmptyGridView(GridView1, "WrOutTable"); isEmptyOut = "yes"; } else { isEmptyIn = null; if (!check1.Checked) { GridView1.PageSize = maxRows; GridView1.DataSource = ds.Tables["WrOutTable"].DefaultView; GridView1.DataBind(); } } if (ds.Tables["WrInTable"].Rows.Count == 0) { MakeEmptyGridView(GridView2, "WrInTable"); isEmptyIn = "yes"; } else { isEmptyIn = null; if (!check1.Checked) { GridView2.PageSize = maxRows; GridView2.DataSource = ds.Tables["WrInTable"].DefaultView; GridView2.DataBind(); } } if (!check1.Checked) { GridView3.Visible = false; //GridView4.Visible = false; GridView5.Visible = false; //GridView6.Visible = false; } else { GridView1.Visible = false; GridView2.Visible = false; GridView5.Visible = true; GridView3.Visible = true; } if (check1.Checked == true) { GridView2.Visible = false; GridView1.Visible = false; if (ds.Tables["CustomerTable"].Rows.Count == 0) { MakeEmptyGridView(GridView3, "CustomerTable"); } if (ds.Tables["CustomerTable2"].Rows.Count == 0) { MakeEmptyGridView(GridView5, "CustomerTable2"); } GridView3.PageSize = maxRows; GridView3.DataSource = ds.Tables["CustomerTable"].DefaultView; GridView3.DataBind(); GridView5.PageSize = maxRows; GridView5.DataSource = ds.Tables["CustomerTable2"].DefaultView; GridView5.DataBind(); ds.Relations.Clear(); if (ds.Tables["CustomerTable2"].Rows.Count != 0) { ds.Relations.Add(ds.Tables["CustomerTable2"].Columns["customer_name"], ds.Tables["WrInTable"].Columns["customer_name"]); for (int rowIndex = 0; rowIndex < GridView5.Rows.Count; rowIndex++) { GridView childgv = (GridView)GridView5.Rows[rowIndex].FindControl("GridView6"); if (childgv != null) { DataRow[] subSet = ds.Tables["CustomerTable2"].Rows[rowIndex].GetChildRows(ds.Relations[0]); if (Child_page_IN != 0) { childgv.PageIndex = Child_page_IN; } DataTable dt = new DataTable(); dt = ds.Tables["WrInTable"].Clone(); if (subSet.Length == 0) { if (rowIndex == 0) { MakeEmptyGridView2(GridView5); } else { GridView5.Rows[rowIndex].Visible = false; } } else { for (int i = 0; i < subSet.Length; i++) { dt.Rows.Add(subSet[i].ItemArray); } childgv.DataSource = dt; childgv.DataBind(); if (GridView5.Rows[0].Cells[0].Text == "No Records Found.") { GridView5.Rows[0].Visible = false; } } } } } if (ds.Tables["CustomerTable"].Rows.Count != 0) { ds.Relations.Add(ds.Tables["CustomerTable"].Columns["customer_name"], ds.Tables["WrOutTable"].Columns["customer_name"]); for (int rowIndex = 0; rowIndex < GridView3.Rows.Count; rowIndex++) { GridView childgv = (GridView)GridView3.Rows[rowIndex].FindControl("GridView4"); if (childgv != null) { DataRow[] subSet = ds.Tables["CustomerTable"].Rows[rowIndex].GetChildRows(ds.Relations[1]); if (Child_page_OUT != 0) { childgv.PageIndex = Child_page_OUT; } DataTable dt = new DataTable(); dt = ds.Tables["WrOutTable"].Clone(); if (subSet.Length == 0) { if (rowIndex == 0) { MakeEmptyGridView2(GridView3); } else { GridView3.Rows[rowIndex].Visible = false; } } else { for (int i = 0; i < subSet.Length; i++) { dt.Rows.Add(subSet[i].ItemArray); } childgv.DataSource = dt; childgv.DataBind(); if (GridView3.Rows[0].Cells[0].Text == "No Records Found.") { GridView3.Rows[0].Visible = false; } } } } } if (listResultSelect.SelectedValue == "WROUT") { GridView3.Visible = true; GridView5.Visible = false; } else if (listResultSelect.SelectedValue == "WRIN") { GridView3.Visible = false; GridView5.Visible = true; } else { GridView3.Visible = true; GridView5.Visible = true; } } else { if (listResultSelect.SelectedValue == "WROUT") { GridView1.Visible = true; GridView2.Visible = false; GridView3.Visible = false; GridView5.Visible = false; } else if (listResultSelect.SelectedValue == "WRIN") { GridView1.Visible = false; GridView2.Visible = true; GridView3.Visible = false; GridView5.Visible = false; } else { GridView1.Visible = true; GridView2.Visible = true; GridView3.Visible = false; GridView5.Visible = false; } ds.Dispose(); } Get_total(); } catch { Response.Write("<script>alert('Date Error. Please Check the Date and Try again'); self.close();</script>"); Response.Write("<script>window.history.back();</script>"); } }
protected void Button6_Click(object sender, EventArgs e) { GridView3.DataBind(); }
private void Bindgrid3() { GridView3.DataSource = pmp.PurchaseInfo(Convert.ToInt32(DropDownList1.SelectedValue), Convert.ToInt32(DropDownList2.SelectedValue)); GridView3.DataBind(); UpdatePanel5.Update(); }
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 ShowData() { string query; SqlCommand cmd; SqlDataAdapter adpt; DataTable dt = new DataTable(); if (coursename == null) { coursename = ddlCourseType.SelectedValue.Replace(" ", "_"); } con.Open(); if (lbEntryType.SelectedItem.Text.Equals("All")) { query = "select Type_name from " + coursename.Replace(" ", "_") + "_" + ddlCourseNo.SelectedValue.Replace("-", string.Empty) + "_Entry_Type where Enrolledin IS Not NULL"; cmd = new SqlCommand(query, con); SqlDataReader dr = cmd.ExecuteReader(); query = ""; while (dr.Read()) { query = query + "Select Personal_No as \"Personal No\", Name, Rank from " + coursename.Replace(" ", "_") + "_" + ddlCourseNo.SelectedValue.Replace("-", string.Empty) + "_" + dr.GetString(0).Replace(" ", "_") + " where name <> 'MAXIMUM MARKS' UNION "; } dr.Close(); if (query.Contains("UNION")) { query = query.Substring(0, query.LastIndexOf("UNION")); } if (!query.Equals("")) { cmd = new SqlCommand(query, con); adpt = new SqlDataAdapter(cmd); adpt.Fill(dt); } GridView1.DataSource = dt; GridView1.DataBind(); GridView3.Visible = false; GridView3.EnableViewState = false; GridView1.Visible = true; GridView1.EnableViewState = true; } else { table_name = coursename.Replace(" ", "_") + "_" + ddlCourseNo.SelectedValue.Replace("-", string.Empty) + "_" + lbEntryType.SelectedItem.Text.Replace(" ", "_"); //if (dt.Rows.Count > 0) //{ //exlfile.Visible = false; //single.Visible = true; if (string.IsNullOrEmpty(Session["User_ID"] as string)) { query = "If exists(select name from sysobjects where name = '" + table_name + "') Select Personal_No as \"Personal No\", Name, Rank from " + table_name + " where name <> 'MAXIMUM MARKS' "; //Response.Write(query); cmd = new SqlCommand(query, con); adpt = new SqlDataAdapter(cmd); dt = new DataTable(); adpt.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); GridView3.Visible = false; GridView3.EnableViewState = false; GridView1.Visible = true; GridView1.EnableViewState = true; } else if (Session["Access_Level"].ToString().Equals("4")) { query = "If exists(select name from sysobjects where name = '" + table_name + "') Select Personal_No as \"Personal No\", Name, Rank from " + table_name + " where name <> 'MAXIMUM MARKS' "; //Response.Write(query); cmd = new SqlCommand(query, con); adpt = new SqlDataAdapter(cmd); dt = new DataTable(); adpt.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); GridView3.Visible = false; GridView3.EnableViewState = false; GridView1.Visible = true; GridView1.EnableViewState = true; } else { query = "If exists(select name from sysobjects where name = '" + table_name + "') Select Personal_No as \"ID\", Personal_No as \"Personal No\", Name, Rank from " + table_name + " where name <> 'MAXIMUM MARKS' "; //Response.Write(query); cmd = new SqlCommand(query, con); adpt = new SqlDataAdapter(cmd); dt = new DataTable(); adpt.Fill(dt); GridView3.DataSource = dt; GridView3.DataBind(); GridView3.Visible = true; GridView3.EnableViewState = true; GridView1.Visible = false; GridView1.EnableViewState = false; } flag = 1; SubmitButton.Text = "Add"; } Button1.Visible = true; Button1.EnableViewState = true; con.Close(); }
private void Bindgrid3() { GridView3.DataSource = lpp.Query_ProType(TextBox1.Text, TextBox2.Text); GridView3.DataBind(); }
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 Page_Load(object sender, EventArgs e) { //Add columns to DataTable. dt.Columns.AddRange( new DataColumn[9] { new DataColumn("project"), new DataColumn("project_id"), new DataColumn("indicator_type"), new DataColumn("indicator_type_id"), new DataColumn("indicator"), new DataColumn("target"), new DataColumn("fsda_indicator_code_id"), new DataColumn("fsda_indicator_code"), new DataColumn("id") }); //Set AutoIncrement True for the First Column. dt.Columns["id"].AutoIncrement = true; //Set the Starting or Seed value. dt.Columns["id"].AutoIncrementSeed = 1; //Set the Increment value. dt.Columns["id"].AutoIncrementStep = 1; disag_dt.Columns.AddRange( new DataColumn[3] { new DataColumn("disaggregation_id"), //new DataColumn("disaggregation"), new DataColumn("foreign_id"), new DataColumn("id") }); disag_dt.Columns["id"].AutoIncrement = true; disag_dt.Columns["id"].AutoIncrementSeed = 1; disag_dt.Columns["id"].AutoIncrementStep = 1; /*temp.Columns.AddRange( * new DataColumn[2] * { * new DataColumn("disaggregation"), * new DataColumn("foreign_id") * });*/ temp.Columns.AddRange( new DataColumn[2] { new DataColumn("disaggregation_id"), new DataColumn("foreign_id") }); if (!IsPostBack) { ViewState["dt"] = dt; ViewState["disag_dt"] = disag_dt; temp.Clear(); ViewState["temp"] = temp; this.BindGrid(); EntityDataSource1.WhereParameters.Clear(); EntityDataSource1.WhereParameters.Add("project_indicator_id", TypeCode.Int32, HiddenProjectIndicatorID.Value.Trim()); GridView3.DataBind(); } }
protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e) { string HeitiG = ""; Global gl = new Global(); if (e.CommandName == "DeleteCompEvent") //DELETE THE COMPETITION EVENT - NOT USED ANY MORE { int index = Convert.ToInt32(e.CommandArgument); GridViewRow CurrentRow = GridView3.Rows[index]; string CompCode = (string)this.GridView3.DataKeys[index]["mot"]; Int32 EventLineNo = (Int32)this.GridView3.DataKeys[index]["greinnumer"]; if ((CompCode != "") & (EventLineNo > 0)) { AthleticCompetitionCRUD AthlCompCRUD = new AthleticCompetitionCRUD(); Athl_CompetitionEvents AthlCompetitionEvent = new Athl_CompetitionEvents(); AthlCompetitionEvent = AthlCompCRUD.GetCompetitionEvent(CompCode, EventLineNo); AthlCompCRUD.DeleteCompetitonEvent(AthlCompetitionEvent); GridView3.DataBind(); } } if (e.CommandName == "ShowCompetitors") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow CurrentRow = GridView3.Rows[index]; string CompCode = (string)this.GridView3.DataKeys[index]["mot"]; Int32 EventLineNo = (Int32)this.GridView3.DataKeys[index]["greinnumer"]; //gl.SetCompetitionEventNo(GridView3.DataKeys[index].Values[1].ToString()); string EventLineNoText = GridView3.DataKeys[index].Values[1].ToString(); index = GetColumnIndexByName(CurrentRow, "heitigreinar"); HeitiG = CurrentRow.Cells[index].Text; HeitiG = HttpUtility.HtmlDecode(HeitiG); gl.SetCompetitionEventName(HeitiG); Response.Redirect("CompetitorsInEvent.aspx?Event=" + EventLineNoText); } if (e.CommandName == "EnterEventResults") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow CurrentRow = GridView3.Rows[index]; string CompCode = (string)this.GridView3.DataKeys[index]["mot"]; Int32 EventLineNo = (Int32)this.GridView3.DataKeys[index]["greinnumer"]; //gl.SetCompetitionEventNo(GridView3.DataKeys[index].Values[1].ToString()); string EventLineNoText = GridView3.DataKeys[index].Values[1].ToString(); index = GetColumnIndexByName(CurrentRow, "heitigreinar"); HeitiG = CurrentRow.Cells[index].Text; HeitiG = HttpUtility.HtmlDecode(HeitiG); gl.SetCompetitionEventName(HeitiG); Response.Redirect("UpdateEventResults.aspx?Event=" + EventLineNoText); } if (e.CommandName == "ShowResults") { string EventCode = ""; string Gend; string EventStatus = ""; string EventLineNoText = ""; Int32 index; index = Convert.ToInt32(e.CommandArgument); GridViewRow CurrentRow = GridView3.Rows[index]; EventLineNoText = GridView3.DataKeys[index].Values[1].ToString(); //gl.SetCompetitionEventNo(EventLineNoText); index = GetColumnIndexByName(CurrentRow, "heitigreinar"); HeitiG = CurrentRow.Cells[index].Text; HeitiG = HttpUtility.HtmlDecode(HeitiG); gl.SetCompetitionEventName(HeitiG); index = GetColumnIndexByName(CurrentRow, "greinnumer"); EventCode = CurrentRow.Cells[index].Text; //gl.SetSelectedEventCode(EventCode); gl.SetSelectedEventCode(EventLineNoText); index = GetColumnIndexByName(CurrentRow, "kyn"); if (CurrentRow.Cells[index].Text.Substring(0, 1) == "B") { gl.SetSelectedGender("0"); } else { Gend = CurrentRow.Cells[index].Text; if (Gend == "Karl") { gl.SetSelectedGender("1"); } else { gl.SetSelectedGender("2"); } } index = GetColumnIndexByName(CurrentRow, "StaðaKeppni"); EventStatus = CurrentRow.Cells[index].Text; if (EventStatus == "Stendur yfir") { Response.Redirect("EventProgressLiveUpdate.aspx?EventLineNo=" + EventLineNoText + "&EventName=" + HeitiG); } else { Response.Redirect("PrintEventResults.aspx?Event=" + EventLineNoText); } } if (e.CommandName == "PrizeCeremonyFinished") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow CurrentRow = GridView3.Rows[index]; string CompCode = (string)this.GridView3.DataKeys[index]["mot"]; Int32 EventLineNo = (Int32)this.GridView3.DataKeys[index]["greinnumer"]; string EventLineNoText = GridView3.DataKeys[index].Values[1].ToString(); EventLineNo = Convert.ToInt32(EventLineNoText); AthleticCompetitionCRUD AthlCompCRUD = new AthleticCompetitionCRUD(); Athl_CompetitionEvents CompEvent = new Athl_CompetitionEvents(); if ((CompCode != "") && (EventLineNo > 0)) { CompEvent = AthlCompCRUD.GetCompetitionEvent(CompCode, EventLineNo); AthleticsEntities1 AthlEnt = new AthleticsEntities1(); AthlEnt.UpdateEventDateTimeAndStatus(CompCode, EventLineNo, CompEvent.dagsetning, CompEvent.timi, CompEvent.stadakeppni, 2); //Set Prize Ceremony has finished for this Event Int32 ColNoForPrizeCeremonyStatus = 0; ColNoForPrizeCeremonyStatus = GetColumnIndexByName(CurrentRow, "tilkynnaverdlaunaafhendingu"); CurrentRow.Cells[ColNoForPrizeCeremonyStatus].Text = "Lokið"; } } }
protected void OkBtn_Click(object sender, EventArgs e) { try { if (Disaggregation3DropDown.SelectedItem.Value == "0" || Disaggregation3DropDown.SelectedItem.Value == "new") { if (Disaggregation2DropDown.SelectedItem.Value == "0" || Disaggregation2DropDown.SelectedItem.Value == "new") { if (Disaggregation1DropDown.SelectedItem.Value == "0" || Disaggregation1DropDown.SelectedItem.Value == "new") { //Nothing to save return; } else { //Save the first disaggre int projIndicatorId = int.Parse(HiddenProjectIndicatorID.Value.Trim()); int disagId = int.Parse(Disaggregation1DropDown.SelectedItem.Value.Trim()); /*var tData = from data in db.project_indicator_disaggregation * where data.project_indicator_id == projIndicatorId * && data.disaggregation_id == disagId * select data; * if (tData.Count() == 0) * { * project_indicator_disaggregation newDis = new project_indicator_disaggregation(); * newDis.project_indicator_id = int.Parse(HiddenProjectIndicatorID.Value.Trim()); * newDis.disaggregation_id = int.Parse(Disaggregation1DropDown.SelectedItem.Value.Trim()); * db.project_indicator_disaggregation.Add(newDis); * }*/ DataTable myDt = ViewState["temp"] as DataTable; DataRow dr = myDt.NewRow(); dr[0] = disagId; dr[1] = projIndicatorId; myDt.Rows.Add(dr); ViewState["temp"] = myDt; GridView3.DataSource = myDt; GridView3.DataBind(); } } else { //Save the second disagr int projIndicatorId = int.Parse(HiddenProjectIndicatorID.Value.Trim()); int disagId = int.Parse(Disaggregation2DropDown.SelectedItem.Value.Trim()); /*var tData = from data in db.project_indicator_disaggregation * where data.project_indicator_id == projIndicatorId * && data.disaggregation_id == disagId * select data; * if (tData.Count() == 0) * { * project_indicator_disaggregation newDis = new project_indicator_disaggregation(); * newDis.project_indicator_id = int.Parse(HiddenProjectIndicatorID.Value.Trim()); * newDis.disaggregation_id = int.Parse(Disaggregation2DropDown.SelectedItem.Value.Trim()); * db.project_indicator_disaggregation.Add(newDis); * }*/ DataTable myDt = ViewState["temp"] as DataTable; DataRow dr = myDt.NewRow(); dr[0] = disagId; dr[1] = projIndicatorId; myDt.Rows.Add(dr); ViewState["temp"] = myDt; GridView3.DataSource = myDt; GridView3.DataBind(); } } else { //Save the thrid disagrr int projIndicatorId = int.Parse(HiddenProjectIndicatorID.Value.Trim()); int disagId = int.Parse(Disaggregation3DropDown.SelectedItem.Value.Trim()); /*var tData = from data in db.project_indicator_disaggregation * where data.project_indicator_id == projIndicatorId * && data.disaggregation_id == disagId * select data; * if (tData.Count() == 0) * { * project_indicator_disaggregation newDis = new project_indicator_disaggregation(); * newDis.project_indicator_id = int.Parse(HiddenProjectIndicatorID.Value.Trim()); * newDis.disaggregation_id = int.Parse(Disaggregation3DropDown.SelectedItem.Value.Trim()); * db.project_indicator_disaggregation.Add(newDis); * }*/ DataTable myDt = ViewState["temp"] as DataTable; DataRow dr = myDt.NewRow(); dr[0] = disagId; dr[1] = projIndicatorId; myDt.Rows.Add(dr); ViewState["temp"] = myDt; GridView3.DataSource = myDt; GridView3.DataBind(); } } catch (Exception ex) { throw new Exception(ex.Message); } finally { /*if(db.SaveChanges() > 0) * { * db.SaveChanges(); * * EntityDataSource1.WhereParameters.Clear(); * EntityDataSource1.WhereParameters.Add("project_indicator_id", TypeCode.Int32, HiddenProjectIndicatorID.Value.Trim()); * GridView3.DataBind(); * }*/ SaveDisaggregationBtn.Visible = true; } }
protected void btnAddOrg_Click(object sender, EventArgs e) { System.Data.SqlClient.SqlConnection sc = new System.Data.SqlClient.SqlConnection(); // sc.ConnectionString = @"Server=localhost;Database=WildTek;Trusted_Connection=Yes;"; String cs = ConfigurationManager.ConnectionStrings["WildTekConnectionString"].ConnectionString; sc.ConnectionString = cs; System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand(); System.Data.SqlClient.SqlCommand insertContact = new System.Data.SqlClient.SqlCommand(); System.Data.SqlClient.SqlCommand pullOrgID = new System.Data.SqlClient.SqlCommand(); sc.Open(); insert.Connection = sc; insertContact.Connection = sc; pullOrgID.Connection = sc; String orgName = textOrgName.Text; //String city = textOrgCity.Text; String county = textOrgCounty.Text; // String streetAddress = txtStreetAddress.Text; //String state = ddlState.SelectedValue; ; //String postalCode = txtPostalCode.Text; String contactFirstName = contactFirstName1.Text; String contactLastName = contactLastName1.Text; //String phoneNumber = txtPhoneNumber.Text; String email = txtEmail.Text; //String secondaryEmail = txtSecondaryEmail.Text; DateTime lastUpdated = DateTime.Today; String lastUpdatedBy = HttpUtility.HtmlEncode(Session["USER_ID"]); var hiddenValue = hiddenControl.Value; var hiddenCity1 = hiddenCity.Value; var hiddenState1 = hiddenState.Value; var hiddenZip1 = hiddenZip.Value; Organization newOrg = new Organization(orgName, hiddenCity1, county, hiddenValue, hiddenState1, hiddenZip1); insert.CommandText = "insert into Organization (orgName, city, county, lastUpdated, lastUpdatedBy, streetAddress, state, postalCode) values (@orgName, @city, @county, @lastUpdated, @lastUpdatedBy, @streetAddress, @state, @postalCode)"; insert.Parameters.AddWithValue("@orgName", newOrg.getOrgName()); insert.Parameters.AddWithValue("@city", hiddenCity1); insert.Parameters.AddWithValue("@county", newOrg.getCounty()); insert.Parameters.AddWithValue("@lastUpdated", lastUpdated); insert.Parameters.AddWithValue("@lastUpdatedBy", lastUpdatedBy); insert.Parameters.AddWithValue("@streetAddress", hiddenValue); insert.Parameters.AddWithValue("@state", hiddenState1); insert.Parameters.AddWithValue("@postalCode", hiddenZip1); //insert.Parameters.AddWithValue("@contactFirstName", newOrg.getContactFirstName()); //insert.Parameters.AddWithValue("@contactLastName", newOrg.getContactLastName()); //insert.Parameters.AddWithValue("@phoneNumber", newOrg.getPhoneNumber()); //insert.Parameters.AddWithValue("@email", newOrg.getEmail()); //insert.Parameters.AddWithValue("@secondaryEmail", newOrg.getSecondaryEmail()); insert.ExecuteNonQuery(); pullOrgID.Parameters.Clear(); pullOrgID.CommandText = "SELECT MAX(OrgID) From Organization"; int tempOrgID = (int)pullOrgID.ExecuteScalar(); insertContact.CommandText = "insert into ContactInformation (contactFirstName, contactLastName, contactEmail, PrimaryContact, OrgID, LastUpdated, LastUpdatedBy) values (@contactFN, @contactLN, @contactEmail, @primaryContact, @OrgID, @LastUpdated, @LastUpdatedBy)"; insertContact.Parameters.AddWithValue("@contactFN", contactFirstName); insertContact.Parameters.AddWithValue("@contactLN", contactLastName); insertContact.Parameters.AddWithValue("@contactEmail", email); insertContact.Parameters.AddWithValue("@PrimaryContact", "Y"); insertContact.Parameters.AddWithValue("@OrgID", tempOrgID); insertContact.Parameters.AddWithValue("@LastUpdated", lastUpdated); insertContact.Parameters.AddWithValue("@LastUpdatedBy", lastUpdatedBy); insertContact.ExecuteNonQuery(); //lblLastUpdated.Text = "Last Updated: " + lastUpdated; //lblLastUpdatedBy.Text = "Last Updated By: " + lastUpdatedBy; string read = "Select * from Organization"; SqlCommand cmd = new SqlCommand(read, sc); SqlDataReader myRead = cmd.ExecuteReader(); string read1 = "Select * from Organization"; SqlCommand cmd1 = new SqlCommand(read1, sc); SqlDataReader myRead1 = cmd1.ExecuteReader(); ddlOrganization.Items.Clear(); ddlOrg.Items.Clear(); ddlOrganization.Items.Add(new ListItem("--Select Organization--", "0")); ddlOrg.Items.Add(new ListItem("--Select Organization--", "0")); while (myRead.Read()) { ddlOrganization.Items.Add(new ListItem(myRead["OrgName"].ToString(), myRead["OrgID"].ToString())); } while (myRead1.Read()) { ddlOrg.Items.Add(new ListItem(myRead1["OrgName"].ToString(), myRead1["OrgID"].ToString())); } ddlOrganization.DataBind(); ddlOrg.DataBind(); textOrgName.Text = ""; // textOrgCity.Text = ""; textOrgCounty.Text = ""; //txtStreetAddress.Text = ""; // ddlState.SelectedIndex = 0; ddlOrg.SelectedIndex = 0; // txtPostalCode.Text = ""; txtContactFirstName.Text = ""; txtContactLastName.Text = ""; contactFirstName1.Text = ""; contactLastName1.Text = ""; //txtPhoneNumber.Text = ""; txtEmail.Text = ""; //txtSecondaryEmail.Text = ""; sc.Close(); GridView1.DataBind(); GridView3.DataBind(); }
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 btnUpdateOrganization_Click(object sender, EventArgs e) { System.Data.SqlClient.SqlConnection sc = new System.Data.SqlClient.SqlConnection(); // sc.ConnectionString = @"Server=localhost;Database=WildTek;Trusted_Connection=Yes;"; String cs = ConfigurationManager.ConnectionStrings["WildTekConnectionString"].ConnectionString; sc.ConnectionString = cs; sc.Open(); System.Data.SqlClient.SqlCommand update = new System.Data.SqlClient.SqlCommand(); update.Connection = sc; SqlConnection con = new SqlConnection(cs); System.Data.SqlClient.SqlCommand updatePrimaryContact = new System.Data.SqlClient.SqlCommand(); updatePrimaryContact.Connection = sc; System.Data.SqlClient.SqlCommand updateContact = new System.Data.SqlClient.SqlCommand(); updateContact.Connection = sc; String tempLastUpdatedBy = HttpUtility.HtmlEncode(Session["USER_ID"].ToString()); update.CommandText = "update organization set orgName = @orgName, city = @city, county = @county, lastUpdated = @lastUpdated, lastUpdatedBy = @lastUpdatedBy, streetAddress = @streetAddress, state = @state, postalCode = @postalCode where orgID = @orgID"; update.Parameters.AddWithValue("@orgName", txtOrgName.Text); update.Parameters.AddWithValue("@city", txtCity.Text); update.Parameters.AddWithValue("@county", txtCounty.Text); update.Parameters.AddWithValue("@orgID", ddlOrganization.SelectedItem.Value); update.Parameters.AddWithValue("@lastUpdated", DateTime.Today); update.Parameters.AddWithValue("@lastUpdatedBy", tempLastUpdatedBy); update.Parameters.AddWithValue("@streetAddress", txtStreetAddress2.Text); update.Parameters.AddWithValue("@state", ddlState2.SelectedItem.Value); update.Parameters.AddWithValue("@postalCode", txtPostalCode2.Text); //update.Parameters.AddWithValue("@contactFirstName", txtContactFirstName2.Text); //update.Parameters.AddWithValue("@contactLastName", txtContactLastName2.Text); //update.Parameters.AddWithValue("@phoneNumber", txtPhoneNumber2.Text); //update.Parameters.AddWithValue("@email", txtEmail2.Text); //update.Parameters.AddWithValue("@secondaryEmail", txtSecondaryEmail2.Text); update.ExecuteNonQuery(); updatePrimaryContact.Parameters.Clear(); updatePrimaryContact.CommandText = "update ContactInformation set PrimaryContact='N' where OrgID = @orgID"; updatePrimaryContact.Parameters.AddWithValue("@orgID", ddlOrganization.SelectedItem.Value); updatePrimaryContact.ExecuteNonQuery(); updateContact.Parameters.Clear(); updateContact.CommandText = "update ContactInformation set PrimaryContact='Y' where ContactID = @contactID"; updateContact.Parameters.AddWithValue("@contactID", ddlContacts.SelectedValue); updateContact.ExecuteNonQuery(); // lblLastUpdated.Text = "Last Updated: " + DateTime.Today; // lblLastUpdatedBy.Text = "Last Updated By: " + "WildTek Developers"; string read = "Select * from Organization"; SqlCommand cmd = new SqlCommand(read, sc); SqlDataReader myRead = cmd.ExecuteReader(); ddlOrganization.Items.Clear(); ddlOrganization.Items.Add(new ListItem("--Select Organization--", "0")); while (myRead.Read()) { ddlOrganization.Items.Add(new ListItem(myRead["OrgName"].ToString(), myRead["OrgID"].ToString())); } ddlOrganization.DataBind(); txtOrgName.Text = ""; txtCity.Text = ""; txtCounty.Text = ""; txtStreetAddress2.Text = ""; ddlState2.SelectedIndex = 0; ddlOrganization.SelectedIndex = 0; txtPostalCode2.Text = ""; ddlContacts.ClearSelection(); //txtContactFirstName.Text = ""; //txtContactLastName.Text = ""; //txtPhoneNumber.Text = ""; //txtEmail.Text = ""; //txtSecondaryEmail.Text = ""; sc.Close(); GridView1.DataBind(); GridView3.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); DataTable dt1 = new DataTable(); DataTable dt2 = new DataTable(); string cs2 = ConfigurationManager.AppSettings["DBConnectionString"]; using (SqlConnection con = new SqlConnection(cs2)) { StringBuilder sb1 = new StringBuilder(); sb1.Append("select ID_klient, nazwisko, wiek from Klient"); SqlCommand cmd = new SqlCommand(sb1.ToString(), con); cmd.CommandType = CommandType.Text; con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); dt.Load(rdr); GridView1.DataSource = dt; GridView1.DataBind(); con.Close(); } using (SqlConnection con = new SqlConnection(cs2)) { StringBuilder sb1 = new StringBuilder(); sb1.Append("select ID_czesc, nazwa, cena from Czesci"); SqlCommand cmd = new SqlCommand(sb1.ToString(), con); cmd.CommandType = CommandType.Text; con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); dt1.Load(rdr); GridView2.DataSource = dt1; GridView2.DataBind(); con.Close(); } using (SqlConnection con = new SqlConnection(cs2)) { StringBuilder sb1 = new StringBuilder(); sb1.Append("select ID_samochod, Marka, Model, Rok_prod from Samochod"); SqlCommand cmd = new SqlCommand(sb1.ToString(), con); cmd.CommandType = CommandType.Text; con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); dt2.Load(rdr); GridView3.DataSource = dt2; GridView3.DataBind(); con.Close(); } }
protected void Page_Load(object sender, EventArgs e) { PDT = PAdapter.Select_By_SID(Convert.ToInt32(Session["sid"].ToString())); GridView3.DataSource = PDT; GridView3.DataBind(); }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { //string AnimalProgram = "SELECT Animal.AnimalName, SUM(NewProgram.TotalKids) AS TotalKids, SUM(NewProgram.TotalAdults) AS TotalAdults, SUM(NewProgram.TotalPeople) AS TotalPeople, COUNT(NewProgram.ProgramID) AS 'Total Programs' " + // "FROM AssignAnimal INNER JOIN NewProgram ON AssignAnimal.NewProgramID = NewProgram.NewProgramID INNER JOIN Animal ON AssignAnimal.AnimalID = Animal.AnimalID INNER JOIN Program ON NewProgram.ProgramID = Program.ProgramID WHERE AssignAnimal.AnimalID = @AnimalID GROUP BY Animal.AnimalName"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); id = Convert.ToInt32(GridView1.SelectedValue.ToString()); //SqlCommand cmd = sc.CreateCommand(); //cmd.CommandType = CommandType.Text; //cmd.CommandText = AnimalProgram; //cmd.Parameters.AddWithValue("@AnimalID", id); //SqlDataAdapter da = new SqlDataAdapter(cmd); //DataTable dt = new DataTable(); //da.Fill(dt); //GridView2.DataSource = dt; //GridView2.DataBind(); string programInfo = "SELECT Animal.AnimalName, Program.ProgramName, Program.ProgramType, format(Program.ProgramCost,'C','en-us') as [Cost], Convert(CHAR(10),[NewProgram].[DateCompleted],101) as [Date] FROM Animal INNER JOIN AssignAnimal ON Animal.AnimalID = AssignAnimal.AnimalID INNER JOIN NewProgram ON AssignAnimal.NewProgramID = NewProgram.NewProgramID INNER JOIN Program ON NewProgram.ProgramID = Program.ProgramID WHERE AssignAnimal.AnimalID = @AnimalID"; SqlCommand cmd2 = sc.CreateCommand(); cmd2.CommandType = CommandType.Text; cmd2.CommandText = programInfo; cmd2.Parameters.AddWithValue("@AnimalID", id); SqlDataAdapter da2 = new SqlDataAdapter(cmd2); DataTable dt2 = new DataTable(); da2.Fill(dt2); GridView3.DataSource = dt2; GridView3.DataBind(); //GridView2.Visible = true; GridView3.Visible = true; String strGetAnimal = "Select Status, AnimalType, AnimalName from [dbo].[Animal] where AnimalID = @AnimalID"; // CHECK FOR EXISTING USERNAMES IN USER RECORD using (SqlCommand getAnimal = new SqlCommand(strGetAnimal, sc)) { sc.Open(); //string btn = ((ImageButton)sender).ID; //string btnID = btn.ToString(); //id = Convert.ToInt32(btnID.Substring(3)); getAnimal.Parameters.AddWithValue("@AnimalID", id); SqlDataReader reader = getAnimal.ExecuteReader(); // if the username exists, process will stop if (reader.HasRows) { while (reader.Read()) { ddlEditStatus.SelectedValue = reader.GetString(0); ddlEditType.Text = reader.GetString(1); txtEditName.Text = reader.GetString(2); } } } }
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 Page_Load(object sender, EventArgs e) { String ConnStr = "SERVER=" + ConfigurationManager.AppSettings["PIBASServer"] + ";USER ID=" + ConfigurationManager.AppSettings["PIBASUser"] + "; PWD =" + ConfigurationManager.AppSettings["PIBASpwd"]; OracleConnection myConnection = new OracleConnection(ConnStr); String strQuery = @"SELECT MA38.FTD_TYPE, " + " FTD_TYPE_DESC, " + "nvl(T_ACTIVE_NOC,0) as T_ACTIVE_NOC , " + " nvl( TOTAL_FACEVALUE,0) as TOTAL_FACEVALUE , " + " nvl( LAST_WORKDAY_NOAC,0) as LAST_WORKDAY_NOAC , " + " nvl(LAST_WORKDAY_FACEVALUE,0) as LAST_WORKDAY_FACEVALUE , " + " nvl(LAST_WORKDAY_MTRNOC,0) as LAST_WORKDAY_MTRNOC , " + " nvl(LAST_WORKDAY_FACEVALE,0) as LAST_WORKDAY_FACEVALE " + " FROM PLS.MA38 " + " LEFT OUTER JOIN " + " ( SELECT FTD_TYPE, " + " SUM (T_Active_NOC) T_ACTIVE_NOC, " + " SUM (Total_FaceValue) TOTAL_FACEVALUE, " + " SUM (Last_workday_NOAC) LAST_WORKDAY_NOAC, " + " SUM (Last_workday_Facevalue) LAST_WORKDAY_FACEVALUE, " + " SUM (Last_WorkDay_MtrNoc) LAST_WORKDAY_MTRNOC, " + " SUM (Last_WorkDay_FaceVale) LAST_WORKDAY_FACEVALE, " + " ( SELECT FTD_TYPE_DESC " + " FROM PLS.MA38 B " + " WHERE B.FTD_TYPE = XYZ.FTD_TYPE " + " GROUP BY FTD_TYPE_DESC) " + " DESC1 " + " FROM ( SELECT FTD_TYPE, " + " COUNT (*) T_ACTIVE_NOC, " + " SUM (DEAL_AMNT) TOTAL_FACEVALUE, " + " 0 LAST_WORKDAY_NOAC, " + " 0 LAST_WORKDAY_FACEVALUE, " + " 0 LAST_WORKDAY_MTRNOC, " + " 0 LAST_WORKDAY_FACEVALE " + " FROM PLS.MH A " + " WHERE FTD_TYPE IN (29, 30, 31) " + " AND STRT_DATE <= '31-jan-2016' " + " AND DEAL_RVSL_INDC <> 1 " + " AND DEAL_STAT = 0 " + "GROUP BY FTD_TYPE " + " UNION ALL " + " SELECT FTD_TYPE, " + " 0 T_ACTIVE_NOC, " + " 0 TOTAL_FACEVALUE, " + " COUNT (*) LAST_WORKDAY_NOAC, " + " SUM (DEAL_AMNT) LAST_WORKDAY_FACEVALUE, " + " 0 LAST_WORKDAY_MTRNOC, " + " 0 LAST_WORKDAY_FACEVALE " + "FROM PLS.MH A " + "WHERE FTD_TYPE IN (29, 30, 31) " + " AND STRT_DATE = '31-jan-2016' " + " AND DEAL_RVSL_INDC <> 1 " + " AND DEAL_STAT = 0 " + " GROUP BY FTD_TYPE " + "UNION ALL " + " SELECT FTD_TYPE, " + " 0 T_ACTIVE_NOC, " + " 0 TOTAL_FACEVALUE, " + " COUNT (*) LAST_WORKDAY_NOAC, " + " SUM (DEAL_AMNT) LAST_WORKDAY_FACEVALUE," + " COUNT (*) LAST_WORKDAY_MTRNOC," + " SUM (DEAL_AMNT) LAST_WORKDAY_FACEVALE" + " FROM PLS.MH A" + " WHERE FTD_TYPE IN (29, 30, 31)" + " AND STRT_DATE = '31-jan-2016'" + " AND DEAL_STAT = 1" + " GROUP BY FTD_TYPE) XYZ" + " GROUP BY FTD_TYPE) ABC" + " ON (MA38.FTD_TYPE = ABC.FTD_TYPE)" + " WHERE MA38.FTD_TYPE IN (31, 30, 29) and MA38.BRAN_CODE = 510" + " ORDER BY MA38.FTD_TYPE"; OracleDataAdapter adapter = new OracleDataAdapter(strQuery, ConnStr); DataSet Ds = new DataSet(); SqlDataSource1.SelectCommand = strQuery; GridView1.DataSource = SqlDataSource1; SqlDataSource1.DataBind(); GridView1.DataBind(); //current Products string strquery1 = "select max (AccountName) as AccountName , ACCT_TYPE ,max(ACCT_TYPE_DESC)as ACCT_TYPE_DESC , sum(counts) as counts , " + " sum(FaceValue) as FaceValue, sum( Active_count) as Active_count , sum(Active_sum) as Active_sum " + " from (select 'Current Account'as AccountName , md.ACCT_TYPE as ACCT_TYPE ,ma.ACCT_TYPE_DESC as ACCT_TYPE_DESC, " + " count(md.ACCT_TYPE) as counts , sum(md.LDGR_BALN) as FaceValue , 0 as Active_count , 0 as Active_sum " + " from pls.md md " + " left outer join pls.ma5 ma on md.ACCT_TYPE = ma.ACCT_TYPE and ma.BRAN_CODE = 510 " + " where md.ACCT_TYPE in (115,116,120) " + " group by md.ACCT_TYPE , ma.ACCT_TYPE_DESC " + " union " + " select 'Current Account' as AccountName , ACCT_TYPE ,'A' as ACCT_TYPE_DESC , 0 as counts , " + " 0 as FaceValue, count(*) as Active_count , sum(LDGR_BALN) as Active_sum " + " from pls.md where md.ACCT_CLSD_DATE is null and md.ACCT_TYPE in (115,116,120) group by ACCT_TYPE " + " )xyz " + " group by ACCT_TYPE "; SqlDataSource2.SelectCommand = strquery1; GridView2.DataSource = SqlDataSource2; SqlDataSource2.DataBind(); GridView2.DataBind(); // Saving Products string strquery2 = "select max (AccountName) as AccountName , ACCT_TYPE ,max(ACCT_TYPE_DESC)as ACCT_TYPE_DESC , sum(counts) as counts , " + " sum(FaceValue) as FaceValue, sum( Active_count) as Active_count , sum(Active_sum) as Active_sum " + " from (select 'Saving Account'as AccountName , md.ACCT_TYPE as ACCT_TYPE ,ma.ACCT_TYPE_DESC as ACCT_TYPE_DESC, " + " count(md.ACCT_TYPE) as counts , sum(md.LDGR_BALN) as FaceValue , 0 as Active_count , 0 as Active_sum " + " from pls.md md " + " left outer join pls.ma5 ma on md.ACCT_TYPE = ma.ACCT_TYPE and ma.BRAN_CODE = 510 " + " where md.ACCT_TYPE in (136,137,139) " + " group by md.ACCT_TYPE , ma.ACCT_TYPE_DESC " + " union " + " select 'Saving Account' as AccountName , ACCT_TYPE ,'A' as ACCT_TYPE_DESC , 0 as counts , " + " 0 as FaceValue, count(*) as Active_count , sum(LDGR_BALN) as Active_sum " + " from pls.md where md.ACCT_CLSD_DATE is null and md.ACCT_TYPE in (136,137,139) group by ACCT_TYPE " + " )xyz " + " group by ACCT_TYPE "; SqlDataSource3.SelectCommand = strquery2; GridView3.DataSource = SqlDataSource3; SqlDataSource3.DataBind(); GridView3.DataBind(); // SqlConnection OC= new SqlConnection(ConnStr); // if (OC.State == ConnectionState.Closed) { OC.Open(); } // SqlCommand ocOM = new SqlCommand(strQuery,OC ); // SqlDataReader ORR = ocOM.ExecuteReader(); // Chart1.DataBindTable(ORR, "FTD_TYPE_DESC"); // //DataTable dt = (DataTable)SqlDataSource1; // // Chart1.DataSource = SqlDataSource1; // // Chart1.DataSourceID = "FTD_TYPE_DESC"; ////Chart1.DataSource = SqlDataSource1; // // Chart1.DataBindTable(dataSource: "SqlDataSource1", xField: "FTD_TYPE"); // // Chart1.Write(); }
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; }
//显示页面内容 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; } }