Example #1
0
        public ActionResult Add()
        {
            int id          = CECRequest.GetQueryInt("id", 0);
            var articleInfo = ArticleService.GetById(id);

            //初始化栏目类别
            var allColumnList = ColumnService.List().ToList();
            var dropdownList  = new List <ColumnInfo>();

            ColumnService.BuildListForTree(dropdownList, allColumnList, 0);
            ViewBag.ColumnDropDownList = dropdownList;

            //输出技术分类
            ViewBag.TechList = TechService.List().Where(m => m.IsDeleted == false);
            //输出行业分类
            ViewBag.IndustryList = IndustryService.List().Where(m => m.IsDeleted == false);

            //已选择的技术分类和行业分类
            ViewBag.SelectTechList     = ArticleService.Article2CategoryListByArticleIdAndType(articleInfo.Id, CatType.Tech);
            ViewBag.SelectIndustryList = ArticleService.Article2CategoryListByArticleIdAndType(articleInfo.Id, CatType.Industry);

            string companyName = string.Empty;

            if (articleInfo.CompanyId > 0)
            {
                //对CompanyName进行赋值
                //数据库中只保存CompanyId,没有保存CompanyName,只能在这里处理一下
                companyName = MemberService.GetBaseCompanyInfo(articleInfo.CompanyId).CompanyName;
            }
            ViewBag.CompanyName = companyName;

            return(View(articleInfo));
        }
Example #2
0
 public IndustryCommands(IndustryService ind, CompanyService com, DataBaseHandlingService db, CommandHandlingService comm, StockMarketService markserv)
 {
     _companyService  = com;
     _dataBaseService = db;
     _commandService  = comm;
     _marketService   = markserv;
     _industryService = ind;
 }
Example #3
0
        //
        // GET: /Category/Industry/

        public ActionResult List()
        {
            var list = IndustryService.List();

            ViewBag.List = list;
            int          id           = Controleng.Common.CECRequest.GetQueryInt("id", 0);
            IndustryInfo industryInfo = null;

            if (id > 0)
            {
                industryInfo = IndustryService.GetById(id);
            }
            return(View(industryInfo));
        }
        public void Init()
        {
            System.Diagnostics.Debug.WriteLine("SetUp");

            context = GenerateNewContext();

            context.Industries.AddRange(industries);
            context.SaveChanges();

            IUnitOfWork     uow     = new UnitOfWork(context);
            IndustryService service = new IndustryService(uow);

            controller = new IndustryController(service);
        }
Example #5
0
        public ActionResult List(IndustryInfo model)
        {
            //检查
            //如果添加,判断别名是否存在
            bool isAdd = true;
            var  list  = IndustryService.List();

            if (model.Id > 0)
            {
                isAdd = false;
            }
            if (isAdd)
            {
                //判断是否别名存在
                if (!string.IsNullOrEmpty(model.Alias))
                {
                    if (list.Where(m => m.Alias == model.Alias).Count() > 0)
                    {
                        ModelState.AddModelError("ALIASEXISTS", "别名存在,请选择其他别名");
                    }
                }
            }
            else
            {
                //编辑,除了自身之外,判断是否存在
                if (!string.IsNullOrEmpty(model.Alias))
                {
                    if (list.Where(m => (m.Alias == model.Alias && m.Id != model.Id)).Count() > 0)
                    {
                        ModelState.AddModelError("ALIASEXISTS", "别名存在,请选择其他别名");
                    }
                }
            }

            if (ModelState.IsValid)
            {
                IndustryService.Create(model);
                ViewBag.Msg = "保存成功";
            }

            list         = IndustryService.List();
            ViewBag.List = list;


            return(View());
        }
        /// <summary>
        ///     Initializes a new instance of the class.
        /// </summary>
        public RegistrationApiController()
        {
            _context = new AllTheSameDbContext();

            _vendorCredentialService = new VendorCredentialService(new UnitOfWork(_context),
                                                                   new VendorCredentialRepository(_context));
            _industryService     = new IndustryService(new UnitOfWork(_context), new IndustryRepository(_context));
            _organizationService = new OrganizationService(new UnitOfWork(_context),
                                                           new OrganizationRepository(_context));
            _orgTypeService      = new OrgTypeService(new UnitOfWork(_context), new OrgTypeRepository(_context));
            _vendorService       = new VendorService(new UnitOfWork(_context), new VendorRepository(_context));
            _vendorTypeService   = new VendorTypeService(new UnitOfWork(_context), new VendorTypeRepository(_context));
            _vendorAdminService  = new VendorAdminService(new UnitOfWork(_context), new VendorAdminRepository(_context));
            _vendorWorkerService = new VendorWorkerService(new UnitOfWork(_context),
                                                           new VendorWorkerRepository(_context));
            _vendorCredDocumentService = new VendorCredDocumentService(new UnitOfWork(_context),
                                                                       new VendorCredDocumentRepository(_context));

            _addressService = new AddressService(new UnitOfWork(_context), new AddressRepository(_context));

            //var vendorCredentialList = _context.VendorCredentials;
            //var industryList = _context.Industries;
            //var organizationList = _context.Organizations;
            //var orgTypeList = _context.OrgTypes;
            //var vendorList = _context.Vendors;
            //var vendorTypeList = _context.VendorTypes;
            //var vendorAdminList = _context.VendorAdmins;
            //var vendorWorkerList = _context.VendorWorkers;
            //var vendorCredDocumentList = _context.VendorCredDocuments;

            //var addressList = _context.Addresses;

            //var c = Repository<Person>.Instance.Count;
            //var c2 = Repository<Person>.Instance.Count;
            //var s = new ServiceProxy<Person,IPersonRepository>().Count;
        }
Example #7
0
 public IndustryController(IndustryService IndustryService)
 {
     this._industryService = IndustryService;
 }
Example #8
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="service"></param>
 /// <param name="logger"></param>
 public IndustryController(IndustryService service, ILogger <IndustryController> logger)
 {
     _Service = service;
     _logger  = logger;
 }
Example #9
0
        public ActionResult Add(ArticleInfo oldModel, FormCollection fc)
        {
            bool isAdd = true;

            if (oldModel.Id > 0)
            {
                isAdd = false;
            }
            if (ModelState.IsValid)
            {
                //TODO
                //在这,最好检查一下标题是否重复,目前没做
                oldModel.AddUserName        = User.Identity.Name;
                oldModel.LastModifyUserName = User.Identity.Name;
                oldModel.CategoryId         = Utils.StrToInt(fc["select_column"], 0);

                //改变URL
                oldModel.Url = oldModel.QuickLinkUrl;
                if (string.IsNullOrEmpty(oldModel.Url))
                {
                    oldModel.Url = string.Format("/article/show/{0}.html", oldModel.TimeSpan);
                }

                oldModel = ArticleService.Create(oldModel);

                //插入到Article2Category表中
                //1,技术分类
                var        requestTechListArray = CECRequest.GetFormString("cbtechlist").Split(',');
                List <int> techList             = new List <int>();
                foreach (string item in requestTechListArray)
                {
                    int id = Utils.StrToInt(item, 0);
                    if (id > 0)
                    {
                        techList.Add(id);
                    }
                }
                ArticleService.InsertArticle2Category(oldModel.Id, CatType.Tech, techList);
                //2,行业分类
                var        requestIndustryList = CECRequest.GetFormString("cbindustrylist").Split(',');
                List <int> industryList        = new List <int>();
                foreach (string item in requestIndustryList)
                {
                    int id = Utils.StrToInt(item, 0);
                    if (id > 0)
                    {
                        industryList.Add(id);
                    }
                }
                ArticleService.InsertArticle2Category(oldModel.Id, CatType.Industry, industryList);


                //完成,提示信息
                if (isAdd)
                {
                    ViewBag.Msg = "添加成功!<a href=\"add\">继续?</a><span class=\"ml10\">或</span><a href=\"list\" class=\"ml10\">返回</a>";
                }
                else
                {
                    ViewBag.Msg = "修改成功!<a href=\"add\">添加新文章?</a><span class=\"ml10\">或</span><a href=\"list\" class=\"ml10\">返回</a>";
                }
            }

            //初始化栏目类别
            //初始化栏目类别
            var allColumnList = ColumnService.List().ToList();
            var dropdownList  = new List <ColumnInfo>();

            ColumnService.BuildListForTree(dropdownList, allColumnList, 0);
            ViewBag.ColumnDropDownList = dropdownList;

            //输出技术分类
            ViewBag.TechList = TechService.List().Where(m => m.IsDeleted == false);
            //输出行业分类
            ViewBag.IndustryList = IndustryService.List().Where(m => m.IsDeleted == false);

            //已选择的技术分类和行业分类
            ViewBag.SelectTechList     = ArticleService.Article2CategoryListByArticleIdAndType(oldModel.Id, CatType.Tech);
            ViewBag.SelectIndustryList = ArticleService.Article2CategoryListByArticleIdAndType(oldModel.Id, CatType.Industry);

            string companyName = string.Empty;

            if (oldModel.CompanyId > 0)
            {
                //对CompanyName进行赋值
                //数据库中只保存CompanyId,没有保存CompanyName,只能在这里处理一下
                companyName = MemberService.GetBaseCompanyInfo(oldModel.CompanyId).CompanyName;
            }
            ViewBag.CompanyName = companyName;

            return(View(oldModel));
        }