protected void Button2_Click(object sender, EventArgs e)
        {
            Button tmp = (Button)sender;

            tmp.Text = "...clicked...";
            try
            {
                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.
                SqlDataSource3.InsertParameters["PurchaseID"].DefaultValue       = TextBox8.Text;
                SqlDataSource3.InsertParameters["PricePaid"].DefaultValue        = TextBox10.Text;
                SqlDataSource3.InsertParameters["Quantity"].DefaultValue         = TextBox11.Text;
                SqlDataSource3.InsertParameters["QuantityReceived"].DefaultValue = TextBox12.Text;

                SqlDataSource3.Insert();

                TextBox8.Text  = "";
                TextBox10.Text = "";
                TextBox11.Text = "";
                TextBox12.Text = "";
            }
            catch (Exception ex)
            {
                Label2.Text = ex.Message;
            }
        }
    protected void btnCreate_Click2(object sender, EventArgs e)
    {
        int i = 0;

        try
        {
            DataView dv = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
            foreach (DataRowView dr in dv)
            {
                i = int.Parse(dr[0].ToString());
            }
            i++;
        }
        catch
        {
            i = 1;
        }
        Session["id"] = i;

        byte[] defimg = File.ReadAllBytes(Server.MapPath("~/") + "App_Themes/Theme1/noimg.jpg");
        Session["logo"] = defimg;

        SqlDataSource3.Insert();
        DSdelRequest.Delete();

        string ss = "Trainer Name is: " + txtTrainerName.Text + " / Email to login: "******" / Password to login: "******"mailto:" + txtEmail.Text + "&body=" + ss + "&subject=Trainer Account Successful");
    }
 protected void Button4_Click(object sender, EventArgs e)
 {
     if (FileUpload3.HasFile == true)
     {
         SqlDataSource3.Insert();
     }
 }
Beispiel #4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (TextBox1.Text != "")
     {
         int msj;
         SqlDataSource3.InsertParameters["MontoInicial"].DefaultValue = TextBox1.Text;
         SqlDataSource3.InsertParameters["Fecha"].DefaultValue        = TextBox2.Text;
         SqlDataSource3.InsertParameters["ID_Caja"].DefaultValue      = DropDownList1.SelectedValue;
         msj = SqlDataSource3.Insert();
         if (msj == 1)
         {
             Response.Write("<script>alert('Datos ingresados correctatmente')</script>");
             TextBox1.Text = "";
             Label1.Text   = "Se ingreso a la caja: " + TextBox1.Text;
         }
         else
         {
             Response.Write("<script>alert('Error, No se guardaron los datos')</script>");
             Label1.Text = "Error.";
         }
     }
     else
     {
         Response.Write("<script>alert('Ingrese un monto')</script>");
     }
 }
Beispiel #5
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        Button tmp = (Button)sender;

        Label1.Text = "";
        try
        {
            //This is similar to the C# we will need for project 2
            //SqlDataSource1.InsertParameters["CowKey"].DefaultValue = DetailsView1.SelectedValue.ToString();
            // Note - The customer ID is an auto generated identity field. It should not be included in the insert.
            SqlDataSource3.InsertParameters["PurchaseID"].DefaultValue = TextBox3.Text;
            SqlDataSource3.InsertParameters["ItemID"].DefaultValue     = TextBox5.Text;
            SqlDataSource3.InsertParameters["Quantity"].DefaultValue   = TextBox6.Text;
            SqlDataSource3.Insert();
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
        //outside the try catch so that no matter what, the text boxes are cleared.

        /*
         * TextBox3.Text = "";
         * TextBox5.Text = "";
         * TextBox6.Text = "";
         */
    }
        protected void linkInsert_Click(object sender, EventArgs e)
        {
            SqlDataSource3.InsertParameters["FirstName"].DefaultValue =
                ((TextBox)GridView1.FooterRow.FindControl("txtfName")).Text;

            SqlDataSource3.InsertParameters["LastName"].DefaultValue =
                ((TextBox)GridView1.FooterRow.FindControl("txtlName")).Text;

            SqlDataSource3.InsertParameters["Address"].DefaultValue =
                ((TextBox)GridView1.FooterRow.FindControl("txtAddress")).Text;

            SqlDataSource3.InsertParameters["City"].DefaultValue =
                ((TextBox)GridView1.FooterRow.FindControl("txtCity")).Text;

            SqlDataSource3.InsertParameters["State"].DefaultValue =
                ((TextBox)GridView1.FooterRow.FindControl("txtState")).Text;

            SqlDataSource3.InsertParameters["ZipCode"].DefaultValue =
                ((TextBox)GridView1.FooterRow.FindControl("txtZipCode")).Text;

            SqlDataSource3.InsertParameters["Phone"].DefaultValue =
                ((TextBox)GridView1.FooterRow.FindControl("txtPhone")).Text;

            SqlDataSource3.InsertParameters["Email"].DefaultValue =
                ((TextBox)GridView1.FooterRow.FindControl("txtEMail")).Text;

            SqlDataSource3.Insert();
        }
 protected void btnRegister_Click(object sender, EventArgs e)
 {
     SqlDataSource3.InsertParameters["CustomerID"].DefaultValue
         = txtCustomerID.Text;
     SqlDataSource3.InsertParameters["ProductCode"].DefaultValue
         = ddlProducts.SelectedValue;
     SqlDataSource3.InsertParameters["RegistrationDate"].DefaultValue
         = DateTime.Today.ToShortDateString();
     try
     {
         SqlDataSource3.Insert();
         this.SendEmailConfirmation();
         txtCustomerID.Text        = "";
         lblCustomer.Text          = "";
         ddlProducts.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         Response.Redirect("ErrorMessage.aspx");
     }
     finally
     {
         btnRegister.Enabled = false;
     }
 }
Beispiel #8
0
 protected void btnAddCtn_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         SqlDataSource3.Insert();
         txtCtnClubname.Text = "";
     }
 }
 protected void lbInsert_Click2(object sender, EventArgs e)
 {
     SqlDataSource3.InsertParameters["boname"].DefaultValue      = ((TextBox)GridView3.FooterRow.FindControl("txtboname")).Text;
     SqlDataSource3.InsertParameters["bocontact"].DefaultValue   = ((TextBox)GridView3.FooterRow.FindControl("txtbocontact")).Text;
     SqlDataSource3.InsertParameters["bosocietyid"].DefaultValue = ((DropDownList)GridView3.FooterRow.FindControl("ddlbosocietyid")).SelectedValue;
     SqlDataSource3.InsertParameters["botype"].DefaultValue      = ((DropDownList)GridView3.FooterRow.FindControl("ddlbotype")).SelectedValue;
     SqlDataSource3.Insert();
 }
Beispiel #10
0
        protected void Book_Flight(object sender, EventArgs e)
        {
            /*
             * origin = (string)Session["origin"];
             * destination = (string)Session["destination"];
             * depart_date = (string)Session["departDate"];
             * return_date = (string)Session["returnDate"];
             * user_id = (string)Session["uid"];
             */
            if (selected_flight_departTable_lbl.Text != "" && selected_flight_returnTable_lbl.Text != "")
            {
                //depart
                //registerNewUser();
                SqlDataSource3.InsertCommandType = SqlDataSourceCommandType.Text;
                SqlDataSource3.InsertCommand     = "Insert into ticket_details (ticket_id,customer_ID,flight_id," +
                                                   "flight_date,Payment_Status) " +
                                                   "VALUES (@ticket_id,@customer_id,@flight_id,@flight_date,@Payment_Status)";
                SqlDataSource3.InsertParameters.Add("ticket_id", "00" + id_From_db);
                SqlDataSource3.InsertParameters.Add("customer_id", user_id);
                SqlDataSource3.InsertParameters.Add("flight_id", GridView1.SelectedRow.Cells[0].Text);
                SqlDataSource3.InsertParameters.Add("flight_date", DateTime.Today.ToString("yyyy-MM-dd"));
                SqlDataSource3.InsertParameters.Add("Payment_Status", "ok");

                SqlDataSource3.Insert();

                //return
                //registerNewUser();
                int id_From_db_return = id_From_db + 1;
                SqlDataSource3.InsertCommandType = SqlDataSourceCommandType.Text;
                SqlDataSource3.InsertCommand     = "Insert into ticket_details (ticket_id,customer_ID,flight_id," +
                                                   "flight_date,Payment_Status) " +
                                                   "VALUES (@ticket_id1,@customer_id1,@flight_id1,@flight_date1,@Payment_Status1)";
                SqlDataSource3.InsertParameters.Add("ticket_id1", "00" + id_From_db_return);
                SqlDataSource3.InsertParameters.Add("customer_id1", user_id);
                SqlDataSource3.InsertParameters.Add("flight_id1", GridView2.SelectedRow.Cells[0].Text);
                SqlDataSource3.InsertParameters.Add("flight_date1", DateTime.Today.ToString("yyyy-MM-dd"));
                SqlDataSource3.InsertParameters.Add("Payment_Status1", "ok");

                SqlDataSource3.Insert();
                Response.Redirect("~/user_management/receipt", false);
            }
            else if (selected_flight_departTable_lbl.Text != "")
            {
                //depart only
                //registerNewUser();
                SqlDataSource3.InsertCommandType = SqlDataSourceCommandType.Text;
                SqlDataSource3.InsertCommand     = "Insert into ticket_details (ticket_id,customer_ID,flight_id," +
                                                   "flight_date,Payment_Status) " +
                                                   "VALUES (@ticket_id,@customer_id,@flight_id,@flight_date,@Payment_Status)";
                SqlDataSource3.InsertParameters.Add("ticket_id", "00" + id_From_db);
                SqlDataSource3.InsertParameters.Add("customer_id", user_id);
                SqlDataSource3.InsertParameters.Add("flight_id", GridView1.SelectedRow.Cells[0].Text);
                SqlDataSource3.InsertParameters.Add("flight_date", DateTime.Today.ToString("yyyy-MM-dd"));
                SqlDataSource3.InsertParameters.Add("Payment_Status", "ok");
                SqlDataSource3.Insert();
                Response.Redirect("~/user_management/receipt", false);
            }
        }
Beispiel #11
0
 protected void LinkButton3_Click(object sender, EventArgs e)
 {
     SqlDataSource3.InsertParameters["aadhar"].DefaultValue    = ((TextBox)GridView3.FooterRow.FindControl("txtaadhar")).Text;
     SqlDataSource3.InsertParameters["spname"].DefaultValue    = ((TextBox)GridView3.FooterRow.FindControl("txtspname")).Text;
     SqlDataSource3.InsertParameters["contact"].DefaultValue   = ((TextBox)GridView3.FooterRow.FindControl("txtcontact")).Text;
     SqlDataSource3.InsertParameters["societyid"].DefaultValue = ((DropDownList)GridView3.FooterRow.FindControl("ddlsocietyid")).SelectedValue;
     SqlDataSource3.InsertParameters["type"].DefaultValue      = ((DropDownList)GridView3.FooterRow.FindControl("ddltype")).SelectedValue;
     SqlDataSource3.InsertParameters["rating"].DefaultValue    = ((TextBox)GridView3.FooterRow.FindControl("txtrating")).Text;
     SqlDataSource3.Insert();
 }
Beispiel #12
0
        protected void insertButtonAutor_Click(object sender, EventArgs e)
        {
            SqlDataSource3.InsertParameters["imie"].DefaultValue =
                ((TextBox)GridView2.FooterRow.FindControl("TextBox1")).Text;

            SqlDataSource3.InsertParameters["nazwisko"].DefaultValue =
                ((TextBox)GridView2.FooterRow.FindControl("TextBox2")).Text;

            SqlDataSource3.Insert();
            GridView2.DataBind();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            DateTime dt = DateTime.Now;

            SqlDataSource3.InsertParameters.Clear();
            SqlDataSource3.InsertParameters.Add("storeid", Session["storeId"].ToString());
            SqlDataSource3.InsertParameters.Add("comment", TextBox1.Text);
            SqlDataSource3.InsertParameters.Add("mail", Session["mail"].ToString());
            SqlDataSource3.InsertParameters.Add("time", dt.ToString());
            TextBox1.Text = "";
            SqlDataSource3.Insert();
        }
 protected void btnZapisz_Click(object sender, EventArgs e)
 {
     SqlDataSource3.InsertCommandType = SqlDataSourceCommandType.Text;
     SqlDataSource3.InsertCommand     = "Insert into Przedmioty (nazwa,ile_godzin,typ_zajec,semestr,Specjalnosc_id_specjalnosc) VALUES (@nazwa,@ile_godzin,@typ_zajec,@semestr,@Specjalnosc_id_specjalnosc)";
     SqlDataSource3.InsertParameters.Clear();
     SqlDataSource3.InsertParameters.Add("nazwa", tbNazwa.Text);
     SqlDataSource3.InsertParameters.Add("ile_godzin", tbIleGodzin.Text);
     SqlDataSource3.InsertParameters.Add("typ_zajec", tbTypZajec.Text);
     SqlDataSource3.InsertParameters.Add("semestr", tbSemestr.Text);
     SqlDataSource3.InsertParameters.Add("Specjalnosc_id_specjalnosc", DropDownList1.SelectedValue.ToString());
     SqlDataSource3.Insert();
     Panel3.Visible = false;
 }
Beispiel #15
0
 protected void Button7_Click(object sender, EventArgs e)
 {
     SqlDataSource3.InsertParameters.Clear();
     SqlDataSource3.InsertParameters.Add("company_name", TextBox1.Text);
     SqlDataSource3.InsertParameters.Add("website", TextBox2.Text);
     SqlDataSource3.InsertParameters.Add("date", TextBox3.Text);
     SqlDataSource3.InsertParameters.Add("month", TextBox8.Text);
     SqlDataSource3.InsertParameters.Add("year", TextBox9.Text);
     SqlDataSource3.InsertParameters.Add("location", TextBox4.Text);
     SqlDataSource3.InsertParameters.Add("eligibility", TextBox5.Text);
     SqlDataSource3.InsertParameters.Add("job_roles", TextBox6.Text);
     SqlDataSource3.InsertParameters.Add("vacancy", TextBox7.Text);
     SqlDataSource3.Insert();
 }
Beispiel #16
0
 protected void InsButton_Click(object sender, EventArgs e)
 {
     try
     {
         SqlDataSource3.InsertParameters["UserId"].DefaultValue   = (AddUserName.SelectedValue);
         SqlDataSource3.InsertParameters["CertId"].DefaultValue   = (AddCertName.SelectedValue);
         SqlDataSource3.InsertParameters["DateCert"].DefaultValue = AddDateCal.SelectedDate.ToString("yyyy-MM-dd");
         SqlDataSource3.Insert();
     }
     catch
     {
         CertExistsError.Visible = true;
     }
 }
Beispiel #17
0
        protected void btnAddPrescriptions_Click(object sender, EventArgs e)
        {
            string patientID = "" + gvPatients.SelectedValue;
            string visitID   = "" + gvVisits.SelectedValue;

            SqlDataSource3.InsertParameters["PatientID"].DefaultValue    = patientID;
            SqlDataSource3.InsertParameters["VisitID"].DefaultValue      = visitID;
            SqlDataSource3.InsertParameters["DrugName"].DefaultValue     = txtDrugName.Text;
            SqlDataSource3.InsertParameters["Instructions"].DefaultValue = txtInstructions.Text;

            SqlDataSource3.Insert();

            txtDrugName.Text     = string.Empty;
            txtInstructions.Text = string.Empty;
        }
    protected void btn_insertar_Click(object sender, EventArgs e)
    {
        int cant;

        cant = SqlDataSource3.Insert();
        if (cant == 1)
        {
            lbl_resultado.Text = "El participante se ha insertado correctamente.";
        }
        else
        {
            lbl_resultado.Text = "Se ha producido un error al insertar" +
                                 "el participante.";
        }
    }
    protected void confirmBtn_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            this.GetCustomerData();
            SqlDataSource2.InsertParameters["CustEmail"].DefaultValue        = emailBox.Text;
            SqlDataSource2.InsertParameters["OrderDate"].DefaultValue        = Convert.ToString(DateTime.Now);
            SqlDataSource2.InsertParameters["CustEmail"].DefaultValue        = emailBox.Text;
            SqlDataSource2.InsertParameters["ShipMethod"].DefaultValue       = shipList.SelectedValue;
            SqlDataSource2.InsertParameters["CreditCardNumber"].DefaultValue = cardBox.Text;
            SqlDataSource2.InsertParameters["ExpirationDate"].DefaultValue   = expBox.Text;

            try
            {
                SqlDataSource2.Insert();
            }
            catch (Exception ex)
            {
                Label1.Text = "A database error has occured" + "Message: " + ex.Message;
            }

            SqlDataSource3.InsertParameters["LastName"].DefaultValue    = lastNameBox.Text;
            SqlDataSource3.InsertParameters["FirstName"].DefaultValue   = firstNameBox.Text;
            SqlDataSource3.InsertParameters["Address"].DefaultValue     = addressBox.Text;
            SqlDataSource3.InsertParameters["City"].DefaultValue        = cityBox.Text;
            SqlDataSource3.InsertParameters["State"].DefaultValue       = stateDdl.SelectedValue;
            SqlDataSource3.InsertParameters["ZipCode"].DefaultValue     = zipBox.Text;
            SqlDataSource3.InsertParameters["PhoneNumber"].DefaultValue = phoneBox.Text;
            SqlDataSource3.InsertParameters["Email"].DefaultValue       = emailBox.Text;
            try
            {
                SqlDataSource3.Insert();
            }
            catch (Exception ex)
            {
                Label1.Text = "A database error has occured" + "Message: " + ex.Message;
            }
        }
        int cardNumber = Convert.ToInt32(cardBox.Text);

        Session["First"] = firstNameBox.Text;
        Session["Last"]  = lastNameBox.Text;
        Session["Date"]  = DateTime.Now;
        Session["Ship"]  = shipList.SelectedValue;
        Response.Redirect("~/ShoppingPages/Receipt.aspx/");
    }
Beispiel #20
0
        protected void Button_Click(object sender, EventArgs e)
        {
            lblResult.Text = "";
            SqlDataSource3.InsertParameters["FirstName"].DefaultValue    = txtFirstName.Text;
            SqlDataSource3.InsertParameters["LastName"].DefaultValue     = txtLastName.Text;
            SqlDataSource3.InsertParameters["DepartmentID"].DefaultValue = deptDropDownList.SelectedValue;

            try
            {
                SqlDataSource3.Insert();
                lblResult.Text = txtFirstName.Text + " Created!";
            }
            catch (Exception ex)
            {
                lblResult.Text = "Error" + ex.Message;
            }
        }
Beispiel #21
0
        protected void linkInsert_Click(object sender, EventArgs e)
        {
            SqlDataSource3.InsertParameters["item_name"].DefaultValue = txtItem.Text;

            SqlDataSource3.InsertParameters["rate"].DefaultValue = txtRate.Text;

            SqlDataSource3.InsertParameters["item_type"].DefaultValue    = dropItem.SelectedValue.ToString();
            SqlDataSource3.InsertParameters["gross_weight"].DefaultValue = txtGross.Text;

            SqlDataSource3.InsertParameters["amount"].DefaultValue = txtAmount.Text;
            SqlDataSource3.Insert();
            //    Response.Write("inserter");


            txtAmount.Text = "";
            txtGross.Text  = "";
            txtItem.Text   = "";
            txtRate.Text   = "";
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                SqlDataSource3.InsertParameters["Name"].DefaultValue     = TextBox6.Text;
                SqlDataSource3.InsertParameters["Address"].DefaultValue  = TextBox2.Text;
                SqlDataSource3.InsertParameters["CardNO"].DefaultValue   = TextBox5.Text;
                SqlDataSource3.InsertParameters["Password"].DefaultValue = TextBox3.Text;
                SqlDataSource3.InsertParameters["BankId"].DefaultValue   = DropDownList1.Text;
                SqlDataSource3.InsertParameters["BranchID"].DefaultValue = DropDownList2.Text;

                SqlDataSource3.Insert();
                Label1.Text = "SUccessfully Added! , Go back To login";
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message;
            }
        }
Beispiel #23
0
 protected void btn2_Click(object sender, EventArgs e)
 {
     try
     {
         DataView s  = (DataView)Sqlds.Select(new DataSourceSelectArguments());
         int      s1 = (int)s[0][0];
         int      s2 = (int)s[0][1];
         int      s3 = (int)s[0][2];
         if (s1 >= int.Parse(txtArjit.Text) && s2 >= int.Parse(txtKirkod.Text) && s3 >= int.Parse(txtVaidyakiya.Text))
         {
             int n = SqlDsHolidays.Update();
             if (n == 1)
             {
                 int a = SqldsRemaining.Update();
                 if (a == 1)
                 {
                     int b = SqlDataSource3.Insert();
                     Response.Write("<script>alert('Data Inserted Successfully')</script>");
                     txtArjit.Text      = "";
                     txtKirkod.Text     = "";
                     txtVaidyakiya.Text = "";
                 }
                 else
                 {
                     Response.Write("<script>alert('Please enter correct details...')</script>");
                 }
             }
             else
             {
                 Response.Write("<script>alert('Please fill the form Correctly')</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('You do not have enough holidays')</script>");
         }
     }
     catch (Exception er)
     {
         Response.Write(er);
     }
 }
Beispiel #24
0
 protected void btnZapiszStudenci_Click(object sender, EventArgs e)
 {
     SqlDataSource3.InsertCommandType = SqlDataSourceCommandType.Text;
     SqlDataSource3.InsertCommand     = "Insert into Studenci (imie,nazwisko,rok_urodzenia,obecnosc_dzieci,ile_dzieci,login,haslo,plec,grupa,Stypendium_id_stypendium,Katedra_id_katedra,Specjalnosc_id_specjalnosc) VALUES (@imie,@nazwisko,@rok_urodzenia,@obecnosc_dzieci,@ile_dzieci,@login,@haslo,@plec,@grupa,@Stypendium_id_stypendium,@Katedra_id_katedra,@Specjalnosc_id_specjalnosc)";
     SqlDataSource3.InsertParameters.Clear();
     SqlDataSource3.InsertParameters.Add("imie", tbImieStudenci.Text);
     SqlDataSource3.InsertParameters.Add("nazwisko", tbNazwiskoStudenci.Text);
     SqlDataSource3.InsertParameters.Add("rok_urodzenia", tbRokUrodzeniaStudenci.Text);
     SqlDataSource3.InsertParameters.Add("obecnosc_dzieci", chbObecnoscDzieciStudenci.Checked.ToString());
     SqlDataSource3.InsertParameters.Add("ile_dzieci", tbIleDzieciStudenci.Text);
     SqlDataSource3.InsertParameters.Add("login", tbLoginStudenci.Text);
     SqlDataSource3.InsertParameters.Add("haslo", tbHasloStudenci.Text);
     SqlDataSource3.InsertParameters.Add("grupa", tbGrupaStudenci.Text);
     SqlDataSource3.InsertParameters.Add("plec", tbPlecStudenci.Text);
     SqlDataSource3.InsertParameters.Add("Stypendium_id_stypendium", ddlStypendiumStudenci.SelectedValue.ToString());
     SqlDataSource3.InsertParameters.Add("Katedra_id_katedra", ddlKatedraStudenci.SelectedValue.ToString());
     SqlDataSource3.InsertParameters.Add("Specjalnosc_id_specjalnosc", ddlSpecjalnoscStudenci.SelectedValue.ToString());
     SqlDataSource3.Insert();
     pDodajStudenci.Visible = false;
 }
Beispiel #25
0
    protected void btnRegisterProduct_Click(object sender, EventArgs e)
    {
        //Validate customer ID again, as it may have been changed
        this.Validate("CustomerID");

        if (this.IsValid)
        {
            SqlDataSource3.InsertParameters["CustomerID"].DefaultValue       = txtCustomerID.Text;
            SqlDataSource3.InsertParameters["ProductCode"].DefaultValue      = ddlSelectProduct.SelectedValue;
            SqlDataSource3.InsertParameters["RegistrationDate"].DefaultValue = "" + DateTime.Today;

            try
            {
                SqlDataSource3.Insert();

                //send email
                SendConfirmationEmail();

                txtCustomerID.Text = "";
                txtCustomerID.Focus();
                lblCustomerName.Text           = "";
                ddlSelectProduct.SelectedValue = "-1";
                EnableControls(false);
            }
            catch (Exception ex)
            {
                //lblError.Text = "A database error has occurred. <br /><br />" +
                //"Message: " + ex.Message;

                Session["Exception"] = ex;
                Response.Redirect("~/ErrorPages/ErrorMessage.aspx");
            }
        }
        else
        {
            //lblCustomerName.Text = "";
            //ddlSelectProduct.SelectedValue = "-1";
            //EnableControls(false);
        }
    }
Beispiel #26
0
        protected void Insert_BT_Click(object sender, EventArgs e)
        {
            if (studentAct_TB.Text.Length == 7)
            {
                SqlDataSource3.InsertParameters["studentAct"].DefaultValue  = studentAct_TB.Text;
                SqlDataSource3.InsertParameters["studentName"].DefaultValue = studentName_TB.Text;
                using (SqlConnection cnn1 = new SqlConnection(sqlcn))
                {
                    using (SqlCommand cmd1 = new SqlCommand())
                    {
                        cmd1.Connection  = cnn1;
                        cmd1.CommandText = "SELECT studentAct FROM dbo.students WHERE studentAct = @studentAct";
                        cmd1.Parameters.Add("@studentAct", SqlDbType.NVarChar).Value = studentAct_TB.Text;
                        cnn1.Open();

                        SqlDataReader rr = cmd1.ExecuteReader();
                        if (!rr.HasRows)
                        {
                            SqlDataSource3.Insert();
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('學號:" + studentAct_TB.Text + " 已存在!');</script>");
                        }

                        rr.Close();
                        cmd1.Dispose();
                        cnn1.Close();
                    }
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('學號應為7碼,請重新輸入正確學號!');</script>");
            }

            Clear_BT_Click(sender, e);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = "";
            DataView view = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);

            if (view.Count > 0)
            {
                //Label1.Text = view[0][3].ToString();
                if (view[0][3].ToString().ToLower() == "true")
                {
                    SqlDataSource3.Update();
                }
                else
                {
                    Label1.Text = "Student #" + view[0][1].ToString() + " is already registered for class " + view[0][2].ToString();
                }
            }
            else
            {
                SqlDataSource3.Insert();
            }
            GridView1.DataBind();
        }
Beispiel #28
0
    /*
     * After an event is created, we need to create a page (there is a 1:1 relationship).
     * To do that, we attach the InsertCommand for the Page SqlDataSource to the OnInserted
     * event handler for the Event SqlDataSource.
     */
    protected void SqlDataSource2_Inserted(object sender, SqlDataSourceStatusEventArgs e)
    {
        lblMessage.Text = "Event scheduled successfully!";
        // e.Command.Parameters[...] returns the parameters from the completed insert, which we recycle with the Page object insert.
        SqlDataSource3.InsertCommandType = SqlDataSourceCommandType.Text;


        // Creating Page object for new Event object.
        // NOTE: parameter names are different every time to avoid parameter confliction errors!
        SqlDataSource3.InsertCommand = "INSERT INTO Page (DepartmentID, EventID, Page_Title, Page_Content) VALUES (@DepID, @EvID, @PT, @PC)";
        SqlDataSource3.InsertParameters.Add("DepID", e.Command.Parameters["@DID"].Value.ToString());
        SqlDataSource3.InsertParameters.Add("EvID", InsertedEventID());
        SqlDataSource3.InsertParameters.Add("PT", e.Command.Parameters["@ET"].Value.ToString());
        SqlDataSource3.InsertParameters.Add("PC", e.Command.Parameters["@ED"].Value.ToString());
        SqlDataSource3.Insert();

        // Clear text boxes to help user know that the task is completed.
        txtStartingTime.Text     = "";
        txtEndingTime.Text       = "";
        txtEventTitle.Text       = "";
        txtEventDescription.Text = "";
        txtLocation.Text         = "";
    }
Beispiel #29
0
 protected void InsertRecord2(object sender, EventArgs e)
 {
     if (DropDownList1.Text == "")   //|| DropDownList2.Text.Length == 0)
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                 "alertMessage",
                                                 "alert('Επιλέξτε Λογαριασμό !!!!');", true);
     }
     else
     {
         if (TextBox8.Text.Length == 0 || TextBox8.Text.Length == 0)
         {
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                     "alertMessage",
                                                     "alert('Δεν έχει συμπληρωθεί το ποσό ΠΡΟΜΗΘΙΕΣ !!!!');", true);
         }
         else
         {
             SqlDataSource3.Insert();
             TextBox8.Text = "";
         }
     }
 }
Beispiel #30
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        var parameters = SqlDataSource3.InsertParameters;

        parameters["CustomerID"].DefaultValue       = txtboxcCustID.Text;
        parameters["ProductCode"].DefaultValue      = DropDownList1.SelectedValue;
        parameters["RegistrationDate"].DefaultValue = DateTime.Today.ToShortDateString();

        try
        {
            SqlDataSource3.Insert();

            txtboxcCustID.Text          = "";
            DropDownList1.SelectedIndex = -1;
            TextBox1.Text = "";
            mailTextMsg();
            //Response.Redirect("~/ProductRegistration.aspx");
        }
        catch (Exception ex)
        {
            Session["exceptionMessage"] = ex.Message;
            Response.Redirect("~/ErrorMessage.aspx");
        }
    }