Beispiel #1
0
        public static List <System.Web.Mvc.SelectListItem> Types()
        {
            List <UserTypeModel> lis = UserTypeModel.GetUserType();
            List <System.Web.Mvc.SelectListItem> items = new List <System.Web.Mvc.SelectListItem>();

            items.Add(new System.Web.Mvc.SelectListItem {
                Text = lis[0].Type, Value = lis[0].TypeId.ToString(), Selected = true
            });

            items.Add(new System.Web.Mvc.SelectListItem {
                Text = lis[1].Type, Value = lis[1].TypeId.ToString()
            });

            return(items);
        }
Beispiel #2
0
        public static List <UserTypeModel> GetUserType()
        {
            List <UserTypeModel> list = new List <UserTypeModel>();
            Database             d    = DatabaseConnection.Connection.Connect();

            {
                using (DbCommand command = d.GetStoredProcCommand("GetUserType"))
                {
                    using (IDataReader reader = (IDataReader)d.ExecuteReader(command))
                    {
                        while (reader.Read())
                        {
                            UserTypeModel us = new UserTypeModel();
                            us.TypeId = (Convert.ToInt32(reader["TypeId"]));
                            us.Type   = ((reader["Type"].ToString()));
                            list.Add(us);
                        }
                    }
                }
            }
            return(list);
        }