public static bool IsPresent(SystemParameter enumVal)
        {
            switch (enumVal)
            {
                case SystemParameter.DropShadow:
                    return Feature.OnXp;

                case SystemParameter.FlatMenu:
                    return Feature.OnXp;

                case SystemParameter.FontSmoothingContrastMetric:
                    return Feature.OnXp;

                case SystemParameter.FontSmoothingTypeMetric:
                    return Feature.OnXp;

                case SystemParameter.MenuFadeEnabled:
                    return Feature.OnWin2k;

                case SystemParameter.SelectionFade:
                    return Feature.OnWin2k;

                case SystemParameter.ToolTipAnimationMetric:
                    return Feature.OnWin2k;

                case SystemParameter.UIEffects:
                    return Feature.OnWin2k;

                case SystemParameter.CaretWidthMetric:
                    return Feature.OnWin2k;

                case SystemParameter.VerticalFocusThicknessMetric:
                    return Feature.OnXp;

                case SystemParameter.HorizontalFocusThicknessMetric:
                    return Feature.OnXp;
            }
            return false;
        }
Beispiel #2
0
        public string CreateAuction(string productname, decimal startingprice, int?auctionduration)
        {
            if (!(Session["user"] is User user))
            {
                return("");
            }
            if (string.IsNullOrWhiteSpace(productname))
            {
                return("#Error: You must provide product name!");
            }
            if (startingprice <= 0)
            {
                return("#Error: You must provide starting price greater than zero!");
            }
            if (auctionduration != null && auctionduration <= 0)
            {
                return("#Error: You must provide auction duration greater than zero!");
            }
            if (auctionduration <= 0)
            {
                return("#Error: You must provide auction duration greater than zero!");
            }

            Guid guid = Guid.NewGuid();

            if (Request.Files["image"] != null && Request.Files["image"].ContentType == "image/png")
            {
                Directory.CreateDirectory(Server.MapPath("~/resources/storage/auctions/" + guid.ToString() + "/"));
                Request.Files["image"].SaveAs(Server.MapPath("~/resources/storage/auctions/" + guid.ToString() + "/image.png"));
            }
            else
            {
                return("#Error: You must provide one .png picture of product!");
            }

            using (var ctx = new AuctionModel())
            {
                try
                {
                    SystemParameter system  = ctx.GetSystemParameters();
                    Auction         auction = new Auction
                    {
                        ID            = guid,
                        Title         = productname,
                        Duration      = auctionduration ?? system.AuctionDuration,
                        Currency      = system.Currency,
                        TokenValue    = system.TokenValue,
                        StartingPrice = startingprice,
                        CreatedOn     = DateTime.Now.AddHours(2),
                        Owner         = user.ID
                    };
                    ctx.Auctions.Add(auction);
                    ctx.SaveChanges();
                    AuctionHub.HubContext.Clients.All.onCreateAuction(auction.ID.ToString(), auction.Title, 0, auction.StartingPrice, "", "", 0, 1);
                    return("You have successfully created auction.");
                }
                catch (Exception e)
                {
                    logger.Error(e.Message);
                    return("#Error: Internal server error.");
                }
            }
        }
Beispiel #3
0
		public static bool IsPresent (SystemParameter enumVal)
		{
#pragma warning disable 219			
			object o;
#pragma warning restore 219			

			switch (enumVal) {
				case SystemParameter.DropShadow:
					try {
						o = SystemInformation.IsDropShadowEnabled;
						return true;
					} catch (Exception) { return false; }
				case SystemParameter.FlatMenu:
					try {
						o = SystemInformation.IsFlatMenuEnabled;
						return true;
					} catch (Exception) { return false; }
				case SystemParameter.FontSmoothingContrastMetric:
					try {
						o = SystemInformation.FontSmoothingContrast;
						return true;
					} catch (Exception) { return false; }
				case SystemParameter.FontSmoothingTypeMetric:
					try {
						o = SystemInformation.FontSmoothingType;
						return true;
					} catch (Exception) { return false; }
				case SystemParameter.MenuFadeEnabled:
					try {
						o = SystemInformation.IsMenuFadeEnabled;
						return true;
					} catch (Exception) { return false; }
				case SystemParameter.SelectionFade:
					try {
						o = SystemInformation.IsSelectionFadeEnabled;
						return true;
					} catch (Exception) { return false; }
				case SystemParameter.ToolTipAnimationMetric:
					try {
						o = SystemInformation.IsToolTipAnimationEnabled;
						return true;
					} catch (Exception) { return false; }
				case SystemParameter.UIEffects:
					try {
						o = SystemInformation.UIEffectsEnabled;
						return true;
					} catch (Exception) { return false; }
				case SystemParameter.CaretWidthMetric:
					try {
						o = SystemInformation.CaretWidth;
						return true;
					} catch (Exception) { return false; }
				case SystemParameter.VerticalFocusThicknessMetric:
					try {
						o = SystemInformation.VerticalFocusThickness;
						return true;
					} catch (Exception) { return false; }
				case SystemParameter.HorizontalFocusThicknessMetric:
					try {
						o = SystemInformation.HorizontalFocusThickness;
						return true;
					} catch (Exception) { return false; }
			}
			
			return false;
		}
        /// <summary>
        /// Get a list of QueryFilter that represent changed fields.
        /// </summary>
        /// <param name="original">Original Entity. The unchanged entity.</param>
        /// <param name="changed">Changed Entity. The entity holding the changed fields.</param>
        /// <returns>QueryFilters of SystemParameterProperty</returns>
        public static QueryFilters <SystemParameterProperty> GetChanges(SystemParameter original, SystemParameter changed)
        {
            // this method returns a list of changes.
            var changes = new QueryFilters <SystemParameterProperty>(13);

            #region Detect Changes
            if (original.SystemParameterID != changed.SystemParameterID)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.SystemParameterID, FilterConditions.Equals, changed.SystemParameterID));
            }
            if (string.CompareOrdinal(original.DeliveryAddressLine1, changed.DeliveryAddressLine1) != 0)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.DeliveryAddressLine1, FilterConditions.Equals, changed.DeliveryAddressLine1));
            }
            if (string.CompareOrdinal(original.DeliveryAddressLine2, changed.DeliveryAddressLine2) != 0)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.DeliveryAddressLine2, FilterConditions.Equals, changed.DeliveryAddressLine2));
            }
            if (original.DeliveryCityID != changed.DeliveryCityID)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.DeliveryCityID, FilterConditions.Equals, changed.DeliveryCityID));
            }
            if (string.CompareOrdinal(original.DeliveryPostalCode, changed.DeliveryPostalCode) != 0)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.DeliveryPostalCode, FilterConditions.Equals, changed.DeliveryPostalCode));
            }
            if (original.DeliveryLocation != changed.DeliveryLocation)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.DeliveryLocation, FilterConditions.Equals, changed.DeliveryLocation));
            }
            if (string.CompareOrdinal(original.PostalAddressLine1, changed.PostalAddressLine1) != 0)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.PostalAddressLine1, FilterConditions.Equals, changed.PostalAddressLine1));
            }
            if (string.CompareOrdinal(original.PostalAddressLine2, changed.PostalAddressLine2) != 0)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.PostalAddressLine2, FilterConditions.Equals, changed.PostalAddressLine2));
            }
            if (original.PostalCityID != changed.PostalCityID)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.PostalCityID, FilterConditions.Equals, changed.PostalCityID));
            }
            if (string.CompareOrdinal(original.PostalPostalCode, changed.PostalPostalCode) != 0)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.PostalPostalCode, FilterConditions.Equals, changed.PostalPostalCode));
            }
            if (string.CompareOrdinal(original.ApplicationSettings, changed.ApplicationSettings) != 0)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.ApplicationSettings, FilterConditions.Equals, changed.ApplicationSettings));
            }
            if (original.LastEditedBy != changed.LastEditedBy)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.LastEditedBy, FilterConditions.Equals, changed.LastEditedBy));
            }
            if (original.LastEditedWhen != changed.LastEditedWhen)
            {
                changes.Add(QueryFilter.New(SystemParameterProperty.LastEditedWhen, FilterConditions.Equals, changed.LastEditedWhen));
            }
            #endregion
            return(changes.Count > 0 ? changes : null);
        }
 public void Delete(SystemParameter systemParameter)
 {
     _systemParameterDal.Delete(systemParameter);
 }
Beispiel #6
0
 internal void Initialize(DataSet ds)
 {
     this.SystemParameter = new SystemParameter(new DBRow(ds.Tables["SystemParameter"].Rows[0]));
 }
        public void RemoveParameter(string categoryName, string parameterName)
        {
            SystemParameter systemParameter = GetSystemParameterByName(categoryName, parameterName);

            SystemParameterDao.Remove(systemParameter);
        }
Beispiel #8
0
        public int Update(SystemParameter systemParameter)
        {
            string sql = "update SystemParameter set ParamenterName='{0}',ParamenterValue={1} where ID={2}";

            return(db.ExecuteCommand(string.Format(sql, systemParameter.ParameterName, systemParameter.ParameterValue, systemParameter.ID)));
        }
Beispiel #9
0
 public ParameterInfo(SystemParameter pSystemParameter, string pParameterValue)
 {
     this.SystemParameter = pSystemParameter;
     this.ParameterValue  = pParameterValue;
 }
Beispiel #10
0
        private static void SerializePatient()
        {
            Patient patient = new Patient();

            PersonData cd = new PersonData();
            cd.ID = Guid.NewGuid();
            cd.Surname = "Androulidakis";
            cd.Name = "Aggelos";

            List<Communication> communications = new List<Communication>();

            Communication commun1 = new Communication();
            commun1.IsPrimary = true;
            commun1.Type = CommunicationType.Phone;
            commun1.Value = "+302107722453";
            communications.Add(commun1);

            Communication commun2 = new Communication();
            commun2.IsPrimary = false;
            commun2.Value = "*****@*****.**";
            commun2.Type = CommunicationType.Email;
            communications.Add(commun2);

            cd.CommunicationList = new List<Communication>(communications);

            List<Address> addresses = new List<Address>();
            Address address = new Address();
            address.Street = "Patission";
            address.StreetNo = "42";
            address.City = "Athens";
            address.Country = "GR";
            address.Notes = "3rd floor";
            address.IsPrimary = true;
            address.ZipCode = "123-45";
            address.County = "Attica";
            addresses.Add(address);
            addresses.Add(address);

            List<Identifier> ids = new List<Identifier>();
            Identifier id = new Identifier();
            id.Type = IdentifierType.PassportID;
            id.Number = "AB202825";
            id.IssueDate = "17/02/2003";
            id.IssueAuthority = "ABC";
            ids.Add(id);
            ids.Add(id);

            cd.IdentifierList = ids;

            cd.AddressList = new List<Address>(addresses);

            patient.PersonData = cd;

            SocioDemographicData sd = new SocioDemographicData();
            sd.Age = 82;
            SystemParameter maritalStatus = new SystemParameter();
            maritalStatus.Code = 1;
            maritalStatus.Description = "widow";
            sd.MaritalStatus = maritalStatus;

            sd.Children = 2;
            SystemParameter sex = new SystemParameter();
            sex.Code = 1;
            sex.Description = "Male";

            sd.Gender = sex;

            SystemParameter livingWith = new SystemParameter();
            livingWith.Code = 1;
            livingWith.Description = "with son/daughter";

            sd.LivingWith = livingWith;

            patient.SD_Data = sd;

            Carer c1 = new Carer();
            c1.PersonData = patient.PersonData;
            c1.SD_Data = patient.SD_Data;

            PatientCaregiver pc1 = new PatientCaregiver();
            pc1.Caregiver = c1;
            pc1.IsPrimary = true;

            PatientCaregiver pc2 = new PatientCaregiver();
            pc2.Caregiver = c1;
            pc2.IsPrimary = false;

            patient.PatientCaregiverList.ListOfCaregivers.Add(pc1);
            patient.PatientCaregiverList.ListOfCaregivers.Add(pc2);

            Clinician respClinician = new Clinician();
            respClinician.PersonData = patient.PersonData;

            patient.ResponsibleClinician = respClinician;

            //PatientAssessment assessment = new PatientAssessment();
            //assessment.MMSE = 22;
            //assessment.DateOfAssessment = System.DateTime.Now;

            //patient.Assessments.ListOfAssessments.Add(assessment);

            SerializeMe(patient, "Patient.xml");
        }
        //EC Data
        /// <summary>
        /// Updates the system parameter.
        /// </summary>
        /// <param name="ecid">The ecid.</param>
        /// <param name="val">The value.</param>
        /// <param name="refreshSecsAgent">The refresh secs agent.</param>
        public override void updateSystemParameter(string ecid, string val, Boolean refreshSecsAgent)
        {
            try
            {
                if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_CONVERSATION_TIMEOUT))
                {
                    SystemParameter.setSECSConversactionTimeout(Convert.ToInt16(val));
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_INITIAL_COMMUNICATION_STATE))
                {
                    SystemParameter.setInitialCommunicationState(val);
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_INITIAL_CONTROL_STATE))
                {
                    SystemParameter.setInitialHostMode(val);
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_EQPNAME))
                {
                    SystemParameter.setEQPName(val);
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_ESTABLISH_COMMUNICATION_TIMEOUT))
                {
                    SystemParameter.setEstablishCommunicationTimeout(Convert.ToInt16(val));
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_SOFT_REVISION))
                {
                    SystemParameter.setSoftRevision(val);
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_TIME_FORMAT))
                {
                    SystemParameter.setTimeFormat(val);
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_MDLN))
                {
                    SystemParameter.setMDLN(val);
                }



                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_CONTROL_STATE_KEEPING_TIME))
                {
                    SystemParameter.setControlStateKeepTime(Convert.ToInt16(val));
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_HEARTBEAT))
                {
                    SystemParameter.setHeartBeatSec(Convert.ToInt32(val));
                    //Restart Timer
                    ITimerAction timer = scApp.getBCFApplication().getTimerAction("SECSHeartBeat");
                    if (timer != null)
                    {
                        timer.start();
                    }
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_DEVICE_ID))
                {
                    scApp.setSECSAgentDeviceID(Convert.ToInt32(val), refreshSecsAgent);
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_T3))
                {
                    scApp.setSECSAgentT3Timeout(Convert.ToInt32(val), refreshSecsAgent);
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_T5))
                {
                    scApp.setSECSAgentT5Timeout(Convert.ToInt32(val), refreshSecsAgent);
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_T6))
                {
                    scApp.setSECSAgentT6Timeout(Convert.ToInt32(val), refreshSecsAgent);
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_T7))
                {
                    scApp.setSECSAgentT7Timeout(Convert.ToInt32(val), refreshSecsAgent);
                }
                else if (BCFUtility.isMatche(ecid, SCAppConstants.ECID_T8))
                {
                    scApp.setSECSAgentT8Timeout(Convert.ToInt32(val), refreshSecsAgent);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception:");
            }
        }
Beispiel #12
0
        public static bool IsPresent(SystemParameter enumVal)
        {
#pragma warning disable 219
            object o;
#pragma warning restore 219

            switch (enumVal)
            {
            case SystemParameter.DropShadow:
                try {
                    o = SystemInformation.IsDropShadowEnabled;
                    return(true);
                } catch (Exception) { return(false); }

            case SystemParameter.FlatMenu:
                try {
                    o = SystemInformation.IsFlatMenuEnabled;
                    return(true);
                } catch (Exception) { return(false); }

            case SystemParameter.FontSmoothingContrastMetric:
                try {
                    o = SystemInformation.FontSmoothingContrast;
                    return(true);
                } catch (Exception) { return(false); }

            case SystemParameter.FontSmoothingTypeMetric:
                try {
                    o = SystemInformation.FontSmoothingType;
                    return(true);
                } catch (Exception) { return(false); }

            case SystemParameter.MenuFadeEnabled:
                try {
                    o = SystemInformation.IsMenuFadeEnabled;
                    return(true);
                } catch (Exception) { return(false); }

            case SystemParameter.SelectionFade:
                try {
                    o = SystemInformation.IsSelectionFadeEnabled;
                    return(true);
                } catch (Exception) { return(false); }

            case SystemParameter.ToolTipAnimationMetric:
                try {
                    o = SystemInformation.IsToolTipAnimationEnabled;
                    return(true);
                } catch (Exception) { return(false); }

            case SystemParameter.UIEffects:
                try {
                    o = SystemInformation.UIEffectsEnabled;
                    return(true);
                } catch (Exception) { return(false); }

            case SystemParameter.CaretWidthMetric:
                try {
                    o = SystemInformation.CaretWidth;
                    return(true);
                } catch (Exception) { return(false); }

            case SystemParameter.VerticalFocusThicknessMetric:
                try {
                    o = SystemInformation.VerticalFocusThickness;
                    return(true);
                } catch (Exception) { return(false); }

            case SystemParameter.HorizontalFocusThicknessMetric:
                try {
                    o = SystemInformation.HorizontalFocusThickness;
                    return(true);
                } catch (Exception) { return(false); }
            }

            return(false);
        }
        public async Task <ISingleResponse <SystemParameter> > CreateSystemParameterAsync(SystemParameter entity)
        {
            Logger?.LogInformation("'{0}' has been invoked", nameof(CreateSystemParameterAsync));

            try
            {
                UnitOfWork.Repository <SystemParameter>().Add(entity);
                await UnitOfWork.SaveChangesAsync();

                return(new SingleResponse <SystemParameter>(entity));
            }
            catch (Exception ex)
            {
                return(new SingleResponse <SystemParameter>(Logger, nameof(CreateSystemParameterAsync), ex));
            }
        }
	public static bool IsPresent(SystemParameter enumVal) {}
Beispiel #15
0
 public static bool IsPresent(SystemParameter enumVal)
 {
     throw null;
 }
Beispiel #16
0
 public async Task <SystemParameter> UpdateSystemParameter(SystemParameter SystemParameterInfo)
 {
     return(await _repository.UpdateAsync(SystemParameterInfo));
 }
Beispiel #17
0
        public int Add(SystemParameter systemParameter)
        {
            string sql = "insert into SystemParameter(ParamenterName,ParamenterValue) values('{0}',{1});";

            return(db.Add(string.Format(sql, systemParameter.ParameterName, systemParameter.ParameterValue)));
        }
Beispiel #18
0
        /// <summary>
        /// Update a SystemParameter
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="code"></param>
        /// <param name="lockID"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        public void DeleteSystemParameter(string currentUser, string user, string appID, string overrideID, string code, string lockID, IRepository <SystemParameter> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (string.IsNullOrEmpty(code))
                {
                    throw new ArgumentOutOfRangeException("code");
                }
                if (string.IsNullOrEmpty(lockID))
                {
                    throw new ArgumentOutOfRangeException("lockID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    // Convert string to guid
                    Guid codeGuid = Guid.Parse(code);

                    // Find item based on ID
                    SystemParameter dataEntity = dataRepository.Single(x => x.Code == codeGuid);

                    // Delete the item
                    dataRepository.Delete(dataEntity);

                    // Commit unit of work
                    uow.Commit();
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);
            }
        }
Beispiel #19
0
        public int Delete(SystemParameter systemParameter)
        {
            string sql = "delete from SystemParameter where ID={0}";

            return(db.ExecuteCommand(string.Format(sql, systemParameter.ID)));
        }
Beispiel #20
0
        /// <summary>
        /// Retrieve a SystemParameter with associated lookups
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="code"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        /// <returns></returns>
        public SystemParameterVMDC GetSystemParameter(string currentUser, string user, string appID, string overrideID, string code, IUnitOfWork uow, IRepository <SystemParameter> dataRepository
                                                      , IExceptionManager exceptionManager, IMappingService mappingService)

        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    SystemParameterDC destination = null;

                    // If code is null then just return supporting lists
                    if (!string.IsNullOrEmpty(code))
                    {
                        // Convert code to Guid
                        Guid codeGuid = Guid.Parse(code);

                        // Retrieve specific SystemParameter
                        SystemParameter dataEntity = dataRepository.Single(x => x.Code == codeGuid);

                        // Convert to data contract for passing through service interface
                        destination = mappingService.Map <SystemParameter, SystemParameterDC>(dataEntity);
                    }



                    // Create aggregate contract
                    SystemParameterVMDC returnObject = new SystemParameterVMDC();

                    returnObject.SystemParameterItem = destination;

                    return(returnObject);
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);

                return(null);
            }
        }
        public string GetParameter(string categoryName, string parameterName)
        {
            SystemParameter systemParameter = GetSystemParameterByName(categoryName, parameterName);

            return(systemParameter.ParameterValue);
        }
Beispiel #22
0
        /// <summary>
        ///  Create a SystemParameter
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="dc"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        public SystemParameterVMDC CreateSystemParameter(string currentUser, string user, string appID, string overrideID, SystemParameterDC dc, IRepository <SystemParameter> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dc)
                {
                    throw new ArgumentOutOfRangeException("dc");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    // Create a new ID for the SystemParameter item
                    dc.Code = Guid.NewGuid();

                    // Map data contract to model
                    SystemParameter destination = mappingService.Map <SystemParameterDC, SystemParameter>(dc);

                    // Add the new item
                    dataRepository.Add(destination);

                    // Commit unit of work
                    uow.Commit();

                    // Map model back to data contract to return new row id.
                    dc = mappingService.Map <SystemParameter, SystemParameterDC>(destination);
                }

                // Create aggregate data contract
                SystemParameterVMDC returnObject = new SystemParameterVMDC();

                // Add new item to aggregate
                returnObject.SystemParameterItem = dc;

                return(returnObject);
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);

                return(null);
            }
        }
 public SystemParameter Add(SystemParameter systemParameter)
 {
     return(_systemParameterDal.Add(systemParameter));
 }
 public void OSFeature_IsPresent_Invoke_ReturnsExpected(SystemParameter feature, bool expected)
 {
     Assert.Equal(expected, OSFeature.IsPresent(feature));
 }
 public SystemParameter Update(SystemParameter systemParameter)
 {
     return(_systemParameterDal.Update(systemParameter));
 }
Beispiel #26
0
 /// <summary>
 /// This method inserts a new record in the table.
 /// Change this method to alter how records are inserted.
 /// </summary>
 /// <param name=entity>entity</param>
 public void Insert(SystemParameter entity)
 {
     DbContext.SystemParameters.InsertOnSubmit(entity);
     DbContext.SubmitChanges();
 }
Beispiel #27
0
        /// <summary>
        /// 取得UIParameter数组
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static IAddinParameter[] GetPluginUIParameters(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }
            List <IAddinParameter> parameters = new List <IAddinParameter>();

            int iPos  = 0;
            int iPos2 = 0;

            //替换的变量只支持数字与字母,点与下划线

            iPos = text.IndexOf("@");
            while (iPos >= 0)
            {
                //取
                char[] chs;
                iPos2 = iPos;
                do
                {
                    iPos2 = iPos2 + 1;
                    if (iPos2 >= text.Length)
                    {
                        break;
                    }
                    string val = text.Substring(iPos2, 1);
                    chs = val.ToCharArray();
                } while (char.IsLetterOrDigit(chs[0]) || chs[0] == '.' || chs[0] == '_');


                string parameter = text.Substring(iPos + 1, iPos2 - iPos - 1);

                UIParameter p = new UIParameter();

                p.Name = "@" + parameter; //参数全名

                //UI参数的格式要么是@mstformdata.NewRow.cntno 三段式,要么是就是一段式,二段式都有可能
                //一段式:@Phid
                //二段式:@mstformdata.phid 表示从mstformdata的所有行中找出phid

                int iPos3 = 0;
                iPos3 = parameter.IndexOf(".");
                if (iPos3 > 0)
                {
                    //三段式UI格式
                    p.FirstPart = parameter.Substring(0, iPos3);
                    string part  = parameter.Substring(iPos3 + 1, parameter.Length - iPos3 - 1);
                    int    iPos4 = 0;
                    iPos4 = part.IndexOf(".");
                    if (iPos4 > 0)
                    {
                        p.SecondPart = part.Substring(0, iPos4);
                        p.ThirdPart  = part.Substring(iPos4 + 1, part.Length - iPos4 - 1);
                    }
                    else
                    {
                        //二段式,可以省略数据的类型,第二段为空
                        p.SecondPart = string.Empty;
                        p.ThirdPart  = part;
                    }
                }
                else
                {
                    //一段式UI参数
                    p.FirstPart  = string.Empty; //前缀为空
                    p.SecondPart = string.Empty; //来源的数据部分为空
                    p.ThirdPart  = parameter;
                }

                //判断是何种参数
                if (BizParameter.IsBizParameter(p.FirstPart))
                {
                    //业务参数
                    BizParameter bp = new BizParameter();
                    bp.Name       = p.Name;
                    bp.FirstPart  = p.FirstPart;
                    bp.SecondPart = p.SecondPart;
                    bp.ThirdPart  = p.ThirdPart;
                    parameters.Add(bp);
                }
                else if (SystemParameter.IsSystemParameter(p.FirstPart))
                {
                    //系统参数
                    SystemParameter sp = new SystemParameter();
                    sp.Name       = p.Name;
                    sp.FirstPart  = p.FirstPart;
                    sp.SecondPart = p.SecondPart;
                    sp.ThirdPart  = p.ThirdPart;
                    parameters.Add(sp);
                }
                else
                {
                    //UI参数
                    //如果第一段不为空,第二段为空,则第二段设置为All;
                    if (!string.IsNullOrEmpty(p.FirstPart) && string.IsNullOrEmpty(p.SecondPart))
                    {
                        p.SecondPart = EnumUIDataSourceType.All.ToString();
                    }
                    parameters.Add(p);
                }

                iPos = text.IndexOf("@", iPos + 1);
            }

            return(parameters.ToArray());
        }
Beispiel #28
0
 /// <summary>
 /// This method deletes a record in the table.
 /// Change this method to alter how records are deleted.
 /// </summary>
 /// <param name=entity>entity</param>
 public void Delete(SystemParameter entity)
 {
     DbContext.SystemParameters.Attach(entity);
     DbContext.SystemParameters.DeleteOnSubmit(entity);
     DbContext.SubmitChanges();
 }
Beispiel #29
0
        public async Task <SystemParameter> CreateSystemParameter(SystemParameter SystemParameterInfo)
        {
            SystemParameterInfo.Id = await _repository.InsertAndGetIdAsync(SystemParameterInfo);

            return(SystemParameterInfo);
        }
Beispiel #30
0
        public SaveResult AddValue <T>(string code, T value, string description, DateTime?validFrom, DateTime?validTo, bool isActive = true)
        {
            try
            {
                var existingEntity = _context.Set <SystemParameter>().Where(s => s.Code == code).FirstOrDefault();

                if (existingEntity == null)
                {
                    var language = _context
                                   .Set <SystemLanguage>()
                                   .FirstOrDefault(s => s.Code == "en-US");

                    var systemTranslation = new SystemTranslation()
                    {
                        SystemLanguage = language,
                        Text           = description
                    };

                    var systemParameter = new SystemParameter()
                    {
                        Code = code,
                        SystemTranslation = systemTranslation,
                    };

                    var systemParameterValue = new SystemParameterValue()
                    {
                        SystemParameter = systemParameter,
                        ValidFrom       = validFrom,
                        ValidTo         = validTo,
                        IsActive        = isActive,
                        Value           = value.ToString(),
                    };

                    _entities.Add(systemParameterValue);
                }
                else
                {
                    var systemParameterValue = new SystemParameterValue()
                    {
                        SystemParameter = existingEntity,
                        ValidFrom       = validFrom,
                        ValidTo         = validTo,
                        IsActive        = isActive,
                        Value           = value.ToString(),
                    };

                    _entities.Add(systemParameterValue);
                    var existingValues = _entities.Where(s => s.SystemParameterId == existingEntity.Id).ToList();
                    existingValues.ForEach(s => s.IsActive = false);
                }

                _context.SaveChanges();

                return(new SaveResult());
            }
            catch (Exception e)
            {
                _logger.LogError(new EventId(), e, string.Empty);
                return(new SaveResult("Error"));
            }
        }