Example #1
0
        }//end static method

        public static Context CreateInstanceFromCache(this Context ctx, string dataCenterId, long userId)
        {
            Context contextByDataCenterId = DataCenterService.GetDataCenterContextFromCache(dataCenterId);

            //处理用户登录名
            {
                FormMetadata metadata     = FormMetaDataCache.GetCachedFormMetaData(contextByDataCenterId, FormIdConst.SEC_User);
                BusinessInfo businessInfo = metadata.BusinessInfo.GetSubBusinessInfo(new List <string> {
                    "FNumber", "FUserAccount", "FName"
                });
                DynamicObject dataObject = BusinessDataServiceHelper.LoadFromCache(contextByDataCenterId, new object[] { userId }, businessInfo.GetDynamicObjectType()).FirstOrDefault();
                contextByDataCenterId.UserId = dataObject.PkId <long>();
                if (businessInfo.GetField("FNumber") != null)
                {
                    contextByDataCenterId.LoginName = dataObject.FieldProperty <string>(businessInfo.GetField("FNumber"));
                }
                if (businessInfo.GetField("FUserAccount") != null)
                {
                    contextByDataCenterId.LoginName = dataObject.FieldProperty <string>(businessInfo.GetField("FUserAccount"));
                }
                contextByDataCenterId.UserName = dataObject.FieldProperty <string>(businessInfo.GetField("FName"));
            }

            return(contextByDataCenterId);
        }//end static method
 public useradminController(IAccountRepository _rightRepository, IDataCenterRepository _datacenterRepository, IMaterialRepository _materialRepository, ICostanalysisRepository _costanalysisRepository)
 {
     accountService      = new AccountService(_rightRepository);
     centerService       = new DataCenterService(_datacenterRepository);
     materialService     = new MaterialService(_materialRepository);
     costanalysisService = new CostanalysisService(_costanalysisRepository);
 }
Example #3
0
 public HomeController(IDataCenterRepository _centerRepository, IMaterialRepository _materialRepository, IAccountRepository _rightRepository, IManagementRepository _managementRepository)
 {
     centerService = new DataCenterService(_centerRepository);
     accountService = new AccountService(_rightRepository);
     materialService = new MaterialService(_materialRepository);
     managementService = new ManagementService(_managementRepository);
 }
Example #4
0
        public virtual ServiceResult Invoke(string featureId = "")
        {
            var result = new ServiceResult <List <DataCenterInfoOutput> >();

            try
            {
                bool   flag = DataCenterService.IsDeployAsPublicCloud(this.KDContext.Session.AppContext);
                string host = flag ? this.KDContext.WebContext.Context.Request.Url.Host : string.Empty;

                var infos = DataCenterService.GetDataCentersFromMC(string.Empty, Context.DataBaseCategory.Normal, string.Empty, host);
                if (!featureId.IsNullOrEmptyOrWhiteSpace() && infos.Any())
                {
                    var ctx = this.KDContext.Session.AppContext;
                    ctx = ctx.CreateAdministratorFromCache(infos.First().Id);
                    FeatureVerifier.CheckFeature(ctx, featureId);
                }//end if

                result.Code    = (int)ResultCode.Success;
                result.Message = ResultCode.Success.ToString();
                result.Data    = infos.Select(db => new DataCenterInfoOutput
                {
                    Id     = db.Id,
                    Number = db.Number,
                    Name   = db.Name
                }).ToList();
            }
            catch (Exception ex)
            {
                result.Code    = (int)ResultCode.Fail;
                result.Message = ex.Message;
            }
            return(result);
        } //end method
Example #5
0
 public useradminController(IAccountRepository _rightRepository, IDataCenterRepository _datacenterRepository, IMaterialRepository _materialRepository, ICostanalysisRepository _costanalysisRepository)
 {
     accountService = new AccountService(_rightRepository);
     centerService = new DataCenterService(_datacenterRepository);
     materialService = new MaterialService(_materialRepository);
     costanalysisService = new CostanalysisService(_costanalysisRepository);
 }
Example #6
0
 public HomeController(IDataCenterRepository _centerRepository, IMaterialRepository _materialRepository, IAccountRepository _rightRepository, IManagementRepository _managementRepository)
 {
     centerService     = new DataCenterService(_centerRepository);
     accountService    = new AccountService(_rightRepository);
     materialService   = new MaterialService(_materialRepository);
     managementService = new ManagementService(_managementRepository);
 }
Example #7
0
        }//end static method

        public static Context CreateAdministratorFromCache(this Context ctx, string dataCenterId)
        {
            Context contextByDataCenterId = DataCenterService.GetDataCenterContextFromCache(dataCenterId);

            contextByDataCenterId.UserId   = FormConst.AdministratorID;
            contextByDataCenterId.UserName = "******";
            return(contextByDataCenterId);
        }//end static method
Example #8
0
        /// <summary>
        /// Gets the network limits.
        /// </summary>
        /// <returns>The network limits</returns>
        public Task <NetworkLimits> GetNetworkLimits(CancellationToken cancellationToken)
        {
            if (!HasNetworkLimits)
            {
                return(null);
            }

            return(DataCenterService.GetNetworkLimitsByLink(string.Format("{0}{1}", Configuration.BaseUri, networkLimitsLink.Value.Href), cancellationToken));
        }
        public void GetAcceptOffNameByIdTest()
        {
            DataCenterService        target        = new DataCenterService(); // TODO: Initialize to an appropriate value
            string                   acceptOffCode = "111";                   // TODO: Initialize to an appropriate value
            ResponseService <string> expected      = null;                    // TODO: Initialize to an appropriate value
            ResponseService <string> actual;

            actual = target.GetAcceptOffNameById(acceptOffCode);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #10
0
        public void GetCompanyNameByIdToTextTest()
        {
            DataCenterService        target   = new DataCenterService(); // TODO: Initialize to an appropriate value
            string                   compCode = string.Empty;            // TODO: Initialize to an appropriate value
            ResponseService <string> expected = null;                    // TODO: Initialize to an appropriate value
            ResponseService <string> actual;

            actual = target.GetCompanyNameByIdToText(compCode);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #11
0
        public void GetTitleNameFromSexTest()
        {
            DataCenterService target = new DataCenterService();  // TODO: Initialize to an appropriate value
            string            sex    = "M";                      // TODO: Initialize to an appropriate value
            ResponseService <List <TitleName> > expected = null; // TODO: Initialize to an appropriate value
            ResponseService <List <TitleName> > actual;

            actual = target.GetTitleNameFromSex(sex);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #12
0
        public void GetSpecialDocTypeTest()
        {
            DataCenterService target      = new DataCenterService();   // TODO: Initialize to an appropriate value
            string            docStatus   = "A";                       // TODO: Initialize to an appropriate value
            string            trainStatus = "Y";                       // TODO: Initialize to an appropriate value
            ResponseService <List <SpecialDocument> > expected = null; // TODO: Initialize to an appropriate value
            ResponseService <List <SpecialDocument> > actual;

            actual = target.GetSpecialDocType(docStatus, trainStatus);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #13
0
        }//end constructor

        /// <summary>
        /// 获取业务数据中心。
        /// </summary>
        /// <returns>返回服务端结果。</returns>
        public virtual ServiceResult <List <object> > GetDataCenterList()
        {
            var result = new ServiceResult <List <object> >();

            try
            {
                var infos = DataCenterService.GetDataCentersFromMC(string.Empty, Context.DataBaseCategory.Normal);

                result.Code    = (int)ResultCode.Success;
                result.Message = string.Format("成功返回{0}个数据中心!", infos.Count);
                result.Data    = infos.Select(db => new
                {
                    Id     = db.Id,
                    Number = db.Number,
                    Name   = db.Name
                }).Cast <object>().ToList();
            }
            catch (Exception ex)
            {
                result.Code    = (int)ResultCode.Fail;
                result.Message = ex.Message;
            }
            return(result);
        } //end method
Example #14
0
 public performanceController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
Example #15
0
 public processparaController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
 public datacenterController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
Example #17
0
 public datacenterController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
Example #18
0
 public waterqualityController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
 public performanceController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
 public processparaController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
Example #21
0
 public waterregulaController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
Example #22
0
 public waterqualityController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
 public waterregulaController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
Example #24
0
 public partialpageController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }
 public partialpageController(IDataCenterRepository _centerRepository)
 {
     centerService = new DataCenterService(_centerRepository);
 }