protected void AssignStudent(object sender, EventArgs e)
 {
     Page.ClientScript.RegisterStartupScript(GetType(), "id", "toggle_forms('AssignStudentClass')", true);
     if (Page.IsValid)
     {
         DBHandler.DBHandler   db = new DBHandler.DBHandler(con);
         Entities.personalInfo t1 = new Entities.personalInfo()
         {
             pKId = Session["School"].ToString(),
         };
         Entities.StudentSubject t2 = new Entities.StudentSubject()
         {
             pKId = SchoolID.Value,
             year = Year.Text,
         };
         Entities.Class c1 = new Entities.Class()
         {
             className = DropDownList1.SelectedValue,
         };
         Entities.Section s1 = new Entities.Section()
         {
             sectionName = DropDownList2.SelectedValue,
         };
         db.AssignStudentClass(t1, t2, c1, s1);
         SqlDataSource6.DataBind();
         GridView1.DataBind();
     }
 }
Beispiel #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //SqlDataSource2.DataBind();
        //SqlDataSource4.DataBind();
        //SqlDataSource7.DataBind();
        SqlDataSource6.DataBind();
        SqlDataSource5.DataBind();

        //GridView1.DataBind();
        GridView2.DataBind();
        ////DetailsView1.DataBind();
        DetailsView2.DataBind();
        //System.Threading.Thread.Sleep(2000);
        //Response.Redirect("Admin.aspx?companyListBox.SelectedValue=" + companyListBox.SelectedValue);
    }
 protected void Button10_Click1(object sender, EventArgs e)
 {
     SqlDataSource6.SelectCommand = "SELECT [ID_MaraProd], [MarcaP] FROM [MarcaProd] WHERE MarcaP like '%" + TextBox3.Text + "%'";
     SqlDataSource6.DataBind();
 }
    protected void btnNext_Click(object sender, EventArgs e)
    {
        //save project code to cookie
        if (!Page.IsValid)
        {
            return;
        }
        else
        {
            ManageCookie mgCookie = new ManageCookie();
            users        ck       = mgCookie.ReadCookies();

            // update to database
            SqlParameter pj_code = new SqlParameter("@pj_code", SqlDbType.NVarChar, 15);
            pj_code.Direction = ParameterDirection.Input;
            pj_code.Value     = lblProjectCode.Text;

            SqlParameter p_id = new SqlParameter("@p_id", SqlDbType.Int);
            p_id.Direction = ParameterDirection.Input;
            p_id.Value     = ck.p_id;

            SqlParameter d_id = new SqlParameter("@d_id", SqlDbType.NVarChar, 20);
            d_id.Direction = ParameterDirection.Input;
            d_id.Value     = ck.d_id;

            SqlParameter mi_id = new SqlParameter("@mi_id", SqlDbType.NVarChar, 25);
            mi_id.Direction = ParameterDirection.Input;
            mi_id.Value     = ck.mi_id;

            SqlParameter pj_name = new SqlParameter("@pj_name", SqlDbType.NVarChar, 500);
            pj_name.Direction = ParameterDirection.Input;
            pj_name.Value     = txtProjectName.Text;

            SqlParameter pj_yut_id = new SqlParameter("@pj_yut_id", SqlDbType.Int);
            pj_yut_id.Direction = ParameterDirection.Input;
            pj_yut_id.Value     = ddlYudtasad.SelectedValue;

            SqlParameter pj_year = new SqlParameter("@pj_year", SqlDbType.NVarChar, 4);
            pj_year.Direction = ParameterDirection.Input;
            pj_year.Value     = ddlYear.SelectedValue;

            SqlParameter pj_budget_money = new SqlParameter("@pj_budget_money", SqlDbType.Float);
            pj_budget_money.Direction = ParameterDirection.Input;
            pj_budget_money.Value     = txtBudget.Text.Replace(",", "");

            SqlParameter pj_budget = new SqlParameter("@pj_budget", SqlDbType.NVarChar, 50);
            pj_budget.Direction = ParameterDirection.Input;
            pj_budget.Value     = txtBudget.Text;

            SqlParameter pj_budget_category = new SqlParameter("@pj_budget_category", SqlDbType.NVarChar, 200);
            pj_budget_category.Direction = ParameterDirection.Input;
            pj_budget_category.Value     = DropDownList2.SelectedValue;

            //SqlParameter pj_integrateProject = new SqlParameter("@pj_integrateProject", SqlDbType.NVarChar);
            //pj_integrateProject.Direction = ParameterDirection.Input;
            ////pj_integrateProject.Value = txtIntegrate.Text;
            //pj_integrateProject.Value = string.Empty;

            //SqlParameter pj_relateDept = new SqlParameter("@pj_relateDept", SqlDbType.NVarChar);
            //pj_relateDept.Direction = ParameterDirection.Input;
            ////pj_relateDept.Value = txtRelate.Text;
            //pj_relateDept.Value = string.Empty;

            SqlParameter pj_status = new SqlParameter("@pj_status", SqlDbType.NVarChar);
            pj_status.Direction = ParameterDirection.Input;
            pj_status.Value     = Request.QueryString["status"];

            insertParameters.Add(pj_code);
            insertParameters.Add(p_id);
            insertParameters.Add(d_id);
            insertParameters.Add(mi_id);
            insertParameters.Add(pj_name);
            insertParameters.Add(pj_yut_id);
            insertParameters.Add(pj_year);
            insertParameters.Add(pj_budget);
            insertParameters.Add(pj_budget_money);
            //insertParameters.Add(pj_integrateProject);
            //insertParameters.Add(pj_relateDept);
            insertParameters.Add(pj_status);
            insertParameters.Add(pj_budget_category);

            try
            {
                SqlDataSource44.Update();

                //keep project code in cookie for usage in follwing pages
                mgCookie.UpdateCookies("pj_code", lblProjectCode.Text);
            }
            catch (Exception ex)
            {
                //ELMA Log
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            }


            SqlDataSource6.SelectCommand = "SELECT pj_id FROM [projects] where pj_code = '" + lblProjectCode.Text + "' and pj_status = '" + Request.QueryString["status"] + "'";
            SqlDataSource6.DataBind();

            DataView dv1 = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);

            //keep project code in cookie for usage in follwing pages
            mgCookie.UpdateCookies("pj_id", dv1.Table.Rows[0]["pj_id"].ToString());

            Response.Redirect("project_filter.aspx");
        }
    }