Ejemplo n.º 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        clsregister        obj    = new clsregister();
        clsregistrationprp objprp = new clsregistrationprp();

        objprp.email          = emailaddress.Text;
        objprp.f_name         = firstname.Text;
        objprp.l_name         = lastname.Text;
        objprp.rollno         = rollno.Text;
        objprp.sem            = Sem.SelectedItem.Text;
        objprp.dept           = DropDownList4.SelectedItem.Text;
        objprp.acc_type       = DropDownList3.SelectedItem.Text;
        objprp.password       = Password.Text;
        objprp.contact        = contact.Text;
        objprp.parent         = parent.Text;
        objprp.parentemail    = parentemail.Text;
        objprp.parentcontact  = parentcontact.Text;
        objprp.parentpassword = CreateRandomPassword();
        objprp.lastupd        = Convert.ToString(Session["cod"]) + "||" + "Admin" + "||" + Convert.ToString(DateTime.Now);
        //now to send mail

        //try statemnt
        try
        {
            success.Visible = true;
            obj.save_rec_admin(objprp);
            objprp.studentid = obj.findid(objprp);
            obj.join_family(objprp);
            success.Text = "Student " + firstname.Text + "-" + lastname.Text + " Added Successfully";

            if (Convert.ToInt32(DropDownList3.SelectedItem.Value) == 2 || Convert.ToInt32(DropDownList3.SelectedItem.Value) == 3)
            {
                msgtoparent();
                msgtostudent();
            }
            else
            {
                msgtocc();
            }
        }
        catch (Exception exp)
        {
            success.Visible = true;

            success.Text = exp + "ERROR!!!";
        }


        firstname.Text    = string.Empty;
        lastname.Text     = string.Empty;
        rollno.Text       = string.Empty;
        emailaddress.Text = string.Empty;
        rollno.Text       = string.Empty;
        contact.Text      = string.Empty;
        Password.Text     = string.Empty;
        Sem.Items.Clear();
        DropDownList3.Items.Clear();
        DropDownList4.Items.Clear();
        SetFocus(firstname);
    }