Exemplo n.º 1
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            string Fname           = Request["TxtFistName"].ToString();
            string Lname           = Request["TxtLastName"].ToString();
            string Email           = Request["TxtEmail"].ToString();
            string Password        = Request["TxtPassword"].ToString();
            string Nic             = Request["TxtNic"].ToString();
            string age             = Request["TxtAge"].ToString();
            string address         = Request["TxtAddr"].ToString();
            string ConfirmPassword = Request["TxtConfirmPassword"].ToString();

            string date = DateTime.Today.ToString("dd-MM-yyyy");

            if (Password == ConfirmPassword)
            {
                Admin newuser = new Admin(Email, Password);

                AdminBusinessClass.AddNewAdmin(newuser, Fname, Lname, Email, Password, Nic, age, address, date);


                Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect script",
                                                        "alert(' You have been successfully registered ..!'); location.href='AdminProfile.aspx';",
                                                        true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect script",
                                                        "alert('Password Invalid..!'); location.href='Register.aspx';",
                                                        true);
            }
        }
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            var id = Request.QueryString["Email"];

            string Fname           = Request["TxtFistName"].ToString();
            string Lname           = Request["TxtLastName"].ToString();
            string Email           = id.ToString();
            string Password        = Request["TxtPassword"].ToString();
            string Nic             = Request["TxtNic"].ToString();
            string age             = Request["TxtAge"].ToString();
            string address         = Request["TxtAddr"].ToString();
            string ConfirmPassword = Request["TxtConfirmPassword"].ToString();

            if (Password == ConfirmPassword)
            {
                Admin newuser = new Admin(Email, Password);

                AdminBusinessClass.UpdateAdmin(newuser, Fname, Lname, Email, Password, Nic, age, address);

                Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect script",
                                                        "alert(' You have been successfully registered ..!'); location.href='UpdateDetails.aspx';",
                                                        true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect script",
                                                        "alert('Password Invalid..!'); location.href='UpdateDetails.aspx';",
                                                        true);
            }
        }
        protected void update_Click(object sender, EventArgs e)
        {
            AdminBusinessClass adm       = new AdminBusinessClass();
            string             foodname  = FoodName.Text;
            string             filename  = FileUpload.FileName;
            string             hyperlink = Hyperlink.Text;
            string             region;

            if (RadioButton3.Checked == true)
            {
                region = "en-US";
            }
            else if (RadioButton1.Checked == true)
            {
                region = "fr-FR";
            }
            else
            {
                region = "ar-AE";
            }
            if (adm.updateFooddetatils(foodname, filename, hyperlink, region))
            {
                confirm.Text = "Updated";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Admin vUser = new Admin();

            vUser.Mail = Session["mail"].ToString();

            List <Admin> adm_PD = AdminBusinessClass.ViewAdminDetails(vUser);



            cdcatalog.DataSource = adm_PD;

            cdcatalog.DataBind();
        }
Exemplo n.º 5
0
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            string mail     = Request["TxtEmail"].ToString();
            string password = Request["TxtPassword"].ToString();


            User newuser = new User(mail, password);

            Admin newadmin = new Admin(mail, password);



            if (UserBusinessClass.verifyUser(newuser))
            {
                newuser         = UserBusinessClass.login(newuser);
                Session["mail"] = newuser.email;

                Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect script",
                                                        "alert('Login successfully done!You are login as a User'); location.href='Index.aspx';",
                                                        true);
            }

            else if (AdminBusinessClass.verifyAdmin(newadmin))
            {
                newadmin        = AdminBusinessClass.login(newadmin);
                Session["mail"] = newadmin.Mail;

                Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect script",
                                                        "alert('Login successfully done!You are login as Admin'); location.href='AdminPanel.aspx';",
                                                        true);
            }

            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "redirect script",
                                                        "alert('Sorry...! email or password incorrect'); location.href='SignIn.aspx';",
                                                        true);
            }
        }
Exemplo n.º 6
0
 public void loaddetails()
 {
     DataList1.DataSource = AdminBusinessClass.GetFoodDetails(Session["Lang"].ToString());
     DataList1.DataBind();
 }
Exemplo n.º 7
0
 public AdminController()
 {
     _adminBusinessClass = new AdminBusinessClass();
 }