Exemplo n.º 1
0
        public ajax f_ajax(ajax model)
        {
            Connector filter = new Connector();
            Maker     make   = new Maker();
            singin    user   = new singin();

            user = make.maker();

            user.Name.Ferst_Name = "moein";

            switch (model.name)
            {
            case "Name.Ferst_Name":
                user.Name.Ferst_Name = model.valu;
                user        = filter.connector(user);
                model.error = user.Name.Ferst_Name_error;
                break;

            case "Name.Last_Name":
                user.Name.Last_Name = model.valu;
                user        = filter.connector(user);
                model.error = user.Name.Last_Name_error;
                break;

            case "Email.email":
                user.Email.email = model.valu;
                user             = filter.connector(user);
                model.error      = user.Email.email_error;
                model.data_error = user.data_email_error;
                break;

            case "Number.number":
                user.Number.number = model.valu;
                user             = filter.connector(user);
                model.error      = user.Number.number_error;
                model.data_error = user.data_email_error;
                break;

            case "Password.password":
                user.Password.password = model.valu;
                user        = filter.connector(user);
                model.error = user.Password.password_error;
                break;

            case "Password.ConfirmPassword":
                user.Password.ConfirmPassword = model.valu;
                user        = filter.connector(user);
                model.error = null;
                break;

            case "UserName.userName":
                user.UserName.userName = model.valu;
                user             = filter.connector(user);
                model.error      = user.UserName.userName_error;
                model.data_error = user.data_dusername_error;
                break;
            }

            return(model);
        }
Exemplo n.º 2
0
        public void  dataAdd(singin model)
        {
            var data = new mycontext();

            data.users.Add(new user
            {
                ferstname = (model.Name.Ferst_Name),
                LastName  = (model.Name.Last_Name),
                number    = (model.Number.number),
                UserName  = (model.UserName.userName),
                Password  = (model.Password.password),
                email     = (model.Email.email)
            });
            data.SaveChanges();
        }
Exemplo n.º 3
0
        public singin maker()
        {
            singin x = new singin
            {
                Name = new Name
                {
                    Ferst_Name       = null,
                    Ferst_Name_error = null,
                    Last_Name        = null,
                    Last_Name_error  = null,
                }
                ,
                Email = new Email
                {
                    email       = null,
                    email_error = null
                }
                , Number = new Number
                {
                    number       = null,
                    number_error = null
                }
                ,
                UserName = new UserName
                {
                    userName       = null,
                    userName_error = null
                }
                ,
                Password = new Password
                {
                    password              = null,
                    ConfirmPassword       = null,
                    ConfirmPassword_error = null,
                    password_error        = null
                }
                , data_dusername_error = null
                , data_email_error     = null
                , data_number_error    = null
                , acces = false
            };


            return(x);
        }
Exemplo n.º 4
0
        public singin connector(singin model)
        {
            F_Email    f_Email    = new F_Email();
            F_Name     f_Name     = new F_Name();
            F_Number   f_number   = new F_Number();
            F_password f_password = new F_password();
            F_UserName f_username = new F_UserName();
            F_database f_database = new F_database();
            AddData    add        = new AddData();

            model.Email                = f_Email.f_Email(model.Email);
            model.Name                 = f_Name.f_Name(model.Name);
            model.Number               = f_number.f_Number(model.Number);
            model.Password             = f_password.f_password(model.Password);
            model.UserName             = f_username.f_UserName(model.UserName);
            model.data_dusername_error = f_database.f_Udatabase(model);
            model.data_number_error    = f_database.f_Ndatabase(model);
            model.data_email_error     = f_database.f_Edatabase(model);
            model.acces                =
                (
                    model.Email.email_error == null &
                    model.Name.Ferst_Name_error == null &
                    model.Name.Last_Name_error == null &
                    model.Number.number_error == null &
                    model.Password.password_error == null &
                    model.Password.ConfirmPassword_error == null &
                    model.UserName.userName_error == null &
                    model.data_email_error == null &
                    model.data_dusername_error == null &
                    model.data_number_error == null
                );
            if (model.acces)
            {
                add.dataAdd(model);
            }
            if (model.acces)
            {
                FormsAuthentication.SetAuthCookie(model.UserName.userName, false);
            }
            return(model);
        }
Exemplo n.º 5
0
        public string f_Edatabase(singin model)
        {
            ErrorCollection error_box = new ErrorCollection();
            bool            acces;
            var             data = new mycontext();
            var             E    = data.users.FirstOrDefault(m => m.email == model.Email.email);

            if (E != null)
            {
                acces = false;
            }
            else
            {
                acces = true;
            }
            model.data_email_error = error_box.error_box(10, acces);
            if (model.Email.email == null)
            {
                model.data_email_error = null;
            }
            return(model.data_email_error);
        }
Exemplo n.º 6
0
        public string f_Ndatabase(singin model)
        {
            ErrorCollection error_box = new ErrorCollection();
            bool            acces;
            var             data = new mycontext();
            var             N    = data.users.FirstOrDefault(m => m.number == model.Number.number);

            if (N != null)
            {
                acces = false;
            }
            else
            {
                acces = true;
            }
            model.data_number_error = error_box.error_box(9, acces);
            if (model.Number.number == null)
            {
                model.data_number_error = null;
            }
            return(model.data_number_error);
        }
Exemplo n.º 7
0
        public string f_Udatabase(singin model)
        {
            ErrorCollection error_box = new ErrorCollection();
            bool            acces;
            var             data = new mycontext();

            var U = data.users.FirstOrDefault(m => m.UserName == model.UserName.userName);

            if (U != null)
            {
                acces = false;
            }
            else
            {
                acces = true;
            }
            model.data_dusername_error = error_box.error_box(8, acces);
            if (model.UserName.userName == null)
            {
                model.data_dusername_error = null;
            }
            return(model.data_dusername_error);
        }
Exemplo n.º 8
0
        public ActionResult singin(singin user)
        {
            user = filter.connector(user);

            return(View(user));
        }
Exemplo n.º 9
0
        public ActionResult singin()
        {
            singin user = new singin();

            return(View(user));
        }