Example #1
0
    private int _SaveUpdate()
    {
        int StudentId = 0;

        if (Request.QueryString["StudentId"] != null)
        {
            StudentId = Convert.ToInt32(Request.QueryString["StudentId"]);
        }

        objUser.UserId    = StudentId;
        objUser.FirstName = txt_FirstName.Text;
        objUser.LastName  = txt_LastName.Text;
        objUser.Email     = txtEmail.Text;
        objUser.Password  = txtPassword.Text;
        objUser.CityId    = Convert.ToInt16(hdn_CityID.Value);
        objUser.SchoolId  = Convert.ToInt16(hdn_SchoolID.Value);
        objUser.ClassId   = Convert.ToInt16(hdn_ClassID.Value);
        objUser.UserName  = txtUsername.Text.Trim();
        return(objStudent.InsertStudent(objUser));
    }
    private int _SaveUpdate()
    {
        objUser.UserId    = Convert.ToInt32(hdnStudentId.Value);
        objUser.FirstName = txtFirstName.Text;
        objUser.LastName  = txtLastName.Text;
        objUser.Password  = txtPassword.Text;
        objUser.Email     = txtEmail.Text;
        objUser.CityId    = Convert.ToInt32(ddlCity.SelectedValue);
        objUser.SchoolId  = Convert.ToInt32(ddlSchool.SelectedValue);
        objUser.ClassId   = Convert.ToInt32(ddlClass.SelectedValue);
        objUser.UserName  = txtUsername.Text.Trim();

        int res = objStudent.InsertStudent(objUser);

        if (res > 0)
        {
            DataTable studInfo = objStudent.GetMyProfileInfo(res);
            if (studInfo.Rows.Count > 0)
            {
                try
                {
                    string        ClassAdminEmail = studInfo.Rows[0]["ClassAdminEmail"].ToString();
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<p>Dear " + studInfo.Rows[0]["ClassAdminName"].ToString() + ",</p>");
                    sb.Append("<p>New registration in your Class: <b>" + studInfo.Rows[0]["Class"].ToString() + "</b><p>");
                    sb.Append("<p>Student Name: " + txtFirstName.Text + " " + txtLastName.Text + " ,</p>");
                    sb.Append("<p>School Name: " + studInfo.Rows[0]["School"].ToString() + "</p>");
                    Helper.sendMail("BikeTour - New Student Registration", ClassAdminEmail, sb.ToString());
                }
                catch (Exception ex)
                {
                }
            }
        }

        return(res);
    }