Beispiel #1
0
        public JsonResult GetDeptTreeView()
        {
            var res    = new DeptRepository();
            var result = res.GetDeptTreeView();

            return(result.Any() ? Json(result, JsonRequestBehavior.AllowGet) : null);
        }
Beispiel #2
0
        public JsonResult GetId(int id)
        {
            var res    = new DeptRepository();
            var result = res.GetId(id);

            return(result.Any() ? Json(result, JsonRequestBehavior.AllowGet) : Json("", JsonRequestBehavior.AllowGet));
        }
 public TicketController()
 {
     db = DB.Entities;
     _ticketRepository = new TicketRepository(db);
     _deptRepository = new DeptRepository(db);
     _ticketDetailRepository = new TicketDetailRepository(db);
     _ticketUserRepository = new TicketUserRepository(db);
 }
 public RequestBillController()
 {
     db = DB.Entities;
     _checkoutRepository = new CheckoutRepository(db);
     _deptRepository = new DeptRepository(db);
     _checkoutDetailRepository = new CheckoutDetailsRepository(db);
     _ticketRepository = new TicketRepository(db);
 }
        /// <summary>
        /// Get a specify Dept
        /// </summary>
        /// <param name="Id">The Dept id</param>
        /// <returns>A specify Dept</returns>
        public Dept GetDeptById(int id)
        {
            var dept = DeptRepository.GetDepts().Where(m => m.Id.Equals(id)).FirstOrDefault();

            if (dept != null)
            {
                dept.Name   = "Microsoft";
                dept.Remark = "Microsoft";
            }
            return(dept);
        }
        public ActionResult Dept()
        {
            var vm = new DeptViewModel();

            vm.Department = new DeptRepository().GetAll();
            vm.DeptList   = new List <SelectListItem>();
            vm.Department.ForEach(x => vm.DeptList.Add(new SelectListItem()
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }));

            var m = new DeptRepository().GetAllDeptWithSubDept();

            return(View(vm));
        }
Beispiel #7
0
        public JsonResult GetDeptTreeViewFilter()
        {
            var res    = new DeptRepository();
            var result = res.GetDeptTreeView();

            result.Insert(0, new DeptModel()
            {
                Code        = "",
                Children    = null,
                DelFlag     = false,
                DeptCode    = "",
                EnName      = "Select One",
                HasChildren = false,
                Id          = ""
            });
            return(result.Any() ? Json(result, JsonRequestBehavior.AllowGet) : null);
        }
        private void RegisterRepositories(IMapper mapper)
        {
            For <ApplicationDbContext>().Use <ApplicationDbContext>();
            Func <DbContext> contextCreator = () => new ApplicationDbContext() as DbContext;

            //  Injection For Employee Service

            GenericRepository <Employee> EmployeeGenericRepository = new GenericRepository <Employee>(contextCreator);
            EmployeeRepository           employeeRepository        = new EmployeeRepository(EmployeeGenericRepository);

            For <EmployeeService>().Use <EmployeeService>()
            .Ctor <EmployeeRepository>().Is(employeeRepository)
            .Ctor <IMapper>().Is(mapper);

            //inject Department Service
            GenericRepository <Department> DepartmentGenericRepository = new GenericRepository <Department>(contextCreator);
            DeptRepository deptRepository = new DeptRepository(DepartmentGenericRepository);

            For <DeptService>().Use <DeptService>()
            .Ctor <DeptRepository>().Is(deptRepository)
            .Ctor <IMapper>().Is(mapper);
        }
 public DeptController()
 {
     var db = DB.Entities;
     _deptRepository = new DeptRepository(db);
 }
Beispiel #10
0
        public static void CreateDept(SysMessageLog Message, ApplicationDbContext DataAccess)
        {
            try
            {
                Message.Prefix            = "新增「部門」-初始資料:";
                using DeptRepository repo = new DeptRepository(DataAccess)
                      {
                          User = SystemOperator.SysOperator, Message = Message
                      };
                List <DeptSet> depts = new List <DeptSet>()
                {
                    new DeptSet()
                    {
                        Dept = new DeptModel()
                        {
                            DeptId = "0019", DeptName = "中正分行", IsBranch = true
                        }
                    },
                    new DeptSet()
                    {
                        Dept = new DeptModel()
                        {
                            DeptId = "0028", DeptName = "東台北分行", IsBranch = true
                        }
                    },
                    new DeptSet()
                    {
                        Dept = new DeptModel()
                        {
                            DeptId = "0037", DeptName = "龍山分行", IsBranch = true
                        }
                    },
                    new DeptSet()
                    {
                        Dept = new DeptModel()
                        {
                            DeptId = "0046", DeptName = "西園分行", IsBranch = true
                        }
                    },
                    new DeptSet()
                    {
                        Dept = new DeptModel()
                        {
                            DeptId = "0055", DeptName = "西門分行", IsBranch = true
                        }
                    },
                };

                depts.ForEach(dept =>
                {
                    if (null == repo.QueryData(new[] { dept.Dept.DeptId }))
                    {
                        repo.Create(dept);
                    }
                });
                repo.CommitData(FuncAction.Create);
            }
            finally
            {
                Message.Prefix = string.Empty;
            }
        }
Beispiel #11
0
 public DeptService(DeptRepository repo, IMapper mapper)
 {
     _repo   = repo;
     _mapper = mapper;
 }
 //public string Get()
 //{
 //    return "Welcome To Web API";
 //}
 //public List<string> Get(int Id)
 //{
 //    return new List<string> {
 //        "Hello1",
 //        "Welcome To Web API"
 //    };
 //}
 /// <summary>
 /// Get All Dept
 /// </summary>
 /// <returns>All Dept List</returns>
 public List <Dept> GetAll()
 {
     return(DeptRepository.GetDepts());
 }
 public DeptController(DeptRepository deptRep)
 {
     ViewBag.FirstNavigate = "权限管理";
     this.deptRep = deptRep;
 }