Esempio n. 1
0
 public DeptListVM()
 {
     ResultList            = new List <ListRow>();
     Input                 = new ListInput(5);
     Input.OrderExpression = Dept.DefaultSortString;
     EditInput             = new DeptEditVM.EditInput();
 }
Esempio n. 2
0
        private int Save(DeptEditVM.EditInput input, bool changeDeptFunc)
        {
            Dept dept;

            if (input.Id == 0)
            {
                dept       = new Dept();
                dept.Corp  = GetLoginCorp();
                dept.Funcs = new DomainList <Func>();
            }
            else
            {
                dept = DeptBD.Get(input.Id);
            }
            if (!AdminCode.Equals(dept.Code, StringComparison.OrdinalIgnoreCase))
            {
                dept.Code = input.Code;
            }
            dept.Name = input.Name;
            if (IsAdmin() && changeDeptFunc)
            {
                dept.Funcs.Clear();
                if (!string.IsNullOrEmpty(input.DeptFuncIds))
                {
                    Array.ForEach(input.DeptFuncIds.Split(','), o => dept.Funcs.Add(FuncBD.Get(int.Parse(o))));
                }
            }
            DeptBD.Save(dept);
            return(dept.Id);
        }