Example #1
0
        public ActionResult DeleteDetails(string id)
        {
            IOrgDao orgDao = _factory.CreateOrgDao();
            Org     org    = orgDao.Get(id);

            return(View(org));
        }
Example #2
0
        public ActionResult Edit(string id)
        {
            IOrgDao orgDao = _factory.CreateOrgDao();
            Org     org    = orgDao.Get(id);

            ViewData["ParentOrg"] = org.Parent;
            return(View(new OrgModel(org)));
        }
Example #3
0
        public ActionResult Delete(string id, string parentId)
        {
            IOrgDao orgDao = _factory.CreateOrgDao();
            Org     org    = orgDao.Get(id);

            orgDao.Delete(org);
            return(RedirectToAction("Index", new { id = parentId }));
        }
Example #4
0
        public ActionResult Details(string id)
        {
            IOrgDao      orgDao = _factory.CreateOrgDao();
            Org          org    = orgDao.Get(id);
            IList <User> users  = _factory.CreateUserDao().GetUsers(org);

            ViewData["ParentOrg"] = org.Parent;
            return(View(new OrgDetailsModel(org, users)));
        }
Example #5
0
        /// <summary>
        /// </summary>
        /// <param name="dao"></param>
        /// <exception cref="ArgumentNullException">dao is null.</exception>
        public void Save(IOrgDao dao)
        {
            if (dao == null)
            {
                throw new ArgumentNullException("dao");
            }
            Org ug = !String.IsNullOrEmpty(Id) ? dao.Get(Id) : new Org(Name);

            ug.Name    = Name;
            ug.Remarks = Remark;
            dao.SaveOrUpdate(ug);
            dao.Flush();
            if (Parent != null)
            {
                IOrgCollection list = Parent.Childs;
                list.Add(ug);
                dao.SaveOrUpdate(Parent);
            }
        }
Example #6
0
 /// <summary>
 /// </summary>
 /// <param name="dao"></param>
 /// <exception cref="ArgumentNullException">dao is null.</exception>
 public void Save(IOrgDao dao)
 {
     if (dao == null)
         throw new ArgumentNullException("dao");
     Org ug = !String.IsNullOrEmpty(Id) ? dao.Get(Id) : new Org(Name);
     ug.Name = Name;
     ug.Remarks = Remark;
     dao.SaveOrUpdate(ug);
     dao.Flush();
     if (Parent != null)
     {
         IOrgCollection list = Parent.Childs;
         list.Add(ug);
         dao.SaveOrUpdate(Parent);
     }
 }