protected void GridView6_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView6.PageIndex = e.NewPageIndex; // GridView3.DataSource = AdminLogic.getStudentBasicData(Session["courseID"].ToString()); GridView6.DataBind(); }
public void fetchdata() { string connectionString = ConfigurationManager.ConnectionStrings["mycon"].ConnectionString; SqlConnection con = new SqlConnection(connectionString); con.Open(); SqlCommand c = new SqlCommand("select papername from Publication where btype='General science' and published='Yes'", con); SqlDataReader rdr = c.ExecuteReader(); GridView1.DataSource = rdr; GridView1.DataBind(); GridView1.GridLines = GridLines.None; rdr.Close(); con.Close(); con.Open(); SqlCommand c2 = new SqlCommand("select papername from Publication where btype='Neuroscience & Psychology' and published='Yes'", con); SqlDataReader rdr2 = c2.ExecuteReader(); GridView2.DataSource = rdr2; GridView2.DataBind(); GridView2.GridLines = GridLines.None; rdr2.Close(); con.Close(); con.Open(); SqlCommand c3 = new SqlCommand("select papername from Publication where btype='Genetics & Molicular Biology' and published='Yes'", con); SqlDataReader rdr3 = c3.ExecuteReader(); GridView3.DataSource = rdr3; GridView3.DataBind(); GridView3.GridLines = GridLines.None; rdr3.Close(); con.Close(); con.Open(); SqlCommand c4 = new SqlCommand("select papername from Publication where btype='Biochemistry' and published='Yes'", con); SqlDataReader rdr4 = c4.ExecuteReader(); GridView4.DataSource = rdr4; GridView4.DataBind(); GridView4.GridLines = GridLines.None; rdr4.Close(); con.Close(); con.Open(); SqlCommand c5 = new SqlCommand("select papername from Publication where btype='Engineering' and published='Yes'", con); SqlDataReader rdr5 = c5.ExecuteReader(); GridView5.DataSource = rdr5; GridView5.DataBind(); GridView5.GridLines = GridLines.None; rdr5.Close(); con.Close(); con.Open(); SqlCommand c6 = new SqlCommand("select papername from Publication where btype='Chemistry' and published='Yes'", con); SqlDataReader rdr6 = c6.ExecuteReader(); GridView6.DataSource = rdr6; GridView6.DataBind(); GridView6.GridLines = GridLines.None; rdr6.Close(); con.Close(); con.Open(); SqlCommand c7 = new SqlCommand("select papername from Publication where btype='Physics' and published='Yes'", con); SqlDataReader rdr7 = c7.ExecuteReader(); GridView7.DataSource = rdr7; GridView7.DataBind(); GridView7.GridLines = GridLines.None; rdr7.Close(); con.Close(); con.Open(); SqlCommand c8 = new SqlCommand("select papername from Publication where btype='Material Sciences' and published='Yes'", con); SqlDataReader rdr8 = c8.ExecuteReader(); GridView8.DataSource = rdr8; GridView8.DataBind(); GridView8.GridLines = GridLines.None; rdr8.Close(); con.Close(); con.Open(); SqlCommand c9 = new SqlCommand("select papername from Publication where btype='Social & Political Science' and published='Yes'", con); SqlDataReader rdr9 = c9.ExecuteReader(); GridView9.DataSource = rdr9; GridView9.DataBind(); GridView9.GridLines = GridLines.None; rdr9.Close(); con.Close(); con.Open(); SqlCommand c10 = new SqlCommand("select papername from Publication where btype='Earth & Environmental Science' and published='Yes'", con); SqlDataReader rdr10 = c10.ExecuteReader(); GridView10.DataSource = rdr10; GridView10.DataBind(); GridView10.GridLines = GridLines.None; rdr10.Close(); con.Close(); con.Open(); SqlCommand c11 = new SqlCommand("select papername from Publication where btype='Chemical Engineering' and published='Yes'", con); SqlDataReader rdr11 = c11.ExecuteReader(); GridView11.DataSource = rdr11; GridView11.DataBind(); GridView11.GridLines = GridLines.None; rdr11.Close(); con.Close(); con.Open(); SqlCommand c12 = new SqlCommand("select papername from Publication where btype='Medical' and published='Yes'", con); SqlDataReader rdr12 = c12.ExecuteReader(); GridView12.DataSource = rdr12; GridView12.DataBind(); GridView12.GridLines = GridLines.None; rdr12.Close(); con.Close(); con.Open(); SqlCommand c13 = new SqlCommand("select papername from Publication where btype='Agri Food & Aqua' and published='Yes'", con); SqlDataReader rdr13 = c13.ExecuteReader(); GridView13.DataSource = rdr13; GridView13.DataBind(); GridView13.GridLines = GridLines.None; rdr13.Close(); con.Close(); con.Open(); SqlCommand c14 = new SqlCommand("select papername from Publication where btype='Immunology & Microbiology' and published='Yes'", con); SqlDataReader rdr14 = c14.ExecuteReader(); GridView14.DataSource = rdr14; GridView14.DataBind(); GridView14.GridLines = GridLines.None; rdr14.Close(); con.Close(); con.Open(); SqlCommand c15 = new SqlCommand("select papername from Publication where btype='Pharmaceutical Sciences' and published='Yes'", con); SqlDataReader rdr15 = c15.ExecuteReader(); GridView15.DataSource = rdr15; GridView15.DataBind(); GridView15.GridLines = GridLines.None; rdr15.Close(); con.Close(); con.Open(); SqlCommand c16 = new SqlCommand("select papername from Publication where btype='Informatics' and published='Yes'", con); SqlDataReader rdr16 = c16.ExecuteReader(); GridView16.DataSource = rdr16; GridView16.DataBind(); GridView16.GridLines = GridLines.None; rdr16.Close(); con.Close(); con.Open(); SqlCommand c17 = new SqlCommand("select papername from Publication where btype='Business and Management' and published='Yes'", con); SqlDataReader rdr17 = c17.ExecuteReader(); GridView17.DataSource = rdr17; GridView17.DataBind(); GridView17.GridLines = GridLines.None; rdr17.Close(); con.Close(); }
}//GetTokenAsSystem_Click end. protected void GetTokenAsUser_Click(object sender, EventArgs e) { if ((CheckBoxList2.Items.Cast <ListItem>().Count(li => li.Selected)) == 0) { Label3.Text = "You have not selected a ADFS server. Please select ADFS servers to view Token response."; Label3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF0000"); GridView6.DataSource = null; GridView6.DataBind(); } if (DropDownList1.SelectedItem != null) { AdfsSqlHelper stsName = new AdfsSqlHelper(); string FarmEndpoint = stsName.GetFarmName(); var SelectedADFS = CheckBoxList2.Items.Cast <ListItem>().Where(i => i.Selected).Select(i => i.ToString()).ToArray(); DataTable TokenCheckTable = new DataTable(); TokenCheckTable.Columns.Add("ADFS Server Name"); TokenCheckTable.Columns.Add("IP"); TokenCheckTable.Columns.Add("Target Identifier"); TokenCheckTable.Columns.Add("TokenResponse"); foreach (object ADFS in SelectedADFS) { IPAddress[] ipaddress = Dns.GetHostAddresses(ADFS.ToString()); DataRow row = TokenCheckTable.NewRow(); row["ADFS Server Name"] = ADFS.ToString(); foreach (IPAddress ip4 in ipaddress.Where(ip => ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)) { row["IP"] = (ip4.ToString()); String appliesTo = DropDownList1.SelectedItem.Text; String federationServer = ip4.ToString(); String endpoint = "https://" + federationServer + "/adfs/services/trust/2005/usernamemixed"; DateTime now = new DateTime(); DateTime FinalTime = now.AddMinutes(60); string username = TextBox3.Text; string password = TextBox4.Text.Protect(); //Request body RST. Do not alter. String RST = String.Format("<s:Envelope xmlns:s=" + "\"http://www.w3.org/2003/05/soap-envelope\"" + " " + "xmlns:a=" + "\"http://www.w3.org/2005/08/addressing\"" + " " + "xmlns:u=" + "\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + "><s:Header><a:Action s:mustUnderstand=" + "\"1\"" + ">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue" + "</a:Action><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand=" + "\"1\"" + ">" + endpoint + "</a:To><o:Security s:mustUnderstand=" + "\"1\"" + " " + "xmlns:o=" + "\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"" + "><o:UsernameToken><o:Username>" + username + "</o:Username><o:Password Type=" + "\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\"" + ">" + password.Unprotect() + "</o:Password></o:UsernameToken></o:Security></s:Header><s:Body><t:RequestSecurityToken xmlns:t=" + "\"http://schemas.xmlsoap.org/ws/2005/02/trust\"" + "><wsp:AppliesTo xmlns:wsp=" + "\"http://schemas.xmlsoap.org/ws/2004/09/policy\"" + "><a:EndpointReference><a:Address>" + appliesTo + "</a:Address></a:EndpointReference></wsp:AppliesTo><t:KeySize>0</t:KeySize><t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType><t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType><t:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</t:TokenType></t:RequestSecurityToken></s:Body></s:Envelope>"); //String RST = String.Format("<s:Envelope xmlns:s=" + "\"http://www.w3.org/2003/05/soap-envelope\"" + " " + "xmlns:a=" + "\"http://www.w3.org/2005/08/addressing\"" + " " + "xmlns:u=" + "\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"" + "><s:Header><a:Action s:mustUnderstand=" + "\"1\"" + ">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue" + "</a:Action><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand=" + "\"1\"" + ">" + endpoint + "</a:To><o:Security s:mustUnderstand=" + "\"1\"" + " " + "xmlns:o=" + "\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"" + "><o:UsernameToken><o:Username>" + username + "</o:Username><o:Password Type=" + "\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\"" + ">" + password + "</o:Password></o:UsernameToken></o:Security></s:Header><s:Body><t:RequestSecurityToken xmlns:t=" + "\"http://schemas.xmlsoap.org/ws/2005/02/trust\"" + "><wsp:AppliesTo xmlns:wsp=" + "\"http://schemas.xmlsoap.org/ws/2004/09/policy\"" + "><a:EndpointReference><a:Address>" + appliesTo + "</a:Address></a:EndpointReference></wsp:AppliesTo><t:KeySize>0</t:KeySize><t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType><t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType><t:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</t:TokenType></t:RequestSecurityToken></s:Body></s:Envelope>"); HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://" + FarmEndpoint + "/adfs/services/trust/2005/usernamemixed");//url and Host header FieldInfo field_ServicePoint_ProxyServicePoint = (typeof(ServicePoint)) .GetField("m_ProxyServicePoint", BindingFlags.NonPublic | BindingFlags.Instance); req.Proxy = new WebProxy(ip4.ToString() + ":443");//server IP and port field_ServicePoint_ProxyServicePoint.SetValue(req.ServicePoint, false); req.Referer = "https://" + FarmEndpoint; req.Headers.Add("Name", "https://" + FarmEndpoint + "/adfs/services/trust/2005/usernamemixed"); req.Method = "POST"; req.ContentType = "application/soap+xml"; //req.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; req.KeepAlive = true; req.AllowAutoRedirect = false; byte[] data = Encoding.UTF8.GetBytes(RST); req.ContentLength = data.Length; try { Stream dataStream = req.GetRequestStream(); dataStream.Write(data, 0, data.Length); dataStream.Close(); HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); byte[] result = null; int byteCount = Convert.ToInt32(resp.ContentLength); using (BinaryReader reader = new BinaryReader(resp.GetResponseStream())) { result = reader.ReadBytes(byteCount); row["Target Identifier"] = DropDownList1.SelectedItem.Value; //Dirt way to extract claims string claims = System.Text.Encoding.UTF8.GetString(result); XmlDocument xmltest = new XmlDocument(); xmltest.LoadXml(claims); string xmltoken = xmltest.InnerText; if (xmltoken.Contains("SAML:1")) { int first = xmltoken.IndexOf("tc:SAML:1.0:cm"); int last = xmltoken.LastIndexOf("tc:SAML:1.0:cm"); string Finaltoken = xmltoken.Substring(first, last - first); row["TokenResponse"] = Finaltoken; } else { row["TokenResponse"] = xmltoken; } } } catch (Exception TokenExp) { row["Target Identifier"] = DropDownList1.SelectedItem.Value; row["TokenResponse"] = TokenExp.Message.ToString(); } } TokenCheckTable.Rows.Add(row); } GridView6.DataSource = TokenCheckTable; GridView6.DataBind(); } else { Label3.Text = "You have not selected an RP Identifier."; Label3.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF0000"); GridView6.DataSource = null; GridView6.DataBind(); } }//GetTokenAsUser_Click end.
private void Load_GridView6() { GridView6.DataBind(); }
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList4.SelectedValue == "2") { Button1.Text = "Υπολογισμός Λειτουργικών Δαπανών"; GridView3.DataSourceID = "Leitourg_Dapanes"; GridView3.DataBind(); GridView4.DataSourceID = "Leitourg_Dapanes"; GridView4.DataBind(); GridView6.DataSourceID = "Leitourg_Dapanes"; GridView6.DataBind(); GridView7.DataSourceID = "Leitourg_Dapanes"; GridView7.DataBind(); } else if (DropDownList4.SelectedValue == "1") { GridView3.DataSourceID = "DimosS_Dapanes"; GridView3.DataBind(); GridView4.DataSourceID = "DimosS_Dapanes"; GridView4.DataBind(); GridView6.DataSourceID = "DimosS_Dapanes"; GridView6.DataBind(); GridView7.DataSourceID = "DimosS_Dapanes"; GridView7.DataBind(); Button1.Text = "Υπολογισμός Δημοσίων Σχέσεων"; } TextBox2.Text = ""; string Etos_Y_X = DropDownList3.Text; string strConn_X; strConn_X = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; SqlConnection Conn_X = new SqlConnection(strConn_X); Conn_X.Open(); string sqltitle_X; sqltitle_X = "SELECT Int1 FROM Xrisi"; sqltitle_X += " WHERE (Etos ='" + Etos_Y_X + "') AND O_C = 0 "; // sqltitle += " AND (edition ='" + edition + "')"; SqlCommand com_X = new SqlCommand(sqltitle_X, Conn_X); Int32 CurrentQty_X; CurrentQty_X = Convert.ToInt32(com_X.ExecuteScalar()); if (CurrentQty_X != 0) { TextBox12.Text = Convert.ToString(CurrentQty_X); } else { TextBox12.Text = "0"; } Conn_X.Close(); }
protected void Button1_Click(object sender, EventArgs e) { //count total transcation of area for reason con.Open(); SqlCommand da1 = new SqlCommand("SELECT top 15 Temperature FROM [dataset] where name='" + DropDownList1.Text + "'", con); SqlDataReader dt1 = da1.ExecuteReader(); if (dt1.HasRows) { GridView1.DataSource = dt1; GridView1.DataBind(); } con.Close(); con.Open(); SqlCommand da = new SqlCommand("select top 5 Temperature from [dataset] where [name]='" + DropDownList1.Text + "' ", con); SqlDataReader dr = da.ExecuteReader(); while (dr.Read()) { string productname = dr[0].ToString(); top += productname + ","; txtvalue.Text = top.TrimEnd(','); } txtvalue.Text.TrimEnd(','); con.Close(); DataTable dt = new DataTable(); con.Open(); SqlCommand cmd1 = new SqlCommand("select top 5 name,Temperature from [dataset] where [name]='" + DropDownList1.Text + "' ", con); SqlDataAdapter sda = new SqlDataAdapter(cmd1); sda.Fill(dt); con.Close(); string[] x = new string[dt.Rows.Count]; int[] y = new int[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { x[i] = dt.Rows[i][0].ToString(); y[i] = Convert.ToInt32(dt.Rows[i][1]); } Chart1.Series[0].Points.DataBindXY(x, y); ForecastTable dt10 = TimeSeries.naive(GetInputforshirt(), 1, 6); GridView2.DataSource = dt10; GridView2.DataBind(); ForecastTable dt11 = TimeSeries.weightedMovingAverage(GetInputforshirt(), 1, (Decimal)0.05, (Decimal)0.15, (Decimal)0.8); GridView3.DataSource = dt11; GridView3.DataBind(); ForecastTable dt12 = TimeSeries.wellsweilderMovingaverage(GetInputforshirt(), 1, 2, 2); GridView6.DataSource = dt12; GridView6.DataBind(); con.Open(); SqlCommand da12 = new SqlCommand("select top 5 PulseRate from [dataset] where [name]='" + DropDownList1.Text + "' ", con); SqlDataReader dr1 = da12.ExecuteReader(); while (dr1.Read()) { string productname = dr1[0].ToString(); top1 += productname + ","; txtheartbeat.Text = top1.TrimEnd(','); } txtheartbeat.Text.TrimEnd(','); con.Close(); DataTable dt2 = new DataTable(); con.Open(); SqlCommand cmd2 = new SqlCommand("select top 5 name,PulseRate from [dataset] where [name]='" + DropDownList1.Text + "' ", con); SqlDataAdapter sda2 = new SqlDataAdapter(cmd2); sda2.Fill(dt2); con.Close(); ForecastTable dt102 = TimeSeries.naive(GetInputforheartbeat(), 1, 6); GridView4.DataSource = dt102; GridView4.DataBind(); ForecastTable dt112 = TimeSeries.weightedMovingAverage(GetInputforheartbeat(), 1, (Decimal)0.05, (Decimal)0.15, (Decimal)0.8); GridView5.DataSource = dt112; GridView5.DataBind(); foreach (GridViewRow row in GridView4.Rows) { string val = GridView3.Rows[5].Cells[2].Text; // Label2.Text = "Upcoming Of State:" + ddlarea.Text + "of crime:" + DropDownList1.Text + val; } }
public void resultRepeat() { try { String bd = Session["BD"].ToString(); var registros = Controlasql.ClistFiles("S.S.T", bd); if (registros.Rows.Count > 0) { GridView1.DataSource = registros; GridView1.DataBind(); } else { GridView1.DataSource = null; GridView1.DataBind(); } } catch (Exception ex) { alerta.MessageBox(this, $"{ex}"); // Response.Redirect("Exceptionnet.aspx"); } try { String bd = Session["BD"].ToString(); var registros = Controlasql.ClistFiles("P.E.S.V", bd); if (registros.Rows.Count > 0) { GridView2.DataSource = registros; GridView2.DataBind(); } else { GridView2.DataSource = null; GridView2.DataBind(); } } catch (Exception ex) { alerta.MessageBox(this, $"{ex}"); // Response.Redirect("Exceptionnet.aspx"); } try { String bd = Session["BD"].ToString(); var registros = Controlasql.ClistFiles("RRHH", bd); if (registros.Rows.Count > 0) { GridView3.DataSource = registros; GridView3.DataBind(); } else { GridView3.DataSource = null; GridView3.DataBind(); } } catch (Exception ex) { alerta.MessageBox(this, $"{ex}"); // Response.Redirect("Exceptionnet.aspx"); } try { String bd = Session["BD"].ToString(); var registros = Controlasql.ClistFiles("Correspondencia", bd); if (registros.Rows.Count > 0) { GridView4.DataSource = registros; GridView4.DataBind(); } else { GridView4.DataSource = null; GridView4.DataBind(); } } catch (Exception ex) { alerta.MessageBox(this, $"{ex}"); // Response.Redirect("Exceptionnet.aspx"); } try { String bd = Session["BD"].ToString(); var registros = Controlasql.ClistFiles("Plan_Contingencia", bd); if (registros.Rows.Count > 0) { GridView5.DataSource = registros; GridView5.DataBind(); } else { GridView5.DataSource = null; GridView5.DataBind(); } } catch (Exception ex) { alerta.MessageBox(this, $"{ex}"); // Response.Redirect("Exceptionnet.aspx"); } try { String bd = Session["BD"].ToString(); var registros = Controlasql.ClistFiles("Covid_19", bd); if (registros.Rows.Count > 0) { GridView6.DataSource = registros; GridView6.DataBind(); } else { GridView6.DataSource = null; GridView6.DataBind(); } } catch (Exception ex) { alerta.MessageBox(this, $"{ex}"); // Response.Redirect("Exceptionnet.aspx"); } try { String bd = Session["BD"].ToString(); var registros = Controlasql.ClistFiles("Examen_MA", bd); if (registros.Rows.Count > 0) { GridView7.DataSource = registros; GridView7.DataBind(); } else { GridView7.DataSource = null; GridView7.DataBind(); } } catch (Exception ex) { alerta.MessageBox(this, $"{ex}"); // Response.Redirect("Exceptionnet.aspx"); } try { String bd = Session["BD"].ToString(); var registros = Controlasql.ClistFiles("Plan_MA", bd); if (registros.Rows.Count > 0) { GridView8.DataSource = registros; GridView8.DataBind(); } else { GridView8.DataSource = null; GridView8.DataBind(); } } catch (Exception ex) { alerta.MessageBox(this, $"{ex}"); // Response.Redirect("Exceptionnet.aspx"); } try { String bd = Session["BD"].ToString(); var registros = Controlasql.ClistFiles("CursosMA", bd); if (registros.Rows.Count > 0) { GridView9.DataSource = registros; GridView9.DataBind(); } else { GridView9.DataSource = null; GridView9.DataBind(); } } catch (Exception ex) { alerta.MessageBox(this, $"{ex}"); // Response.Redirect("Exceptionnet.aspx"); } try { String bd = Session["BD"].ToString(); var registros = Controlasql.ClistFiles("Formatos_sanidad", bd); if (registros.Rows.Count > 0) { GridView10.DataSource = registros; GridView10.DataBind(); } else { GridView10.DataSource = null; GridView10.DataBind(); } } catch (Exception ex) { alerta.MessageBox(this, $"{ex}"); // Response.Redirect("Exceptionnet.aspx"); } }
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { Leitourg_Dapanes.DataBind(); DimosS_Dapanes.DataBind(); if (DropDownList4.SelectedValue == "2") { Button1.Text = "Υπολογισμός Λειτουργικών Δαπανών"; GridView3.DataSourceID = "Leitourg_Dapanes"; GridView3.DataBind(); GridView4.DataSourceID = "Leitourg_Dapanes"; GridView4.DataBind(); GridView6.DataSourceID = "Leitourg_Dapanes"; GridView6.DataBind(); GridView7.DataSourceID = "Leitourg_Dapanes"; GridView7.DataBind(); } else if (DropDownList4.SelectedValue == "1") { GridView3.DataSourceID = "DimosS_Dapanes"; GridView3.DataBind(); GridView4.DataSourceID = "DimosS_Dapanes"; GridView4.DataBind(); GridView6.DataSourceID = "DimosS_Dapanes"; GridView6.DataBind(); GridView7.DataSourceID = "DimosS_Dapanes"; GridView7.DataBind(); Button1.Text = "Υπολογισμός Δημοσίων Σχέσεων"; } TextBox6.Text = "Σύν. Δαπ. : " + DropDownList2.SelectedItem.Text; TextBox10.Text = "Δαπάνες Εξ Ιδίων "; if (GridView3.Rows.Count > 0) { TextBox9.Text = GridView3.Rows[0].Cells[0].Text; } if (GridView6.Rows.Count > 0) { TextBox14.Text = GridView6.Rows[0].Cells[0].Text; } string Etos_Y = DropDownList3.Text; string Gr_Eisp = DropDownList1.SelectedValue; string Minas = DropDownList2.SelectedValue; string DS_LS = DropDownList4.SelectedValue; string strConn; strConn = WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString; SqlConnection Conn = new SqlConnection(strConn); Conn.Open(); string sqltitle; sqltitle = "SELECT COUNT(*) FROM Exoda"; sqltitle += " WHERE (Etos ='" + Etos_Y + "')"; sqltitle += " AND (GR_Eiprajeis ='" + Gr_Eisp + "')"; sqltitle += " AND ([Month] ='" + Minas + "')"; sqltitle += " AND ([DS_Leit] ='" + DS_LS + "')"; // sqltitle += " AND (edition ='" + edition + "')"; SqlCommand com = new SqlCommand(sqltitle, Conn); Int32 CurrentQty; CurrentQty = Convert.ToInt32(com.ExecuteScalar()); if (CurrentQty != 0) { Button2.Enabled = false; Button1.Enabled = false; Label1.Text = "Υπάρχει καταχώρηση " + DropDownList4.SelectedItem.Text + " για τον Μήνα " + DropDownList2.SelectedItem.Text + " Έτους " + DropDownList3.SelectedItem.Text; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + Label1.Text + " ');", true); // Label1.Text = "Υπάρχει καταχώρηση " + DropDownList4.SelectedItem.Text + " για τον Μήνα " + DropDownList2.SelectedItem.Text + " Έτους " + DropDownList3.SelectedItem.Text ; // I WANT TO SHOW HERE THE TEXTBOX3 FROM THE DATABASE QTY } else { if (GridView2.Rows.Count > 0) { Button2.Enabled = true; Button1.Enabled = true; } Label1.Text = " "; } }
protected void GridView6_IndexChanging(object sender, GridViewPageEventArgs e) { GridView6.PageIndex = e.NewPageIndex; GridView6.DataBind(); }
void Availableformz() { GridView6.DataSource = ClassDataManager.FormsAvailable(drugi); GridView6.DataBind(); }
protected void TextBox7_TextChanged(object sender, EventArgs e) { Label9.Text = ""; bool check1 = true, check2 = true; SqlConnection con = new SqlConnection(ConnectionString); con.Open(); string query = "SELECT a.accountID, a.fullName, a.email, SUM(h.workingHour) AS totalHour, h.requestID FROM HourSpent AS h JOIN Account AS a ON h.accountID=a.accountID WHERE h.accountID=@ittechID GROUP BY h.requestID, a.accountID, a.fullName, a.email ORDER BY a.accountID"; SqlCommand cmd = new SqlCommand(query, con); cmd.Parameters.AddWithValue("@ittechID", TextBox7.Text.Trim()); SqlDataReader sdr = cmd.ExecuteReader(); if (sdr.HasRows) { GridView5.DataSource = sdr; GridView5.DataBind(); } else { check1 = false; } con.Close(); con.Open(); query = "SELECT OverWorkingHour.accountID, Account.fullName, Account.email, OverWorkingHour.rate, SUM(OverWorkingHour.overHour) AS totalOverHour, OverWorkingHour.requestID FROM OverWorkingHour JOIN Account ON OverWorkingHour.accountID = Account.accountID WHERE OverWorkingHour.accountID=@ittechID GROUP BY OverWorkingHour.requestID, OverWorkingHour.accountID, Account.fullName, Account.email, OverWorkingHour.rate ORDER BY OverWorkingHour.accountID"; cmd = new SqlCommand(query, con); cmd.Parameters.AddWithValue("@ittechID", TextBox7.Text.Trim()); sdr = cmd.ExecuteReader(); if (sdr.HasRows) { GridView6.DataSource = sdr; GridView6.DataBind(); } else { check2 = false; } con.Close(); if (!check1 && !check2) { Label9.Text = "No Data Found. Please refer to two tables below."; } else if (check1 && !check2) { Label9.Text = "No Data Found. Please refer to the total overtime hour table."; } else if (!check1 && check2) { Label9.Text = "No Data Found. Please refer to the total office hour table."; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] != "Project Manager") { Response.Redirect("login.aspx"); } string accountID = ""; SqlConnection con = new SqlConnection(ConnectionString); con.Open(); string userN = Session["userN"].ToString(); string que = "SELECT accountID FROM Account WHERE userName LIKE '" + userN + "%'"; SqlCommand cmd2 = new SqlCommand(que, con); SqlDataReader sdr2 = cmd2.ExecuteReader(); while (sdr2.Read()) { accountID = sdr2["accountID"].ToString(); } con.Close(); con.Open(); string query = "SELECT Request.requestID, Account.fullName, Account.email, Request.issueName, Request.description, convert(varchar, Request.requestDate, 101) AS requestDate FROM Request JOIN Account ON Request.accountID = Account.accountID AND personInCharge=1"; SqlCommand cmd = new SqlCommand(query, con); SqlDataReader sdr = cmd.ExecuteReader(); GridView1.DataSource = sdr; GridView1.DataBind(); con.Close(); con.Open(); query = "SELECT accountID, 'IT Techinician with ID: ' + CONVERT(varchar(10), accountID) AS fullDesc FROM Account WHERE accountID != 1 AND role = 'IT Technician'"; cmd = new SqlCommand(query, con); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); sda.Fill(ds); if (!Page.IsPostBack) { DropDownList1.DataSource = ds; DropDownList1.DataTextField = "fullDesc"; DropDownList1.DataValueField = "accountID"; DropDownList1.DataBind(); } con.Close(); con.Open(); query = "SELECT Account.accountID, Account.fullName, Account.email, Request.requestID, Request.issueName, Request.description, convert(varchar, Request.assignedDate, 101) AS assignedDate, ITTechStatus = (SELECT CASE WHEN COUNT(requestID) >2 THEN 'Busy' ELSE 'Available' END AS ITStatus FROM Request WHERE personInCharge = Account.accountID AND status != 'Completed' AND assignedDate IS NOT NULL GROUP BY personInCharge ) FROM Request JOIN Account ON Request.personInCharge = Account.accountID AND Request.assignedDate IS NOT NULL AND Request.status != 'Completed'"; cmd = new SqlCommand(query, con); sdr = cmd.ExecuteReader(); GridView2.DataSource = sdr; GridView2.DataBind(); con.Close(); con.Open(); query = "SELECT OverWorkingHour.overTimeID, Account.fullName, Account.email, OverWorkingHour.requestID, convert(varchar, OverWorkingHour.date, 101) AS date, OverWorkingHour.overHour, OverWorkingHour.rate, (OverWorkingHour.rate * OverWorkingHour.overHour) AS earn FROM OverWorkingHour JOIN Account ON OverWorkingHour.accountID = Account.accountID"; cmd = new SqlCommand(query, con); sdr = cmd.ExecuteReader(); GridView3.DataSource = sdr; GridView3.DataBind(); con.Close(); con.Open(); query = "SELECT Request.requestID, Request.issueName, Request.description, Request.personInCharge, convert(varchar, Request.requestDate, 101) AS requestDate, convert(varchar, Request.assignedDate, 101) AS assignedDate, convert(varchar, getdate(), 101) AS todayDate, DATEDIFF(day, Request.assignedDate, getdate()) AS dateSpent FROM Request WHERE personInCharge!= 1 AND status != 'Completed' AND DATEDIFF(day, Request.assignedDate, getdate()) > 7"; cmd = new SqlCommand(query, con); sdr = cmd.ExecuteReader(); GridView4.DataSource = sdr; GridView4.DataBind(); con.Close(); con.Open(); query = "SELECT accountID, 'IT Techinician with ID: ' + CONVERT(varchar(10), accountID) AS fullDesc FROM Account WHERE accountID != 1 AND role = 'IT Technician'"; cmd = new SqlCommand(query, con); sda = new SqlDataAdapter(cmd); ds = new DataSet(); sda.Fill(ds); if (!Page.IsPostBack) { DropDownList2.DataSource = ds; DropDownList2.DataTextField = "fullDesc"; DropDownList2.DataValueField = "accountID"; DropDownList2.DataBind(); } con.Close(); con.Open(); query = "SELECT a.accountID, a.fullName, a.email, SUM(h.workingHour) AS totalHour, h.requestID FROM HourSpent AS h JOIN Account AS a ON h.accountID=a.accountID GROUP BY h.requestID, a.accountID, a.fullName, a.email ORDER BY a.accountID"; cmd = new SqlCommand(query, con); sdr = cmd.ExecuteReader(); GridView5.DataSource = sdr; GridView5.DataBind(); con.Close(); con.Open(); query = "SELECT OverWorkingHour.accountID, Account.fullName, Account.email, OverWorkingHour.rate, SUM(OverWorkingHour.overHour) AS totalOverHour, OverWorkingHour.requestID FROM OverWorkingHour JOIN Account ON OverWorkingHour.accountID = Account.accountID GROUP BY OverWorkingHour.requestID, OverWorkingHour.accountID, Account.fullName, Account.email, OverWorkingHour.rate ORDER BY OverWorkingHour.accountID"; cmd = new SqlCommand(query, con); sdr = cmd.ExecuteReader(); GridView6.DataSource = sdr; GridView6.DataBind(); con.Close(); }
protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = 'C:\Users\Neel Rayal\Documents\Ad_project2.mdf'; Integrated Security = True; Connect Timeout = 30"); string temp1 = " select * from page1db where Id = " + "('" + Session["Id"] + "')"; SqlCommand cmd1 = new SqlCommand(temp1, con); SqlDataAdapter sda1 = new SqlDataAdapter(cmd1); DataTable dt1 = new DataTable(); sda1.Fill(dt1); GridView1.DataSource = dt1; GridView1.DataBind(); string temp2 = " select * from page2db where Id = " + "('" + Session["Id"] + "')"; SqlCommand cmd2 = new SqlCommand(temp2, con); SqlDataAdapter sda2 = new SqlDataAdapter(cmd2); DataTable dt2 = new DataTable(); sda2.Fill(dt2); GridView2.DataSource = dt2; GridView2.DataBind(); string temp3 = " select * from page3db where Id = " + "('" + Session["Id"] + "')"; string temp4 = " select * from page4db where Id = " + "('" + Session["Id"] + "')"; string temp5 = " select * from page5db where Id = " + "('" + Session["Id"] + "')"; string temp6 = " select * from page6db where Id = " + "('" + Session["Id"] + "')"; SqlCommand cmd3 = new SqlCommand(temp3, con); SqlCommand cmd4 = new SqlCommand(temp4, con); SqlCommand cmd5 = new SqlCommand(temp5, con); SqlCommand cmd6 = new SqlCommand(temp6, con); SqlDataAdapter sda3 = new SqlDataAdapter(cmd3); SqlDataAdapter sda4 = new SqlDataAdapter(cmd4); SqlDataAdapter sda5 = new SqlDataAdapter(cmd5); SqlDataAdapter sda6 = new SqlDataAdapter(cmd6); DataTable dt3 = new DataTable(); DataTable dt4 = new DataTable(); DataTable dt5 = new DataTable(); DataTable dt6 = new DataTable(); sda3.Fill(dt3); GridView3.DataSource = dt3; GridView3.DataBind(); sda4.Fill(dt4); GridView4.DataSource = dt4; GridView4.DataBind(); sda5.Fill(dt5); GridView5.DataSource = dt5; GridView5.DataBind(); sda6.Fill(dt6); GridView6.DataSource = dt6; GridView6.DataBind(); }