示例#1
0
 protected void gvEstablishment_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     lblUpdateShow.Text         = "";
     gvEstablishment.PageIndex  = e.NewPageIndex;
     gvEstablishment.DataSource = EstablishmentDB.getAllEstablishments();
     gvEstablishment.DataBind();
 }
示例#2
0
 protected void gvEstablishment_SelectedIndexChanged(object sender, EventArgs e)
 {
     lblUpdateShow.Text = "";
     PanelEst.Visible   = true;
     if (Session["esttemp"] == null)
     {
         List <Establishment> estlist = EstablishmentDB.getAllEstablishments();
         Establishment        es      = estlist[gvEstablishment.PageSize * gvEstablishment.PageIndex + gvEstablishment.SelectedIndex];
         tbxEstID.Text            = es.ID;
         tbxEstADdress.Text       = es.Address;
         tbxEstEmail.Text         = es.Email;
         tbxEstName.Text          = es.Name;
         tbxEstPhone.Text         = es.Phone.ToString();
         tbxEstType.Text          = es.Type;
         ddlestatus.SelectedValue = es.Status;
     }
     else
     {
         Establishment es2 = EstablishmentDB.getEstablishmentByEmail(tbxSearch.Text);
         tbxEstID.Text            = es2.ID;
         tbxEstADdress.Text       = es2.Address;
         tbxEstEmail.Text         = es2.Email;
         tbxEstName.Text          = es2.Name;
         tbxEstPhone.Text         = es2.Phone.ToString();
         tbxEstType.Text          = es2.Type;
         ddlestatus.SelectedValue = es2.Status;
     }
 }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["email"] == null)
        {
            Server.Transfer("CommonLogin.aspx");
        }
        else
        {
            List <Establishment> elist = EstablishmentDB.getAllEstablishments();
            foreach (Establishment es in elist)
            {
                if (es.Type == "Hospital" || es.Type == "Blood Bank")
                {
                    ddlEstablish.Items.Add(es.Name);
                }
            }

            ddlEstablish.Items.Insert(0, "--Select--");
            lblAmount.Visible = false;
            u           = UsersDB.getUserbyEmail(Session["email"].ToString());
            pendinglist = new List <BloodPlateletRequestUser>();
            bplist      = BloodPlateletRequestUserDB.getUserBloodRequestsbyUserID(u.userId);
            foreach (BloodPlateletRequestUser b in bplist)
            {
                if (b.Status == "pending")
                {
                    pendinglist.Add(b);
                }
            }

            if (pendinglist.Count == 0)
            {
                lblSorry.Visible = true;
                Panel1.Visible   = false;
                Panel2.Visible   = false;
            }
            else
            {
                lblSorry.Visible  = false;
                Panel1.Visible    = true;
                gvUser.DataSource = pendinglist;
                gvUser.DataBind();
                Panel2.Visible = false;
            }
            lblee.Visible  = false;
            lbleeh.Visible = false;
            lbleu.Visible  = false;
            lbleuh.Visible = false;
        }
    }
    protected void btnResetPassword_Click(object sender, EventArgs e)
    {
        List <Establishment> estlist = EstablishmentDB.getAllEstablishments();
        int found = 0;

        try
        {
            foreach (Establishment u in estlist)
            {
                if (tbxFgEmail.Text == u.Email)
                {
                    found = 1;
                    break;
                }
            }


            if (found == 0)
            {
                lblError.Visible   = true;
                lblError.ForeColor = System.Drawing.Color.Red;
                lblError.Text      = "Email Address not found! Please Try Again.";
                return;
            }

            else
            {
                Users      fgmail = UsersDB.getUserbyEmail(tbxFgEmail.Text);
                SmtpClient client = new SmtpClient("smtp.gmail.com");
                client.EnableSsl   = true;
                client.Credentials = new NetworkCredential("*****@*****.**", "inft.3050");
                MailMessage msg = new MailMessage("*****@*****.**", tbxFgEmail.Text);
                msg.Subject = "Your Current Password";
                msg.Body    = "Your password is: " + fgmail.password;
                client.Send(msg);

                lblError.Visible   = true;
                lblError.ForeColor = System.Drawing.Color.Green;
                lblError.Text      = "Reset password sent to " + tbxFgEmail.Text;
            }
        }
        catch (Exception)
        {
            lblError.Visible   = true;
            lblError.ForeColor = System.Drawing.Color.Red;
            lblError.Text      = "Unable to sent email! Try Again";
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["establishment"] == null)
     {
         Server.Transfer("Login.aspx");
     }
     else
     {
         List <Establishment> establishments = EstablishmentDB.getAllEstablishments();
         Establishment        es             = (Establishment)Session["establishment"];
         if (es.Type == "Blood Bank")
         {
             linkOrgans1.Visible = false;
             linkOrgans2.Visible = false;
         }
     }
 }
示例#6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["email"] == null)
        {
            Button1.Enabled = true;
        }
        else
        {
            Button1.Enabled = false;
        }
        int          num = 0, esnum = 0, btc = 0, numo = 0;
        List <Users> userslist = UsersDB.getallUsers();

        num = userslist.Count;
        lblTotalUsers.Text = num.ToString();
        lblOutput.Text     = "";
        List <Establishment> estlist = EstablishmentDB.getAllEstablishments();

        esnum = estlist.Count;
        lblTotalAssociates.Text = esnum.ToString();

        List <GReportBloodPlatelet> listEE = GReportBloodPlateletDB.HgetAllBloodEToE();
        List <GReportBloodPlatelet> listEU = GReportBloodPlateletDB.HgetAllBloodEToU();
        List <GReportBloodPlatelet> listUE = GReportBloodPlateletDB.HgetAllBloodUToE();
        List <GReportBloodPlatelet> listUU = GReportBloodPlateletDB.HgetAllBloodUToU();

        btc = listEE.Count + listEU.Count + listUE.Count + listUU.Count;
        lblSuccessfulBloodDonation.Text = btc.ToString();

        List <OrganRecipient> orlist = OrganRecipientDB.getAllRecipients();

        foreach (OrganRecipient o in orlist)
        {
            if (o.Status == "complete")
            {
                numo++;
            }
        }
        lblOrganDonation.Text = numo.ToString();
    }
示例#7
0
    protected void btnEUpdate_Click(object sender, EventArgs e)
    {
        string        tempemail = tbxEstEmail.Text;
        Establishment tempest   = EstablishmentDB.getEstablishmentByEmail(tempemail);

        tempest.Status = ddlestatus.SelectedValue;
        Admins a = AdminDB.getAdminbyEmail(Session["email"].ToString());

        tempest.Admin = a;
        int num = EstablishmentDB.updateestStatus(tempest);

        if (num != 1)
        {
            lblOutput.Text = "Cannot Update Establishment!";
        }
        else
        {
            lblUpdateShow.Text         = "Update Successful!";
            PanelEst.Visible           = false;
            gvEstablishment.DataSource = EstablishmentDB.getAllEstablishments();
            gvEstablishment.DataBind();
            gvEstablishment.SelectedIndex = -1;
        }
    }
示例#8
0
    protected void btnSubmit2_Click(object sender, EventArgs e)
    {
        List <Establishment> establishments = EstablishmentDB.getAllEstablishments();
        Establishment        es             = new Establishment();

        foreach (Establishment est in establishments)
        {
            if (tbxEmail2.Text.ToLower() == est.Email.ToLower() && (est.Type == "Blood Bank" || est.Type == "Hospital"))
            {
                estFound  = true;
                estFoundG = false;
                estFoundN = false;
                es        = est;
                break;
            }
            else if (tbxEmail2.Text.ToLower() == est.Email.ToLower() && est.Type == "Government")
            {
                estFoundG = true;
                estFound  = false;
                estFoundN = false;
                es        = est;
                break;
            }
            else if (tbxEmail2.Text.ToLower() == est.Email.ToLower() && est.Type == "NGO")
            {
                estFoundG = false;
                estFound  = false;
                estFoundN = true;
                es        = est;
                break;
            }
        }

        if (estFound == true)
        {
            if (tbxPassword2.Text == es.Password)
            {
                if (es.Status == "active")
                {
                    Session["establishment"] = es;
                    Server.Transfer("HospitalHomePage.aspx");
                }
                else
                {
                    lbl2Output.Text = "You cannot access to this email anymore. Please contact admin for more details";
                    return;
                }
            }
            else
            {
                lbl2Output.Text = "Incorrect password!";
                return;
            }
        }
        else if (estFoundG == true)
        {
            if (tbxPassword2.Text == es.Password)
            {
                if (es.Status == "active")
                {
                    Session["establishment"] = es;
                    Server.Transfer("GMyAccount.aspx");
                }
                else
                {
                    lbl2Output.Text = "You cannot access to this email anymore. Please contact admin for more details";
                    return;
                }
            }
            else
            {
                lbl2Output.Text = "Incorrect password!";
                return;
            }
        }
        else if (estFoundN == true)
        {
            if (tbxPassword2.Text == es.Password)
            {
                if (es.Status == "active")
                {
                    Session["establishment"] = es;
                    Server.Transfer("NHomePage.aspx");
                }
                else
                {
                    lbl2Output.Text = "You cannot access to this email anymore. Please contact admin for more details";
                    return;
                }
            }
            else
            {
                lbl2Output.Text = "Incorrect password!";
                return;
            }
        }
        else
        {
            lbl2Output.Text = "Account doesn't exist";
            return;
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        //sending request if the amount is greater than 1
        if (Convert.ToInt32(tbxAmount.Text) > 0)
        {
            Establishment          currentEstab     = (Establishment)Session["establishment"];
            EstablishmentBPRequest currentRequestBP = new EstablishmentBPRequest();
            currentRequestBP.BloodGroup    = ddlBloodType.SelectedValue;
            currentRequestBP.Units         = Convert.ToInt32(tbxAmount.Text);
            currentRequestBP.MatchedUnits  = 0;
            currentRequestBP.Type          = ddlRequestType.SelectedValue;
            currentRequestBP.Establishment = currentEstab;
            currentRequestBP.Status        = "pending";
            currentRequestBP.RequestDate   = DateTime.Today;
            int num = EstablishmentBPRequestDB.insertEstablishmentRequest(currentRequestBP);
            if (num != 1)
            {
                lblOutput.Text = "Cannot";
            }
            else
            {
                List <EstablishmentBPRequest> establishmentBPRequest = EstablishmentBPRequestDB.getAllEstablishmentRequests();
                //get inserted request
                string x      = establishmentBPRequest[0].ID;
                int    tempId = Convert.ToInt32(x.Substring(4, x.Length - 4));
                foreach (EstablishmentBPRequest tempReq in establishmentBPRequest)
                {
                    int t = Convert.ToInt32(tempReq.ID.Substring(4, tempReq.ID.Length - 4));

                    if (tempId <= t && tempReq.Establishment.ID == currentEstab.ID)
                    {
                        tempId = Convert.ToInt32(tempReq.ID.Substring(4, tempReq.ID.Length - 4));
                    }
                }
                EstablishmentBPRequest request = EstablishmentBPRequestDB.getRequestByID("bper" + Convert.ToString(tempId));
                lblOutput.Text = "Your request ID is bper" + tempId;
                List <Establishment> establishments = EstablishmentDB.getAllEstablishments();
                foreach (Establishment est in establishments)
                {
                    EstabEstabMatch newMatch = new EstabEstabMatch();
                    if ((est.Type == "Hospital" || est.Type == "Blood Bank") && currentEstab.ID != est.ID)
                    {
                        int d = getDistance(est.Address, currentEstab.Address);
                        if (d < 3600)
                        {
                            newMatch.Request  = request;
                            newMatch.Match    = est;
                            newMatch.Distance = d;
                            newMatch.Status   = "pending";
                            EstabEstabMatchDB.insertMatch(newMatch);
                        }
                    }
                }
                List <Users>            users    = UsersDB.getallUsers();
                List <LastDonationDate> allDates = LastDonationDateDB.getAllLastDonations();

                foreach (Users tusr in users)
                {
                    EstabUserMatch newMatch     = new EstabUserMatch();
                    string         userGroup    = tusr.BloodType;
                    string         requestGroup = request.BloodGroup;
                    bool           f            = false;
                    //check blood to match with other user
                    if (requestGroup == "AB+")
                    {
                        f = true;
                    }
                    else if (requestGroup == "AB-" && (userGroup == "O-" || userGroup == "B-" || userGroup == "A-" || userGroup == "AB-"))
                    {
                        f = true;
                    }
                    else if (requestGroup == "A+" && (userGroup == "O-" || userGroup == "O+" || userGroup == "A-" || userGroup == "A+"))
                    {
                        f = true;
                    }
                    else if (requestGroup == "A-" && (userGroup == "O-" || userGroup == "A-"))
                    {
                        f = true;
                    }
                    else if (requestGroup == "B+" && (userGroup == "O-" || userGroup == "O+" || userGroup == "B-" || userGroup == "B+"))
                    {
                        f = true;
                    }
                    else if (requestGroup == "B-" && (userGroup == "O-" || userGroup == "B-"))
                    {
                        f = true;
                    }
                    else if (requestGroup == "O+" && (userGroup == "O-" || userGroup == "O+"))
                    {
                        f = true;
                    }
                    else if (requestGroup == "O-" && (userGroup == "O-"))
                    {
                        f = true;
                    }

                    //if match found check his medical status and status
                    if (f == true && tusr.medicalStatus.ToLower() == "can donate" && tusr.Status == "Allow")
                    {
                        foreach (LastDonationDate d in allDates)
                        {
                            if (d.User.userId == tusr.userId)
                            {
                                if ((d.LastDonation < System.DateTime.Now.AddDays(-90) && d.Type == "blood") || (d.LastDonation < System.DateTime.Now.AddDays(-14) && d.Type == "platelet") && d.Status == "Not in transaction")
                                {
                                    int d1 = getDistance(Convert.ToString(tusr.latitude) + "," + Convert.ToString(tusr.longtitude), currentEstab.Address);
                                    if (d1 < 3600)
                                    {
                                        newMatch.Match    = tusr;
                                        newMatch.Request  = request;
                                        newMatch.Status   = "pending";
                                        newMatch.Distance = d1;
                                        EstabUserMatchDB.insertMatch(newMatch);
                                    }
                                }
                            }
                        }
                    }
                }

                tbxAmount.Text               = "";
                ddlBloodType.SelectedIndex   = 0;
                ddlRequestType.SelectedIndex = 0;
                string MyAccountUrl = "RequestBlood.aspx";
                Page.Header.Controls.Add(new LiteralControl(string.Format(@" <META http-equiv='REFRESH' content=4;url={0}> ", MyAccountUrl)));
            }
        }
        else
        {
            lblOutput.Text = "Blood amount cannot be 0 or less than that";
            return;
        }
    }
示例#10
0
    protected void btnRequest_Click(object sender, EventArgs e)
    {
        string groups, estname, type;
        int    unit;

        if (RadioBlood.Checked)
        {
            groups = "blood";
        }
        else
        {
            groups = "platelet";
        }
        if (tbxAmount.Text == "")
        {
            lblAmount.Visible = true;
            return;
        }
        else
        {
            lblAmount.Visible = false;
            unit = Convert.ToInt32(tbxAmount.Text);
        }
        estname = ddlEstablish.SelectedItem.Text;
        Establishment es = EstablishmentDB.getEstablishmentByName(estname);
        Users         u  = UsersDB.getUserbyEmail(Session["email"].ToString());

        type = ddlBloodType.SelectedValue;
        BloodPlateletRequestUser b = new BloodPlateletRequestUser(unit, 0, es, u, type, "pending", groups, DateTime.Now);
        int num = BloodPlateletRequestUserDB.insertBloodRequestByUser(b);

        if (num != 1)
        {
            lblOutput.Text = "Cannot Request Blood!";
            return;
        }
        else
        {
            lblOutput.Text = "Request Successful!";


            List <BloodPlateletRequestUser> bloodPlateletRequestUser = BloodPlateletRequestUserDB.getAllUserBloodRequests();

            string x      = bloodPlateletRequestUser[0].bplUserRequestID;
            int    tempID = Convert.ToInt32(x.Substring(4, x.Length - 4));
            foreach (BloodPlateletRequestUser bpr in bloodPlateletRequestUser)
            {
                if (tempID < Convert.ToInt32(bpr.bplUserRequestID.Substring(4, bpr.bplUserRequestID.Length - 4)) && bpr.requestorID.UserId == u.UserId)
                {
                    tempID = Convert.ToInt32(bpr.bplUserRequestID.Substring(4, bpr.bplUserRequestID.Length - 4));
                }
            }

            BloodPlateletRequestUser request        = BloodPlateletRequestUserDB.getUserBloodRequestsbyID("bpur" + Convert.ToString(tempID));
            List <Establishment>     establishments = EstablishmentDB.getAllEstablishments();
            foreach (Establishment est in establishments)
            {
                BPMatchUserToEstab newMatch = new BPMatchUserToEstab();
                if ((est.Type == "Hospital" || est.Type == "Blood Bank") && request.Establishment.ID != est.ID)
                {
                    int d = getDistance(est.Address, request.Establishment.Address);
                    if (d < 3600 && d > 0)
                    {
                        newMatch.bpRequestID = request;
                        newMatch.matchID     = est;
                        newMatch.distance    = d;
                        newMatch.status      = "pending";
                        int nums = BPMatchUserToEstabDB.insertbp(newMatch);
                        if (nums != 1)
                        {
                            lblOutput.Text = "Cannot Request Blood!";
                            return;
                        }
                        else
                        {
                            lblOutput.Text = "Request Successful!";
                        }
                    }
                }
            }
            List <Users>            users    = UsersDB.getallUsers();
            List <LastDonationDate> lastDate = LastDonationDateDB.getAllLastDonations();
            foreach (Users usr in users)
            {
                BPMatchUserToUser newMatchU = new BPMatchUserToUser();

                string userGroup    = usr.BloodType;
                string requestGroup = request.Type;
                bool   f            = false;
                if (requestGroup == "AB+")
                {
                    f = true;
                }
                else if (requestGroup == "AB-" && (userGroup == "O-" || userGroup == "B-" || userGroup == "A-" || userGroup == "AB-"))
                {
                    f = true;
                }
                else if (requestGroup == "A+" && (userGroup == "O-" || userGroup == "O+" || userGroup == "A-" || userGroup == "A+"))
                {
                    f = true;
                }
                else if (requestGroup == "A-" && (userGroup == "O-" || userGroup == "A-"))
                {
                    f = true;
                }
                else if (requestGroup == "B+" && (userGroup == "O-" || userGroup == "O+" || userGroup == "B-" || userGroup == "B+"))
                {
                    f = true;
                }
                else if (requestGroup == "B-" && (userGroup == "O-" || userGroup == "B-"))
                {
                    f = true;
                }
                else if (requestGroup == "O+" && (userGroup == "O-" || userGroup == "O+"))
                {
                    f = true;
                }
                else if (requestGroup == "O-" && (userGroup == "O-"))
                {
                    f = true;
                }
                if ((request.requestorID.UserId != usr.UserId) && (f == true) && (usr.MedicalStatus.ToLower() == "can donate") && (usr.status == "Allow"))
                {
                    foreach (LastDonationDate lddate in lastDate)
                    {
                        if ((lddate.User.UserId == usr.UserId))
                        {
                            if ((lddate.LastDonation < System.DateTime.Now.AddDays(-90) && lddate.Type == "blood") || (lddate.LastDonation < System.DateTime.Now.AddDays(-14) && lddate.Type == "platelet") && lddate.Status == "Not in transaction")
                            {
                                string origin = usr.Latitude + "," + usr.Longtitude;
                                int    d      = getDistance(origin, request.Establishment.Address);
                                if (d < 3600)
                                {
                                    newMatchU.bplUsrRequestID = request;
                                    newMatchU.matchID         = usr;
                                    newMatchU.distance        = d;
                                    newMatchU.status          = "pending";
                                    BPMatchUserToUserDB.insertbpusertoUser(newMatchU);
                                }
                            }
                        }
                    }
                }
            }
            string DRUrl = "DonateAndRequest.aspx";
            Page.Header.Controls.Add(new LiteralControl(string.Format(@" <META http-equiv='REFRESH' content=3;url={0}> ", DRUrl)));
        }
        //}
    }
示例#11
0
    protected void btnsearch_Click(object sender, EventArgs e)
    {
        lblUpdateShow.Text = "";
        Panel1.Visible     = false;
        bool temail = false;

        if (tbxSearch.Text == "")
        {
            lblError.Visible = true;
            lblError.Text    = "Please enter the email address to search";
            return;
        }
        else
        {
            if (DropDownList2.SelectedIndex == 0)
            {
                lblError.Visible = true;
                lblError.Text    = "Please select category to search the individual";
                Panel1.Visible   = false;
                Panel2.Visible   = false;
                return;
            }

            else if (DropDownList2.SelectedIndex == 1)
            {
                List <AUser> userslist = AUserDB.getallUsers();

                foreach (AUser u in userslist)
                {
                    if (tbxSearch.Text.ToLower() == u.email.ToLower())
                    {
                        temail = true;
                        break;
                    }
                    else
                    {
                        temail = false;
                    }
                }

                if (temail == true)
                {
                    PanelUserAll.Visible = true;
                    AUser        suser        = AUserDB.getUserbyEmail(tbxSearch.Text);
                    List <AUser> tempuserlist = new List <AUser>();
                    tempuserlist.Add(suser);
                    gvUser.DataSource = tempuserlist;
                    gvUser.DataBind();
                    Session["etemp"] = tbxSearch.Text;
                    Panel1.Visible   = false;
                    Panel2.Visible   = false;
                    lblError.Text    = "";
                }
                else
                {
                    PanelUserAll.Visible = false;
                    lblError.Visible     = true;
                    lblError.Text        = "The email address not found in the system for User";
                    Panel1.Visible       = false;
                    Panel2.Visible       = false;
                    Session["etemp"]     = null;
                }
            }

            else if (DropDownList2.SelectedIndex == 2)
            {
                List <Admins> adminslist = AdminDB.getallAdmins();

                foreach (Admins m in adminslist)
                {
                    if (tbxSearch.Text.ToLower() == m.email.ToLower())
                    {
                        temail = true;
                        break;
                    }
                    else
                    {
                        temail = false;
                    }
                }

                if (temail == true)
                {
                    PanelAllAdmins.Visible = true;
                    Admins        sadmin        = AdminDB.getAdminbyEmail(tbxSearch.Text);
                    List <Admins> tempadminlist = new List <Admins>();
                    tempadminlist.Add(sadmin);
                    gvAdmin.DataSource = tempadminlist;
                    gvAdmin.DataBind();
                    Session["atemp"]     = tbxSearch.Text;
                    pAdminDetail.Visible = false;
                    lblError.Text        = "";
                }
                else
                {
                    PanelAllAdmins.Visible = false;
                    pAdminDetail.Visible   = false;
                    lblError.Visible       = true;
                    lblError.Text          = "The email address not found in the system for Admin";
                    Session["atemp"]       = null;
                }
            }


            else if (DropDownList2.SelectedIndex == 3)
            {
                List <Establishment> estlist = EstablishmentDB.getAllEstablishments();

                foreach (Establishment es in estlist)
                {
                    if (tbxSearch.Text.ToLower() == es.Email.ToLower())
                    {
                        temail = true;
                        break;
                    }
                    else
                    {
                        temail = false;
                    }
                }

                if (temail == true)
                {
                    PanelAllEstablishment.Visible = true;
                    Establishment        estab       = EstablishmentDB.getEstablishmentByEmail(tbxSearch.Text);
                    List <Establishment> tempestlist = new List <Establishment>();
                    tempestlist.Add(estab);
                    gvEstablishment.DataSource = tempestlist;
                    gvEstablishment.DataBind();
                    Session["esttemp"] = tbxSearch.Text;
                    PanelEst.Visible   = false;
                    lblError.Text      = "";
                }
                else
                {
                    PanelAllEstablishment.Visible = false;
                    PanelEst.Visible   = false;
                    lblError.Visible   = true;
                    lblError.Text      = "The email address not found in the system for Establishment";
                    Session["esttemp"] = null;
                }
            }
        }
    }
示例#12
0
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        lblUpdateShow.Text = "";
        if (DropDownList2.SelectedIndex == 0)
        {
            PanelUserAll.Visible          = false;
            PanelAllAdmins.Visible        = false;
            Panel1.Visible                = false;
            pAdminDetail.Visible          = false;
            PanelAllEstablishment.Visible = false;
            PanelEst.Visible              = false;
            lblError.Text   = "";
            lblAOutput.Text = "";
            lblOutput.Text  = "";
            lblCError.Text  = "";
        }

        else if (DropDownList2.SelectedIndex == 1)
        {
            List <AUser> allUsers = AUserDB.getallUsers();
            if (allUsers.Count == 0)
            {
                lblCError.Text = "Sorry! There is no user found!";
                return;
            }
            else
            {
                PanelUserAll.Visible          = true;
                Panel1.Visible                = false;
                PanelAllAdmins.Visible        = false;
                pAdminDetail.Visible          = false;
                PanelAllEstablishment.Visible = false;
                PanelEst.Visible              = false;
                bindUser();
                gvUser.SelectedIndex = -1;
                lblCError.Text       = "";
                lblError.Text        = "";
                tbxSearch.Text       = "";
                Session["etemp"]     = null;
                Session["esttemp"]   = null;
            }
        }

        else if (DropDownList2.SelectedIndex == 2)
        {
            List <Admins> alladmins = AdminDB.getallAdmins();
            if (alladmins.Count == 0)
            {
                lblCError.Text = "Sorry! There is no user found!";
                return;
            }
            else
            {
                PanelUserAll.Visible          = false;
                Panel1.Visible                = false;
                pAdminDetail.Visible          = false;
                PanelAllEstablishment.Visible = false;
                PanelEst.Visible              = false;
                PanelAllAdmins.Visible        = true;
                gvAdmin.SelectedIndex         = -1;
                bindAdmin();
                lblCError.Text     = "";
                lblError.Text      = "";
                tbxSearch.Text     = "";
                Session["atemp"]   = null;
                Session["esttemp"] = null;
            }
        }
        else if (DropDownList2.SelectedIndex == 3)
        {
            List <Establishment> allest = EstablishmentDB.getAllEstablishments();
            if (allest.Count == 0)
            {
                lblCError.Text = "Sorry! There is no user found!";
                return;
            }
            else
            {
                PanelUserAll.Visible          = false;
                Panel1.Visible                = false;
                pAdminDetail.Visible          = false;
                PanelAllAdmins.Visible        = false;
                PanelAllEstablishment.Visible = true;
                PanelEst.Visible              = false;
                gvEstablishment.DataSource    = allest;
                gvEstablishment.DataBind();
                lblCError.Text = "";
                gvEstablishment.SelectedIndex = -1;
                lblError.Text    = "";
                tbxSearch.Text   = "";
                Session["atemp"] = null;
                Session["etemp"] = null;
            }
        }
    }