예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        sv = new soapservices();
        course = sv.LoadCourses();
        if (!Page.IsPostBack)
        {
            txtDropDownList.DataBind();
            txtDropDownList.DataSource = course;
            txtDropDownList.DataMember = "COURSE_ID";
            txtDropDownList.DataTextField = "COURSE_NAME";
            txtDropDownList.DataValueField = "COURSE_ID";
            txtDropDownList.DataBind();
        }

        sv = new soapservices();
        units = sv.LoadUnits();
        if (!Page.IsPostBack)
        {
            dropSuperProfession.DataBind();
            dropSuperProfession.DataSource = units;
            dropSuperProfession.DataMember = "UNIT_ID";
            dropSuperProfession.DataTextField = "UNIT_NAME";
            dropSuperProfession.DataValueField = "UNIT_ID";
            dropSuperProfession.DataBind();
        }
    }
예제 #2
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        soapservices sv = new soapservices();
        try
        {
            User user = null;
            user=sv.Login(txtUsername.Text, txtpassword.Text);
            int user_id = user.USER_ID;

            if (user_id>0)
            {
                Session["user_id"] = user_id;
                Session["user_email"] = user.USER_EMAIL;
                Session["user_type"] = user.USER_TYPE;
                Response.Redirect("home.aspx");
            }
            else
            {
                Session["user_id"] = 0;
                Session["user_email"] = "no user";
                Session["user_type"] = -1;
            //    ClientScript.RegisterStartupScript(this.GetType(), "onclick",
            //"<script language=javascript>alert('Invalid Login details');</script>");
            }

        }
        catch (Exception){
          //  throw new Exception(ex.Message);
         //   ClientScript.RegisterOnSubmitStatement(this.GetType(), "onclick", "document.getElementById('warning').style.display = 'block';");
            Session["ERROR"] = "invalid login credentials";
           // Session.RemoveAll();
        }
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        s = new soapservices();
        user_id = Int32.Parse(Session["user_id"].ToString());

        //Load all user details
        Photo photo = s.GetPhoto(user_id);
        Response.BinaryWrite(photo.PHOTO);
        Response.ContentType = "image/png";
        Response.End();
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        s=new soapservices();
        try
        {
            //assigns variables session values
            user_id = Int32.Parse(Session["user_id"].ToString());
            user_email = Session["user_email"].ToString();
            user_type = Int32.Parse(Session["user_type"].ToString());

            ClientScript.RegisterStartupScript(this.GetType(), "onclick",
               "<script language=javascript> user_type="+user_type+";</script>");

            //load profile details
            if (!Page.IsPostBack)
            {
              //  Load all user details
                user = s.LoadProfile(user_id);
                txtNational_ID.Text = user.NATIONAL_ID;
                txtScreenName.Text = user.USER_NAME;
                txtDOB.Text = user.USER_DOB;
                txtEmail.Text = user.USER_EMAIL;
                txtGender.Text = user.USER_GENDER;
                txtPhoneNumber.Text = user.PHONE_NUMBER;

                //load student details if the user is a student
                if (user_type == 0)
                {
                    st = s.LoadStudent(user_id);

                    txtRegno.Text = st.REG_NUMBER;
                    txtcourse.Text = st.COURSE;
                    txtcosYear.Text = st.YEAR_STARTED;
                }
                    //load supervisor details if the user is a aupervisor with user type=1
                else
                {
                    sup=s.GetSupervisor(user_id);
                    txtprofession.Text = sup.SUPER_PROFESION;
                    txtphysicalLocation.Text = sup.PHYSICAL_LOCATION;
                }

            }
        }
        catch (Exception ex)
        {
            //throw new Exception(ex.Message);
            Response.Redirect("index.aspx");
        }
    }
예제 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SiteMaster master = Page.Master as SiteMaster;
        master.home = "class=active";

        try {
          user_id =Int32.Parse(Session["user_id"].ToString());
          user_email = Session["user_email"].ToString() ;
          user_type  = Int32.Parse(Session["user_type"].ToString());

          sv = new soapservices();
          units = sv.LoadUnits();
          if (!Page.IsPostBack)
          {
          dropTopics.DataBind();
          dropTopics.DataSource = units;
          dropTopics.DataMember = "UNIT_ID";
          dropTopics.DataTextField = "UNIT_NAME";
          dropTopics.DataValueField = "UNIT_ID";
          dropTopics.DataBind();
          }
        }
        catch { Response.Redirect("index.aspx"); }
    }