Example #1
0
        public IHttpActionResult Get(int DeptId)
        {
            DeptService deptService = CreateDeptService();
            var         dept        = deptService.GetDeptById(DeptId);

            return(Ok(dept));
        }
 private void UpdateDept()
 {
     int          id     = 1;
     IDeptService cs     = new DeptService();
     var          data   = cs.GetDeptById(id);
     var          result = cs.UpdateSingleDept(data);
 }
Example #3
0
        public IHttpActionResult Get()
        {
            DeptService deptService = CreateDeptService();
            var         depts       = deptService.GetDepts();

            return(Ok(depts));
        }
        public ActionResult Save(int?id, int?deptId, string deptName)
        {
            var obj = new SysUser()
            {
                DeptId = deptId.GetValueOrDefault(), Sex = -1
            };

            if (id.HasValue)
            {
                obj = UserService.Get(id.Value);
                if (obj.DeptId > 0)
                {
                    deptName = DeptService.GetFullTitle().GetValue(obj.DeptId);
                    deptId   = obj.DeptId;
                }
            }
            ViewBag.DeptName = deptName;
            ViewBag.Roles    = RoleService.GetRolesByDept(deptId.GetValueOrDefault(), id.HasValue).Select(o => new SelectListItem()
            {
                Text = o.Title, Value = o.RoleId.ToString()
            }).ToList();
            ViewBag.Posits = ListToSelect(PositService.GetPositByDept(deptId.GetValueOrDefault()).Select(o => new SelectListItem()
            {
                Text = o.Title, Value = o.PositId
            }), "请选择");
            return(View(obj));
        }
Example #5
0
 public DeptService getDeptService()
 {
     if (deptService == null)
     {
         deptService = new DeptServiceImpl();
     }
     return deptService;
 }
        public ActionResult Index(DeptVM vm, string Selected)
        {
            DeptService deptService = new DeptService();

            vm.Employees   = deptService.getEmployeesByDeptNo(Convert.ToInt32(Selected));
            vm.Departments = deptService.Departments;

            return(View(vm));
        }
        // GET: Dept
        public ActionResult Index()
        {
            DeptService deptServices = new DeptService();
            DeptVM      deptMV       = new DeptVM {
                Employees = deptServices.Employees, Departments = deptServices.Departments
            };

            return(View(deptMV));
        }
Example #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DeptService d = new DeptService();
         repeaterDept.DataSource = d.GetAllDepartment();
         repeaterDept.DataBind();
     }
 }
Example #9
0
        public async Task <PageResult> GetPageListAsync(int deptId, PageOption pageOption, string strSearch = null)
        {
            Expression <Func <Sys_User, bool> > exp = p => true;

            if (!string.IsNullOrEmpty(strSearch))
            {
                exp = exp.And(p =>
                              p.ID.ToString().Contains(strSearch) ||
                              p.Name.Contains(strSearch) ||
                              p.LoginName.Contains(strSearch) ||
                              p.Code.Contains(strSearch));
            }
            IQueryable <UserDto> query = null;

            if (deptId == 0)
            {
                query = from user in _unitOfWork.SysUserRep.Query.Where(exp)
                        join i in _unitOfWork.SysDeptRep.Query
                        on user.DeptID equals i.ID into list
                        from dept in list.DefaultIfEmpty()
                        select new UserDto
                {
                    UserID    = user.ID,
                    UserName  = user.Name,
                    DeptID    = user.DeptID,
                    DeptName  = dept.Name,
                    Code      = user.Code,
                    LoginName = user.LoginName,
                    Sex       = user.Sex,
                    Remark    = user.Remark
                };
            }
            else
            {
                var deptService = new DeptService(_unitOfWork);
                var deptList    = new List <DeptDto>();
                deptList.Add(deptService.Init(deptId).Data);
                deptService.GetDeptByParentId(deptList, deptId);
                query = from user in _unitOfWork.SysUserRep.Query.Where(exp)
                        join dept in deptList
                        on user.DeptID equals dept.DeptID
                        select new UserDto
                {
                    UserID    = user.ID,
                    UserName  = user.Name,
                    DeptID    = user.DeptID,
                    DeptName  = dept.DeptName,
                    Code      = user.Code,
                    LoginName = user.LoginName,
                    Sex       = user.Sex,
                    Remark    = user.Remark
                };
            }
            return(await query.ToPageResultAsync(pageOption));
        }
        public ActionResult SaveDept()
        {
            int count = 0;

            ViewBag.depts = ListToSelect(DeptService.GetFullTitle().Select(o => new SelectListItem()
            {
                Text = o.Value, Value = o.Key.ToString()
            }), emptyTitle: "请选择");
            ViewBag.grids = UserService.GetPageList(Request.Params, out count).ToJson();
            return(View());
        }
Example #11
0
 private void InitForm()
 {
     this.CurrModalityCode = LocalConfiguration.Instance.DefaultModalityCode;
     this.SexList = UISex.FromEntities(SexService.GetSexList());
     this.ExamTypeList = UIExamType.FromEntities(ExamTypeService.GetExamTypeList());
     this.ModalityList = UIModality.FromEntities(ModalityService.GetModalityList());
     this.DepartmentList = UIDept.FromEntities(DeptService.GetDeptList());
     this.ReportUserList = UIUser.FromEntities(UserService.GetUserList());
     this.ReviewUserList = UIUser.FromEntities(UserService.GetUserList());
     this.PatientSourceList = UIPatientList.FromEntities(PatientSourceService.GetPatientSourceList());
 }
Example #12
0
 public InitController(
     DeptService deptService,
     ProjService projService,
     UserService userService,
     InitService initService
     )
 {
     _deptService = deptService;
     _projService = projService;
     _userService = userService;
     _initService = initService;
 }
        private void AddDept()
        {
            DeptModel data = new DeptModel();

            data.CompanyID   = 2;
            data.DeptName    = "test";
            data.UpperDeptID = 1;
            data.DeptRemark  = "test";
            data.SortID      = 0;
            IDeptService cs     = new DeptService();
            var          result = cs.InsertSingleDept(data);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var         deptid  = Convert.ToInt32(Request.QueryString["ID"]);
         DeptService service = new DeptService();
         var         dept    = service.GetDeptById(deptid);
         lbName.Text         = dept.Name;
         lbBudget.Text       = dept.Budget;
         lbStartDate.Text    = dept.StartDate.ToLongDateString();
         lbInstructorId.Text = dept.InstructorId.ToString();
         lbRowVersion.Text   = dept.RowVersion;
     }
 }
Example #15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Contoso.Model.Department dept = new Contoso.Model.Department
            {
                Name         = txtName.Text,
                Budget       = TxtBudget.Text,
                StartDate    = Convert.ToDateTime(TxtStartDate.Text),
                InstructorId = Convert.ToInt32(TxtInstructorId.Text),
                RowVersion   = TxtRowVersion.Text
            };
            DeptService service = new DeptService();

            service.SaveDepartment(dept);
        }
        public ActionResult GetDepts(int pageIndex, int pageSize, string keyWord)
        {
            var service  = new DeptService();
            var pageData = service.GetList(pageIndex, pageSize, keyWord);
            var count    = service.GetCout(keyWord);
            var result   = new LayPadding <DeptEntity>()
            {
                result = true,
                msg    = "success",
                list   = pageData,
                count  = count
            };

            return(Content(result.ToJson()));
        }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var         deptid            = Convert.ToInt32(Request.QueryString["ID"]);
                DeptService service           = new DeptService();
                Contoso.Model.Department dept = service.GetDeptById(deptid);

                txtName.Text         = dept.Name;
                TxtBudget.Text       = dept.Budget;
                TxtStartDate.Text    = dept.StartDate.ToString();
                TxtInstructorId.Text = dept.InstructorId.ToString();
                TxtRowVersion.Text   = dept.RowVersion;
            }
        }
        public ActionResult FindTreeList()
        {
            var list  = DeptService.GetPageList(false);
            var trees = new List <DepartMentExt>()
            {
                new DepartMentExt()
                {
                    DeptId    = 0,
                    Title     = "组织机构",
                    Childrens = new List <DepartMentExt>()
                }
            };

            trees[0].Childrens.AddRange(list);
            return(new JsonNetResult(trees));
        }
Example #19
0
        public override IResponseMessageBase OnTextRequest(RequestMessageText requestMessage)
        {
            var responseMessage = base.CreateResponseMessage <ResponseMessageText>();

            if (requestMessage.Content == null)
            {
                responseMessage.Content = "您没有发送任何消息内容!";
            }
            else if (requestMessage.Content == "帮助")
            {
                responseMessage = HelpService.GetResponseMessage(requestMessage);
            }
            else if (requestMessage.Content == "科室")
            {
                responseMessage = DeptService.GetResponseMessage(requestMessage);
            }
            return(responseMessage);
        }
Example #20
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                Contoso.Model.Department dt = new Contoso.Model.Department
                {
                    Id           = Convert.ToInt32(Request.QueryString["id"]),
                    Name         = txtName.Text,
                    Budget       = TxtBudget.Text,
                    StartDate    = Convert.ToDateTime(TxtStartDate.Text),
                    InstructorId = Convert.ToInt32(TxtInstructorId.Text),
                    RowVersion   = TxtRowVersion.Text,
                };

                DeptService service = new DeptService();
                service.UpdateDept(dt);
            }
        }
Example #21
0
        protected void repeaterDept_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var deptid = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "Edit")
            {
                Response.Redirect("EditDept.aspx?id=" + deptid);
            }

            if (e.CommandName == "Delete")
            {
                DeptService service = new DeptService();
                service.DeleteDepartment(deptid);
                Response.Redirect("DeptList.aspx");
            }

            if (e.CommandName == "Details")
            {
                Response.Redirect("DetailDept.aspx?id=" + deptid);
            }
        }
 public DeptController(DeptService service)
 {
     _service = service;
 }
Example #23
0
 public static int Edit(Dept de)
 {
     return(DeptService.Edit(de));
 }
Example #24
0
 public static IQueryable GetById(int id)
 {
     return(DeptService.GetById(id));
 }
Example #25
0
 public static int Add(Dept de)
 {
     return(DeptService.Add(de));
 }
Example #26
0
 public static int dele(Dept dd)
 {
     return(DeptService.dele(dd));
 }
Example #27
0
 public static int Del(int DeptId)
 {
     return(DeptService.Del(DeptId));
 }
Example #28
0
 public static int GetRows()
 {
     return(DeptService.GetRows());
 }
Example #29
0
 public static Model.Huang.PageList PageListDemo(int pageindex, int pagesize)
 {
     return(DeptService.PageListDemo(pageindex, pagesize));
 }
 public ManageDepartment()
 {
     deptService = new DeptService();
 }
Example #31
0
 public static IQueryable queryDept()
 {
     return(DeptService.queryDept());
 }