protected void btnSubmit_Click(object sender, EventArgs e)
 {
     SqlDataSource2.InsertParameters["datetime"].DefaultValue = DateTime.Now.ToString();
     SqlDataSource2.Insert();
     SqlDataSource3.Update();
     Response.Redirect("SubmitSurvey.aspx");
 }
Exemple #2
0
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        string id            = ((Label)e.Item.FindControl("Label8")).Text;
        string featurestatus = ((Label)e.Item.FindControl("Label7")).Text;
        string adminapproval = ((Label)e.Item.FindControl("Label6")).Text;


        if (e.CommandName == "Auction")
        {
            Response.Redirect("~/admin/product-setup/AllAuctions?ID=" + id);
        }


        if (e.CommandName == "Feature")
        {
            string fs;
            if (featurestatus == "Yes")
            {
                fs = "No";
            }

            else
            {
                fs = "Yes";
            }
            SqlDataSource3.UpdateParameters.Add("FeatureStatus", fs.ToString());
            SqlDataSource3.UpdateParameters.Add("ID", id);

            SqlDataSource3.Update();
            ListView1.DataBind();
        }

        if (e.CommandName == "Approval")
        {
            string AA;
            if (adminapproval == "Active")
            {
                AA = "Reject";
            }

            else
            {
                AA = "Active";
            }
            SqlDataSource4.UpdateParameters.Add("Approval", AA.ToString());
            SqlDataSource4.UpdateParameters.Add("ID", id);

            SqlDataSource4.Update();
            ListView1.DataBind();
        }

        if (e.CommandName == "Edit")
        {
            Response.Redirect("~/Seller/addproduct.aspx?ID=" + id);
        }
    }
Exemple #3
0
    protected void DaneZBazyDataList_DeleteCommand(object source, DataListCommandEventArgs e)
    {
        DaneZBazyDataList.SelectedIndex = e.Item.ItemIndex;
        int idkomentarz = int.Parse(((Label)(DaneZBazyDataList.SelectedItem.FindControl("LabelofSelectedItem"))).Text);

        SqlDataSource3.UpdateCommand = "UPDATE Posty SET p_usun = 1 WHERE (Posty.id_posty = "
                                       + idkomentarz + "); UPDATE Komentarze SET k_usun=1 WHERE (Posty_id_posty = " + idkomentarz + ")";
        SqlDataSource3.Update();
        DataBind();
    }
Exemple #4
0
    protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        int flag = 0;
        int a    = e.NewSelectedIndex;
        int b    = Convert.ToInt32(GridView1.Rows[e.NewSelectedIndex].Cells[0].Text);

        SqlDataSource3.UpdateCommand = "UPDATE comment SET good = good +" + 1 + "where cid =" + b;
        for (int i = 0; i < aa.k; i++)
        {
            if (b == aa.b1[i])
            {
                flag = 1;
            }
        }
        if (flag == 0)
        {
            SqlDataSource3.Update();
            GridView1.DataBind();
            aa.b1[aa.k] = b;
            aa.k++;
        }



        string        c       = GridView1.Rows[e.NewSelectedIndex].Cells[1].Text;
        string        strConn = ConfigurationManager.ConnectionStrings["movieConnection"].ConnectionString;
        SqlConnection conn    = new SqlConnection(strConn);
        SqlCommand    cmd     = conn.CreateCommand();

        cmd.CommandText = "update usertable set uvalue=uvalue+5 where uid=(select uid from usertable where uname=" + c + ")";

        try
        {
            conn.Open();
            int i = cmd.ExecuteNonQuery();
            //if (i == 1 )
            //  Response.Write("<script language =javascript>alert('发送成功!');location.href='main.aspx';</script>");
        }


        catch (System.Exception ee)
        {
            Response.Write(ee.Message.ToString());
        }
        finally
        {
            conn.Close();
        }
    }
        protected void Button9_Click(object sender, EventArgs e)
        {
            TextBox32.Text = DateTime.Parse(TextBox30.Text).AddDays(-1).ToString("dd/MM/yyyy");

            TextBox28.Text = TextBox28.Text.ToUpper();
            TextBox29.Text = TextBox29.Text.ToUpper();

            if (TextBox26.Text.Length == 0 || TextBox26.Text.Length == 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "alertMessage",
                                                        "alert('ΔΙΑΧΕΙΡΙΣΤΗΣ -- Δεν έχει συμπληρωθεί το πεδίο Επώνυμο !!!!');", true);
            }
            else if (TextBox27.Text.Length == 0 || TextBox27.Text.Length == 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "alertMessage",
                                                        "alert('ΔΙΑΧΕΙΡΙΣΤΗΣ -- Δεν έχει συμπληρωθεί το Πεδίο Όνομα  !!!!');", true);
            }
            else if (DropDownList2.Text.Length == 0 || DropDownList2.Text.Length == 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "alertMessage",
                                                        "alert('ΔΙΑΧΕΙΡΙΣΤΗΣ -- Δεν έχει συμπληρωθεί o Βαθμός  !!!!');", true);
            }

            else if (TextBox28.Text.Length == 0 || TextBox28.Text.Length == 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "alertMessage",
                                                        "alert('ΔΙΑΧΕΙΡΙΣΤΗΣ -- Δεν έχει συμπληρωθεί το πεδίο ΑΦΜ !!!!');", true);
            }
            else if (TextBox29.Text.Length == 0 || TextBox29.Text.Length == 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
                                                        "alertMessage",
                                                        "alert('ΔΙΑΧΕΙΡΙΣΤΗΣ -- Δεν έχει συμπληρωθεί το πεδίο ΔΟΥ !!!!');", true);
            }
            else
            {
                SqlDataSource3.Update();
                Diaxiristis.Insert();
                TextBox26.Text = "";
                TextBox27.Text = "";
                TextBox28.Text = "";
                TextBox29.Text = "";
            }
        }
    /*
     * This page is mainly controlled by the DetailsView. The only changes we had to make
     * were to add validation on the User editing portion. That was accomplished by changing
     * the bound fields into template fields, then using the same validators that are used
     * on the Register page.
     */

    protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
        // In lieu of a Delete operation, we have a User Disable feature.
        // This checks if the user was set to be disabled.
        if (e.NewValues["Enabled"].ToString() == "False")
        {
            // If the user is going to be disabled, we want to update all user department permissions
            // that the user has, and set them all to 0. This prevents them from seeing any data
            // while not deleting their prior contributions.

            SqlDataSource3.UpdateCommandType = SqlDataSourceCommandType.Text;
            // Sets all permissions to 0.
            SqlDataSource3.UpdateCommand = "UPDATE UserDepartmentPermissions SET Can_Read = 0, Can_Edit = 0, Can_Schedule = 0, Is_Admin = 0 WHERE UserID = " +
                                           e.Keys["UserID"].ToString();
            SqlDataSource3.Update();

            // Updates the permission detail view to show changes.
            DetailsView2.DataBind();
        }
    }
Exemple #7
0
    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 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();
        }
Exemple #9
0
        protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            DataView dv3 = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);

            if (e.CommandName == "Update")
            {
                index = Convert.ToInt32(e.CommandArgument);

                string fam  = (string)dv3.Table.Rows[index][0];
                string name = (string)dv3.Table.Rows[index][1];
                string otch = (string)dv3.Table.Rows[index][2];

                DropDownList DropDownList2 = GridView3.Rows[index].Cells[index].FindControl("DropDownList2") as DropDownList;
                string       rezult        = DropDownList2.SelectedValue;

                SqlDataSource3.UpdateParameters["fam"].DefaultValue    = fam;
                SqlDataSource3.UpdateParameters["name"].DefaultValue   = name;
                SqlDataSource3.UpdateParameters["otch"].DefaultValue   = otch;
                SqlDataSource3.UpdateParameters["Result"].DefaultValue = rezult;

                SqlDataSource3.Update();
            }
        }
    protected void btnAssignIncident_Click(object sender, EventArgs e)
    {
        DataRowView SelectedIncident = GetSelectedIncident();
        DataRowView SelectedTech     = GetSelectedTech();

        if (SelectedIncident != null && SelectedTech != null)
        {
            SqlDataSource3.UpdateParameters["IncidentID"].DefaultValue = "" + SelectedIncident["IncidentID"];
            SqlDataSource3.UpdateParameters["TechID"].DefaultValue     = "" + SelectedTech["TechID"];

            try
            {
                SqlDataSource3.Update();

                grdSelectIncident.SelectedIndex = -1;
                grdSelectTech.SelectedIndex     = -1;

                grdSelectIncident.DataBind();
                grdSelectTech.DataBind();

                mvwAssignIncident.ActiveViewIndex = 0;
            }
            catch (Exception ex)
            {
                //lblSummaryError.Text = "A database error has occurred. <br /><br />" +
                //                "Message: " + ex.Message;

                Session["Exception"] = ex;
                Response.Redirect("~/ErrorPages/ErrorMessage.aspx");
            }
        }
        else
        {
            lblSummaryError.Text = "Error reading session data.";
        }
    }
Exemple #11
0
 protected void btnTerminate_Click(object sender, EventArgs e)
 {
     SqlDataSource3.Update();
 }
Exemple #12
0
 protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
 {
     SqlDataSource3.Update();
 }
Exemple #13
0
    protected void Button6_Click(object sender, EventArgs e)
    {
        SqlDataSource3.Update();

        Response.Redirect("~/AdminPage/AdminHome.aspx");
    }
Exemple #14
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            if (DropDownList3.Text == "借阅")
            {
                string         strConn   = ConfigurationManager.ConnectionStrings["TSGConnectionString1"].ConnectionString;
                SqlConnection  conn      = new SqlConnection(strConn);
                string         bookSql   = "SELECT * FROM BOOK WHERE CALLNO = \'" + TextBox3.Text + "\'";
                string         patronSql = "SELECT * FROM PATRON WHERE PATRONID = \'" + TextBox4.Text + "\'";
                SqlCommand     bookCmd   = new SqlCommand(bookSql, conn);
                SqlCommand     patronCmd = new SqlCommand(patronSql, conn);
                SqlDataAdapter bookDa    = new SqlDataAdapter(bookCmd);
                SqlDataAdapter patronDa  = new SqlDataAdapter(patronCmd);
                DataSet        ds        = new DataSet();

                int bookLeft = 0;
                bookDa.Fill(ds, "BOOK");
                DataTable books = ds.Tables["BOOK"];
                try {
                    bookLeft = int.Parse(books.Rows[0]["AVAILABLENUMBER"].ToString());
                }
                catch {
                    Response.Write("<script>alert('输入有误,请重新输入!')</script>");
                    return;
                }
                patronDa.Fill(ds, "PATRON");
                DataTable patrons = ds.Tables["PATRON"];
                try {
                    patrons.Rows[0]["PATRONID"].ToString();
                }
                catch {
                    Response.Write("<script>alert('输入有误,请重新输入!')</script>");
                    return;
                }
                if (bookLeft == 0)
                {
                    Response.Write("<script>alert('库存不足,无法借阅!')</script>");
                    return;
                }
                string lendSql     = "INSERT LEND VALUES(\'" + TextBox3.Text + "\', \'" + TextBox4.Text + "\', GETDATE(), NULL)";
                string decreaseSql = "UPDATE BOOK SET AVAILABLENUMBER = " + (bookLeft - 1) + " WHERE CALLNO = \'" + TextBox3.Text + "\'";
                conn.Open();
                SqlCommand decreaseCmd = new SqlCommand(decreaseSql, conn);
                try {
                    decreaseCmd.ExecuteReader();
                }
                catch {
                    Response.Write("<script>alert('系统错误,请检查输入!')</script>");
                    return;
                }
                conn.Close();
                conn.Open();
                SqlCommand lendCmd = new SqlCommand(lendSql, conn);
                try {
                    lendCmd.ExecuteReader();
                }
                catch {
                    Response.Write("<script>alert('系统错误,请检查输入!')</script>");
                    return;
                }
                finally {
                    TextBox3.Text = "";
                    TextBox4.Text = "";
                    SqlDataSource3.DataBind();
                }
            }
            else
            {
                string         strConn = ConfigurationManager.ConnectionStrings["TSGConnectionString1"].ConnectionString;
                SqlConnection  conn    = new SqlConnection(strConn);
                string         bookSql = "SELECT * FROM BOOK WHERE CALLNO = \'" + TextBox3.Text + "\'";
                SqlCommand     bookCmd = new SqlCommand(bookSql, conn);
                SqlDataAdapter bookDa  = new SqlDataAdapter(bookCmd);
                DataSet        ds      = new DataSet();

                int bookLeft = 0;
                bookDa.Fill(ds, "BOOK");
                DataTable books = ds.Tables["BOOK"];
                try {
                    bookLeft = int.Parse(books.Rows[0]["AVAILABLENUMBER"].ToString());
                }
                catch {
                    Response.Write("<script>alert('输入有误,请重新输入!')</script>");
                    return;
                }

                string lendSql     = "UPDATE (SELECT DISTINCT * FROM LEND) SET RETURNTIME = GETDATE() WHERE CALLNO = \'" + TextBox3.Text + "\' AND PATRONID = \'" + TextBox4.Text + "\'";
                string increaseSql = "UPDATE BOOK SET AVAILABLENUMBER = " + (bookLeft + 1) + " WHERE CALLNO = \'" + TextBox3.Text + "\'";
                conn.Open();
                SqlCommand increaseCmd = new SqlCommand(increaseSql, conn);
                try {
                    increaseCmd.ExecuteReader();
                }
                catch {
                    Response.Write("<script>alert('系统错误,请检查输入!')</script>");
                    return;
                }
                conn.Close();
                conn.Open();
                SqlCommand lendCmd = new SqlCommand(lendSql, conn);
                try {
                    lendCmd.ExecuteReader();
                }
                catch {
                    Response.Write("<script>alert('系统错误,请检查输入!')</script>");
                    return;
                }
                finally {
                    TextBox3.Text = "";
                    TextBox4.Text = "";
                    SqlDataSource3.Update();
                }
            }
        }