public IActionResult Index(LoginViewModel model)
        {
            if (string.IsNullOrEmpty(model.UserName) || string.IsNullOrEmpty(model.Password))
            {
                return(View());
            }
            string sha1password = model.Password;
            var    userDetails  = from user in _context.AdmUser
                                  where user.UserName == model.UserName
                                  select user;
            AdmUser user1 = (AdmUser)userDetails.ToList()[0];

            byte[] EmployeeId = BitConverter.GetBytes(user1.EmployeeId);
            byte[] userId     = BitConverter.GetBytes(user1.EmployeeId);

            HttpContext.Session.Set("EmployeeId", EmployeeId);
            HttpContext.Session.Set("UserId", userId);

            if (user1.Password == model.Password)
            {
                ViewData["UserId"]     = user1.UserId;
                ViewData["EmployeeId"] = user1.EmployeeId;
                return(RedirectToAction("Index", "PretravelClaim"));
                //return RedirectToAction("Index", "PretravelClaim");
            }

            ViewData["errorMessage"] = "Please make sure your password is correct";
            return(View());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Guid,UserAccounts,UserName,Password,LastLoginTime,RoleId,DepId,Sex,Email,Tel,Address,DetailedAddress,NumOfLogins,ThumbnailImage,Id,CreateTime,IsDelete,Description,TimestampV")] AdmUser admUser)
        {
            if (ModelState.IsValid)
            {
                AdmUser user = _context.AdmUser.Where(u => u.UserAccounts == admUser.UserAccounts || u.UserName == admUser.UserName || u.Tel == admUser.Tel).ToList().FirstOrDefault();
                if (user != null && user.Id > 0)
                {
                    if (user.IsDelete == true)
                    {
                        ViewBag.Message = "此用户已存在,但暂时为停用状态";
                        return(View(user));
                    }
                    else
                    {
                        ViewBag.Message = "此用户已存在";
                        return(View(user));
                    }
                }
                admUser.CreateTime = DateTime.Now;
                admUser.Guid       = Guid.NewGuid().ToString().ToUpper();
                admUser.PGuid      = admUserModel.Guid;
                admUser.Password   = _encryptionAndDecryption.AESEncrypt(admUser.Password, _appSetting.EncryptKey);
                _context.Add(admUser);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(admUser));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Guid,UserAccounts,UserName,Password,LastLoginTime,RoleId,DepId,Sex,Email,Tel,Address,DetailedAddress,NumOfLogins,ThumbnailImage,Id,CreateTime,IsDelete,Description,TimestampV")] AdmUser admUser)
        {
            if (id != admUser.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(admUser);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdmUserExists(admUser.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(admUser));
        }
Ejemplo n.º 4
0
        public async Task <bool> SendMessageUpdate(PostMessageUpdateRequest request)
        {
            string message = request.Message;

            int admUserId = request.AdmUserId;
            int admSiteId = request.AdmSiteId;

            AdmMessage admMessage = _autoMapper.Map <AdmMessage>(request);

            admMessage.MessageDate = _repository.GetSchoolNow(admSiteId);

            foreach (var id in request.UserIDs)
            {
                AdmUser admUser = await _repository.GetAsync <AdmUser>(u => u.AdmUserID == id);

                admMessage.Recipients.Add(admUser);
            }

            bool isForwarded = request.ActionType.Equals("forwarded");

            admMessage.AdmMessagesDetails.Add(new AdmMessagesDetail
            {
                AdmMessageID    = admMessage.AdmMessageID,
                SentByAdmUserID = admUserId,
                MesageText      = message.Trim(),
                MessageDate     = _repository.GetSchoolNow(admSiteId),
                IsForwarded     = isForwarded
            });

            await _repository.CreateAsync <AdmMessage>(admMessage);

            return(true);
        }
Ejemplo n.º 5
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        AdmUser cont = new AdmUser();

        CFun.GetPageData <AdmUser>(cont, this);
        //cont.GroupIdList = CFun.RequestPamStr("gname");
        string GroupIdList  = CFun.RequestPamStr("gname");
        string platformList = CFun.RequestPamStr("platformname");

        cont.GroupIdList = "," + GroupIdList + ',';
        if (cont.Ld == 0)
        {
            cont.CreateDate = DateTime.Now;
        }
        cont.LastDate = DateTime.Now;

        if (TxtUPass.Text != "")
        {
            cont.UPassword = CFun.MD5(TxtUPass.Text);
        }

        if (new BllAdmUser().InsertorUpdateitem(cont))
        {
            BllAdmActHistory.SaveLog(CurrentUId, (int)EnumCCActiveClass.客服人员管理, cont.Ld.Value, "");
            CFun.AlertMegT("保存成功!", "closeFlowPanel", "");
        }
        else
        {
            CFun.AlertMegT("发生错误,请稍后再试!", "back", "");
        }
    }
Ejemplo n.º 6
0
 public IActionResult Create(IFormCollection collection, AdmUser admUser)
 {
     try
     {
         // TODO: Add insert logic here
         if (admUser.Id > 0)
         {
             admUser.Password = EncryptionAndDecryption.Encode(admUser.Password);
             DBHandler.Db.AdmUser.Update(admUser);
         }
         else
         {
             admUser.CreateTime = DateTime.Now;
             admUser.Password   = EncryptionAndDecryption.Encode(admUser.Password);
             // _DccyDbContext.AdmUser.Add(admUser);
             DBHandler.Db.AdmUser.Add(admUser);
         }
         int m = DBHandler.DbSavaChange();
         if (m > 0)
         {
             return(RedirectToAction(nameof(Index)));
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         return(RedirectToAction("Error", "Home", new ErrorViewModel {
             RequestId = ex.Message
         }));
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 生成左侧菜单
        /// </summary>
        /// <returns></returns>
        public JsonResult GetLeftMenuTreeData()
        {
            /// <summary>
            /// 用户菜单集合
            /// </summary>
            List <LeftMenu> MenuList    = new List <LeftMenu>();
            string          userSession = HttpContext.Session.GetString("AdmUserSession");

            if (!string.IsNullOrEmpty(userSession) && JsonConvert.DeserializeObject <AdmUser>(userSession).Id > 0)
            {
                AdmUser admUser = JsonConvert.DeserializeObject <AdmUser>(HttpContext.Session.GetString("AdmUserSession"));
                if (admUser != null && admUser.Id > 0)
                {
                    List <string> menuguids = GetMenuGuidByUserRoleIdORDepId(admUser);
                    if (menuguids.Count > 0)
                    {
                        //清空根节点guid集合
                        rootmenuguids.Clear();
                        var Menus = DBHandler.Db.LeftMenu.Where(s => menuguids.Select(o => o).Any(e => s.IsDelete != false && s.Guid == e)).ToList();
                        if (Menus != null && Menus.Count > 0)
                        {
                            Menus.ForEach(u =>
                            {
                                GetRootMenus(Menus, u);
                            });
                            if (RootMenu.Count > 0)
                            {
                                RootMenu.ForEach(u =>
                                {
                                    MenuList.Add(CreateMenuTree(Menus, u));
                                });
                            }
                            else
                            {
                                return(Json(new
                                {
                                    StateCode = (int)ResultEnum.操作失败,
                                    Message = "此用户暂无任何权限,请及时联系管理员!!!"
                                }));
                            }
                        }
                    }
                    else
                    {
                        return(Json(new
                        {
                            StateCode = (int)ResultEnum.未登录,
                            Message = "请选登录"
                        }));
                    }
                }
            }
            return(Json(new
            {
                StateCode = (int)ResultEnum.操作成功,
                Message = "请求成功",
                Data = MenuList
            }));
        }
        /// <summary>
        /// 生成左侧菜单
        /// </summary>
        /// <returns></returns>
        public JsonResult GetLeftMenuTreeData()
        {
            string userSession = HttpContext.Session.GetString("AdmUserSession");

            if (!string.IsNullOrEmpty(userSession) && JsonConvert.DeserializeObject <AdmUser>(userSession).Id > 0)
            {
                AdmUser admUser = JsonConvert.DeserializeObject <AdmUser>(userSession);
                if (admUser != null && admUser.Id > 0)
                {
                    List <string> menuGuids = GetMenuGuidByUserRoleIdORDepId(admUser);
                    if (menuGuids.Count > 0)
                    {
                        //清空根节点guid集合
                        rootmenuguids.Clear();
                        //以集合做为条件查询数据库
                        var Menus = _context.AdmJurisdiction.Where(h => menuGuids.Select(c1 => c1).Any(c2 => h.Guid.Equals(c2))).ToList();
                        if (Menus != null && Menus.Count > 0)
                        {
                            Menus.ForEach(u =>
                            {
                                GetRootMenus(Menus, u);
                            });
                            if (RootMenu.Count > 0)
                            {
                                RootMenu.ForEach(u =>
                                {
                                    MenuList.Add(CreateMenuTree(Menus, u));
                                });
                                if (MenuList.Count > 0)
                                {
                                    return(Json(new
                                    {
                                        StateCode = (int)ResultEnum.SUCCESS,
                                        Message = "请求成功",
                                        Data = MenuList
                                    }));
                                }
                            }
                            else
                            {
                                return(Json(new
                                {
                                    StateCode = (int)ResultEnum.ERROR,
                                    Message = "此用户暂无任何权限,请及时联系管理员!!!"
                                }));
                            }
                        }
                    }
                }
            }
            return(Json(new
            {
                StateCode = (int)ResultEnum.NOTLOGGED,
                Message = "请选登录"
            }));
        }
        public ActionResult Create(IFormCollection collection, AdmUser admUser)
        {
            try
            {
                // TODO: Add insert logic here

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 10
0
        // GET: AdmUsers
        public IActionResult Index()
        {
            string userSession = HttpContext.Session.GetString("AdmUserSession");

            if (!string.IsNullOrEmpty(userSession) && JsonConvert.DeserializeObject <AdmUser>(userSession).Id > 0)
            {
                admUserModel = JsonConvert.DeserializeObject <AdmUser>(userSession);
                Task <List <AdmUser> > task = Task.Run(() => _context.AdmUser.Where(u => u.PGuid == admUserModel.Guid && admUserModel.IsDelete == false).ToList());
                task.Wait();
                return(View(task.Result));
            }
            return(RedirectToAction("Index", "Login"));
            // return View(await _context.AdmUser.ToListAsync());
        }
Ejemplo n.º 11
0
        public async Task <IActionResult> Create([Bind("Guid,UserAccounts,UserName,Password,LastLoginTime,RoleId,DepId,Sex,Email,Tel,Address,DetailedAddress,NumOfLogins,ThumbnailImage,Id,CreateTime,IsDelete,Description,TimestampV")] AdmUser admUser)
        {
            if (ModelState.IsValid)
            {
                admUser.CreateTime = DateTime.Now;
                admUser.Guid       = Guid.NewGuid().ToString().ToUpper();
                admUser.Password   = _encryptionAndDecryption.AESEncrypt(admUser.Password, _appSetting.EncryptKey);
                _context.Add(admUser);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(admUser));
        }
Ejemplo n.º 12
0
    private string ModifyCheckCode()
    {
        int     id   = CFun.RequestPamInt("ids");
        AdmUser cont = new AdmUser();

        cont.Ld        = id;
        cont.CheckCode = new Random().Next(1000, 9999);
        if (new BllAdmUser().InsertorUpdateitem(cont))
        {
            return("");
        }
        else
        {
            return("1");
        }
    }
Ejemplo n.º 13
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        AdmUser cont = new AdmUser();

        CFun.GetPageData <AdmUser>(cont, this);
        if (TxtUPass.Text.Trim() != "")
        {
            cont.UPassword = CFun.MD5(TxtUPass.Text.Trim());
        }
        cont.LastDate = DateTime.Now;

        if (new BllAdmUser().InsertorUpdateitem(cont))
        {
            CFun.AlertMegT("信息修改成功!", "", "userinfo.aspx");
        }
        else
        {
            CFun.AlertMegT("发生错误,请稍后再试!", "back", "");
        }
    }
Ejemplo n.º 14
0
        /// <summary>
        /// 得到用户所在部门与角色中的菜单ids
        /// </summary>
        /// <param name="admUser"></param>
        /// <returns></returns>
        private List <string> GetMenuGuidByUserRoleIdORDepId(AdmUser admUser)
        {
            List <string> menuids = new List <string>();
            Task          taskdep = DBHandler.Db.AdmDepartment.Where(u => u.Id == admUser.DepId).AsQueryable().ForEachAsync(m =>
            {
                if (m.IsDelete == false && !menuids.Contains(m.MenuGuid))
                {
                    menuids.Add(m.MenuGuid);
                }
            });
            Task taskrole = DBHandler.Db.AdmRole.Where(u => u.Id == admUser.RoleId).AsQueryable().AsQueryable().ForEachAsync(m =>
            {
                if (m.IsDelete == false && !menuids.Contains(m.MenuGuid))
                {
                    menuids.Add(m.MenuGuid);
                }
            });

            Task.WaitAll(taskdep, taskrole);
            return(menuids);
        }
Ejemplo n.º 15
0
        // GET: AdmUser/Create
        public ActionResult Create()
        {
            AdmUser admUser = new AdmUser()
            {
                UserName      = "******",
                UserAccounts  = "123456",
                Password      = "******",
                Guid          = Guid.NewGuid().ToString().ToUpper(),
                DepId         = 2,
                RoleId        = 1,
                LastLoginTime = DateTime.Now,
                Sex           = 1,
                NumOfLogins   = 1
            };

            admUser.CreateTime = DateTime.Now;
            admUser.Password   = EncryptionAndDecryption.Encode(admUser.Password);
            // _DccyDbContext.AdmUser.Add(admUser);
            DBHandler.Db.AdmUser.Add(admUser);
            int m = DBHandler.DbSavaChange();

            return(View());
        }
Ejemplo n.º 16
0
        protected override void Seed(EFCMSRepository context)
        {
            //  This method will be called after migrating to the latest version.
            #region AdmProfile
            var sa = new AdmProfile()
            {
                Name = "Administrador"
            };
            var Author = new AdmProfile()
            {
                Name = "Author"
            };
            #endregion

            #region WebUser
            var adminuser = new AdmUser()
            {
                Name       = "Fischer",
                LastName   = "Tirado",
                Email      = "*****@*****.**",
                Active     = true,
                AdmProfile = sa
            };
            var Author1 = new AdmUser()
            {
                Name       = "Luchito",
                LastName   = "Perez",
                Email      = "*****@*****.**",
                Active     = true,
                AdmProfile = Author
            };
            var Author2 = new AdmUser()
            {
                Name       = "Marita",
                LastName   = "Rojas",
                Email      = "*****@*****.**",
                Active     = true,
                AdmProfile = Author
            };
            var WebUser1 = new WebUser()
            {
                Name         = "Rebecca",
                LastName     = "Huertas",
                Email        = "*****@*****.**",
                RegisterDate = new DateTime(2010, 5, 13),
                Active       = true
            };
            var WebUser2 = new WebUser()
            {
                Name         = "Gianina",
                LastName     = "Mejía",
                Email        = "*****@*****.**",
                RegisterDate = new DateTime(2012, 8, 22),
                Active       = true
            };
            #endregion

            #region AdmMenu
            var menu01 = new AdmMenu()
            {
                Name     = "Dashboard",
                Icon     = "dashboard",
                Position = 1,
                Active   = true
            };
            var menu02 = new AdmMenu()
            {
                Name     = "Posts",
                Icon     = "tags",
                Position = 2,
                Active   = true
            };
            var menu03 = new AdmMenu()
            {
                Name     = "Páginas",
                Icon     = "globe",
                Position = 3,
                Active   = true
            };
            var menu04 = new AdmMenu()
            {
                Name     = "Configuración",
                Icon     = "edit",
                Position = 4,
                Active   = true
            };
            var menu0401 = new AdmMenu()
            {
                Name     = "Administradores",
                Position = 1,
                Active   = true,

                MenuParent = menu04
            };
            var menu0402 = new AdmMenu()
            {
                Name     = "Usuarios Web",
                Position = 2,
                Active   = true,

                MenuParent = menu04
            };
            var menu0403 = new AdmMenu()
            {
                Name     = "Perfiles",
                Position = 3,
                Active   = true,

                MenuParent = menu04
            };
            var menu0404 = new AdmMenu()
            {
                Name     = "Esquemas del CMS",
                Position = 4,
                Active   = true,

                MenuParent = menu04
            };
            var menu0405 = new AdmMenu()
            {
                Name     = "Plantillas del CMS",
                Position = 5,
                Active   = true,

                MenuParent = menu04
            };
            #endregion

            #region AdmModule
            #endregion

            #region Section
            //var Section_Home = new Section()
            //{
            //    Name = "Home Page",
            //    TagName = "home",
            //    Internal = false,
            //    Active = true
            //};
            //var Section_Footer = new Section()
            //{
            //    Name = "Pie de Página",
            //    TagName = "footer",
            //    Internal = false,
            //    Active = true
            //};
            //var Section_Toolbar = new Section()
            //{
            //    Name = "Herramientas",
            //    TagName = "toolbar",
            //    Internal = false,
            //    Active = true
            //};
            //var Section_Services = new Section()
            //{
            //    Name = "Servicios",
            //    TagName = "services",
            //    Internal = true,
            //    Active = true
            //};
            //var Section_Portfolio= new Section()
            //{
            //    Name = "Portafolio",
            //    TagName = "portfolio",
            //    Internal = true,
            //    Active = true
            //};
            //var Section_About = new Section()
            //{
            //    Name = "Acerca de",
            //    TagName = "about",
            //    Internal = true,
            //    Active = true
            //};
            //var Section_Team = new Section()
            //{
            //    Name = "Equipo",
            //    TagName = "team",
            //    Internal = true,
            //    Active = true
            //};
            //var Section_Contact = new Section()
            //{
            //    Name = "Contacto",
            //    TagName = "contact",
            //    Internal = true,
            //    Active = true
            //};
            //var Section_Blog = new Section()
            //{
            //    Name = "Blog",
            //    TagName = "blog",
            //    Internal = true,
            //    Active = true
            //};
            #endregion

            #region Schema
            var Schema_Home = new CmsSchema()
            {
                Name       = "Sección Home",
                Iterations = 1,
                Position   = 1,
                IsPage     = false,
                Active     = true,
            };
            var Schema_Services = new CmsSchema()
            {
                Name       = "Sección Servicios",
                Iterations = 1,
                Position   = 2,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Portfolio = new CmsSchema()
            {
                Name       = "Sección Portafolio",
                Iterations = 1,
                Position   = 3,
                IsPage     = true,
                Active     = true,
            };
            var Schema_About = new CmsSchema()
            {
                Name       = "Sección Acerca de",
                Iterations = 1,
                Position   = 4,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Team = new CmsSchema()
            {
                Name       = "Sección El Equipo",
                Iterations = 1,
                Position   = 5,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Contact = new CmsSchema()
            {
                Name       = "Sección Contáctenos",
                Iterations = 1,
                Position   = 6,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Blog = new CmsSchema()
            {
                Name       = "Sección Blog",
                Iterations = 1,
                Position   = 7,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Home1 = new CmsSchema()
            {
                SchemaParent = Schema_Home,
                Name         = "Animación Home",
                Iterations   = 1,
                Position     = 1,
                IsPage       = false,
                Active       = true,
            };
            var Schema_Home11 = new CmsSchema()
            {
                SchemaParent = Schema_Home1,
                Name         = "Animación Intro",
                Iterations   = 1,
                Position     = 1,
                IsPage       = false,
                Active       = true,
            };
            var Schema_Services1 = new CmsSchema()
            {
                SchemaParent = Schema_Services,
                Name         = "Servicio",
                Position     = 1,
                IsPage       = true,
                Active       = true,
            };
            var Schema_Portfolio1 = new CmsSchema()
            {
                SchemaParent = Schema_Portfolio,
                Name         = "Portafolio",
                Position     = 1,
                IsPage       = true,
                Active       = true,
            };
            var Schema_About1 = new CmsSchema()
            {
                SchemaParent = Schema_About,
                Name         = "Historia",
                Position     = 1,
                IsPage       = true,
                Active       = true,
            };
            var Schema_Team1 = new CmsSchema()
            {
                SchemaParent = Schema_Team,
                Name         = "Bloque Nuestro Equipo",
                Iterations   = 1,
                Position     = 1,
                IsPage       = true,
                Active       = true,
            };
            var Schema_Team2 = new CmsSchema()
            {
                SchemaParent = Schema_Team,
                Name         = "Bloque Nuestros Clientes",
                Iterations   = 1,
                Position     = 1,
                IsPage       = true,
                Active       = true,
            };
            var Schema_Team11 = new CmsSchema()
            {
                SchemaParent = Schema_Team1,
                Name         = "Equipo",
                Position     = 1,
                IsPage       = false,
                Active       = true,
            };
            var Schema_Team21 = new CmsSchema()
            {
                SchemaParent = Schema_Team2,
                Name         = "Cliente",
                Position     = 1,
                IsPage       = false,
                Active       = true,
            };
            var Schema_Contact1 = new CmsSchema()
            {
                SchemaParent = Schema_Contact,
                Name         = "Formulario Contacto",
                Iterations   = 1,
                Position     = 1,
                IsPage       = true,
                Active       = true,
            };
            #endregion

            #region Article
            var Article_Home = new CmsArticle()
            {
                Schema       = Schema_Home,
                Title        = "Inicio",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#home\" /></root>",
                Author       = adminuser,
                Position     = 1,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_Services = new CmsArticle()
            {
                Schema       = Schema_Services,
                Title        = "Servicios",
                SubTitle     = "Lorem ipsum dolor sit amet consectetur.",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#services\" /></root>",
                Author       = adminuser,
                Position     = 2,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_Portfolio = new CmsArticle()
            {
                Schema       = Schema_Portfolio,
                Title        = "Portafolio",
                SubTitle     = "Lorem ipsum dolor sit amet consectetur.",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#portfolio\" /></root>",
                Author       = adminuser,
                Position     = 3,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_About = new CmsArticle()
            {
                Schema       = Schema_About,
                Title        = "Acerca de",
                SubTitle     = "Lorem ipsum dolor sit amet consectetur.",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#about\" /></root>",
                Author       = adminuser,
                Position     = 4,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_Team = new CmsArticle()
            {
                Schema       = Schema_Team,
                Title        = "El Equipo",
                SubTitle     = "Lorem ipsum dolor sit amet consectetur.",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#team\" /></root>",
                Author       = adminuser,
                Position     = 5,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_Contact = new CmsArticle()
            {
                Schema       = Schema_Contact,
                Title        = "Contáctenos",
                SubTitle     = "Lorem ipsum dolor sit amet consectetur.",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#contact\" /></root>",
                Author       = adminuser,
                Position     = 6,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_Home01 = new CmsArticle()
            {
                Schema        = Schema_Home1,
                ArticleParent = Article_Home,
                Title         = "Animación Home",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Home0101 = new CmsArticle()
            {
                Schema        = Schema_Home11,
                ArticleParent = Article_Home01,
                Title         = "Bienvenido a Nuestro Estudio!",
                SubTitle      = "Es bueno conocerte",
                XmlParams     = "<root><item key=\"url\" value=\"#services\" /><item key=\"tag\" value=\"Dime Más\" /></root>",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Services01 = new CmsArticle()
            {
                Schema        = Schema_Services1,
                ArticleParent = Article_Services,
                Title         = "E-Commerce",
                XmlParams     = "<root><item key=\"css\" value=\"fa-shopping-cart\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Services02 = new CmsArticle()
            {
                Schema        = Schema_Services1,
                ArticleParent = Article_Services,
                Title         = "Responsive Design",
                XmlParams     = "<root><item key=\"css\" value=\"fa-laptop\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.",
                Author        = adminuser,
                Position      = 2,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Services03 = new CmsArticle()
            {
                Schema        = Schema_Services1,
                ArticleParent = Article_Services,
                Title         = "Web Security",
                XmlParams     = "<root><item key=\"css\" value=\"fa-lock\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.",
                Author        = adminuser,
                Position      = 3,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio01 = new CmsArticle()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Round Icons",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/roundicons.png\" /></root>",
                SubTitle      = "Graphic Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio02 = new CmsArticle()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Startup Framework",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/startup-framework.png\" /></root>",
                SubTitle      = "Website Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio03 = new CmsArticle()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Treehouse",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/treehouse.png\" /></root>",
                SubTitle      = "Website Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio04 = new CmsArticle()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Golden",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/golden.png\" /></root>",
                SubTitle      = "Website Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio05 = new CmsArticle()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Escape",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/escape.png\" /></root>",
                SubTitle      = "Website Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio06 = new CmsArticle()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Dreams",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/dreams.png\" /></root>",
                SubTitle      = "Website Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_About01 = new CmsArticle()
            {
                Schema        = Schema_About1,
                ArticleParent = Article_About,
                Title         = "Our Humble Beginnings",
                SubTitle      = "2009-2011",
                XmlParams     = "<root><item key=\"image\" value=\"/img/about/1.jpg\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt ut voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae sit vero unde, sed, incidunt et ea quo dolore laudantium consectetur!",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_About02 = new CmsArticle()
            {
                Schema        = Schema_About1,
                ArticleParent = Article_About,
                Title         = "An Agency is Born",
                SubTitle      = "March 2011",
                XmlParams     = "<root><item key=\"image\" value=\"/img/about/2.jpg\" /><item key=\"align\" value=\"right\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt ut voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae sit vero unde, sed, incidunt et ea quo dolore laudantium consectetur!",
                Author        = adminuser,
                Position      = 2,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_About03 = new CmsArticle()
            {
                Schema        = Schema_About1,
                ArticleParent = Article_About,
                Title         = "Transition to Full Service",
                SubTitle      = "December 2012",
                XmlParams     = "<root><item key=\"image\" value=\"/img/about/3.jpg\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt ut voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae sit vero unde, sed, incidunt et ea quo dolore laudantium consectetur!",
                Author        = adminuser,
                Position      = 3,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_About04 = new CmsArticle()
            {
                Schema        = Schema_About1,
                ArticleParent = Article_About,
                Title         = "Phase Two Expansion",
                SubTitle      = "July 2014",
                XmlParams     = "<root><item key=\"image\" value=\"/img/about/4.jpg\" /><item key=\"align\" value=\"right\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt ut voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae sit vero unde, sed, incidunt et ea quo dolore laudantium consectetur!",
                Author        = adminuser,
                Position      = 4,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team01 = new CmsArticle()
            {
                Schema        = Schema_Team1,
                ArticleParent = Article_Team,
                Title         = "Nuestro Equipo",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut eaque, laboriosam veritatis, quos non quis ad perspiciatis, totam corporis ea, alias ut unde.",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team02 = new CmsArticle()
            {
                Schema        = Schema_Team2,
                ArticleParent = Article_Team,
                Title         = "Nuestros Clientes",
                Author        = adminuser,
                Position      = 2,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0101 = new CmsArticle()
            {
                Schema        = Schema_Team11,
                ArticleParent = Article_Team01,
                Title         = "Kay Garland",
                SubTitle      = "Lead Designer",
                XmlParams     = "<root><item key=\"image\" value=\"/img/team/1.jpg\" /><item key=\"twitter\" value=\"#\" /><item key=\"facebook\" value=\"#\" /><item key=\"linkedin\" value=\"#\" /></root>",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0102 = new CmsArticle()
            {
                Schema        = Schema_Team11,
                ArticleParent = Article_Team01,
                Title         = "Larry Parker",
                SubTitle      = "Lead Marketer",
                XmlParams     = "<root><item key=\"image\" value=\"/img/team/2.jpg\" /><item key=\"twitter\" value=\"#\" /><item key=\"facebook\" value=\"#\" /><item key=\"linkedin\" value=\"#\" /></root>",
                Author        = adminuser,
                Position      = 2,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0103 = new CmsArticle()
            {
                Schema        = Schema_Team11,
                ArticleParent = Article_Team01,
                Title         = "Diana Pertersen",
                SubTitle      = "Lead Developer",
                XmlParams     = "<root><item key=\"image\" value=\"/img/team/3.jpg\" /><item key=\"twitter\" value=\"#\" /><item key=\"facebook\" value=\"#\" /><item key=\"linkedin\" value=\"#\" /></root>",
                Author        = adminuser,
                Position      = 3,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0201 = new CmsArticle()
            {
                Schema        = Schema_Team21,
                ArticleParent = Article_Team02,
                Title         = "evanto",
                XmlParams     = "<root><item key=\"image\" value=\"/img/logos/envato.jpg\" /></root>",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0202 = new CmsArticle()
            {
                Schema        = Schema_Team21,
                ArticleParent = Article_Team02,
                Title         = "designmodo",
                XmlParams     = "<root><item key=\"image\" value=\"/img/logos/designmodo.jpg\" /></root>",
                Author        = adminuser,
                Position      = 2,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0203 = new CmsArticle()
            {
                Schema        = Schema_Team21,
                ArticleParent = Article_Team02,
                Title         = "themeforest",
                XmlParams     = "<root><item key=\"image\" value=\"/img/logos/themeforest.jpg\" /></root>",
                Author        = adminuser,
                Position      = 3,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0204 = new CmsArticle()
            {
                Schema        = Schema_Team21,
                ArticleParent = Article_Team02,
                Title         = "creative-market",
                XmlParams     = "<root><item key=\"image\" value=\"/img/logos/creative-market.jpg\" /></root>",
                Author        = adminuser,
                Position      = 4,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Contact01 = new CmsArticle()
            {
                Schema        = Schema_Contact1,
                ArticleParent = Article_Contact,
                Title         = "Formulario de Contacto",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };

            #endregion

            #region Post
            var post1 = new Post()
            {
                Title        = "El primer teléfono para gatos es una realidad",
                Resumen      = "El primer teléfono para gatos ha llegado, y no es una mala broma. Weenect es una empresa que fabrica...",
                Description  = "El primer teléfono para gatos ha llegado, y no es una mala broma. Weenect es una empresa que fabrica localizadores GPS para niños y perros, los cuales te permiten rastrearlos desde la comodidad de tu teléfono. Ahora toca el turno de los gatos con un nuevo localizador que además cuenta con teléfono integrado. El Weenect Cats se coloca en el collar de tu gato y tiene diversas funciones. Cuando tu mascota se sale de una zona determinada, tu teléfono envía una alerta y te permite llamarle gracias a que cuenta con una tarjeta SIM, así como un micrófono y parlantes que se ubican en el dispositivo.",
                Active       = true,
                PublishDate  = new DateTime(2015, 10, 15),
                RegisterDate = DateTime.Now,
                Author       = Author1
            };
            var post2 = new Post()
            {
                Title        = "10 funciones secretas de Google Drive",
                Resumen      = "Las aplicaciones de Google Drive destacan por su simpleza y facilidad de uso. Si bien no están a la par de...",
                Description  = "Las aplicaciones de Google Drive destacan por su simpleza y facilidad de uso. Si bien no están a la par de la suite Microsoft Office, Docs tiene cosas que son impresionantes, aunque no siempre están al alcance de la vista. <h2>Herramienta de búsqueda</h2> Google Docs nos da una mano con investigaciones permitiéndonos realizar búsquedas y luego citas de forma simple. Para esto, solo debemos ir a Herramientas y seleccionar Investigar seguidamente un cuadro de búsqueda se abrirá a la derecha y podremos buscar sobre cualquier temática. Si se desea podemos añadir un enlace o bien una cita al contenido. Otro aspecto interesante de la herramienta, es que permite realizar búsquedas sin tener que salir de la página en la cual estamos trabajando. <h2>Reconocimiento de voz</h2> Haciendo uso de un micrófono podemos utilizar la herramienta de reconocimiento de voz que funciona de maravillas. Nuevamente debemos dirigirnos a la sección de herramientas y seleccionar \"Escritura por voz\".",
                Active       = true,
                PublishDate  = new DateTime(2015, 10, 16),
                RegisterDate = DateTime.Now,
                Author       = Author2
            };
            post1.AddComment(new Comment()
            {
                Message = "Me parece una excelente idea, creo que podría salvar muchas vidas.", WebUser = WebUser1, RegisterDate = DateTime.Now
            });
            post1.AddComment(new Comment()
            {
                Message = "No lo sé, creo que hay cosas mas importantes de las que deberían preocuparse.", WebUser = WebUser2, RegisterDate = DateTime.Now
            });
            post2.AddComment(new Comment()
            {
                Message = "Me encanto mucho el post, no sabía que podía personalizar mis carpetas.", WebUser = WebUser2, RegisterDate = DateTime.Now
            });
            #endregion

            context.AdmProfileRepository.Add(sa);
            context.AdmProfileRepository.Add(Author);

            context.AdmUserRepository.Add(adminuser);
            context.AdmUserRepository.Add(Author1);
            context.AdmUserRepository.Add(Author2);

            context.WebUserRepository.Add(WebUser1);
            context.WebUserRepository.Add(WebUser2);

            context.AdmMenuRepository.Add(menu01);
            context.AdmMenuRepository.Add(menu02);
            context.AdmMenuRepository.Add(menu03);
            context.AdmMenuRepository.Add(menu04);
            context.AdmMenuRepository.Add(menu0401);
            context.AdmMenuRepository.Add(menu0402);
            context.AdmMenuRepository.Add(menu0403);
            context.AdmMenuRepository.Add(menu0404);
            context.AdmMenuRepository.Add(menu0405);

            context.SchemaRepository.Add(Schema_Home);
            context.SchemaRepository.Add(Schema_Services);
            context.SchemaRepository.Add(Schema_Portfolio);
            context.SchemaRepository.Add(Schema_About);
            context.SchemaRepository.Add(Schema_Team);
            context.SchemaRepository.Add(Schema_Contact);
            context.SchemaRepository.Add(Schema_Blog);
            context.SchemaRepository.Add(Schema_Home1);
            context.SchemaRepository.Add(Schema_Home11);
            context.SchemaRepository.Add(Schema_Services1);
            context.SchemaRepository.Add(Schema_Portfolio1);
            context.SchemaRepository.Add(Schema_About1);
            context.SchemaRepository.Add(Schema_Team1);
            context.SchemaRepository.Add(Schema_Team2);
            context.SchemaRepository.Add(Schema_Contact1);

            context.ArticleRepository.Add(Article_Home);
            context.ArticleRepository.Add(Article_Services);
            context.ArticleRepository.Add(Article_Portfolio);
            context.ArticleRepository.Add(Article_About);
            context.ArticleRepository.Add(Article_Team);
            context.ArticleRepository.Add(Article_Contact);
            context.ArticleRepository.Add(Article_Home01);
            context.ArticleRepository.Add(Article_Home0101);
            context.ArticleRepository.Add(Article_Services01);
            context.ArticleRepository.Add(Article_Services02);
            context.ArticleRepository.Add(Article_Services03);
            context.ArticleRepository.Add(Article_Portfolio01);
            context.ArticleRepository.Add(Article_Portfolio02);
            context.ArticleRepository.Add(Article_Portfolio03);
            context.ArticleRepository.Add(Article_Portfolio04);
            context.ArticleRepository.Add(Article_Portfolio05);
            context.ArticleRepository.Add(Article_Portfolio06);
            context.ArticleRepository.Add(Article_About01);
            context.ArticleRepository.Add(Article_About02);
            context.ArticleRepository.Add(Article_About03);
            context.ArticleRepository.Add(Article_About04);
            context.ArticleRepository.Add(Article_Team01);
            context.ArticleRepository.Add(Article_Team02);
            context.ArticleRepository.Add(Article_Team0101);
            context.ArticleRepository.Add(Article_Team0102);
            context.ArticleRepository.Add(Article_Team0103);
            context.ArticleRepository.Add(Article_Team0201);
            context.ArticleRepository.Add(Article_Team0202);
            context.ArticleRepository.Add(Article_Team0203);
            context.ArticleRepository.Add(Article_Team0204);
            context.ArticleRepository.Add(Article_Contact01);

            context.PostRepository.Add(post1);
            context.PostRepository.Add(post2);

            context.Commit();
        }
Ejemplo n.º 17
0
 public List <AdmRole> GetAcountUserRolesListByAcountUser(DccyDbContext dbContext, AdmUser admUser, out List <int> depIdList, out List <string> depGuidList, out List <int> roleIdList, out List <string> roleGuidList)
 {
     try
     {
         GetDepIdListByAcountUser(dbContext, admUser, out depIdList, out depGuidList);
         return(GetRoleIdListByDepIdList(dbContext, depGuidList, out roleIdList, out roleGuidList));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// 通过当前用户得到用记角色
        /// </summary>
        /// <param name="dbContext"></param>
        /// <param name="admUser"></param>
        /// <param name="roleIdList"></param>
        /// <param name="roleGuidList"></param>
        /// <returns></returns>
        public List <AdmRole> GetAcountUserRoleListTREEByAcountUser(DccyDbContext dbContext, AdmUser admUser, out List <int> roleIdList, out List <string> roleGuidList)
        {
            List <int>     depidList    = new List <int>();
            List <string>  depguidList  = new List <string>();
            List <int>     roleidList   = new List <int>();
            List <string>  roleguidList = new List <string>();
            List <int>     juridlist    = new List <int>();
            List <string>  jurguidlist  = new List <string>();
            List <AdmRole> admRoles     = new List <AdmRole>();

            try
            {
                var roles = GetAcountUserRolesListByAcountUser(dbContext, admUser, out depidList, out depguidList, out roleidList, out roleguidList);
                roleGuidList = roleguidList;
                roleIdList   = roleidList;
                return(CreateNodesTreeListRole(dbContext, roles));
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 得到用户所在部门与角色中的菜单ids
        /// </summary>
        /// <param name="admUser"></param>
        /// <returns>菜单ID集合</returns>
        private List <string> GetMenuGuidByUserRoleIdORDepId(AdmUser admUser)
        {
            userDepIdList.Clear();
            userRoleIdList.Clear();
            userJurGuidList.Clear();
            RootMenu.Clear();
            MenuList.Clear();
            var userDeps = _context.AdmUserDepartment.Where(u => u.AdmUserId == admUser.Id && u.IsDelete == false).ToList();

            if (userDeps != null && userDeps.Count > 0)
            {
                #region 拓展Expression拼接lamada
                Expression <Func <AdmDepRole, bool> > expression = t => true;
                userDeps.ForEach(u =>
                {
                    if (!userDepIdList.Contains(u.AdmDepId))
                    {
                        userDepIdList.Add(u.AdmDepId);
                    }
                    expression = expression.And(t => t.DepId.Equals(u.AdmDepId) && t.IsDelete == false);
                });
                var admDepRoles = _context.AdmDepRole.AsQueryable().Where(expression).ToList();
                #endregion
                if (admDepRoles != null && admDepRoles.Count > 0)
                {
                    var roleJurs = _context.AdmRoleJur.Where(h => admDepRoles.Select(c1 => c1.RoleId).Any(c2 => h.AdmRoleId.Equals(c2))).ToList();
                    if (roleJurs != null && roleJurs.Count > 0)
                    {
                        roleJurs.ForEach(k =>
                        {
                            if (!userRoleIdList.Contains(k.AdmRoleId))
                            {
                                userRoleIdList.Add(k.AdmRoleId);
                            }
                            if (!userJurGuidList.Contains(k.AdmJurGuid))
                            {
                                userJurGuidList.Add(k.AdmJurGuid);
                            }
                        });
                    }
                }
            }
            #region Task测试


            //Task taskdep = DBHandler.Db.AdmDepartment.Where(u => u.Id == admUser.DepId).ForEachAsync(m =>
            //{
            //    if (m.IsDelete == false && !menuids.Contains(m.MenuGuid))
            //    {
            //        menuids.Add(m.MenuGuid);
            //    }
            //});
            //Task taskrole = DBHandler.Db.AdmRole.Where(u => u.Id == admUser.RoleId).AsQueryable().ForEachAsync(m =>
            //{
            //    if (m.IsDelete == false && !menuids.Contains(m.MenuGuid))
            //    {
            //        menuids.Add(m.MenuGuid);
            //    }
            //});
            //Task.WaitAll(taskdep, taskrole);
            #endregion
            return(userJurGuidList);
        }
Ejemplo n.º 20
0
        public ActionResult Login(string acountName, string password, string code)
        {
            AdmUser admUser = null;

            #region 用户名验证
            if (acountName != null && acountName.Length > 0 && acountName != "")
            {
                var user = DBHandler.Db.AdmUser.First(u => u.UserAccounts == acountName || u.Email == acountName || u.Tel == acountName);
                if (user != null && user.Id > 0)
                {
                    admUser = user;
                }
                else
                {
                    ViewBag.LoginMsg = "请输入合法的登录帐号或帐号不存在!!!";
                    return(View("Index"));
                }
            }
            else
            {
                ViewBag.LoginMsg = "请输入合法的登录帐号!!!";
                return(View("Index"));
            }
            #endregion
            #region 密码验证
            if (password != null && password.Length > 0 && password != "")
            {
                var userPwdEncode = EncryptionAndDecryption.Encode(password);
                if (admUser.Password.Equals(userPwdEncode))
                {
                }
                else
                {
                    ViewBag.LoginMsg = "密码错误!!!";
                    return(View("Index"));
                }
            }
            else
            {
                ViewBag.LoginMsg = "请输入合法的登录密码!!!";
                return(View("Index"));
            }
            #endregion
            #region 验证码
            if (code != null && code.Length > 0 && code != "")
            {
                if (code.Equals(TempData["SecurityCode"]))
                {
                    HttpContext.Session.SetString("AdmUserSession", JsonConvert.SerializeObject(admUser));
                    return(RedirectToAction("Index", "Home", admUser));
                }
                else
                {
                    ViewBag.LoginMsg = "验证码输入错误!!!";
                    return(View("Index"));
                }
            }
            else
            {
                ViewBag.LoginMsg = "请输入合法的验证码!!!";
                return(View("Index"));
            }
            #endregion
        }
Ejemplo n.º 21
0
        public ActionResult Login(string acountName, string Tel, string password, string code)
        {
            AdmUser admUser = null;

            #region 用户名验证
            if (acountName != null && acountName.Length > 0 && acountName != "")
            {
                var user = DBHandler.Db.AdmUser.FirstOrDefault(u => u.UserAccounts == acountName || u.Email == acountName || u.Tel == acountName || u.UserName == acountName || u.Tel == Tel || u.UserAccounts == Tel || u.UserName == Tel || u.Email == Tel);
                if (user != null && user.Id > 0)
                {
                    admUser = user;
                }
                else
                {
                    ViewBag.LoginMsg = "请输入合法的登录帐号或帐号不存在!!!";
                    return(View("Index"));
                }
            }
            else
            {
                ViewBag.LoginMsg = "请输入合法的登录帐号!!!";
                return(View("Index"));
            }
            #endregion
            #region 密码验证
            if (password != null && password.Length > 0 && password != "")
            {
                var userPwdEncode = EncryptionAndDecryption.Encode(password);
                if (admUser.Password.Equals(userPwdEncode))
                {
                }
                else
                {
                    ViewBag.LoginMsg = "密码错误!!!";
                    return(View("Index"));
                }
            }
            else
            {
                ViewBag.LoginMsg = "请输入合法的登录密码!!!";
                return(View("Index"));
            }
            #endregion
            #region 验证码
            if (code != null && code.Length > 0 && code != "")
            {
                if (code.Equals(TempData["SecurityCode"]))
                {
                    HttpContext.Session.SetString("AdmUserSession", JsonConvert.SerializeObject(admUser));
                    Logger.Info(JsonConvert.SerializeObject("用户帐号:" + admUser.UserAccounts + ",用户名:" + admUser.UserName + ",用户Emal:" + admUser.Email + ",用户电话:" + admUser.Tel));
                    return(RedirectToRoute(new { Controller = "SysAdm", Action = "Index" }));
                }
                else
                {
                    ViewBag.LoginMsg = "验证码输入错误!!!";
                    return(View("Index"));
                }
            }
            else
            {
                ViewBag.LoginMsg = "请输入合法的验证码!!!";
                return(View("Index"));
            }
            #endregion
        }
Ejemplo n.º 22
0
 public List <AdmDepartment> GetDepIdListByAcountUser(DccyDbContext dbContext, AdmUser admUser, out List <int> depIdList, out List <string> depGuidList)
 {
     try
     {
         List <AdmDepartment> userDeps = null;
         List <int>           idlist   = null;
         List <string>        Guidlist = null;
         if (admUser != null)
         {
             //得到用户部门对应表数据
             List <AdmUserDepartment> admUserDepartments = dbContext.AdmUserDepartment.Where(u => u.AdmUserGuid == admUser.Guid).ToList();
             //通过用户部门表得到当前用户的部门集合
             userDeps = dbContext.AdmDepartment.Where(h => admUserDepartments.Select(c1 => c1.AdmDepGuid).Any(c2 => h.Guid.Equals(c2) && h.IsDelete == false)).ToList();
             if (userDeps.Count > 0)
             {
                 idlist   = new List <int>();
                 Guidlist = new List <string>();
                 userDeps.ForEach(u =>
                 {
                     if (!Guidlist.Contains(u.Guid))
                     {
                         Guidlist.Add(u.Guid);
                     }
                     if (!idlist.Contains(u.Id))
                     {
                         idlist.Add(u.Id);
                     }
                 });
             }
         }
         depIdList   = idlist;
         depGuidList = Guidlist;
         return(userDeps);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Ejemplo n.º 23
0
        protected override void Seed(Layqa.Repository.EFLayqaRepository context)
        {
            //  This method will be called after migrating to the latest version.
            #region AdmProfile
            var sa = new AdmProfile()
            {
                Name = "Administrador"
            };
            var Author = new AdmProfile()
            {
                Name = "Author"
            };
            #endregion

            #region WebUser
            var adminuser = new AdmUser()
            {
                Name         = "Fischer",
                LastName     = "Tirado",
                Email        = "*****@*****.**",
                RegisterDate = DateTime.Now,
                Active       = true,
                AdmProfile   = sa
            };
            #endregion

            #region AdmMenu
            var menu01 = new AdmMenu()
            {
                Name       = "Dashboard",
                Controller = "Home",
                IconCss    = "dashboard",
                Position   = 1,
                Active     = true
            };
            var menu02 = new AdmMenu()
            {
                Name       = "Posts",
                Controller = "Post",
                IconCss    = "tags",
                Position   = 2,
                Active     = true
            };
            var menu03 = new AdmMenu()
            {
                Name       = "Páginas",
                Controller = "Article",
                IconCss    = "globe",
                Position   = 3,
                Active     = true
            };
            var menu04 = new AdmMenu()
            {
                Name     = "Configuración",
                IconCss  = "edit",
                Position = 4,
                Active   = true
            };
            var menu0401 = new AdmMenu()
            {
                Name       = "Administradores",
                Controller = "AdmUser",
                Position   = 1,
                Active     = true,

                MenuParent = menu04
            };
            var menu0402 = new AdmMenu()
            {
                Name       = "Usuarios Web",
                Controller = "WebUser",
                Position   = 2,
                Active     = true,

                MenuParent = menu04
            };
            var menu0403 = new AdmMenu()
            {
                Name       = "Perfiles",
                Controller = "AdmProfile",
                Position   = 3,
                Active     = true,

                MenuParent = menu04
            };
            var menu0404 = new AdmMenu()
            {
                Name       = "Esquemas del CMS",
                Controller = "Schema",
                Position   = 4,
                Active     = true,

                MenuParent = menu04
            };
            var menu0405 = new AdmMenu()
            {
                Name       = "Plantillas del CMS",
                Controller = "Template",
                Position   = 5,
                Active     = true,

                MenuParent = menu04
            };
            #endregion

            #region Template
            var Template_SectionHome = new Template()
            {
                Name      = "Sección Home Page",
                AdminView = "section",
                FrontView = "section_home",
                IsSection = true,
                Active    = true
            };
            var Template_SectionServices = new Template()
            {
                Name      = "Sección Servicios",
                AdminView = "section",
                FrontView = "section_services",
                IsSection = true,
                Active    = true
            };
            var Template_SectionPortfolio = new Template()
            {
                Name      = "Sección Portafolio",
                AdminView = "section",
                FrontView = "section_portfolio",
                IsSection = true,
                Active    = true
            };
            var Template_SectionAbout = new Template()
            {
                Name      = "Sección Acerca de",
                AdminView = "section",
                FrontView = "section_about",
                IsSection = true,
                Active    = true
            };
            var Template_SectionTeam = new Template()
            {
                Name      = "Sección Equipo",
                AdminView = "section",
                FrontView = "section_team",
                IsSection = true,
                Active    = true
            };
            var Template_SectionContact = new Template()
            {
                Name      = "Sección Contacto",
                AdminView = "section",
                FrontView = "section_contact",
                IsSection = true,
                Active    = true
            };
            var Template_SectionBlog = new Template()
            {
                Name      = "Sección Blog",
                AdminView = "section",
                FrontView = "section_blog",
                IsSection = true,
                Active    = true
            };
            var Template_Parrafo = new Template()
            {
                Name      = "Párrafo",
                AdminView = "parrafo",
                FrontView = "parrafo",
                Active    = true
            };
            var Template_Pagina = new Template()
            {
                Name      = "Página",
                AdminView = "pagina",
                FrontView = "pagina",
                Active    = true
            };
            var Template_Contenedor = new Template()
            {
                Name      = "Contenedor",
                AdminView = "contenedor",
                FrontView = "contenedor",
                Active    = true
            };
            var Template_Enlace = new Template()
            {
                Name      = "Enlace (link)",
                AdminView = "enlace",
                FrontView = "enlace",
                Active    = true
            };
            var Template_Foto = new Template()
            {
                Name      = "Foto de Galería",
                AdminView = "imagen",
                FrontView = "imagen",
                Active    = true
            };
            var Template_Intro = new Template()
            {
                Name      = "Párrafo de Intro",
                AdminView = "intro",
                FrontView = "intro",
                Active    = true
            };
            var Template_Documento = new Template()
            {
                Name      = "Documento",
                AdminView = "documento",
                FrontView = "documento",
                Active    = true
            };
            var Template_Acceso = new Template()
            {
                Name      = "Acceso Directo",
                AdminView = "acceso",
                FrontView = "acceso",
                Active    = true
            };
            var Template_Noticia = new Template()
            {
                Name      = "Noticia",
                AdminView = "noticia",
                FrontView = "noticia",
                Active    = true
            };
            var Template_Widget = new Template()
            {
                Name      = "Widget",
                AdminView = "widget",
                FrontView = "widget",
                Active    = true
            };
            var Template_WidgetEnlace = new Template()
            {
                Name      = "Widget con Enlace",
                AdminView = "widget_enlace",
                FrontView = "widget_enlace",
                Active    = true
            };
            var Template_AnimacionHome = new Template()
            {
                Name      = "Animación Home",
                AdminView = "contenedor",
                FrontView = "bloque_animacion",
                Active    = true
            };
            var Template_BloqueAccesos = new Template()
            {
                Name      = "Bloque de Accesos",
                AdminView = "contenedor",
                FrontView = "bloque_accesos",
                Active    = true
            };
            var Template_BloqueWidgets = new Template()
            {
                Name      = "Bloque de Widgets",
                AdminView = "contenedor",
                FrontView = "bloque_widgets",
                Active    = true
            };
            var Template_BloqueNoticias = new Template()
            {
                Name      = "Bloque de Noticias",
                AdminView = "contenedor",
                FrontView = "bloque_noticias",
                Active    = true
            };
            var Template_Portafolio = new Template()
            {
                Name      = "Portafolio",
                AdminView = "portafolio",
                FrontView = "portafolio",
                Active    = true
            };
            var Template_Servicio = new Template()
            {
                Name      = "Servicio",
                AdminView = "servicio",
                FrontView = "servicio",
                Active    = true
            };
            var Template_Historia = new Template()
            {
                Name      = "Historia",
                AdminView = "historia",
                FrontView = "historia",
                Active    = true
            };
            var Template_Equipo = new Template()
            {
                Name      = "Equipo",
                AdminView = "equipo",
                FrontView = "equipo",
                Active    = true
            };
            var Template_Cliente = new Template()
            {
                Name      = "Cliente",
                AdminView = "cliente",
                FrontView = "cliente",
                Active    = true
            };
            var Template_PaginaNoticias = new Template()
            {
                Name      = "Página de Noticias",
                AdminView = "contenedor",
                FrontView = "pagina_noticias",
                Active    = true
            };
            var Template_FormularioContacto = new Template()
            {
                Name      = "Formulario de Contacto",
                AdminView = "contenedor",
                FrontView = "form_contacto",
                Active    = true
            };
            var Template_PaginaError = new Template()
            {
                Id        = 98,
                Name      = "Página de Error",
                AdminView = "contenedor",
                FrontView = "pagina_error",
                Active    = true
            };
            var Template_Error = new Template()
            {
                Id        = 99,
                Name      = "Error",
                AdminView = "error",
                FrontView = "error",
                Active    = true
            };
            #endregion

            #region Schema
            var Schema_Home = new Schema()
            {
                //Section = Section_Home,
                Template = Template_SectionHome,
                //Alias = "Sección Home",
                Iterations = 1,
                Position   = 1,
                IsPage     = false,
                Active     = true,
            };
            var Schema_Services = new Schema()
            {
                //Section = Section_Services,
                Template = Template_SectionServices,
                //Alias = "Sección Servicios",
                Iterations = 1,
                Position   = 2,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Portfolio = new Schema()
            {
                //Section = Section_Portfolio,
                Template = Template_SectionPortfolio,
                //Alias = "Sección Portafolio",
                Iterations = 1,
                Position   = 3,
                IsPage     = true,
                Active     = true,
            };
            var Schema_About = new Schema()
            {
                //Section = Section_About,
                Template = Template_SectionAbout,
                //Alias = "Sección Acerca de",
                Iterations = 1,
                Position   = 4,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Team = new Schema()
            {
                //Section = Section_Team,
                Template = Template_SectionTeam,
                //Alias = "Sección El Equipo",
                Iterations = 1,
                Position   = 5,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Contact = new Schema()
            {
                //Section = Section_Contact,
                Template = Template_SectionContact,
                //Alias = "Sección Contáctenos",
                Iterations = 1,
                Position   = 6,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Blog = new Schema()
            {
                //Section = Section_Blog,
                Template = Template_SectionBlog,
                //Alias = "Sección Blog",
                Iterations = 1,
                Position   = 7,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Home1 = new Schema()
            {
                SchemaParent = Schema_Home,
                //Section = Section_Home,
                Template   = Template_AnimacionHome,
                Iterations = 1,
                Position   = 1,
                IsPage     = false,
                Active     = true,
            };
            var Schema_Home11 = new Schema()
            {
                SchemaParent = Schema_Home1,
                //Section = Section_Home,
                Template   = Template_Intro,
                Iterations = 1,
                Position   = 1,
                IsPage     = false,
                Active     = true,
            };
            var Schema_Services1 = new Schema()
            {
                SchemaParent = Schema_Services,
                //Section = Section_Services,
                Template = Template_Servicio,
                Position = 1,
                IsPage   = true,
                Active   = true,
            };
            var Schema_Portfolio1 = new Schema()
            {
                SchemaParent = Schema_Portfolio,
                //Section = Section_Portfolio,
                Template = Template_Portafolio,
                Position = 1,
                IsPage   = true,
                Active   = true,
            };
            var Schema_About1 = new Schema()
            {
                SchemaParent = Schema_About,
                //Section = Section_About,
                Template = Template_Historia,
                Position = 1,
                IsPage   = true,
                Active   = true,
            };
            var Schema_Team1 = new Schema()
            {
                SchemaParent = Schema_Team,
                //Section = Section_Team,
                Template   = Template_Contenedor,
                Alias      = "Bloque Nuestro Equipo",
                Iterations = 1,
                Position   = 1,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Team2 = new Schema()
            {
                SchemaParent = Schema_Team,
                //Section = Section_Team,
                Template   = Template_Contenedor,
                Alias      = "Bloque Nuestros Clientes",
                Iterations = 1,
                Position   = 1,
                IsPage     = true,
                Active     = true,
            };
            var Schema_Team11 = new Schema()
            {
                SchemaParent = Schema_Team1,
                //Section = Section_Team,
                Template = Template_Equipo,
                Position = 1,
                IsPage   = false,
                Active   = true,
            };
            var Schema_Team21 = new Schema()
            {
                SchemaParent = Schema_Team2,
                //Section = Section_Team,
                Template = Template_Cliente,
                Position = 1,
                IsPage   = false,
                Active   = true,
            };
            var Schema_Contact1 = new Schema()
            {
                SchemaParent = Schema_Contact,
                //Section = Section_Contact,
                Template   = Template_FormularioContacto,
                Iterations = 1,
                Position   = 1,
                IsPage     = true,
                Active     = true,
            };
            #endregion

            #region Article
            var Article_Home = new Article()
            {
                Schema       = Schema_Home,
                Title        = "Inicio",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#home\" /></root>",
                Author       = adminuser,
                Position     = 1,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_Services = new Article()
            {
                Schema       = Schema_Services,
                Title        = "Servicios",
                SubTitle     = "Lorem ipsum dolor sit amet consectetur.",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#services\" /></root>",
                Author       = adminuser,
                Position     = 2,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_Portfolio = new Article()
            {
                Schema       = Schema_Portfolio,
                Title        = "Portafolio",
                SubTitle     = "Lorem ipsum dolor sit amet consectetur.",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#portfolio\" /></root>",
                Author       = adminuser,
                Position     = 3,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_About = new Article()
            {
                Schema       = Schema_About,
                Title        = "Acerca de",
                SubTitle     = "Lorem ipsum dolor sit amet consectetur.",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#about\" /></root>",
                Author       = adminuser,
                Position     = 4,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_Team = new Article()
            {
                Schema       = Schema_Team,
                Title        = "El Equipo",
                SubTitle     = "Lorem ipsum dolor sit amet consectetur.",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#team\" /></root>",
                Author       = adminuser,
                Position     = 5,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_Contact = new Article()
            {
                Schema       = Schema_Contact,
                Title        = "Contáctenos",
                SubTitle     = "Lorem ipsum dolor sit amet consectetur.",
                XmlParams    = "<root><item key=\"hashtag\" value=\"#contact\" /></root>",
                Author       = adminuser,
                Position     = 6,
                Active       = true,
                RegisterDate = DateTime.Now
            };
            var Article_Home01 = new Article()
            {
                Schema        = Schema_Home1,
                ArticleParent = Article_Home,
                Title         = "Animación Home",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Home0101 = new Article()
            {
                Schema        = Schema_Home11,
                ArticleParent = Article_Home01,
                Title         = "Bienvenido a Nuestro Estudio!",
                SubTitle      = "Es bueno conocerte",
                XmlParams     = "<root><item key=\"url\" value=\"#services\" /><item key=\"tag\" value=\"Dime Más\" /></root>",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Services01 = new Article()
            {
                Schema        = Schema_Services1,
                ArticleParent = Article_Services,
                Title         = "E-Commerce",
                XmlParams     = "<root><item key=\"css\" value=\"fa-shopping-cart\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Services02 = new Article()
            {
                Schema        = Schema_Services1,
                ArticleParent = Article_Services,
                Title         = "Responsive Design",
                XmlParams     = "<root><item key=\"css\" value=\"fa-laptop\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.",
                Author        = adminuser,
                Position      = 2,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Services03 = new Article()
            {
                Schema        = Schema_Services1,
                ArticleParent = Article_Services,
                Title         = "Web Security",
                XmlParams     = "<root><item key=\"css\" value=\"fa-lock\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.",
                Author        = adminuser,
                Position      = 3,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio01 = new Article()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Round Icons",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/roundicons.png\" /></root>",
                SubTitle      = "Graphic Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio02 = new Article()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Startup Framework",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/startup-framework.png\" /></root>",
                SubTitle      = "Website Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio03 = new Article()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Treehouse",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/treehouse.png\" /></root>",
                SubTitle      = "Website Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio04 = new Article()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Golden",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/golden.png\" /></root>",
                SubTitle      = "Website Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio05 = new Article()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Escape",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/escape.png\" /></root>",
                SubTitle      = "Website Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Portfolio06 = new Article()
            {
                Schema        = Schema_Portfolio1,
                ArticleParent = Article_Portfolio,
                Title         = "Dreams",
                XmlParams     = "<root><item key=\"image\" value=\"/img/portfolio/dreams.png\" /></root>",
                SubTitle      = "Website Design",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_About01 = new Article()
            {
                Schema        = Schema_About1,
                ArticleParent = Article_About,
                Title         = "Our Humble Beginnings",
                SubTitle      = "2009-2011",
                XmlParams     = "<root><item key=\"image\" value=\"/img/about/1.jpg\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt ut voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae sit vero unde, sed, incidunt et ea quo dolore laudantium consectetur!",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_About02 = new Article()
            {
                Schema        = Schema_About1,
                ArticleParent = Article_About,
                Title         = "An Agency is Born",
                SubTitle      = "March 2011",
                XmlParams     = "<root><item key=\"image\" value=\"/img/about/2.jpg\" /><item key=\"align\" value=\"right\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt ut voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae sit vero unde, sed, incidunt et ea quo dolore laudantium consectetur!",
                Author        = adminuser,
                Position      = 2,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_About03 = new Article()
            {
                Schema        = Schema_About1,
                ArticleParent = Article_About,
                Title         = "Transition to Full Service",
                SubTitle      = "December 2012",
                XmlParams     = "<root><item key=\"image\" value=\"/img/about/3.jpg\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt ut voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae sit vero unde, sed, incidunt et ea quo dolore laudantium consectetur!",
                Author        = adminuser,
                Position      = 3,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_About04 = new Article()
            {
                Schema        = Schema_About1,
                ArticleParent = Article_About,
                Title         = "Phase Two Expansion",
                SubTitle      = "July 2014",
                XmlParams     = "<root><item key=\"image\" value=\"/img/about/4.jpg\" /><item key=\"align\" value=\"right\" /></root>",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt ut voluptatum eius sapiente, totam reiciendis temporibus qui quibusdam, recusandae sit vero unde, sed, incidunt et ea quo dolore laudantium consectetur!",
                Author        = adminuser,
                Position      = 4,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team01 = new Article()
            {
                Schema        = Schema_Team1,
                ArticleParent = Article_Team,
                Title         = "Nuestro Equipo",
                Resumen       = "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut eaque, laboriosam veritatis, quos non quis ad perspiciatis, totam corporis ea, alias ut unde.",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team02 = new Article()
            {
                Schema        = Schema_Team2,
                ArticleParent = Article_Team,
                Title         = "Nuestros Clientes",
                Author        = adminuser,
                Position      = 2,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0101 = new Article()
            {
                Schema        = Schema_Team11,
                ArticleParent = Article_Team01,
                Title         = "Kay Garland",
                SubTitle      = "Lead Designer",
                XmlParams     = "<root><item key=\"image\" value=\"/img/team/1.jpg\" /><item key=\"twitter\" value=\"#\" /><item key=\"facebook\" value=\"#\" /><item key=\"linkedin\" value=\"#\" /></root>",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0102 = new Article()
            {
                Schema        = Schema_Team11,
                ArticleParent = Article_Team01,
                Title         = "Larry Parker",
                SubTitle      = "Lead Marketer",
                XmlParams     = "<root><item key=\"image\" value=\"/img/team/2.jpg\" /><item key=\"twitter\" value=\"#\" /><item key=\"facebook\" value=\"#\" /><item key=\"linkedin\" value=\"#\" /></root>",
                Author        = adminuser,
                Position      = 2,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0103 = new Article()
            {
                Schema        = Schema_Team11,
                ArticleParent = Article_Team01,
                Title         = "Diana Pertersen",
                SubTitle      = "Lead Developer",
                XmlParams     = "<root><item key=\"image\" value=\"/img/team/3.jpg\" /><item key=\"twitter\" value=\"#\" /><item key=\"facebook\" value=\"#\" /><item key=\"linkedin\" value=\"#\" /></root>",
                Author        = adminuser,
                Position      = 3,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0201 = new Article()
            {
                Schema        = Schema_Team21,
                ArticleParent = Article_Team02,
                Title         = "evanto",
                XmlParams     = "<root><item key=\"image\" value=\"/img/logos/envato.jpg\" /></root>",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0202 = new Article()
            {
                Schema        = Schema_Team21,
                ArticleParent = Article_Team02,
                Title         = "designmodo",
                XmlParams     = "<root><item key=\"image\" value=\"/img/logos/designmodo.jpg\" /></root>",
                Author        = adminuser,
                Position      = 2,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0203 = new Article()
            {
                Schema        = Schema_Team21,
                ArticleParent = Article_Team02,
                Title         = "themeforest",
                XmlParams     = "<root><item key=\"image\" value=\"/img/logos/themeforest.jpg\" /></root>",
                Author        = adminuser,
                Position      = 3,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Team0204 = new Article()
            {
                Schema        = Schema_Team21,
                ArticleParent = Article_Team02,
                Title         = "creative-market",
                XmlParams     = "<root><item key=\"image\" value=\"/img/logos/creative-market.jpg\" /></root>",
                Author        = adminuser,
                Position      = 4,
                Active        = true,
                RegisterDate  = DateTime.Now
            };
            var Article_Contact01 = new Article()
            {
                Schema        = Schema_Contact1,
                ArticleParent = Article_Contact,
                Title         = "Formulario de Contacto",
                Author        = adminuser,
                Position      = 1,
                Active        = true,
                RegisterDate  = DateTime.Now
            };

            #endregion

            #region Post
            #endregion

            context.AdmProfileRepository.Add(sa);
            context.AdmProfileRepository.Add(Author);

            context.AdmUserRepository.Add(adminuser);
            context.AdmMenuRepository.Add(menu01);
            context.AdmMenuRepository.Add(menu02);
            context.AdmMenuRepository.Add(menu03);
            context.AdmMenuRepository.Add(menu04);
            context.AdmMenuRepository.Add(menu0401);
            context.AdmMenuRepository.Add(menu0402);
            context.AdmMenuRepository.Add(menu0403);
            context.AdmMenuRepository.Add(menu0404);
            context.AdmMenuRepository.Add(menu0405);

            context.TemplateRepository.Add(Template_SectionHome);
            context.TemplateRepository.Add(Template_SectionServices);
            context.TemplateRepository.Add(Template_SectionPortfolio);
            context.TemplateRepository.Add(Template_SectionAbout);
            context.TemplateRepository.Add(Template_SectionTeam);
            context.TemplateRepository.Add(Template_SectionContact);
            context.TemplateRepository.Add(Template_SectionBlog);
            context.TemplateRepository.Add(Template_Pagina);
            context.TemplateRepository.Add(Template_Parrafo);
            context.TemplateRepository.Add(Template_Contenedor);
            context.TemplateRepository.Add(Template_Enlace);
            context.TemplateRepository.Add(Template_Foto);
            context.TemplateRepository.Add(Template_Intro);
            context.TemplateRepository.Add(Template_Documento);
            context.TemplateRepository.Add(Template_Acceso);
            context.TemplateRepository.Add(Template_Noticia);
            context.TemplateRepository.Add(Template_Portafolio);
            context.TemplateRepository.Add(Template_Servicio);
            context.TemplateRepository.Add(Template_Equipo);
            context.TemplateRepository.Add(Template_Cliente);
            context.TemplateRepository.Add(Template_Widget);
            context.TemplateRepository.Add(Template_WidgetEnlace);
            context.TemplateRepository.Add(Template_AnimacionHome);
            context.TemplateRepository.Add(Template_BloqueAccesos);
            context.TemplateRepository.Add(Template_BloqueWidgets);
            context.TemplateRepository.Add(Template_BloqueNoticias);
            context.TemplateRepository.Add(Template_PaginaNoticias);
            context.TemplateRepository.Add(Template_FormularioContacto);
            context.TemplateRepository.Add(Template_PaginaError);
            context.TemplateRepository.Add(Template_Error);

            context.SchemaRepository.Add(Schema_Home);
            context.SchemaRepository.Add(Schema_Services);
            context.SchemaRepository.Add(Schema_Portfolio);
            context.SchemaRepository.Add(Schema_About);
            context.SchemaRepository.Add(Schema_Team);
            context.SchemaRepository.Add(Schema_Contact);
            context.SchemaRepository.Add(Schema_Blog);
            context.SchemaRepository.Add(Schema_Home1);
            context.SchemaRepository.Add(Schema_Home11);
            context.SchemaRepository.Add(Schema_Services1);
            context.SchemaRepository.Add(Schema_Portfolio1);
            context.SchemaRepository.Add(Schema_About1);
            context.SchemaRepository.Add(Schema_Team1);
            context.SchemaRepository.Add(Schema_Team2);
            context.SchemaRepository.Add(Schema_Contact1);

            context.ArticleRepository.Add(Article_Home);
            context.ArticleRepository.Add(Article_Services);
            context.ArticleRepository.Add(Article_Portfolio);
            context.ArticleRepository.Add(Article_About);
            context.ArticleRepository.Add(Article_Team);
            context.ArticleRepository.Add(Article_Contact);
            context.ArticleRepository.Add(Article_Home01);
            context.ArticleRepository.Add(Article_Home0101);
            context.ArticleRepository.Add(Article_Services01);
            context.ArticleRepository.Add(Article_Services02);
            context.ArticleRepository.Add(Article_Services03);
            context.ArticleRepository.Add(Article_Portfolio01);
            context.ArticleRepository.Add(Article_Portfolio02);
            context.ArticleRepository.Add(Article_Portfolio03);
            context.ArticleRepository.Add(Article_Portfolio04);
            context.ArticleRepository.Add(Article_Portfolio05);
            context.ArticleRepository.Add(Article_Portfolio06);
            context.ArticleRepository.Add(Article_About01);
            context.ArticleRepository.Add(Article_About02);
            context.ArticleRepository.Add(Article_About03);
            context.ArticleRepository.Add(Article_About04);
            context.ArticleRepository.Add(Article_Team01);
            context.ArticleRepository.Add(Article_Team02);
            context.ArticleRepository.Add(Article_Team0101);
            context.ArticleRepository.Add(Article_Team0102);
            context.ArticleRepository.Add(Article_Team0103);
            context.ArticleRepository.Add(Article_Team0201);
            context.ArticleRepository.Add(Article_Team0202);
            context.ArticleRepository.Add(Article_Team0203);
            context.ArticleRepository.Add(Article_Team0204);
            context.ArticleRepository.Add(Article_Contact01);

            context.Commit();
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 当前用户的菜单权限树
        /// </summary>
        /// <param name="dbContext"></param>
        /// <param name="admUser"></param>
        /// <param name="jurIdList"></param>
        /// <param name="jurGuidList"></param>
        /// <returns></returns>
        public List <AdmJurisdiction> GetAcountUserJurListTREEByAcountUser(DccyDbContext dbContext, AdmUser admUser, out List <int> jurIdList, out List <string> jurGuidList)
        {
            List <int>    depIdList    = new List <int>();
            List <string> depGuidList  = new List <string>();
            List <int>    roleIdList   = new List <int>();
            List <string> roleGuidList = new List <string>();
            List <int>    juridlist    = new List <int>();
            List <string> jurguidlist  = new List <string>();

            try
            {
                List <AdmJurisdiction> admuserjurtree = new List <AdmJurisdiction>();
                GetAcountUserRolesListByAcountUser(dbContext, admUser, out depIdList, out depGuidList, out roleIdList, out roleGuidList);
                if (roleGuidList.Count > 0)
                {
                    List <AdmJurisdiction> admuserjur = GetJurListByRoleIdList(dbContext, roleGuidList, out jurguidlist, out juridlist);
                    admuserjurtree = CreateNodesTreeList(dbContext, admuserjur);
                }
                jurIdList   = juridlist;
                jurGuidList = jurguidlist;
                return(admuserjurtree);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 25
0
        public string InitSystem()
        {
            List <AdmJurisdiction> admjurs = new List <AdmJurisdiction>();

            for (int i = 0; i < 5; i++)
            {
                admjurs.Add(new AdmJurisdiction()
                {
                    CreateTime      = DateTime.Now,
                    Guid            = Guid.NewGuid().ToString().ToUpper(),
                    Description     = i.ToString(),
                    IsAuthorization = true,
                    IsDelete        = false,
                    IsOpen          = true,
                    JurName         = "权限" + i.ToString(),
                });
            }
            _dbContext.AdmJurisdiction.AddRange(admjurs);

            List <AdmDepartment> adms = new List <AdmDepartment>();

            for (int i = 0; i < 5; i++)
            {
                adms.Add(new AdmDepartment()
                {
                    CreateTime  = DateTime.Now,
                    DepName     = "部门" + i.ToString(),
                    Description = i.ToString(),
                    Guid        = Guid.NewGuid().ToString().ToUpper(),
                    IsDelete    = false,
                });
            }
            _dbContext.AdmDepartment.AddRange(adms);

            List <AdmRole> admrole = new List <AdmRole>();

            for (int i = 0; i < 5; i++)
            {
                admrole.Add(new AdmRole()
                {
                    CreateTime  = DateTime.Now,
                    Description = i.ToString(),
                    Guid        = Guid.NewGuid().ToString().ToUpper(),
                    IsDelete    = false,
                    RoleName    = "角色" + i.ToString(),
                });
            }
            _dbContext.AdmRole.AddRange(admrole);


            var admUser = new AdmUser()
            {
                UserName        = "******",
                Address         = "杭州",
                DetailedAddress = "滨江聚光中心",
                CreateTime      = DateTime.Now,
                Description     = "测试",
                Email           = "*****@*****.**",
                Guid            = Guid.NewGuid().ToString().ToUpper(),
                IsDelete        = false,
                LastLoginTime   = DateTime.Now,
                Password        = _encryptionAndDecryption.AESEncrypt("123456", _appSetting.EncryptKey),
                Sex             = 0,
                Tel             = "125489654",
                UserAccounts    = "123456",
            };

            _dbContext.AdmUser.Add(admUser);



            List <AdmUserDepartment> admuserdep = new List <AdmUserDepartment>();

            for (int i = 0; i < 3; i++)
            {
                admuserdep.Add(new AdmUserDepartment()
                {
                    AdmDepGuid  = Guid.NewGuid().ToString().ToUpper(),
                    AdmUserGuid = Guid.NewGuid().ToString().ToUpper(),
                    CreateTime  = DateTime.Now,
                    Description = i.ToString(),
                    IsDelete    = false,
                    JurType     = i,
                });
            }
            _dbContext.AdmUserDepartment.AddRange(admuserdep);


            List <AdmDepRole> admdeprole = new List <AdmDepRole>();

            for (int i = 0; i < 3; i++)
            {
                admdeprole.Add(new AdmDepRole()
                {
                    AdmDepGuid  = Guid.NewGuid().ToString().ToUpper(),
                    AdmRoleGuid = Guid.NewGuid().ToString().ToUpper(),
                    CreateTime  = DateTime.Now,
                    Description = i.ToString(),
                    IsDelete    = false,
                    JurType     = i,
                });
            }
            _dbContext.AdmDepRole.AddRange(admdeprole);


            List <AdmRoleJur> admrolejur = new List <AdmRoleJur>();

            for (int i = 0; i < 3; i++)
            {
                admrolejur.Add(new AdmRoleJur()
                {
                    AdmJurGuid  = Guid.NewGuid().ToString().ToUpper(),
                    AdmRoleGuid = Guid.NewGuid().ToString().ToUpper(),
                    CreateTime  = DateTime.Now,
                    Description = i.ToString(),
                    IsDelete    = false,
                    JurType     = i,
                });
            }
            _dbContext.AdmRoleJur.AddRange(admrolejur);
            if (mm == 0)
            {
                mm++;
                int m = _dbContext.SaveChanges();
                return("初始化成功:" + m.ToString());
            }
            else
            {
                return("已初始化");
            }
        }