Ejemplo n.º 1
0
    protected void BtnAdd_Click(object sender, EventArgs e)
    {
        if (studentPhoto.HasFile)
        {
            //create the path to save the file
            string fileName = Path.Combine(Server.MapPath("~/StudentPhoto"), studentPhoto.FileName);
            //save the file to our local path
            studentPhoto.SaveAs(fileName);
            //AlumniImage.ImageUrl = "~/AlumniPhoto/" + PhotoUpload.FileName;
            strphoto = studentPhoto.FileName;
        }
        i = obj.AddStudent(txtfname.Text, txtmname.Text, txtlname.Text, ddngender.SelectedItem.Text, txtdob.Text, ddnbloodgroup.SelectedItem.Text, txtenrollment.Text, txtrollno.Text, txtaadhar.Text, "~/StudentPhoto/" + strphoto,
                           txtcaddress.Text, txtpaddress.Text, Convert.ToInt32(ddnstate.SelectedValue), Convert.ToInt32(ddncity.SelectedValue), txtpin.Text, txthno.Text, txtsno.Text, txtfathername.Text, txtfathercno.Text, txtfatherocc.Text, txtfatherdesig.Text,
                           txtfatherincome.Text, txtmothername.Text, txtmothercno.Text, txtmotherocc.Text, txtmotherdesig.Text, txtmotherincome.Text, "Admin", 1, DateTime.Now.ToString("dd-MM-yyyy"));
        if (i > 0)
        {
            dt4 = obj.GetCurrentStudentId();
            if (dt4.Rows.Count > 0)
            {
                stdntid = Convert.ToInt32(dt4.Rows[0]["StudentId"]);
            }
            j = obj.AddStudentAllotment(stdntid, "Yes", Convert.ToInt32(ddnclass.SelectedValue), Convert.ToInt32(ddnsection.SelectedValue), "Admin", 1, DateTime.Now.ToString());
            if (j > 0)
            {
                lblmsg.Text = "Data Has Been Added";

                dt1 = obj.SelectStudentAllotment();
                dt  = obj.SelectStudent();
                gvdetails.DataSource = dt;
                gvdetails.DataBind();

                // s = "Welcome Mr." + txtfathername.Text + " Welcome To Our School Management Your Ward Had Admitted With Us";
                //s1 = "Welcome Mr." + txtmothername.Text + " Welcome To Our School Management Your Ward Had Admitted With Us";
                //SendSMS(txtfathercno.Text, s);
                //SendSMS(txtmothercno.Text, s1);

                ClearFields();
            }
        }
    }