コード例 #1
0
        protected void btnAccept_Click(object sender, EventArgs e)
        {
            Administrator admin = new Administrator();

            admin.Name         = txtName.Text;
            admin.LastName_1   = txtLastName_1.Text;
            admin.LastName_2   = txtLastName_2.Text;
            admin.NameUser     = txtUserName.Text;
            admin.PasswordUser = txtPassword.Text;
            admin.Email        = txtEmail.Text;

            string conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            AdministratorBusiness adminB = new AdministratorBusiness(conn);
            int exists = adminB.insertAdministrator(admin);

            if (exists == -1)
            {
                Response.Cookies["message"].Value   = "Somenthing is wrong, sorry.";
                Response.Cookies["message"].Expires = DateTime.Now.AddSeconds(5);
                Response.Redirect("./InsertAdministrator.aspx");
            }
            else
            {
                Response.Cookies["message"].Value   = "The administrator was correctly added.";
                Response.Cookies["message"].Expires = DateTime.Now.AddSeconds(5);
                Response.Redirect("./InsertAdministrator.aspx");
            }
        }
コード例 #2
0
        public void SetUp()
        {
            _administratorRepositoryMock = new Mock <IAdministratorRepository>();

            _administratorBusiness = new AdministratorBusiness(
                _administratorRepositoryMock.Object);
        }
コード例 #3
0
        protected void btnAccept_Click(object sender, EventArgs e)
        {
            string conn = "Data Source=163.178.107.130;Initial Catalog=KeggPhones;User ID=sqlserver;Password=saucr.12";
            AdministratorBusiness adminB = new AdministratorBusiness(conn);
            int exists = adminB.verifyExistsAdministrator(txtUser.Text, txtPassword.Text);

            if (exists == 0)
            {
                Response.Cookies["message"].Value   = "Your user name or password are wrong. Try again.";
                Response.Cookies["message"].Expires = DateTime.Now.AddSeconds(5);
                Response.Redirect("./index.aspx");
            }
            else
            {
                Response.Cookies["user"].Value   = txtUser.Text;
                Response.Cookies["user"].Expires = DateTime.Now.AddSeconds(1200);
                Response.Redirect("./Presentation/Principal.aspx");
            }
        }