Beispiel #1
0
    private void LoadLocation()
    {
        clsUserLogin objLogin = new clsUserLogin();

        dt = objLogin.getLocationsforMSPReport();
        if (dt.Rows.Count > 0)
        {
            ddlLocation.DataSource     = dt;
            ddlLocation.DataTextField  = "T_Location";
            ddlLocation.DataValueField = "T_Location";
            ddlLocation.DataBind();
            ddlLocation.Items.Insert(0, "All");
            ddlLocation.SelectedIndex = 0;
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["StudentId"] == null)
     {
         Response.Redirect("../Default.aspx");
     }
     if (!IsPostBack)
     {
         objLogin            = new clsUserLogin();
         objLogin.Std_Agr_Id = Convert.ToInt32(Session["UID"]);
         DataSet ds = objLogin.GetUserImage();
         lblName.Text             = "You are Logged With: " + ds.Tables[0].Rows[0]["FName"].ToString();
         lblName.Visible          = true;
         BindImage1.LaodImageByte = (byte[])ds.Tables[0].Rows[0]["Photo"];
         BindImage1.LoadFileName  = ds.Tables[0].Rows[0]["ImageFile"].ToString();
     }
 }
Beispiel #3
0
    public void VerifyUserLogin()
    {
        objLogin          = new clsUserLogin();
        objLogin.UserName = txtUserName.Text.Trim();
        objLogin.Password = txtPassword.Text.Trim();
        int flag = objLogin.CheckLogin();

        if (flag == 0)
        {
            objLogin.Std_Agr_Id = Convert.ToInt32(objLogin.Std_Agr_Id);
            Session["UID"]      = objLogin.Std_Agr_Id.ToString();
            int LoginUseId = objLogin.GetUserLoginId();
            Session["UserLoginId"] = LoginUseId.ToString();
            Session["UserName"]    = objLogin.UserName.ToString();
            if (objLogin.Role == "Officer")
            {
                Session["OfficerId"] = objLogin.Std_Agr_Id.ToString();
                Session["UserType"]  = "Officer";
                clsUserLogin.ActiveFacultyOnlineStatus(Convert.ToInt32(Session["OfficerId"]));
                Response.Redirect("~/AgricultureOfficer/frmOfficerHome.aspx");
            }
            else if (objLogin.Role == "student")
            {
                Session["StudentId"] = objLogin.Std_Agr_Id.ToString();
                Session["UserType"]  = "Student";
                clsUserLogin.ActiveStudentOnlineStatus(Convert.ToInt32(Session["StudentId"]));
                Response.Redirect("~/Students/frmStudentHome.aspx");
            }
            else
            {
                Response.Redirect("~/Administrator/frmAdminHome.aspx");
            }
        }
        else if (flag == 1)//User Name Wrong
        {
            Page.RegisterClientScriptBlock("FarmersBuddy", "<script>alert('User Name Wrong')</script>");
        }
        else//Password Wrong
        {
            Page.RegisterClientScriptBlock("FarmersBuddy", "<script>alert('Password Wrong')</script>");
        }
    }