protected void btnSubmit_Click(object sender, EventArgs e) { int n = SqlDataSource2.Update(); if (n == 1) { Response.Write("<script>alert('Security Question and Answer has been Changed Successfully...')</script>"); } }
protected void DataListCommentsofPost_DeleteCommand(object source, DataListCommandEventArgs e) { DataListCommentsofPost.SelectedIndex = e.Item.ItemIndex; int idkomentarz = int.Parse(((Label)(DataListCommentsofPost.SelectedItem.FindControl("LabelIdKomentarze"))).Text); SqlDataSource2.UpdateCommand = "UPDATE Komentarze SET k_usun = 1 FROM Komentarze INNER JOIN Posty ON Komentarze.Posty_id_posty = Posty.id_posty INNER JOIN Uzytkownik ON Komentarze.Uzytkownik_id_uzytkownik = Uzytkownik.id_uzytkownik WHERE (Komentarze.id_komentarze = " + idkomentarz + ")"; SqlDataSource2.Update(); DataBind(); }
protected void btn2_Click(object sender, EventArgs e) { foreach (ListItem li in CheckBoxList1.Items) { if (li.Selected == true) { String sql = "update OutwardLetter set OutwardStatus=True WHERE OutwardLetterNo1='" + li.Text + "'"; SqlDataSource2.UpdateCommand = sql; int n = SqlDataSource2.Update(); } } }
protected void Page_Load(object sender, EventArgs e) { hfStatus.Value = "No"; hfStatus2.Value = "No"; int n = SqlDataSource1.Update(); if (n == 1) { SqlDataSource2.Update(); Response.Write("<script>alert('User Cancelled Successfully..')</script>"); } Server.Transfer("RoomDetails.aspx"); }
protected void End_Click(object sender, EventArgs e) { try { SqlDataSource2.Update(); MultiView1.ActiveViewIndex = 0; btnRead.Enabled = false; } catch { MultiView1.ActiveViewIndex = 0; } }
protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e) { string orderno = ((Label)e.Item.FindControl("Label1")).Text; string commissionamount = ((Label)e.Item.FindControl("Label6")).Text; if (e.CommandName == "received") { SqlDataSource2.UpdateParameters.Add("Commissionreceived", commissionamount); SqlDataSource2.UpdateParameters.Add("OrderNo", orderno); SqlDataSource2.Update(); } }
protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e) { SqlDataSource2.UpdateParameters["Ingredient_id"].DefaultValue = e.CommandArgument.ToString(); SqlDataSource2.UpdateParameters["Ingredient_measure_unit"].DefaultValue = ((TextBox)e.Item.FindControl("Ingredient_measure_unitTextBox")).Text; SqlDataSource2.UpdateParameters["Ingredient_quantity"].DefaultValue = ((TextBox)e.Item.FindControl("Ingredient_quantityTextBox")).Text; SqlDataSource2.UpdateParameters["Ingredient_name"].DefaultValue = ((TextBox)e.Item.FindControl("Ingredient_nameTextBox")).Text; SqlDataSource2.Update(); DataList1.EditItemIndex = -1; DataList1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { hfDisable.Value = "Yes"; hfConfirm.Value = "Yes"; hfStatus.Value = "Yes"; int n = SqlDataSource1.Update(); if (n == 1) { SqlDataSource2.Update(); Response.Write("<script>alert('User Confirmed Successfully..')</script>"); } Server.Transfer("FlatDetails.aspx"); }
/// <summary> /// Old Values can be accessed in this Event Handler. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) { Hashtable OldValues; Hashtable NewValues = new Hashtable(); switch (e.CommandName.Trim()) { case "Edit": break; case "Update": GridEditableItem EItem = e.Item as GridEditableItem; OldValues = (Hashtable)EItem.SavedOldValues; e.Item.OwnerTableView.ExtractValuesFromItem(NewValues, EItem); GridEditableItem Item = e.Item as GridEditableItem; RadAutoCompleteBox RadAC = Item["ShipVia"]. FindControl("RadAutoCompleteBox1") as RadAutoCompleteBox; string Text = RadAC.Text.Replace(";", "").Trim(); string Value = ""; foreach (AutoCompleteBoxEntry entry in RadAC.Entries) { if (entry.Text == Text) { Value = entry.Value; break; } } SqlDataSource2.UpdateParameters["ShipperId"].DefaultValue = Value.Trim(); SqlDataSource2.Update(); break; case "Delete": break; case "Cancel": break; default: break; } if (e.CommandName == RadGrid.UpdateCommandName) { RadGrid1.MasterTableView.ClearEditItems(); } }
protected void btn_editar_Click(object sender, EventArgs e) { int cant; cant = SqlDataSource2.Update(); if (cant == 1) { lbl_resultado.Text = "El chip se ha editado correctamente."; } else { lbl_resultado.Text = "Se ha producido un error al editar" + " el chip."; } }
protected void lbUpdate_Click(object sender, EventArgs e) { try { SqlDataSource2.UpdateParameters["Handin"].DefaultValue = ((TextBox)DetailsView1.FindControl("txtHandin")).Text.Trim(); SqlDataSource2.UpdateParameters["Hw"].DefaultValue = ((TextBox)DetailsView1.FindControl("txtHw")).Text.Trim(); SqlDataSource2.Update(); DetailsView1.ChangeMode(DetailsViewMode.ReadOnly); lblTooltip1.Text = "更新成功!"; } catch (SqlException) { lblTooltip1.Text = "更新失败!请检查输入!"; } }
protected void Confirm_Click(object sender, EventArgs e) { if (TextBox1.Text == "") { status.Text = "Please input your name."; return; } if (TextBox4.Text != "") { if (!(System.Text.RegularExpressions.Regex.IsMatch(TextBox4.Text, @"\(?\d{3}\)?-? *\d{3}-? *-?\d{4}"))) { status.Text = "Please input a 10 digit telephone."; return; } } if (TextBox6.Text != "") { if (!(System.Text.RegularExpressions.Regex.IsMatch(TextBox6.Text, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"))) { status.Text = "Please input a valid email address.(For example '*****@*****.**')"; return; } } UserName.Value = User.Identity.Name; DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); DataRow row = dv.Table.Rows[0]; string id = row["Id"].ToString(); UserId.Value = id; DataView dv2 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); if (dv2.Table.Rows.Count == 0) { SqlDataSource2.Insert(); status.Text = "Create account successfully!"; } else { SqlDataSource2.Update(); status.Text = "Edit account successfully!"; } Response.Redirect("Default.aspx"); }
protected void Button2_Click(object sender, EventArgs e) { try { HiddenField2.Value = Group0.SelectedItem.ToString(); SqlDataSource2.Update(); MultiView1.ActiveViewIndex = 0; btnDelete.Enabled = btnEdit.Enabled = false; btnDelete.Visible = btnEdit.Visible = false; } catch { MultiView1.ActiveViewIndex = 0; btnDelete.Enabled = btnEdit.Enabled = btnEdit.Visible = btnDelete.Visible = false; } }
protected void Button1_Click(object sender, EventArgs e) { GridViewRow row = GridView1.SelectedRow; if (row != null) { SqlDataSource1.UpdateCommand = "UPDATE[Orders] SET [Driver] ='" + Session["user"].ToString().Trim() + "' WHERE[order number] = '" + row.Cells[1].Text + "'"; SqlDataSource1.Update(); SqlDataSource2.UpdateCommand = "UPDATE [golfCar] SET [Booked] = '1' WHERE [id] ='" + row.Cells[4].Text + "'"; SqlDataSource2.Update(); } else { } }
protected void Button1_Click(object sender, EventArgs e) { DataView dview = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); if (dview.Table.Rows.Count > 0) { SqlDataSource2.Update(); Label1.Text = "Updated Successfully"; } else { SqlDataSource2.Insert(); Label1.Text = "Updated Successfully"; } }
protected void Button1_Click(object sender, EventArgs e) { string name = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString(); //////////////////////////////////////////////////////////////////////////////////////////////// string savePath = "~/images/products/"; Bitmap src = Bitmap.FromStream(FileUpload1.PostedFile.InputStream) as Bitmap; Bitmap result = ResizeBitmap(src, 350, 200); string saveName = Server.MapPath(savePath) + name + ".Png"; result.Save(saveName, ImageFormat.Png); string imagepath = "~/images/products/" + name + ".Png"; SqlDataSource2.UpdateParameters["d_image"].DefaultValue = imagepath; SqlDataSource2.UpdateParameters["d_id"].DefaultValue = Request.QueryString["id"].ToString(); SqlDataSource2.Update(); }
protected void Button2_Click(object sender, EventArgs e) { try { if (HiddenField1.Value == "مدیر") { txtUserType0.Text = "مدیر"; } txtUserType0.ReadOnly = false; SqlDataSource2.Update(); MultiView1.ActiveViewIndex = 0; } catch { MultiView1.ActiveViewIndex = 0; } }
protected void btnModificar_Click(object sender, EventArgs e) { SqlDataSource2.UpdateParameters["nombre"].DefaultValue = txtNombre.Text; SqlDataSource2.UpdateParameters["estado"].DefaultValue = txtEstado.Text; int cant; cant = SqlDataSource2.Update(); if (cant == 1) { Response.Write("<script>alert('Se modifico el rol')</script>"); gvRoles.DataBind(); } else { Response.Write("<script>alert('No existe el codigo')</script>"); } }
protected void DataListCommentsofPost_UpdateCommand(object source, DataListCommandEventArgs e) { DataListCommentsofPost.SelectedIndex = e.Item.ItemIndex; string oldcoment = ((TextBox)(DataListCommentsofPost.SelectedItem.FindControl("TextBox1"))).Text; string newcoment = ((TextBox)(DataListCommentsofPost.SelectedItem.FindControl("TextBox2"))).Text; int idkomentarz = int.Parse(((Label)(DataListCommentsofPost.SelectedItem.FindControl("LabelIdKomentarze"))).Text); if (!oldcoment.Equals(newcoment)) { SqlDataSource2.UpdateCommand = "UPDATE Komentarze SET k_note = '" + newcoment + "', k_data = GetDate() FROM Komentarze INNER JOIN Posty ON Komentarze.Posty_id_posty = Posty.id_posty INNER JOIN Uzytkownik ON Komentarze.Uzytkownik_id_uzytkownik = Uzytkownik.id_uzytkownik WHERE (Komentarze.id_komentarze = " + idkomentarz + ")"; SqlDataSource2.Update(); DataBind(); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "setInterval(function(){location.href='Comments.aspx';},5000);", true); } }
protected void Update_Click(object sender, EventArgs e) { if (IsValid) { SqlDataSource2.UpdateParameters.Add("Email", Context.User.Identity.GetUserName()); var parameters = SqlDataSource2.UpdateParameters; parameters["LastName"].DefaultValue = LastName.Text; parameters["FirstName"].DefaultValue = FirstName.Text; parameters["Age"].DefaultValue = Age.Text; parameters["Gender"].DefaultValue = Gender.Text; parameters["Height"].DefaultValue = Height.Text; parameters["Weight"].DefaultValue = Weight.Text; double Kilograms = Double.Parse(Weight.Text) * 0.453592; double Meters = Double.Parse(Height.Text) * 0.0254; double BMI = Kilograms / (Meters * Meters); parameters["BMI"].DefaultValue = BMI.ToString(); if (BMI < 18.5) { parameters["Type"].DefaultValue = "Under Weight"; } else if (BMI >= 18.5 && BMI < 25) { parameters["Type"].DefaultValue = "Normal Weight"; } else if (BMI > 25) { parameters["Type"].DefaultValue = "Over Weight"; } try { SqlDataSource2.Update(); } catch (Exception ex) { lblError.Text = DatabaseErrorMessage(ex.Message); } } }
protected void Button2_Click(object sender, EventArgs e) { //成绩提交 foreach (GridViewRow dr in GridView1.Rows) { string Sno = dr.Cells[0].Text; string Cno = dr.Cells[2].Text; string psscore = ((TextBox)dr.Cells[5].FindControl("txtps")).Text.ToString(); string xmscore = ((TextBox)dr.Cells[6].FindControl("txtxm")).Text.ToString(); string zpscore = ((TextBox)dr.Cells[7].FindControl("txtzp")).Text.ToString(); string sqlstr = "update showInfo set psScore='" + psscore + "',xmScore='" + xmscore + "',zpScore='" + zpscore + "' where userNo='" + Sno + "' and Cno='" + Cno + "'"; SqlDataSource2.UpdateCommand = sqlstr; SqlDataSource2.Update(); } SqlDataSource2.DataBind(); Response.Write("<script language=javascript>alert('成绩录入成功!')</script>"); }
protected void Button1_Click(object sender, EventArgs e) { String savePath = "c:\\temp\\day\\uploads\\"; if (FileUpload1.HasFile) { string fileName = FileUpload1.FileName; savePath = savePath + fileName; FileUpload1.SaveAs(savePath); Session["Thesis_FileName"] = FileUpload1.FileName; LinkButton1.Visible = true; LinkButton1.Text = FileUpload1.FileName; SqlDataSource2.Update(); } else { Label8.Text = "請選擇檔案"; } }
protected void UpdateButton_Click(object sender, EventArgs e) { string message; if (FileUpload1.FileName != "") { SqlDataSource2.Update(); message = "Restaurant Updated successfully"; msgLabel.Text = message; } else { try { conn.SqlConnectionObj.Open(); string query = String.Format("Update Restaurant_tbl SET RestaurantAddress='{0}',RestaurantPhone='{1}',RestaurantMinOrder='{2}',OpeningHour='{3}',ClosingHour='{4}',DeliveryFee='{5}' where RestaurantName='{6}'", ResAddTextBox.Text, ResPhoneTextBox.Text, MinOrderTextBox.Text, OpenHrTextBox.Text, CloseHrTextBox.Text, TextBox1.Text, DropDownList1.SelectedValue); conn.SqlCommandObj.CommandText = query; conn.SqlCommandObj.ExecuteNonQuery(); message = "Restaurant Updated successfully"; msgLabel.Text = message; } catch (Exception ex) { throw new Exception("Error occurred during update operation. Try again", ex); } finally { if (conn.SqlConnectionObj != null && conn.SqlConnectionObj.State == ConnectionState.Open) { conn.SqlConnectionObj.Close(); } } } ResPhoneTextBox.Text = ""; ResAddTextBox.Text = ""; MinOrderTextBox.Text = ""; CloseHrTextBox.Text = ""; TextBox1.Text = ""; OpenHrTextBox.Text = ""; }
protected void Button4_Click(object sender, EventArgs e) { GridViewRowCollection grows2 = GridView2.Rows; string alertIDs = ""; for (int i = 0; i < grows2.Count; i++) { if (grows2[i].Cells[indexOfIsCompleted].Text == "True") { SqlDataSource2.UpdateCommand = String.Format(@"UPDATE [dbo].[Items1] SET [ProjectStatus] = 'Completed' WHERE [ID] = {0} ", int.Parse(grows2[i].Cells[indexOfID].Text)); SqlDataSource2.Update(); } else if (grows2[i].Cells[indexOfIsCompleted].Text == "False") { SqlDataSource2.UpdateCommand = String.Format(@"UPDATE [dbo].[Items1] SET [ProjectStatus] = 'Approved' WHERE [ID] = {0} ", int.Parse(grows2[i].Cells[indexOfID].Text)); SqlDataSource2.Update(); } if (grows2[i].Cells[indexOfRemarks].Text.Trim().Replace(" ", "") == "" && grows2[i].Cells[indexOfIsCompleted].Text == "True") { alertIDs += "#" + int.Parse(grows2[i].Cells[indexOfID].Text); if (grows2[i].Cells[indexOfProjectStatus].Text.Contains("Completed")) { SqlDataSource2.UpdateCommand = String.Format(@"UPDATE [dbo].[Items1] SET [ProjectStatus] = 'Approved', [IsCompleted] = 0 WHERE [ID] = {0} ", int.Parse(grows2[i].Cells[indexOfID].Text)); SqlDataSource2.Update(); } } } if (alertIDs.Length > 0) { string AlertMsg = String.Format("<script>alert('Warning: Project ID {0} is (are) attempted to be completed without requestor remarks so the request action is denied. Please check it.')</script>", alertIDs); this.Response.Write(AlertMsg); } this.Response.Write("<script>window.location='Default.aspx'</script>"); }
protected void btn_Click(object sender, EventArgs e) { String Year = DropDownList1.SelectedValue; foreach (ListItem li in CheckBoxList1.Items) { if (li.Selected == true) { String sql = "update Confirmation set Checked='True' WHERE UnitName='" + li.Text + "' AND Year='" + Year + "'"; SqlDataSource2.UpdateCommand = sql; int n = SqlDataSource2.Update(); if (n == 1) { String sql1 = "update SchoolTable set Checked='True' WHERE UnitName='" + li.Text + "' AND Year='" + Year + "'"; SqlDataSource3.UpdateCommand = sql1; int nm = SqlDataSource3.Update(); } } } Server.Transfer("Confirmation1.aspx"); }
protected void Button5_Click(object sender, EventArgs e) { GridViewRowCollection grows = GridView1.Rows; for (int i = 0; i < grows.Count; i++) { if (grows[i].Cells[indexOfProjectStatus].Text.Contains("Approved")) { SqlDataSource1.UpdateCommand = String.Format(@"UPDATE [dbo].[Items1] SET [IsCompleted] = 1 WHERE [ID] = {0} ", int.Parse(grows[i].Cells[indexOfID].Text)); SqlDataSource2.Update(); } else { SqlDataSource1.UpdateCommand = String.Format(@"UPDATE [dbo].[Items1] SET [IsCompleted] = 0 WHERE [ID] = {0} ", int.Parse(grows[i].Cells[indexOfID].Text)); SqlDataSource2.Update(); } } this.Response.Write("<script>window.location='Default.aspx'</script>"); }
protected void btnCadastrar_Click(object sender, EventArgs e) { SqlDataSource2.UpdateParameters["Login"].DefaultValue = txtLogin.Text; SqlDataSource2.UpdateParameters["Senha"].DefaultValue = txtSenha.Text; SqlDataSource2.UpdateParameters["IDCond"].DefaultValue = ddlCond.SelectedItem.Value; SqlDataSource2.UpdateParameters["IDBloco"].DefaultValue = ddlBloco.SelectedItem.Value; SqlDataSource2.UpdateParameters["IDUnit"].DefaultValue = ddlApart.SelectedItem.Value; SqlDataSource1.UpdateParameters["Email"].DefaultValue = txtEmail.Text; SqlDataSource1.UpdateParameters["Telefone"].DefaultValue = txtTelefone.Text; SqlDataSource1.UpdateParameters["Celular"].DefaultValue = txtCelular.Text; SqlDataSource1.UpdateParameters["Email"].DefaultValue = txtEmail.Text; SqlDataSource1.UpdateParameters["Nome"].DefaultValue = txtNome.Text; SqlDataSource1.UpdateParameters["Sexo"].DefaultValue = rblSexo.SelectedItem.Value; SqlDataSource1.UpdateParameters["dtNasc"].DefaultValue = txtdtNasc.Text; SqlDataSource1.UpdateParameters["MorCpf"].DefaultValue = txtCPF.Text; SqlDataSource1.UpdateParameters["MorRg"].DefaultValue = txtRG.Text; SqlDataSource1.UpdateParameters["MorProf"].DefaultValue = txtProfissao.Text; SqlDataSource1.UpdateParameters["MorEmpresa"].DefaultValue = txtEmpresa.Text; SqlDataSource1.UpdateParameters["MorTelEmer"].DefaultValue = txtTelEmer.Text; SqlDataSource1.UpdateParameters["MorEmerContato"].DefaultValue = txtContEmer.Text; SqlDataSource1.Update(); SqlDataSource2.Update(); }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { Session["ID"] = GridView1.SelectedDataKey.Value.ToString(); DataView dview = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty); int lockout = (int)dview.Table.Rows[0]["LockoutEnabled"]; HiddenField1.Value = lockout.ToString(); string i; if (HiddenField1.Value == "0") { i = "1"; } else { i = "0"; } //Response.Redirect("~/Admin/GroomerList.aspx?ID=" + GridView1.SelectedDataKey.Value); SqlDataSource2.UpdateParameters.Add("username", GridView1.SelectedDataKey.Value.ToString()); SqlDataSource2.UpdateParameters.Add("Lockout", i.ToString()); SqlDataSource2.Update(); GridView1.DataBind(); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { SqlDataSource2.UpdateCommand = "UPDATE universidad SET nombre=@nomb WHERE id=@codi"; string nomb = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text; if (nomb != null) { SqlDataSource2.UpdateParameters.Add("nomb", nomb); SqlDataSource2.UpdateParameters.Add("codi", GridView1.DataKeys[e.RowIndex].Values["id"].ToString()); SqlDataSource2.Update(); GridView1.DataBind(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "modificarCarrera();", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "error();", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "error();", true); } }
protected void btnConfirm_Click(object sender, EventArgs e) { fv_set.ChangeMode(FormViewMode.ReadOnly); SqlDataSource2.Update(); }