protected void Page_Load(object sender, EventArgs e) { baglantı = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["database"].ConnectionString); bool isDoctor; if (Session["isDoctor"] != null) { isDoctor = (bool)Session["isDoctor"]; } else { isDoctor = false; } if (!isDoctor) { Response.Redirect("../login/doctor_login.aspx"); } else { DataView dv = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); lblDoctorName.Text = dv[0]["name"].ToString() + " " + dv[0]["surname"].ToString(); baglantı.Open(); } }
public void register() { dview = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); if (dview.Count != 0) { //Label13.Text = "This nick is busy"; //Response.Redirect("index.aspx"); //dview = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); for (int i = 0; i < dview.Count; i++) { if (dview.Table.Rows[i]["u_nick"].Equals(TextBoxSignNick.Text)) { Label13.Text = "This nick is busy"; } if (dview.Table.Rows[i]["u_e_mail"].Equals(TextBoxSignEmail.Text)) { Label12.Text = "This e-mail is busy"; } } //SELECT u_nick FROM Uzytkownik WHERE(u_nick = @u_nicks) OR(u_e_mail = @u_e_mails) } else { SqlDataSource2.Insert(); Label1.Visible = true; //Response.Redirect("index.aspx"); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "setInterval(function(){location.href='index.aspx';},5000);", true); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.Form["fb_id"] == null) { Response.Redirect("login.aspx"); } else { Session["fb_id"] = Request.Form["fb_id"]; Session["fb_name"] = Request.Form["fb_name"]; SqlDataSource2.SelectParameters["fb_id"].DefaultValue = Request.Form["fb_id"]; DataView result = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); if (result != null && result.Count != 1) { SqlDataSource2.InsertParameters["fb_id"].DefaultValue = Request.Form["fb_id"]; SqlDataSource2.InsertParameters["fb_name"].DefaultValue = Request.Form["fb_name"]; SqlDataSource2.Insert(); Session["user_group"] = "0"; } else { Session["user_group"] = result[0]["user_group"].ToString(); } Response.Redirect("start_order.aspx"); } /* Session["fb_id"] = "1104187996259275"; * Session["fb_name"] = "SIMON"; * Session["user_group"] = "1"; */ }
protected void gridsent_RowCommand(object sender, GridViewCommandEventArgs e) { int index = 0; String editButton = Request.Params.Get("__EVENTARGUMENT"); if (editButton != null && editButton.Contains("select")) { string aplicate = editButton.Substring(6, 4); if (aplicate != null && aplicate == "dell") { index = Convert.ToInt32(editButton.Substring(11, editButton.Length - 11)); System.Data.DataView dv = (System.Data.DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); int idsms = Convert.ToInt32(dv.ToTable().Rows[index]["id"]); cnn.Open(); SqlCommand cmd_read = new SqlCommand("update messages set sender=1 where id=" + idsms + "", cnn); cmd_read.ExecuteNonQuery();//update read sms cnn.Close(); gridsent.DataBind(); } else if (aplicate != null && aplicate == "show") { index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gridsent.Rows[index]; System.Data.DataView dv = (System.Data.DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); txtfullmsg.Text = Convert.ToString(dv.ToTable().Rows[index]["msg"]); int idsms = Convert.ToInt32(dv.ToTable().Rows[index]["id"]); txtfullmsg.Visible = true; btnread.Visible = true; } } }
protected void ButtonRegister_Click(object sender, EventArgs e) { Label1.Text = ""; DataView DV = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); DataView DVEmail = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); if (DV.Count == 0 && DVEmail.Count == 0) { if (TextBoxPasswoed.Text == TextBoxRePasswoed.Text) { SqlDataSource1.InsertCommand = "INSERT INTO [Users] ( [UserName], [Password],[UserType], [Email]) " + "VALUES ( @user_name, @pass, @userT, @mail)"; SqlDataSource1.InsertParameters.Add("user_name", TextBoxUserName.Text); SqlDataSource1.InsertParameters.Add("pass", TextBoxPasswoed.Text); SqlDataSource1.InsertParameters.Add("userT", "user"); SqlDataSource1.InsertParameters.Add("mail", TextBoxEmail.Text); int rowsAffected = SqlDataSource1.Insert(); Label1.Text = "user adding"; Response.Redirect("log.aspx"); } else { Label1.Text = "mismatch password"; } } else { Label1.Text = "the user or email alerady create "; } }
protected void Page_Load(object sender, EventArgs e) { SqlDataSource1.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader datosProd1; datosProd1 = (SqlDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty); if (datosProd1.Read()) { lblNombre1.Text = " " + datosProd1["nombreProd"]; lblDescripcion1.Text = " " + datosProd1["descripcionProd"]; } SqlDataSource2.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader datosProd2; datosProd2 = (SqlDataReader)SqlDataSource2.Select(DataSourceSelectArguments.Empty); if (datosProd2.Read()) { lblNombre2.Text = " " + datosProd2["nombreProd"]; lblDescripcion2.Text = " " + datosProd2["descripcionProd"]; } SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader datosProd3; datosProd3 = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty); if (datosProd3.Read()) { lblNombre3.Text = " " + datosProd3["nombreProd"]; lblDescripcion3.Text = " " + datosProd3["descripcionProd"]; } }
protected void Page_Load(object sender, EventArgs e) { SqlDataSource1.SelectParameters["cod"].DefaultValue = Label9.Text; SqlDataSource1.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader datos; datos = (SqlDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty); if (datos.Read()) { Label1.Text = "Nombre:" + datos["Nom_Ser"] + "<br>Descripción:" + datos["Desc_Ser"]; } SqlDataSource2.SelectParameters["cod1"].DefaultValue = Label10.Text; SqlDataSource2.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader datos1; datos1 = (SqlDataReader)SqlDataSource2.Select(DataSourceSelectArguments.Empty); if (datos1.Read()) { Label3.Text = "Nombre:" + datos1["Nom_Ser"] + "<br>Descripción:" + datos1["Desc_Ser"]; } SqlDataSource3.SelectParameters["cod2"].DefaultValue = Label11.Text; SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader datos2; datos2 = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty); if (datos2.Read()) { Label5.Text = "Nombre:" + datos2["Nom_Ser"] + "<br>Descripción:" + datos2["Desc_Ser"]; } }
/* protected void Calendar1_DayRender(object sender, DayRenderEventArgs e) * { * * int x = 0; ; * DataView dv = (DataView)ReservedDateSelect.Select(DataSourceSelectArguments.Empty); * foreach (DataRow dr in dv.Table.Rows) * { * if (e.Day.Date == (DateTime)dv.Table.Rows[x][0]) * { * e.Day.IsSelectable = true; * e.Cell.CssClass = "testing2"; * } * x++; * } * if (e.Day.Date < DateTime.Now) * { * e.Day.IsSelectable = false; * e.Cell.Font.Strikeout = true; * e.Cell.ForeColor = System.Drawing.Color.Black; * e.Cell.BackColor = System.Drawing.Color.White; * } * } * protected void Calendar2_DayRender(object sender, DayRenderEventArgs e) * { * int x = 0; ; * DataView dv = (DataView)ReservedDateSelect0.Select(DataSourceSelectArguments.Empty); * foreach (DataRow dr in dv.Table.Rows) * { * if (e.Day.Date == (DateTime)dv.Table.Rows[x][0]) * { * e.Day.IsSelectable = true; * e.Cell.CssClass = "testing2"; * } * x++; * } * if (e.Day.Date < DateTime.Now) * { * e.Day.IsSelectable = false; * e.Cell.Font.Strikeout = true; * e.Cell.ForeColor = System.Drawing.Color.Black; * e.Cell.BackColor = System.Drawing.Color.White; * } * }*/ protected void Button1_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(1000); string x = ""; DataView dv = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); DataView dv2 = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty); int y = (int)dv2.Table.Rows[0][0]; if (y == 1) { x = (string)dv.Table.Rows[0][3]; } if (x == "prac") { Panel2.Visible = false; Panel3.Visible = false; Panel1.Visible = true; } else if (x == "res") { Panel1.Visible = false; Panel2.Visible = true; Panel3.Visible = false; int z = (int)dv.Table.Rows[0][2];; TextBox6.Text = z.ToString(); } else { Panel1.Visible = false; Panel3.Visible = false; Panel3.Visible = true; } }
public bool isUserAlreadyAdded(int userID) { // Checks if the user ID associated with the inserted email address is already in // the permissions for the department. This is to prevent duplicates. DataView dv = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); dv.RowFilter = "UserID = '" + userID.ToString() + "'"; try { DataRowView dr = dv[0]; if (dr["UserID"].ToString() == userID.ToString()) // This line is just to check that dr is not empty { return(true); } else { return(false); } } catch { return(false); } }
protected void Page_Load(object sender, EventArgs e) { hello.Text = User.Identity.Name; UserName.Value = User.Identity.Name; DataView dv1 = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); DataRow row1 = dv1.Table.Rows[0]; string id = row1["Id"].ToString(); UserId.Value = id; DataView dv2 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); if (dv2.Table.Rows.Count == 0) { return; } DataRow row2 = dv2.Table.Rows[0]; Label1.Text = row2["Name"].ToString(); Label2.Text = row2["Age"].ToString(); Label3.Text = row2["Address"].ToString(); Label4.Text = row2["Telephone"].ToString(); Label5.Text = row2["Gender"].ToString(); Label6.Text = row2["E-mail address"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["loginProvider"] == null) { Response.Redirect("index.aspx"); } addressHiddenField.Value = ""; storeIdHiddenField.Value = ""; nameHiddenField.Value = ""; priceHiddenField.Value = ""; phoneHiddenField.Value = ""; openHiddenField.Value = ""; closeHiddenField.Value = ""; picHiddenField.Value = ""; DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); int countRows = dv.Count; for (int i = 0; i < countRows; i++) { addressHiddenField.Value += "台北市" + dv.Table.Rows[i][1].ToString() + dv.Table.Rows[i][2].ToString() + ";"; storeIdHiddenField.Value += dv.Table.Rows[i][0].ToString() + ";"; nameHiddenField.Value += dv.Table.Rows[i][3].ToString() + ";"; priceHiddenField.Value += dv.Table.Rows[i][4].ToString() + ";"; phoneHiddenField.Value += dv.Table.Rows[i][5].ToString() + ";"; openHiddenField.Value += dv.Table.Rows[i][6].ToString() + ";"; closeHiddenField.Value += dv.Table.Rows[i][7].ToString() + ";"; SqlDataSource2.SelectParameters.Clear(); SqlDataSource2.SelectParameters.Add("storeId", dv.Table.Rows[i][0].ToString()); DataView dvp = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); picHiddenField.Value += dvp.Table.Rows[0][0].ToString() + ";"; } }
protected void RadGridM_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; RadGrid gridP = item["PastDueReleaseNo"].FindControl("RadGridP") as RadGrid; RadGrid grid0 = item["Day0ReleaseNo"].FindControl("RadGrid0") as RadGrid; RadGrid grid1 = item["Day1ReleaseNo"].FindControl("RadGrid1") as RadGrid; RadGrid grid2 = item["Day2ReleaseNo"].FindControl("RadGrid2") as RadGrid; RadGrid grid3 = item["Day3ReleaseNo"].FindControl("RadGrid3") as RadGrid; RadGrid grid4 = item["Day4ReleaseNo"].FindControl("RadGrid4") as RadGrid; SqlDataSourceP.SelectParameters[0].DefaultValue = item.GetDataKeyValue("PastDueReleaseNo").ToString(); SqlDataSource0.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day0ReleaseNo").ToString(); SqlDataSource1.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day1ReleaseNo").ToString(); SqlDataSource2.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day2ReleaseNo").ToString(); SqlDataSource3.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day3ReleaseNo").ToString(); SqlDataSource4.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day4ReleaseNo").ToString(); gridP.DataSource = SqlDataSourceP.Select(DataSourceSelectArguments.Empty); grid0.DataSource = SqlDataSource0.Select(DataSourceSelectArguments.Empty); grid1.DataSource = SqlDataSource1.Select(DataSourceSelectArguments.Empty); grid2.DataSource = SqlDataSource2.Select(DataSourceSelectArguments.Empty); grid3.DataSource = SqlDataSource3.Select(DataSourceSelectArguments.Empty); grid4.DataSource = SqlDataSource4.Select(DataSourceSelectArguments.Empty); gridP.DataBind(); grid0.DataBind(); grid1.DataBind(); grid2.DataBind(); grid3.DataBind(); grid4.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { string username = TextBox1.Text; string password = TextBox2.Text; string log = "select * from CUSTOMER where CUSTOMER_NAME='" + username + "' AND PASSWORD= '******'"; SqlDataSource1.SelectCommand = log; SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.Text; DataView dv = SqlDataSource1.Select(DataSourceSelectArguments.Empty) as DataView; DataView dv2 = SqlDataSource2.Select(DataSourceSelectArguments.Empty) as DataView; string cid = (dv.Table.Rows[0]["CUSTOMER_ID"]).ToString(); string orderlistcount = ((dv2.Count) + 1).ToString(); Label5.Text = cid + orderlistcount; username = "******" + username; if (dv.Count > 0) { //Session["Username"] = username as string; //string orderlist_insert = "insert into ORDER_LIST values( " + orderlistcount + " , '" + user + "','" + phone + "','cash on delivery','" + pw + "')"; //SqlDataSource1.InsertCommand = orderlist_insert; //SqlDataSource1.InsertCommandType = SqlDataSourceCommandType.Text; // dv = SqlDataSource1.Select(DataSourceSelectArguments.Empty) as DataView; //Response.Redirect("~/Home.aspx?Username="+username); } else { Label4.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //RadPivotGrid1.OlapSettings.XmlaConnectionSettings.Encoding = System.Text.Encoding.UTF8; RadDateFrom.SelectedDate = DateTime.Now; RadDateTo.SelectedDate = DateTime.Now; LoadDataForRadGrid1(); RadGrid1.DataBind(); foreach (GridDataItem item in RadGrid1.MasterTableView.Items) { RadHtmlChart chart = item["ChartColumn"].FindControl("RadHtmlChart1") as RadHtmlChart; SqlDataSource2.SelectParameters[0].DefaultValue = item.GetDataKeyValue("customer").ToString(); chart.DataSource = SqlDataSource2.Select(DataSourceSelectArguments.Empty); chart.DataBind(); //for (int i = 0; i < 2; i++) //{ // BarSeries bs = new BarSeries(); // bs.Appearance.FillStyle.BackgroundColor = Staticcolor.StaticColor.GetColor(i); // chart.PlotArea.Series.Add(bs); // for (int j = 1; j < 2; j++) // { // CategorySeriesItem si = new CategorySeriesItem(); // si.Y = j; // bs.SeriesItems.Add(si); // } // } } } }
protected void UploadDocument(object sender, EventArgs e) { string input = "", DirRoot = "", filename = ""; int stringindex = 0, cut = 0; Boolean check = false; if (fuDocument.HasFile) { HttpPostedFile postedFile = fuDocument.PostedFile; DirRoot = System.IO.Path.GetExtension(postedFile.FileName).ToUpper().Replace(".", ""); SqlDataSource2.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString; SqlDataSource2.SelectCommand = "select id,name from filename_extension"; SqlDataSource2.DataBind(); DataView ou1 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); for (int i = 0; i < ou1.Count; i++) { if (DirRoot.ToUpper() == ou1.Table.Rows[i]["name"].ToString().ToUpper()) { check = true; } } if (check) { int fileSize = fuDocument.PostedFile.ContentLength; // Allow only files less than (16 MB)=16777216 bytes to be uploaded. if (fileSize < 16777216) { SqlDataSource sql_insert = new SqlDataSource(); sql_insert.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString; filename = DateTime.Now.ToString("yyyyMMddHHmmssffff") + @"." + DirRoot; //AmazonUpload aws = new AmazonUpload(); //string imgurl = aws.AmazonUpload_file("makelocal", "upload/test", filename, postedFile.InputStream); Google.Apis.Auth.OAuth2.GoogleCredential credential = GCP_AUTH.AuthExplicit(); string imgurl = GCP_AUTH.upload_file_stream("makelocal", "upload/test", filename, postedFile.InputStream, credential); //Label1.Text += fuDocument.FileName.ToString() + " finish<br>"; //fuDocument.SaveAs(Server.MapPath("school_important_images") + "\\" + filename); type0_Image.ImageUrl = imgurl; Image4.Visible = true; Image5.Visible = false; //GridView1.DataBind(); } else { ScriptManager.RegisterStartupScript(fuDocument, fuDocument.GetType(), "alert", "alert('File is out of memory 16MB!')", true); } } else { ScriptManager.RegisterStartupScript(fuDocument, fuDocument.GetType(), "alert", "alert('filename extension is not in role!')", true); } } }
protected void Page_Load(object sender, EventArgs e) { DataView dv1 = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments()); if (dv1[0][0] != DBNull.Value && dv1[0][1] != DBNull.Value && dv1[0][2] != DBNull.Value && dv1[0][3] != DBNull.Value && dv1[0][4] != DBNull.Value) { DataView dv = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments()); if (dv.Count == 1) { Server.Transfer("UserList.aspx"); } else { int n = SqlDataSource1.Insert(); if (n == 1) { Server.Transfer("UserList.aspx"); } } } else { Response.Write("<script>alert('Please Fill Up Your Profile Details First...')</script>"); Server.Transfer("~/Account/Profile.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { hello.Text = User.Identity.Name; UserName.Value = User.Identity.Name; DataView dv1 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); DataRow row1 = dv1.Table.Rows[0]; string id = row1["Id"].ToString(); UserId.Value = id; DataView dv2 = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); if (dv2.Table.Rows.Count == 0) { status.Text = "You have no profile yet. Please use 'Edit Profile' to create a profile first!"; return; } DataRow row2 = dv2.Table.Rows[0]; Name.Text = row2["Name"].ToString(); Age.Text = row2["Age"].ToString(); Address.Text = row2["Address"].ToString(); Telephone.Text = row2["Telephone"].ToString(); Gender.Text = row2["Gender"].ToString(); EmailAddress.Text = row2["E-mail address"].ToString(); }
protected void Button1_Click(object sender, EventArgs e) { try { SqlDataSource1.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader listado; listado = (SqlDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty); if (listado.Read()) { lblTotalI.Text = Convert.ToDecimal(listado["TotalEntrada"]).ToString("0.00"); } else { lblTotalI.Text = "0"; } SqlDataSource2.DataSourceMode = SqlDataSourceMode.DataReader; SqlDataReader listadoSalida; listadoSalida = (SqlDataReader)SqlDataSource2.Select(DataSourceSelectArguments.Empty); if (listadoSalida.Read()) { lblTotalR.Text = Convert.ToDecimal(listadoSalida["TotalSalida"]).ToString("0.00"); } else { lblTotalR.Text = "0"; } Label1.Text = (Convert.ToDecimal(lblTotalI.Text) + Convert.ToDecimal(Label3.Text)).ToString(); Label2.Text = (Convert.ToDecimal(lblTotalR.Text) + Convert.ToDecimal(Label4.Text)).ToString(); } catch (Exception er) { Response.Write("<script>alert('Error! Rango de fecha incorrecta o No existe un registro con la fecha ingresada." + er + "')</script>"); } }
protected void Delete_ButtonClick(object sender, EventArgs e) { AllEmployees.DataSource = SqlDataSource2; SqlDataSource2.Select(DataSourceSelectArguments.Empty); AllEmployees.DataTextField = "last_name"; AllEmployees.DataValueField = "ssn"; AllEmployees.DataBind(); }
protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e) { PastProjects.DataSource = SqlDataSource2; SqlDataSource2.Select(DataSourceSelectArguments.Empty); PastProjects.DataTextField = "name"; PastProjects.DataValueField = "project_ID"; PastProjects.DataBind(); }
protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e) { AllEmployees.DataSource = SqlDataSource2; SqlDataSource2.Select(DataSourceSelectArguments.Empty); AllEmployees.DataTextField = "last_name"; AllEmployees.DataValueField = "ssn"; AllEmployees.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { if (IsPostBack) { SqlDataSource2.Select(DataSourceSelectArguments.Empty); GridView1.DataBind(); } }
protected void getData() { DataView stud_Address = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drv in stud_Address) { DataRow row = drv.Row; lblSadd.Text = row["Address1"].ToString(); lblSadd1.Text = row["Address2"].ToString(); lblPost.Text = row["Postcode"].ToString(); lblCity.Text = row["City"].ToString(); lblState.Text = row["State"].ToString(); } DataView parentF = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drv in parentF) { DataRow row = drv.Row; lblFname.Text = row["Name"].ToString(); lblFOcc.Text = row["Occupation"].ToString(); lblFsalary.Text = row["Salary"].ToString(); lblphone.Text = row["Contact"].ToString(); } DataView parentAdd = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drv in parentAdd) { DataRow row = drv.Row; lblFadd.Text = row["Address1"].ToString(); lblFpost.Text = row["Postcode"].ToString(); lblFstate.Text = row["State"].ToString(); lblFcity.Text = row["City"].ToString(); } DataView parentM = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drv in parentM) { DataRow row = drv.Row; lblMname.Text = row["Name"].ToString(); lblMOcc.Text = row["Occupation"].ToString(); lblMsalary.Text = row["Salary"].ToString(); } DataView stud_Acad = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drv in stud_Acad) { DataRow row = drv.Row; lblSIns.Text = row["Name_of_Institution"].ToString(); lblSGrad.Text = row["Date"].ToString(); lblcgpa.Text = row["CGPA"].ToString(); lblField.Text = row["Field_of_Study"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); if (ck != null) { string strDeptID = ck.d_code; //Redirect Login users to pending page //redirectToPendingPage(); //string strDeptID = "01001"; string strProjectStatus = ck.pj_status; //keep project code in cookie for usage in follwing pages mgCookie.UpdateCookies("pj_status", strProjectStatus); string strSQL1 = "select * from dbo.department d, dbo.ministry m where d.mi_id = m.mi_id and d.d_code = '" + strDeptID + "'"; SqlDataSource4.SelectCommand = strSQL1; SqlDataSource4.DataBind(); DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty); foreach (DataRow dRow in dv1.Table.Rows) { lblDeptCode.Text = dRow["mi_code"].ToString(); lblDeptName.Text = dRow["mi_name"].ToString(); lblDivisionCode.Text = dRow["d_code"].ToString(); lblDivisionName.Text = dRow["d_name"].ToString(); mgCookie.UpdateCookies("mi_id", dRow["mi_id"].ToString()); } if (!Page.IsPostBack) { string strSQL = "SELECT * from dbo.projects where pj_id = " + ck.pj_id; SqlDataSource2.SelectCommand = strSQL; SqlDataSource2.DataBind(); DataView dv = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); lblProjectCode.Text = dv.Table.Rows[0]["pj_code"].ToString(); txtProjectName.Text = dv.Table.Rows[0]["pj_name"].ToString(); ddlYudtasad.SelectedValue = dv.Table.Rows[0]["pj_yut_id"].ToString(); ddlYear.SelectedValue = dv.Table.Rows[0]["pj_year"].ToString(); txtBudget.Text = dv.Table.Rows[0]["pj_budget"].ToString(); DropDownList2.SelectedValue = dv.Table.Rows[0]["pj_budget_type"].ToString(); //txtIntegrate.Text = dv.Table.Rows[0]["pj_integrateproject"].ToString(); //txtRelate.Text = dv.Table.Rows[0]["pj_relateDept"].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { DataView dvSql = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); foreach (DataRowView drvSql in dvSql) { Label1.Text = drvSql["cost"].ToString(); } }
private DataRowView GetSelectedTech() { DataView TechniciansTable = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); TechniciansTable.RowFilter = "TechID = " + grdSelectTech.SelectedValue; DataRowView row = (DataRowView)TechniciansTable[0]; return(row); }
// Returns the newest event ID. public String InsertedEventID() { DataView dv = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); dv.Sort = "Created_At DESC"; DataRowView dr = dv[0]; return(dr["EventID"].ToString()); }
protected void Button2_Click(object sender, EventArgs e) { DataView view = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); if (TextBox6.Text == view[0][1].ToString()) { Session["Auth"] = "true"; Response.Redirect("ListCourses.aspx"); } }
public void refresh() { ListBox1.Items.Clear(); DataView totalMessages = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); for (int i = 0; i <= totalMessages.Count - 1; i++) { ListBox1.Items.Add(totalMessages[i][0].ToString() + ": " + totalMessages[i][1]); } }
protected void Button1_Click(object sender, EventArgs e) { if (DropDownList1.SelectedValue != "__________") { if (DropDownList2.SelectedValue != "") { SqlConnection connection3 = new SqlConnection(SqlDataSource3.ConnectionString); SqlCommand getUser = new SqlCommand( "SELECT UsersKruzhki.ДатаПодачи FROM UsersKruzhki WHERE ((UsersKruzhki.KruzhId LIKE '" + DropDownList1.SelectedValue + "') AND (UsersKruzhki.UserId LIKE '" + DropDownList2.SelectedValue + "'));", connection3); connection3.Open(); SqlDataReader reader = getUser.ExecuteReader(); reader.Read(); LabelReg.Text = reader[0].ToString(); reader.Close(); connection3.Close(); LabelReg.Visible = true; // Делаем выборку кружковых работ по двум параметрам SqlConnection connection = new SqlConnection(SqlDataSource2.ConnectionString); // выбираем не провереные работы if (CheckBox1.Checked) { SqlDataSource2.SelectCommand = " SELECT * " + " FROM Works INNER JOIN UsersKruzhki ON Works.Владелец = UsersKruzhki.UserId AND Works.Кружок = UsersKruzhki.KruzhId INNER JOIN Users ON UsersKruzhki.UserId = Users.UserId " + " WHERE (( Works.Кружок LIKE '" + DropDownList1.SelectedValue + "') " + " AND ( Works.Владелец LIKE '" + DropDownList2.SelectedValue + "') AND ( Works.Статус = 'не проверено') )"; } else { SqlDataSource2.SelectCommand = " SELECT * " + " FROM Works INNER JOIN UsersKruzhki ON Works.Владелец = UsersKruzhki.UserId AND Works.Кружок = UsersKruzhki.KruzhId INNER JOIN Users ON UsersKruzhki.UserId = Users.UserId " + " WHERE (( Works.Кружок LIKE '" + DropDownList1.SelectedValue + "') " + " AND ( Works.Владелец LIKE '" + DropDownList2.SelectedValue + "') AND ( (Works.Статус = 'проверено') OR (Works.Статус = 'не засчитано')) )"; } DataSourceSelectArguments argument = new DataSourceSelectArguments(); connection.Open(); SqlDataSource2.Select(argument); connection.Close(); GridView1.Visible = true; GridView1.DataBind(); } } }