Exemplo n.º 1
0
        public ActionResult RegisterSoft(string regkey)
        {
            try
            {
                RegInfo regInfo = ReginfoRepository.Common.GetKeyInfo(false, regkey);
                var result = ReginfoRepository.Common.ValidRegInfo(regInfo);

                if (!result.IsValid)
                {
                    return JsonError(result.Message);
                }

                //判断是否在允许导入范围内
                DateTime tmCurrent = DateTime.Now;

                if (regInfo.ImportEndTime.CompareTo(tmCurrent) < 0)
                {
                    return JsonError("注册码无法导入!");
                }

                if (regInfo.ImportStartTime.CompareTo(tmCurrent) > 0)
                {
                    return JsonError("注册码无法导入!");
                }

                Company company = null;
                var list = CompanyRepository.GetAll();
                if (list != null && list.Count > 0)
                {
                    company = list[0];
                }
                if (company == null)
                {
                    company = new Company();
                }

                company.CodeNo = regInfo.CompanyCode;
                company.Name = regInfo.CompanyName;
                company.RegKey = regkey;

                CompanyRepository.SaveOrUpdate(company);
            }
            catch (Exception ex)
            {
                return JsonError(ex.Message);
            }

            return JsonSuccess();
        }
Exemplo n.º 2
0
        public ActionResult SaveOrUpdate(Company company)
        {
            try
            {
                if (company.Id > 0)
                {
                    company = this.CompanyRepository.Get(company.Id);
                    TryUpdateModel(company);
                }

                CompanyRepository.SaveOrUpdate(company);
            }
            catch (Exception ex)
            {
                return JsonError(ex.Message);
            }

            return JsonSuccess();
        }
Exemplo n.º 3
0
        public ActionResult SysConfig()
        {
            Company company = null;

            var list = CompanyRepository.GetAll();
            if (list != null && list.Count > 0)
            {
                company = list[0];
            }

            if (company == null)
            {
                company = new Company();
            }

            return View(company);
        }