Пример #1
0
        public ActionResult ulist(string usearchString)
        {
            IEnumerable <user> a = uservice.GetAll().Where(b => b.account_type == "user");

            if (!String.IsNullOrEmpty(usearchString))
            {
                a = from c in a
                    where c.username.ToUpper().Contains(usearchString.Trim().ToUpper()) || c.account_type.ToUpper().Contains(usearchString.Trim().ToUpper())
                    select c;


                //var det = db.products.ToList();
                List <usermodel> viewlist = new List <usermodel>();
                foreach (user u in a)
                {
                    usermodel usr = new usermodel()
                    {
                        userid       = u.userid,
                        username     = u.username,
                        password     = u.password,
                        con_password = u.con_password,
                        gender       = u.gender,
                        address      = u.address,
                        account_type = u.account_type
                    };
                    viewlist.Add(usr);
                }

                return(View(viewlist));
            }
            else
            {
                return(RedirectToAction("ulist"));
            }
        }
Пример #2
0
        public ActionResult Index()
        {
            obj.TestDepartmentCreateRedirect();
            string current  = calenderItem.GetCurrentYearRecords();
            var    dict1x   = current.Split(' ');
            string monthss  = dict1x[0].ToString();
            int    monthnox = DateTime.ParseExact(monthss, "MMMM", CultureInfo.InvariantCulture).Month;
            var    model    = new usermodel
            {
                ListItems    = calenderItem.Years(),
                ListItems1   = calenderItem.GetDates(monthnox),
                SelectedItem = monthnox
            };

            //ViewData["Records"] = calenderItem.Years();
            //string currentDate = calenderItem.GetCurrentYearRecords();
            return(View(model));
        }
Пример #3
0
        //************************************************user(admin panel)********************************************

        //get user_details
        public ActionResult ulist()
        {
            IEnumerable <user> userlist = uservice.GetAll().Where(a => a.account_type == "user");
            List <usermodel>   viewlist = new List <usermodel>();

            foreach (user u in userlist)
            {
                usermodel user = new usermodel()
                {
                    userid       = u.userid,
                    username     = u.username,
                    password     = u.password,
                    con_password = u.con_password,
                    gender       = u.gender,
                    address      = u.address,
                    account_type = u.account_type
                };
                viewlist.Add(user);
            }
            return(View(viewlist));
        }
Пример #4
0
        private void Txtcontra_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                if (txtusu.Text != "Username" && txtusu.TextLength > 2)
                {
                    if (txtcontra.Text != "password")
                    {
                        usermodel user       = new usermodel();                             //INSTANCIAMOS LA CAPA DE DOMINIO
                        var       validLogin = user.LoginUser(txtusu.Text, txtcontra.Text); // DECLARACION DE LA VARIABLE IMPLICITA PARA PARAMETRO EL TEXBOX
                        if (validLogin == true)                                             // VAMOS A INSTANCIAR
                        {
                            this.Hide();
                            Bienvenida Bienvenida = new Bienvenida();
                            Bienvenida.ShowDialog();

                            formulario mainmenu = new formulario();
                            mainmenu.Show();
                            mainmenu.FormClosed += Logout;
                        }
                        else
                        {
                            msgError("incorrect username or password entered. \n please try again. ");//MENSSAGE INCORRECT

                            txtcontra.Text = "CONTRASEÑA";
                            txtcontra.UseSystemPasswordChar = false;
                            txtusu.Focus();
                        }
                    }
                    else
                    {
                        msgError("please enter password");
                    }
                }
                else
                {
                    msgError("please enter username");
                }
            }
        }