Пример #1
0
        public CoolUserListModel PrepareCoolUserListModel(CoolUserListModel model, List <CoolUser> coolUsers)
        {
            foreach (var c in coolUsers)
            {
                CoolUserModel ccm = new CoolUserModel();
                ccm = PrepareCoolUserModel(ccm, c);
                model.Items.Add(ccm);
            }
            model.AvailableCompanies = _coolComService.GetAll().Select(k => new SelectListItem {
                Text = k.Id, Value = k.Id
            }).ToList();

            return(model);
        }
Пример #2
0
        public CoolQueryModel PrepareCoolQueryModel(CoolQueryModel model, CoolQuery coolQuery, bool fillAvailableCompanies = false, bool fillAvailableDirections = false)
        {
            model.Id                 = coolQuery.Id;
            model.CompanyId          = coolQuery.CoolComId;
            model.Description        = coolQuery.Description;
            model.QueryCode          = coolQuery.QueryCode;
            model.CoolQueryDirection = coolQuery.CoolQueryDirection;
            model.Query              = coolQuery.Query;
            model.CreatedDate        = coolQuery.CreatedDate;

            if (fillAvailableCompanies)
            {
                model.AvailableCompanies = _coolComService.GetAll().Select(k => new SelectListItem {
                    Text = k.Id, Value = k.Id
                }).ToList();
            }

            if (fillAvailableDirections)
            {
                model.AvailableDirections = Enum.GetValues(typeof(CoolQueryDirection)).Cast <CoolQueryDirection>().Select(v => new SelectListItem
                {
                    Text  = v.ToString(),
                    Value = ((int)v).ToString()
                }).ToList();
            }

            return(model);
        }
Пример #3
0
        private CoolAppModel PrepareCoolAppModel(CoolAppModel model, CoolApp coolApp, bool fillAvailableCompanies = false)
        {
            model.Id            = coolApp.Id;
            model.AppCode       = coolApp.AppCode;
            model.CompanyId     = coolApp.CoolComId;
            model.CoolCompanyId = coolApp.CoolCompanyId;
            model.Image         = "<span class=\"avatar avatar-online\"><img src=\"" + _erpManagerSettings.AppPicturePath + coolApp.Id + "\"/></span>";
            if (fillAvailableCompanies)
            {
                model.AvailableCompanies = _coolComService.GetAll().Select(k => new SelectListItem {
                    Text = k.Id, Value = k.Id
                }).ToList();
            }

            return(model);
        }