protected void Button2_Click(object sender, EventArgs e) { if (this.IsPostBack) { if (TextBox2.Text == "" || TextBox3.Text == "" || TextBox4.Text == "" || TextBox5.Text == "" || TextBox6.Text == "") { Response.Write("<script>alert('Add Questions have missing Fields')</script>"); } else { SqlDataSource2.InsertParameters["question"].DefaultValue = TextBox2.Text; SqlDataSource2.InsertParameters["Choice1"].DefaultValue = TextBox3.Text; SqlDataSource2.InsertParameters["Choice2"].DefaultValue = TextBox4.Text; SqlDataSource2.InsertParameters["Choice3"].DefaultValue = TextBox5.Text; SqlDataSource2.InsertParameters["Choice4"].DefaultValue = TextBox6.Text; SqlDataSource2.Insert(); SqlDataSource2.DataBind(); GridView1.DataBind(); TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; } } }
protected void Button1_Click(object sender, EventArgs e) { if (Photo.HasFile) { string FileName = Photo.FileName.ToLower(); string Extension = FileName.Substring(FileName.LastIndexOf('.')); if (Extension == ".jpg" || Extension == ".jpeg" || Extension == ".png") { HiddenFieldPhoto.Value = "/photos/" + FileName; Photo.SaveAs(Server.MapPath(HiddenFieldPhoto.Value)); SqlDataSource2.Insert(); msg.Text = "Advertisement added successfully!"; msg.CssClass = "text-success"; } else { msg.Text = "Please select an image file"; msg.CssClass = "text-danger"; } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "$('#myModal').modal('hide');$('body').removeClass('modal-open');$('.modal-backdrop').remove();$('#myModal').modal('show');", true); } }
protected void Button2_Click(object sender, EventArgs e) { if (FileUpload2.HasFile == true) { SqlDataSource2.Insert(); } }
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 btnRegisterProduct_Click(object sender, EventArgs e) { if (IsValid && ddlProducts.SelectedIndex > -1) { var parameters = SqlDataSource2.InsertParameters; parameters["CustomerID"].DefaultValue = selected.CustomerID.ToString(); parameters["ProductCode"].DefaultValue = ddlProducts.SelectedValue; parameters["RegistrationDate"].DefaultValue = DateTime.Now.ToString(); try { SqlDataSource2.Insert(); SendConfirmationEmail(ddlProducts.SelectedItem.Text); // Easy hard-coded email ResetProductControls(); txtCustomerID.Text = ""; } catch (Exception ex) { string errorMsg = "A database error has occurred. " + "Message: " + ex.Message; lblError.Text = errorMsg; Session["ErrorMessage"] = errorMsg; Session["ReturnUrl"] = Request.Url.ToString(); Response.Redirect("~/ErrorMessage"); } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { var c = e.CommandArgument.ToString(); if (e.CommandName == "start_order") { SqlDataSource2.InsertParameters["rest_id"].DefaultValue = c; SqlDataSource2.InsertParameters["chairman"].DefaultValue = Session["fb_id"].ToString(); SqlDataSource2.InsertParameters["max_cost"].DefaultValue = "0"; SqlDataSource2.InsertParameters["max_order"].DefaultValue = "0"; SqlDataSource2.Insert(); Response.Redirect("start_order.aspx"); } else if (e.CommandName == "start_shout") { GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer); String max_cost = ((TextBox)row.FindControl("max_cost")).Text; String max_order = ((TextBox)row.FindControl("max_order")).Text; SqlDataSource2.InsertParameters["rest_id"].DefaultValue = c; SqlDataSource2.InsertParameters["chairman"].DefaultValue = Session["fb_id"].ToString(); SqlDataSource2.InsertParameters["max_cost"].DefaultValue = max_cost; SqlDataSource2.InsertParameters["max_order"].DefaultValue = max_order; SqlDataSource2.Insert(); Response.Redirect("start_order.aspx"); } }
protected void Button3_Click1(object sender, EventArgs e) { Button tmp = (Button)sender; Label1.Text = ""; try { //This is similar to the C# we will need for project 2 SqlDataSource2.InsertParameters["HerdID"].DefaultValue = DetailsView1.SelectedValue.ToString(); // Note - The customer ID is an auto generated identity field. It should not be included in the insert. SqlDataSource2.InsertParameters["FeedSourceKey"].DefaultValue = TextBox6.Text; SqlDataSource2.InsertParameters["QuantityTotal"].DefaultValue = TextBox7.Text; SqlDataSource2.InsertParameters["ItemID"].DefaultValue = TextBox8.Text; SqlDataSource2.InsertParameters["Waste"].DefaultValue = TextBox9.Text; SqlDataSource2.Insert(); } catch (Exception ex) { Label1.Text = ex.Message; } //outside the try catch so that no matter what, the text boxes are cleared. TextBox6.Text = ""; TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; }
protected void Button1_Click(object sender, EventArgs e) { try { SqlDataSource4.UpdateParameters["CardNO"].DefaultValue = Session["CardNo"].ToString(); SqlDataSource4.UpdateParameters["deposit"].DefaultValue = TextBox1.Text; SqlDataSource4.Update(); SqlDataSource2.InsertParameters["deposit"].DefaultValue = "True"; SqlDataSource2.InsertParameters["withdrow"].DefaultValue = "False"; SqlDataSource2.InsertParameters["Ammount"].DefaultValue = TextBox1.Text; SqlDataSource2.InsertParameters["BranchID"].DefaultValue = DropDownList1.Text; SqlDataSource2.InsertParameters["CardNO"].DefaultValue = Session["CardNo"].ToString(); SqlDataSource2.InsertParameters["date"].DefaultValue = DateTime.Today.ToString("dd-MM-yyyy") + " " + DateTime.Now.ToString("HH: mm:ss"); SqlDataSource2.Insert(); Label1.Text = "Successfull!! Done ! , Go to view Balance To Check your Update Balance!!"; } catch (Exception ee) { Label1.Text = ee.StackTrace; } }
protected void lkInsertsession_Click(object sender, EventArgs e) { SqlDataSource2.InsertParameters["SessionCode"].DefaultValue = ((TextBox)GridView2.FooterRow.FindControl("txtSession")).Text; SqlDataSource2.InsertParameters["ProgramId"].DefaultValue = ((DropDownList)GridView2.FooterRow.FindControl("DropDownList1")).SelectedValue; // SqlDataSource1.InsertParameters["SessionCode"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("txtSession")).Text; SqlDataSource2.Insert(); }
protected void LinkButton2_Click(object sender, EventArgs e) { SqlDataSource2.InsertParameters["unvan"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("unvan")).Text; SqlDataSource2.InsertParameters["ad"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("ad")).Text; SqlDataSource2.InsertParameters["soyad"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("soyad")).Text; SqlDataSource2.Insert(); }
protected void btnSubmit_Click(object sender, EventArgs e) { SqlDataSource2.InsertParameters["datetime"].DefaultValue = DateTime.Now.ToString(); SqlDataSource2.Insert(); SqlDataSource3.Update(); Response.Redirect("SubmitSurvey.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { Button tmp = (Button)sender; tmp.Text = "...clicked..."; try { //This is similar to the C# we will need for project 2 SqlDataSource2.InsertParameters["ComponentID"].DefaultValue = DetailsView1.SelectedValue.ToString(); // Note - The customer ID is an auto generated identity field. It should not be included in the insert. SqlDataSource2.InsertParameters["SerialNumber"].DefaultValue = TextBox1.Text; SqlDataSource2.InsertParameters["SubstituteID"].DefaultValue = TextBox3.Text; SqlDataSource2.InsertParameters["Location"].DefaultValue = TextBox4.Text; SqlDataSource2.InsertParameters["Quantity"].DefaultValue = TextBox5.Text; SqlDataSource2.InsertParameters["DateInstalled"].DefaultValue = TextBox6.Text; SqlDataSource2.InsertParameters["EmployeeID"].DefaultValue = TextBox7.Text; SqlDataSource2.Insert(); TextBox1.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; } catch (Exception ex) { Label1.Text = ex.Message; } }
protected void Button2_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database.mdf;Integrated Security=True;User Instance=True"); SqlDataAdapter adp = new SqlDataAdapter("select * from cart ", con); System.Data.DataTable dt = new System.Data.DataTable(); adp.Fill(dt); if (dt.Rows.Count == 0) { Label5.Text = "not exist..."; } else { for (int i = 0; i < dt.Rows.Count; i++) { Label5.Text = dt.Rows[i]["uid"].ToString(); Label6.Text = dt.Rows[i]["transid"].ToString(); Label7.Text = dt.Rows[i]["pid"].ToString(); Label8.Text = dt.Rows[i]["qty"].ToString(); Label9.Text = dt.Rows[i]["totalprice"].ToString(); SqlDataSource2.Insert(); Label5.Text = ""; Label6.Text = ""; Label7.Text = ""; Label8.Text = ""; Label9.Text = ""; } Server.Transfer("payment.aspx"); } }
protected void InsertRecord(object sender, EventArgs e) { SqlDataSource2.Insert(); //Response.Redirect("CreateOrder.aspx"); string connStr = ConfigurationManager.ConnectionStrings["myConnectionAd"].ConnectionString; SqlConnection conn = new SqlConnection(connStr); conn.Open(); SqlCommand cmd = new SqlCommand("Select_Orders_Staging", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); GrdTransaction_Staging.DataSource = dt; GrdTransaction_Staging.DataBind(); if (conn != null && conn.State == System.Data.ConnectionState.Open) { conn.Close(); } }
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 Button1_Click(object sender, EventArgs e) { SqlDataSource2.InsertCommand = "INSERT INTO [TIMESLOTS] (Timeslot, Patient,Problems,DoctorName,AppointmentDate) VALUES(" + "\"" + DropDownList2.Text + "\", \"" + user + "\", \"" + TextBox1.Text + "\",\"" + DropDownList1.Text + "\",\"" + Calendar1.SelectedDate.ToShortDateString() + "\");"; SqlDataSource2.Insert(); GridView1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { SqlDataSource2.Insert(); Label5.Text = "Thank you!!! your Updates will apear soon"; Label5.Visible = true; }
protected void Button1_Click(object sender, EventArgs e) { Button tmp = (Button)sender; Label1.Text = ""; try { //This is similar to the C# we will need for project 2 SqlDataSource2.InsertParameters["VetID"].DefaultValue = DetailsView1.SelectedValue.ToString(); // Note - The customer ID is an auto generated identity field. It should not be included in the insert. SqlDataSource2.InsertParameters["TreatmentKey"].DefaultValue = TextBox4.Text; SqlDataSource2.InsertParameters["CowMedicalKey"].DefaultValue = TextBox5.Text; SqlDataSource2.InsertParameters["Medication"].DefaultValue = TextBox6.Text; SqlDataSource2.InsertParameters["MediconQuantity"].DefaultValue = TextBox7.Text; SqlDataSource2.InsertParameters["Cost"].DefaultValue = TextBox8.Text; SqlDataSource2.InsertParameters["SymptomKey"].DefaultValue = TextBox9.Text; SqlDataSource2.Insert(); } catch (Exception ex) { Label1.Text = ex.Message; } //outside the try catch so that no matter what, the text boxes are cleared. TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; }
protected void btnCreate_Click(object sender, EventArgs e) { if (IsValid) { var parameters1 = SqlDataSource1.InsertParameters; var parameters2 = SqlDataSource2.InsertParameters; parameters1["LoginID"].DefaultValue = txtNewName.Text; parameters1["Password"].DefaultValue = txtNewPass.Text; parameters1["Access"].DefaultValue = txtAccess.SelectedValue; parameters2["LoginID"].DefaultValue = txtNewName.Text; parameters2["Active"].DefaultValue = "No"; try { SqlDataSource1.Insert(); if (txtAccess.SelectedValue == "Applicant") { SqlDataSource2.Insert(); } lblError.Text = "New user created"; lblError.Visible = true; } catch (Exception ex) { lblError.Text = "A database error has occurred. " + "message: " + ex.Message; lblError.Visible = true; } } }
protected void lbInsert_Click1(object sender, EventArgs e) { SqlDataSource2.InsertParameters["boname"].DefaultValue = ((TextBox)GridView2.FooterRow.FindControl("txtboname")).Text; SqlDataSource2.InsertParameters["bocontact"].DefaultValue = ((TextBox)GridView2.FooterRow.FindControl("txtbocontact")).Text; SqlDataSource2.InsertParameters["bosocietyid"].DefaultValue = ((DropDownList)GridView2.FooterRow.FindControl("ddlbosocietyid")).SelectedValue; SqlDataSource2.InsertParameters["botype"].DefaultValue = ((DropDownList)GridView2.FooterRow.FindControl("ddlbotype")).SelectedValue; SqlDataSource2.Insert(); }
protected void btnAddRcc_Click(object sender, EventArgs e) { if (Page.IsValid) { SqlDataSource2.Insert(); txtRccClubname.Text = ""; } }
protected void lbtnInsert_Click(object sender, EventArgs e) { SqlDataSource2.InsertParameters["Drink_ID"].DefaultValue = ((TextBox)GridView4.FooterRow.FindControl("txtDrink_IDinsert")).Text; SqlDataSource2.InsertParameters["Ingredient_ID"].DefaultValue = ((TextBox)GridView4.FooterRow.FindControl("txtIngredient_IDinsert")).Text; SqlDataSource2.InsertParameters["Amount"].DefaultValue = ((TextBox)GridView4.FooterRow.FindControl("txtAmountinsert")).Text; SqlDataSource2.Insert(); }
protected void Button2_Click(object sender, EventArgs e) { SqlDataSource2.Insert(); GridView2.DataBind(); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; Panel1.Visible = false; }
protected void Insert_Click(object sender, EventArgs e) { SqlDataSource2.InsertParameters["website"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("website")).Text; SqlDataSource2.InsertParameters["topic"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("topic")).Text; //SqlDataSource2.InsertParameters["sub_code"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("subname")).Text; SqlDataSource2.InsertParameters["url"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("url")).Text; SqlDataSource2.Insert(); }
protected void btndelete_Click(object sender, EventArgs e) { SqlDataSource2.Insert(); lbldelete.Text = "delete succeeded"; lbldelete.Visible = true; //lbldelete.ForeColor = System.Drawing.Color.Green; GridView1.AllowSorting = true; GridView1.AutoGenerateColumns = true; }
protected void Button1_Click(object sender, EventArgs e) { SqlDataSource2.InsertParameters["Kraj"].DefaultValue = DropDownList1.SelectedValue; SqlDataSource2.InsertParameters["Nazwa_sluzby"].DefaultValue = TextBox1.Text; SqlDataSource2.InsertParameters["Przyblizona_liczba_agentow"].DefaultValue = TextBox2.Text; SqlDataSource2.InsertParameters["Data_zalozenia"].DefaultValue = Calendar1.SelectedDate.ToLongDateString(); SqlDataSource2.Insert(); }
protected void Button1_Click(object sender, EventArgs e) { SqlDataSource2.InsertParameters["nome"].DefaultValue = txtNome.Text; SqlDataSource2.InsertParameters["numero"].DefaultValue = txtNumero.Text; SqlDataSource2.Insert(); GridView1.DataBind(); }
protected void btnGuardar_Click(object sender, EventArgs e) { SqlDataSource2.InsertParameters[0].DefaultValue = txtNombre.Text; SqlDataSource2.InsertParameters[1].DefaultValue = txtEstado.Text; SqlDataSource2.Insert(); Response.Write("<script>alert('Se guardo correctamente')</script>"); Limpiar2(pCambio); gvRoles.DataBind(); }
protected void LinkButton2_Click(object sender, EventArgs e) { SqlDataSource2.InsertParameters["aadhar"].DefaultValue = ((TextBox)GridView2.FooterRow.FindControl("txtaadhar")).Text; SqlDataSource2.InsertParameters["spname"].DefaultValue = ((TextBox)GridView2.FooterRow.FindControl("txtspname")).Text; SqlDataSource2.InsertParameters["contact"].DefaultValue = ((TextBox)GridView2.FooterRow.FindControl("txtcontact")).Text; SqlDataSource2.InsertParameters["societyid"].DefaultValue = ((DropDownList)GridView2.FooterRow.FindControl("ddlsocietyid")).SelectedValue; SqlDataSource2.InsertParameters["type"].DefaultValue = ((DropDownList)GridView2.FooterRow.FindControl("ddltype")).SelectedValue; SqlDataSource2.InsertParameters["rating"].DefaultValue = ((TextBox)GridView2.FooterRow.FindControl("txtrating")).Text; SqlDataSource2.Insert(); }
protected void Button2_Click(object sender, EventArgs e) { int CustBooks; if (!int.TryParse(txtCopyOfNum.Text, out CustBooks)) { Label1.Text = "Enter an Integer here"; return; } string StrCopy = DropDownList1.Text; int amount = (int.Parse(StrCopy) - int.Parse(txtCopyOfNum.Text)); if (amount < 0) { lbl1.Text = " Sorry we dont have this amount of Copies, We can sale You: " + StrCopy; txtCopyOfNum.Text = StrCopy; txtCopyOfNum.Focus(); return; } lbl1.Text = ""; try { string lastCopyAmount = (int.Parse(StrCopy) - int.Parse(txtCopyOfNum.Text)).ToString(); int atre = int.Parse(lastCopyAmount); String ConStr; ConStr = System.Configuration.ConfigurationManager. ConnectionStrings["LibConnectionString"].ConnectionString; SqlConnection sqlCON = new SqlConnection(); sqlCON.ConnectionString = ConStr; SqlCommand InsertCom = new SqlCommand(); InsertCom.Connection = sqlCON; String sql; sql = "INSERT INTO [Books] ([CopyCount]) VALUES (@CCount)"; InsertCom.Parameters.Add("@CCont", SqlDbType.Int); InsertCom.Parameters["@CCont"].Value = atre; SqlDataSource2.Insert(); DetailsView1.Visible = true; DropDownList1.Visible = false; SqlDataSource2.DataBind(); txtCopyOfNum.Text = ""; txtCusName.Text = ""; txtCusName.Visible = false; txtCopyOfNum.Visible = false; Button2.Visible = false; Label1.Visible = false; Label2.Visible = false; } catch { } }