Example #1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        List <Establishment> establishments = EstablishmentDB.getAllTempEstablishments();
        int estFound = 0;

        foreach (Establishment tee in establishments)
        {
            if (tbxEmail.Text == tee.Email)
            {
                if (tee.Status == "pending")
                {
                    estFound = 1;
                }
                else if (tee.Status == "approved")
                {
                    estFound = 2;
                }
            }
        }
        if (estFound == 1)
        {
            lblOutput.Text = "Your application is processing.";
        }
        else if (estFound == 2)
        {
            lblOutput.Text = "Your establishment already exists.";
        }
        else
        {
            Establishment te = new Establishment();
            te.Email    = tbxEmail.Text;
            te.Name     = tbxName.Text;
            te.Password = tbxPassword.Text;
            te.Type     = rbtnlstType.SelectedValue;
            te.Phone    = Convert.ToInt32(tbxPhone.Text);
            te.Address  = tbxAddress.Text;
            te.Status   = "pending";
            int num = EstablishmentDB.insertTempEstablishment(te);
            if (num != 1)
            {
                lblOutput.Text = "Cannot";
            }
            else
            {
                lblOutput.Text = "Your application was successful.";
            }
        }
    }
Example #2
0
    protected void gvTempE_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        if (ddlEChoose.SelectedIndex == 1)
        {
            gvTempE.PageIndex  = e.NewPageIndex;
            gvTempE.DataSource = EstablishmentDB.getAllTempEstablishments();
            gvTempE.DataBind();
        }
        else if (ddlEChoose.SelectedIndex == 3)
        {
            gvTempE.PageIndex  = e.NewPageIndex;
            gvTempE.DataSource = EstablishmentDB.getAllTempEstablishmentsbyStatus("approved");
            gvTempE.DataBind();
        }

        else if (ddlEChoose.SelectedIndex == 4)
        {
            gvTempE.PageIndex  = e.NewPageIndex;
            gvTempE.DataSource = EstablishmentDB.getAllTempEstablishmentsbyStatus("dismissed");
            gvTempE.DataBind();
        }
    }
Example #3
0
    protected void ddlEChoose_SelectedIndexChanged(object sender, EventArgs e)
    {
        Label2.Text = "";
        if (ddlEChoose.SelectedIndex == 0)
        {
            Panel1.Visible      = false;
            PanelEAll.Visible   = false;
            PanelPening.Visible = false;
            lblSelectError.Text = "";
        }

        else if (ddlEChoose.SelectedIndex == 1)
        {
            PanelEAll.Visible   = true;
            Panel1.Visible      = false;
            PanelPening.Visible = false;
            List <Establishment> estlists = EstablishmentDB.getAllTempEstablishments();
            if (estlists.Count == 0)
            {
                lblSelectError.Text = "Sorry! There are no record found.";
            }
            else
            {
                gvTempE.DataSource = estlists;
                gvTempE.DataBind();
                lblSelectError.Text = "There are " + estlists.Count + " records found";
            }
        }

        else if (ddlEChoose.SelectedIndex == 2)
        {
            PanelEAll.Visible = false;
            Panel1.Visible    = false;

            List <Establishment> estplists = EstablishmentDB.getAllTempEstablishmentsbyStatus("pending");
            if (estplists.Count == 0)
            {
                lblSelectError.Text = "Sorry! There are no pending request right now.";
                return;
            }
            else
            {
                gvpending.DataSource = estplists;
                gvpending.DataBind();
                lblSelectError.Text = "There are " + estplists.Count + " pending records found";
                PanelPening.Visible = true;
            }
        }

        else if (ddlEChoose.SelectedIndex == 3)
        {
            PanelEAll.Visible   = false;
            Panel1.Visible      = false;
            PanelPening.Visible = false;
            List <Establishment> estalists = EstablishmentDB.getAllTempEstablishmentsbyStatus("approved");
            if (estalists.Count == 0)
            {
                lblSelectError.Text = "Sorry! There are approved no record found.";
                return;
            }
            else
            {
                gvTempE.DataSource = estalists;
                gvTempE.DataBind();
                lblSelectError.Text = "There are " + estalists.Count + " approved records found";
                PanelEAll.Visible   = true;
            }
        }

        else if (ddlEChoose.SelectedIndex == 4)
        {
            PanelEAll.Visible   = false;
            Panel1.Visible      = false;
            PanelPening.Visible = false;
            List <Establishment> estdlists = EstablishmentDB.getAllTempEstablishmentsbyStatus("dismissed");
            if (estdlists.Count == 0)
            {
                lblSelectError.Text = "Sorry! There are no dismissed record found.";
                return;
            }
            else
            {
                gvTempE.DataSource = estdlists;
                gvTempE.DataBind();
                lblSelectError.Text = "There are " + estdlists.Count + " dismissed records found";
                PanelEAll.Visible   = true;
            }
        }
    }
Example #4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (tbxAEmail.Text == "")
        {
            lblEmail.Visible = true;
            return;
        }
        else
        {
            lblEmail.Visible = false;
        }

        if (tbxName.Text == "")
        {
            lblName.Visible = true;
            return;
        }
        else
        {
            lblName.Visible = false;
        }


        if (tbxPassword.Text == "")
        {
            lblPassword.Visible = true;
            return;
        }
        else
        {
            lblPassword.Visible = false;
        }


        if (tbxPhone.Text == "")
        {
            lblPhone.Visible = true;
            return;
        }
        else
        {
            lblPhone.Visible = false;
        }


        if (tbxAAddress.Text == "")
        {
            lblAddress.Visible = true;
            return;
        }
        else
        {
            lblAddress.Visible = false;
        }

        //check the existing email from the database
        List <Establishment> alltempesb = EstablishmentDB.getAllTempEstablishments();

        foreach (Establishment est in alltempesb)
        {
            if (est.Email == tbxAEmail.Text)
            {
                lblOutput.Text = "Email already existed! Please change your email or you are already regiestered!";
                return;
            }
        }

        Establishment es  = new Establishment(tbxAEmail.Text, tbxName.Text, tbxPassword.Text, "Government", Convert.ToInt32(tbxPhone.Text), tbxAAddress.Text);
        int           num = EstablishmentDB.insertTempEstablishment(es);

        if (num != 1)
        {
            lblOutput.Text = "Fail to put to the government tempestablishment account!";
        }
        else
        {
            Admins        a    = AdminDB.getAdminbyEmail(Session["email"].ToString());
            Establishment te   = EstablishmentDB.getTempEstablishmentByEmail(tbxAEmail.Text);
            Establishment newG = new Establishment(tbxAEmail.Text, tbxName.Text, tbxPassword.Text, "Government", Convert.ToInt32(tbxPhone.Text), tbxAAddress.Text, te.ID, a);
            int           num2 = EstablishmentDB.insertEstablishment(newG);
            if (num2 != 1)
            {
                lblOutput.Text = "Fail to put to the government establishment account!";
            }
            else
            {
                lblOutput.Text   = "Government account successfully inserted!";
                tbxAAddress.Text = "";
                tbxAEmail.Text   = "";
                tbxName.Text     = "";
                tbxPassword.Text = "";
                tbxPhone.Text    = "";
            }
        }
    }