/**
         * @return a JwtToken object (JWT Bearer Token),
         * based on the Merchant Configuration passed to the Constructor of Authorize Class
         */
        public JwtToken GetToken()
        {
            try
            {
                if (_merchantConfig != null)
                {
                    LogMerchantDetails();

                    Enumerations.ValidateRequestType(_merchantConfig.RequestType);

                    var tokenObj = (JwtToken) new JwtTokenGenerator(_merchantConfig).GetToken();

                    if (_merchantConfig.IsGetRequest || _merchantConfig.IsDeleteRequest)
                    {
                        _logger.Trace("{0} {1}", "Content-Type:", "application/json");
                    }
                    else if (_merchantConfig.IsPostRequest || _merchantConfig.IsPutRequest || _merchantConfig.IsPatchRequest)
                    {
                        _logger.Trace("{0} {1}", "Content-Type:", "application/hal+json");
                    }

                    _logger.Trace("{0} {1}", "Authorization:", tokenObj.BearerToken);

                    return(tokenObj);
                }

                return(null);
            }
            catch (Exception e)
            {
                ExceptionUtility.Exception(e.Message, e.StackTrace);
                return(null);
            }
        }
Ejemplo n.º 2
0
 public override WebRequestHeaders GetUrlContent()
 {
     UrlData.Add(new WebRequestHeader("num-items", NumberOfItems.ToString()));
     UrlData.Add(new WebRequestHeader("tabs", Tabs.ToString()));
     UrlData.Add(new WebRequestHeader("genre", Enumerations.GetDataName(Genre)));
     return(base.GetUrlContent());
 }
Ejemplo n.º 3
0
        public string FindPathToType(string name)
        {
            var classType = Classes.Where(c => c.IsExported).FirstOrDefault(cl => cl.Name == name);

            if (classType != null)
            {
                return(classType.GetPath());
            }

            var interfaceType = Interfaces.Where(i => i.IsExported).FirstOrDefault(cl => cl.Name == name);

            if (interfaceType != null)
            {
                return(interfaceType.GetPath());
            }

            var enumType = Enumerations.Where(e => e.IsExported).FirstOrDefault(cl => cl.Name == name);

            if (enumType != null)
            {
                return(enumType.GetPath());
            }

            foreach (var nspace in Namespaces.Where(n => n.IsExported))
            {
                var path = nspace.FindPathToType(name);
                if (path != null)
                {
                    return(path);
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of class CodeControl
        /// </summary>
        /// <param name="content">Base64 content of the web resource</param>
        /// <param name="type">Web resource type</param>
        public CodeControl(string content, Enumerations.WebResourceType type)
        {
            InitializeComponent();

            textEditor = new TextEditor
            {
                ShowLineNumbers = true,
                FontSize = 12,
                FontFamily = new System.Windows.Media.FontFamily("Consolas"),
                //Focusable = true,
                //IsHitTestVisible = true
            };

            var wpfHost = new ElementHost
            {
                Child = textEditor,
                Dock = DockStyle.Fill,
                BackColorTransparent = true,
            };

            Controls.Add(wpfHost);

            if (!string.IsNullOrEmpty(content))
            {
                // Converts base64 content to string
                byte[] b = Convert.FromBase64String(content);
                innerContent = System.Text.Encoding.UTF8.GetString(b);
                originalContent = innerContent;
                innerType = type;
            }
        }
Ejemplo n.º 5
0
        public void SetRequestType_Delete()
        {
            var merchantConfig = MerchantConfigObj("JWT", "DELETE");

            Enumerations.SetRequestType(merchantConfig);
            Assert.AreEqual(true, merchantConfig.IsDeleteRequest);
        }
Ejemplo n.º 6
0
 public UserContext(string _nomeusuario, string _userid, Enumerations.TipoPerfil _tipoPerfil, string _computador)
 {
     this.NomeUsuario = _nomeusuario;
     this.UserID = _userid;
     this.TipoPerfil = _tipoPerfil;
     this.NomeComputador = _computador;
 }
Ejemplo n.º 7
0
    private static Player CreateWarrior(Player newPlayer, string playerName, Enumerations.Gender M_F)
    {
        newPlayer.PlayerName = playerName;
        newPlayer.CharClass = Enumerations.CharClass.Warrior;
        newPlayer.Class = new WarriorClass();
        newPlayer.Gender = M_F;
        newPlayer.IDPlayer = GetLastPlayerID();

        newPlayer.PhysicalDMG = 15;
        newPlayer.MagicDMG = 5;
        newPlayer.MoveSpeed = 20;
        newPlayer.JumpForce = 5;

        newPlayer.PhysDMGMultiplication = 1;
        newPlayer.MagicDMGMultiplication = 1;

        newPlayer.CurrentSceneName = "LEVEL_1";
        newPlayer.PosX = 179.5f;
        newPlayer.PosY = 5.6f;
        newPlayer.PosZ = 10.3f;

        newPlayer.MaxHealth = 110;
        newPlayer.CurrentHealth = 110;
        newPlayer.MaxMana = 80;
        newPlayer.CurrentMana = 80;

        newPlayer.PlayerLvl = 1;
        newPlayer.Experience = 550;     //ZA DEBUG

        newPlayer.PathToSave = Application.dataPath + "\\Saves\\" + newPlayer.PlayerName + "_" + newPlayer.IDPlayer + ".save";
        return SerializePlayerToDat(newPlayer);
    }
Ejemplo n.º 8
0
        /// <summary>
        /// Create UploadViewModels based on the LocalUpload List,
        /// which should already be populated with all local uploads
        /// started from this client. This method runs at each application start
        /// and only then. Its purpose is to populate the client's uploads list.
        /// </summary>
        /// <param name="localUploads"></param>
        /// <returns>Task</returns>
        private void CreateUploadViewModels(IList <LocalUpload> localUploads)
        {
            IList <Task <UploadViewModel> > tasks = new List <Task <UploadViewModel> >();

            foreach (LocalUpload localUpload in localUploads)
            {
                //tasks.Add(InstatiateUploadViewModel(localUpload));

                UploadViewModel u = CreateNewUploadVM() as UploadViewModel;
                u.LocalUpload = localUpload;

                if (String.IsNullOrEmpty(localUpload.Status))
                {
                    localUpload.Status = Enumerations.Status.Pending.GetStringValue();
                }

                this.ActivateItem(u);

                Enumerations.Status status = Enumerations.GetStatusFromString(localUpload.Status);

                if (status == Enumerations.Status.Completed)
                {
                    this.CompletedUploads.Add(u);
                }
                else
                {
                    this.PendingUploads.Add(u);
                }
            }

            _log.Info("Created " + this.PendingUploads.Count + " UploadViewModels for the upload manager.");
        }
Ejemplo n.º 9
0
        public void SetRequestType_Put()
        {
            var merchantConfig = MerchantConfigObj("JWT", "PUT");

            Enumerations.SetRequestType(merchantConfig);
            Assert.AreEqual(true, merchantConfig.IsPutRequest);
        }
Ejemplo n.º 10
0
        protected virtual void HandleChg(NotificationConnection c, Command cmd)
        {
            Status newStatus = Enumerations.GetStatus(cmd.Params[0]);

            Command response = new Command(Verb.Chg, cmd.TrId, cmd.Params[0]);

            Server.Send(c, response);

            Server.UserStatusChanged(c.User, newStatus);

            // .SentInitialChg is a protocol dialect-dependent property, it shouldn't be a member of NotificationConnection
            // there should be a ProtocolState member instead, which contains this stuff

            if (!c.SentInitialChg)
            {
                // after the initial CHG from the client, give it the ILNs of its Forward List

                foreach (User forwardUser in c.User.Properties.VirtualAllowedForwardList)
                {
                    if (forwardUser.Status != Status.Fln && forwardUser.Status != Status.Hdn)
                    {
                        SendIln(c, cmd.TrId, forwardUser);
                    }
                }

                c.SentInitialChg = true;
            }
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method updates the view model data and sends update command back
        /// to the solution builder.</summary>
        ///--------------------------------------------------------------------------------
        protected override void OnUpdate()
        {
            // send update for any updated children
            foreach (EnumerationViewModel item in Enumerations)
            {
                if (item.IsEdited == true)
                {
                    item.Update();
                }
            }
            // send update for any new children
            foreach (EnumerationViewModel item in ItemsToAdd.OfType <EnumerationViewModel>())
            {
                item.Update();
                Enumerations.Add(item);
            }
            ItemsToAdd.Clear();

            // send delete for any deleted children
            foreach (EnumerationViewModel item in ItemsToDelete.OfType <EnumerationViewModel>())
            {
                item.Delete();
                Enumerations.Remove(item);
            }
            ItemsToDelete.Clear();

            // reset modified for children
            foreach (EnumerationViewModel item in Enumerations)
            {
                item.ResetModified(false);
            }
        }
 public RegularExpressionAttribute(string friendlyName, string pattern, System.Text.RegularExpressions.RegexOptions options, bool escapeCharacters, Enumerations.Action action = Enumerations.Action.All)
     : base(friendlyName, action)
 {
     Pattern = pattern;
     Options = options;
     EscapeCharacters = escapeCharacters;
 }
Ejemplo n.º 13
0
        public FileChecksumViewModel(MainWindowViewModel viewModel, DirectoryItem item) : base(viewModel)
        {
            m_AlgorithimList = Enumerations.GetEnumValueDescriptionPairs(typeof(Enumerations.ChecksumAlgorithim));
            RaisePropertyChanged(nameof(AlgorithimList));

            SelectedItem = item;
        }
Ejemplo n.º 14
0
 public static void ChatMessage(Int32 id, Int32 sender, String msg, Enumerations.MessageType type)
 {
     if (Data.TempPlayers.ContainsKey(sender) && Data.Players.ContainsKey(sender)) {
         using (var buffer = new DataBuffer()) {
         buffer.WriteInt32((Int32)Packets.Server.ChatMessage);
         buffer.WriteByte((Byte)type);
             if (Data.TempPlayers[sender].InGame) {
                 switch (type) {
                     case Enumerations.MessageType.System:
                     buffer.WriteString(String.Format("<SYSTEM> {0}", msg));
                     break;
                     case Enumerations.MessageType.Error:
                     buffer.WriteString(String.Format("<ERROR> {0}", msg));
                     break;
                     case Enumerations.MessageType.World:
                     buffer.WriteString(String.Format("[W] {0}: {1}", Data.Players[sender].Characters[Data.TempPlayers[sender].CurrentCharacter].Name, msg));
                     break;
                     case Enumerations.MessageType.Map:
                     buffer.WriteString(String.Format("[S] {0}: {1}", Data.Players[sender].Characters[Data.TempPlayers[sender].CurrentCharacter].Name, msg));
                     break;
                     case Enumerations.MessageType.Emote:
                     buffer.WriteString(String.Format("{0} {1}", Data.Players[sender].Characters[Data.TempPlayers[sender].CurrentCharacter].Name, msg));
                     break;
                 }
             }
             SendDataTo(id, buffer);
         }
     }
 }
Ejemplo n.º 15
0
        public async Task <MessageResponse <EmployeeResponse> > InsertAsync(EmployeeRequest employeeRequest)
        {
            var messageResponse = new MessageResponse <EmployeeResponse>
            {
                Inconsistencies = employeeRequest.Validate()
            };

            var    result  = false;
            string message = "";

            if (!messageResponse.Inconsistencies.Any())
            {
                var employeeExist = await _employeeService.ListByIdetificationNumberAsync(employeeRequest.IdentificationNumber);

                if (employeeExist == null)
                {
                    _employeeService.InsertAsync(employeeRequest);
                    result = await _unitOfWork.CompletedAsync();

                    message = result ? Enumerations.GetDescription(SuccessAndErrorMessages.SuccessfullyIncluded) : Enumerations.GetDescription(SuccessAndErrorMessages.ErrorOccurredWhileAdding);
                }
                else
                {
                    message = Enumerations.GetDescription(SuccessAndErrorMessages.NotAddedAlreadyExists);
                }
            }

            messageResponse.IsSuccess  = result;
            messageResponse.StatusCode = HttpStatusCode.OK;
            messageResponse.Message    = message;

            return(messageResponse);
        }
Ejemplo n.º 16
0
 public APIController(MerchantConfig merchantConfig)
 {
     _logger = LogManager.GetCurrentClassLogger();
     Enumerations.ValidateRequestType(merchantConfig.RequestType);
     Enumerations.SetRequestType(merchantConfig);
     _paymentRequestService = new PaymentRequestService(merchantConfig);
 }
Ejemplo n.º 17
0
 static ProjectInfoType()
 {
     if (Dict == null)
     {
         Dict = Enumerations.GenDict <Type>();
     }
 }
Ejemplo n.º 18
0
 static AccountStatus()
 {
     if (Dict == null)
     {
         Dict = Enumerations.GenDict <Type>();
     }
 }
Ejemplo n.º 19
0
        public SchemaDataModel(JToken data)
        {
            this._data = data as JArray;

            Enumerations = _data
                           .Where(i => GetItemParentFor(i) == "http://schema.org/Enumeration")
                           .Cast <JObject>()
                           .ToList();

            var enumerationIds = Enumerations
                                 .Select(i => i["@id"]?.ToObject <string>())
                                 .Where(i => !String.IsNullOrWhiteSpace(i))
                                 .ToList();

            EnumerationMembers = _data
                                 .Where(i => GetItemTypes(i).Any(t => enumerationIds.Contains(t)))
                                 .Cast <JObject>()
                                 .ToList();

            Models = _data
                     .Where(i => GetItemTypes(i).Contains("rdfs:Class"))
                     .Cast <JObject>()
                     .Except(Enumerations)
                     .ToList();

            ModelProperties = _data
                              .Where(i => GetItemTypes(i).Contains("rdf:Property"))
                              .Cast <JObject>()
                              .ToList();
        }
Ejemplo n.º 20
0
        public static int Size(this Enumerations currentDataType)
        {
            switch (currentDataType)
            {
            case Enumerations.uint8:
                return(sizeof(byte));

            case Enumerations.int16:
                return(sizeof(Int16));

            case Enumerations.int32:
                return(sizeof(Int32));

            case Enumerations.single:
                return(sizeof(Single));

            case Enumerations.envidouble:
                return(sizeof(double));

            case Enumerations.uint32:
                return(sizeof(UInt32));

            case Enumerations.int64:
                return(sizeof(Int64));

            case Enumerations.uint16:
                return(sizeof(UInt16));

            default:
                return(sizeof(double));
            }
        }
Ejemplo n.º 21
0
 public EnumerationAttribute(string name, Enumerations enumerations, string selectedEnumeration, bool canBeNull)
 {
     Name = name;
     Enumerations = enumerations;
     SelectedEnumeration = selectedEnumeration;
     CanBeNull = canBeNull;
 }
Ejemplo n.º 22
0
 protected void ParameterChanged(Enumerations.ManipulationTypes ManipulationType)
 {
     if (DomainSharedModel.ImageManipulationItems.OnInitializeFilters == false)
     {
         DomainSharedModel.ImageManipulationItems.SaveFilter(this);
     }
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Traverses the message.
        /// </summary>
        /// <param name="member">The member.</param>
        /// <param name="reportingType">Type of the reporting.</param>
        /// <param name="concat">The concat.</param>
        /// <param name="indent">The indent.</param>
        private static void TraverseMessage(IMessageMember member, ReportingType reportingType, ref StringBuilder concat, ref int indent)
        {
            StringBuilder memberConcat = new StringBuilder();
            string        name         = member.Name;
            object        value        = null;

            if (indent > 0)
            {
                memberConcat.AppendFormat("|{0}", Environment.NewLine);
                memberConcat.AppendFormat("{0}", "+" + new String('-', indent));
            }

            memberConcat.AppendFormat("{0}", Acronyms.BuildPhrase(name));

            if (member.HasValue)
            {
                value = member.GetValue();

                if (null != value)
                {
                    string strValue = String.Format("{0}", value);
                    // verify if value has a description
                    string meaning = Enumerations.GetMeaning(strValue);
                    if (null != meaning)
                    {
                        memberConcat.AppendFormat(" : {0} ({1}){2}", strValue, meaning, Environment.NewLine);
                    }
                    else
                    {
                        memberConcat.AppendFormat(" : {0}{1}", strValue, Environment.NewLine);
                    }
                }
                else
                {
                    memberConcat.AppendFormat("{0}", Environment.NewLine);
                }
            }
            else
            {
                memberConcat.AppendFormat("{0}", Environment.NewLine);
            }

            string line = memberConcat.ToString();

            if (!line.EndsWith("(NULL)" + Environment.NewLine))
            {
                concat.Append(line);
            }

            if (member.HasChildren)
            {
                indent++;
                foreach (IMessageMember child in member.GetChildren())
                {
                    TraverseMessage(child, reportingType, ref concat, ref indent);
                }
                indent--;
            }
        }
 public SocialSecurityAttribute(string friendlyName, bool isClearNumber, Enumerations.Action action = Enumerations.Action.All)
     : base(friendlyName, Constants.RegularExpressionPatterns.SocialSecurity, System.Text.RegularExpressions.RegexOptions.None, false, action)
 {
     if (isClearNumber)
         Pattern = Constants.RegularExpressionPatterns.SocialSecurity_Clear;
     else
         Pattern = Constants.RegularExpressionPatterns.SocialSecurity;
 }
Ejemplo n.º 25
0
 private EnumDto MapEnum(UserGroup userGroup)
 {
     return(new EnumDto
     {
         Id = (int)userGroup,
         Name = Enumerations.GetEnumDescription(userGroup)
     });
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Initializes a new instance of class ImageControl
        /// </summary>
        /// <param name="content">Base64 content of the web resource</param>
        /// <param name="type">Web resource type</param>
        public ImageControl(string content, Enumerations.WebResourceType type)
        {
            InitializeComponent();

            innerType = type;
            originalContent = content;
            innerContent = content;
        }
Ejemplo n.º 27
0
 private EnumDto MapEnum(ItemGroup itemGroup)
 {
     return(new EnumDto
     {
         Id = (int)itemGroup,
         Name = Enumerations.GetEnumDescription(itemGroup)
     });
 }
Ejemplo n.º 28
0
 /// <summary>
 ///   Date: 10/16/2011
 ///   Adds a lock on behalf of a transaction to the active locks.
 /// </summary>
 /// <param name = "transactionId">The transaction id.</param>
 /// <param name = "operationMode">The operation mode.</param>
 /// <remarks>
 ///   Side effects: the new lock is added to the table entry
 /// </remarks>
 public void AddToActiveLocks(int transactionId, Enumerations.OperationMode operationMode)
 {
     Lock lockToAdd = new Lock(transactionId, operationMode);
     Lock result =
         ActiveLocks.Find(matching => matching.TransactionId == transactionId && matching.Mode == operationMode);
     if (result == null)
         ActiveLocks.Add(lockToAdd);
 }
 public static uint GetDaycareStepCounterOffset(Enumerations daycare)
 {
     return(daycare switch
     {
         Enumerations.WildArea => DayCare_Wildarea_Step_Counter,
         Enumerations.Route5 => DayCare_Route5_Step_Counter,
         _ => throw new ArgumentException(nameof(daycare)),
     });
        public async Task <bool> IsEggReady(Enumerations daycare, CancellationToken token)
        {
            var ofs = GetDaycareEggIsReadyOffset(daycare);
            // Read a single byte of the Daycare metadata to check the IsEggReady flag.
            var data = await Connection.ReadBytesAsync(ofs, 1, token).ConfigureAwait(false);

            return(data[0] == 1);
        }
Ejemplo n.º 31
0
 public void Mod(Enumerations.SysInfoType sysInfoType, string content)
 {
     SysInfo model = Get(sysInfoType);
     model.Attach();
     model.Content = content;
     model.ModTime = DateTime.Now;
     model.Detach();
     Update(model);
 }
Ejemplo n.º 32
0
        public OptionsView()
        {
            InitializeComponent();

            //lpElevationUnit.ItemsSource = Enumerations.GetNames<Enumerations.ElevationUnit>();
            lpElevationUnit.ItemsSource = Enumerations.GetElevationUnits();
            lpDistanceUnit.ItemsSource  = Enumerations.GetDistanceUnits();
            btnAbout.Tap += btnAbout_Tap;
        }
Ejemplo n.º 33
0
 public ZipCodeAttribute(string friendlyName, bool isClear, Enumerations.Action action = Enumerations.Action.All)
     : base(friendlyName, Constants.RegularExpressionPatterns.ZipCode, System.Text.RegularExpressions.RegexOptions.None, false, action)
 {
     IsClear = isClear;
     if (IsClear)
         Pattern = Constants.RegularExpressionPatterns.ZipCode_Clear;
     else
         Pattern = Constants.RegularExpressionPatterns.ZipCode;
 }
Ejemplo n.º 34
0
        public byte[] ExportTask(List<TaskItem> taskItems, Enumerations.ContentType contentType)
        {
            var xmlSerializer = new XmlSerializer(typeof(List<TaskItem>));

            MemoryStream memoryStream = new MemoryStream();
            xmlSerializer.Serialize(memoryStream, taskItems);

            return memoryStream.GetBuffer();
        }
Ejemplo n.º 35
0
 public List<Widget> GetAllWidgets(Enumerations.WidgetType widgetType)
 {
     return this.GetAllWidgets().Where(w => w.WidgetType == (int)widgetType).ToList();
     //return AspectF.Define
     //    .CacheList<Widget, List<Widget>>(_cacheResolver, CacheKeys.WidgetKeys.WidgetsByType((int)widgetType),
     //    w => CacheKeys.WidgetKeys.Widget(w.ID))
     //    .Return<List<Widget>>(() =>
     //        _database.GetList<Widget, Enumerations.WidgetTypeEnum>(widgetType, CompiledQueries.WidgetQueries.GetAllWidgets_ByWidgetType));
 }
 public async Task SetEggStepCounter(Enumerations daycare, CancellationToken token)
 {
     // Set the step counter in the Daycare metadata to 180. This is the threshold that triggers the "Should I create a new egg" subroutine.
     // When the game executes the subroutine, it will generate a new seed and set the IsEggReady flag.
     // Just setting the IsEggReady flag won't refresh the seed; we want a different egg every time.
     var data = new byte[] { 0xB4, 0, 0, 0 }; // 180
     var ofs  = GetDaycareStepCounterOffset(daycare);
     await Connection.WriteBytesAsync(data, ofs, token).ConfigureAwait(false);
 }
Ejemplo n.º 37
0
 /// <summary>
 ///   10/17/2011
 ///   Initializes a new instance of the <see cref = "Operation" /> class.
 /// </summary>
 /// <param name = "mode">The operation mode.</param>
 /// <param name = "transId">The ID of the transaction on whose behalf the operation is created</param>
 /// <param name = "dataId">The index of the data item the operation operates on (or a sentinel value in case its a begin/commit/abort op)</param>
 /// <param name = "newValue">The new value to write in case the operation is a write op.</param>
 /// <param name = "ro">Whether the transaction issuing the operation is a read only transaction - used for MVCC</param>
 /// <param name = "ts">The timestamp of the operation.</param>
 public Operation(Enumerations.OperationMode mode, int transId, int dataId = -1, int newValue = -1,
     bool ro = false, int ts = 0)
 {
     opMode = mode;
     transactionNumber = transId;
     dataItem = dataId;
     this.newValue = newValue;
     readOnly = ro;
     timeStamp = ts;
 }
Ejemplo n.º 38
0
 public static void AddCharacter(String name, Int32 pclass, Enumerations.Gender gender)
 {
     using (var buffer = new DataBuffer()) {
         buffer.WriteInt32((Int32)Packets.Client.AddCharacter);
         buffer.WriteString(name);
         buffer.WriteInt32(pclass);
         buffer.WriteByte((Byte)gender);
         SendData(buffer);
     }
 }
        public TreeChecksumViewModel(MainWindowViewModel viewModel, DirectoryItem rootNode) : base(viewModel)
        {
            string nameOfNone = Enumerations.ChecksumAlgorithim.None.GetDescription();

            m_AlgorithimList = Enumerations.GetEnumValueDescriptionPairs(typeof(Enumerations.ChecksumAlgorithim));
            m_AlgorithimList.Remove(new KeyValuePair <string, string>(nameOfNone, nameOfNone));

            RaisePropertyChanged(nameof(AlgorithimList));

            RootNode = rootNode;
        }
 public void SelectedUpdate()
 {
     if (myDirection == Enumerations.Direction.Choose)
     {
         myDirection = Enumerations.ChooseDirection(_canvasDirections);
     }
     if (Input.GetKeyUp(KeyCode.R) && _hasMoved == false)
     {
         myDirection = Enumerations.Direction.Choose;
     }
 }
Ejemplo n.º 41
0
        public EntityRelationshipModel(CharTypeID parentCharTypeID, int parentRecID, CharTypeID?childCharTypeID = null, int?childRecID = null)
        {
            var endpoint = Environment.GetEnvironmentVariable(EnvironmentVariables.ApiUrl);

            this.ParentURL = $"http://{endpoint}/v2/{Enumerations.GetEnumDescription(parentCharTypeID)}/{parentRecID}";

            if (childCharTypeID != null && childRecID != null)
            {
                this.ChildURL = $"http://{endpoint}/v2/{Enumerations.GetEnumDescription(childCharTypeID)}/{childRecID}";
            }
        }
Ejemplo n.º 42
0
 public static void ChatMessageWorld(Int32 sender, String msg, Enumerations.MessageType type)
 {
     for (var i = 0; i < Data.Players.Count; i++) {
         if (Data.Players.ContainsKey(Data.Players.ElementAt(i).Key)) {
             var key = Data.Players.ElementAt(i).Key;
             if (Data.TempPlayers.ContainsKey(key)) {
                 if (Data.TempPlayers[key].InGame) Send.ChatMessage(key, sender, msg, type);
             }
         }
     }
 }
Ejemplo n.º 43
0
 public List<Widget> GetWidgetList(string username, Enumerations.WidgetType widgetType)
 {            
     var userGuid = this.GetUserGuidFromUserName(username);
     var userRoles = this.userRepository.GetRolesOfUser(userGuid);
     var widgets = this.widgetRepository.GetAllWidgets(widgetType);
     if (userRoles.Count > 0)
         return widgets.Where(w => this.widgetsInRolesRepository.GetWidgetsInRolesByWidgetId(w.ID)
             .Exists(wr => userRoles.Exists(role => role.RoleId == wr.AspNetRole.RoleId))).ToList();
     else
         return widgets;
 }
Ejemplo n.º 44
0
        public JsonResult Process(int objectTypeId, int objectId, bool active)
        {
            try
            {
                using (Entity db = new Entity())
                {
                    IRequestEntity entity = null;
                    switch (Enumerations.Parse <RequestObjectType>(objectTypeId))
                    {
                    case RequestObjectType.Activity:
                        entity = db.t_activity.Find(objectId);
                        break;

                    case RequestObjectType.Aim:
                        entity = db.t_aim.Find(objectId);
                        break;

                    case RequestObjectType.Country:
                        entity = db.t_country.Find(objectId);
                        break;

                    case RequestObjectType.Indicator:
                        entity = db.t_indicator.Find(objectId);
                        break;

                    case RequestObjectType.Project:
                        entity = db.t_project.Find(objectId);
                        break;

                    case RequestObjectType.Site:
                        entity = db.t_site.Find(objectId);
                        break;

                    case RequestObjectType.User:
                        entity = db.t_user.Find(objectId);
                        break;

                    case RequestObjectType.Attachment:
                        entity = db.t_observation_attachment.Find(objectId);
                        break;
                    }
                    entity.active           = active;
                    entity.updatedby_userid = CurrentUser.Id;
                    entity.updated_date     = DateTime.Now;
                    db.SaveChanges();
                }

                return(GetJsonResult(true, String.Empty));
            }
            catch (Exception ex)
            {
                return(GetJsonResult(ex));
            }
        }
Ejemplo n.º 45
0
        public List <SelectListItem> GetSessionTypes()
        {
            List <SelectListItem> sessionTypes = Enum.GetValues(typeof(SessionType))
                                                 .Cast <SessionType>()
                                                 .Select(t => new SelectListItem
            {
                Value = Convert.ToInt16(t).ToString(),
                Text  = Enumerations.GetEnumDescription(t)
            }).ToList();

            return(sessionTypes);
        }
Ejemplo n.º 46
0
        public List <SelectListItem> GetUserRoles()
        {
            List <SelectListItem> userRoles = Enum.GetValues(typeof(UserRoles))
                                              .Cast <UserRoles>()
                                              .Select(t => new SelectListItem
            {
                Value = Convert.ToInt16(t).ToString(),
                Text  = Enumerations.GetEnumDescription(t)
            }).ToList();

            return(userRoles);
        }
Ejemplo n.º 47
0
 public List<Ability> GetAbilitys(Enumerations.CharClass charClass, int level)
 {
     switch (charClass)
     {
         case Enumerations.CharClass.Warrior:
             return allWarriorAbilitys[level];
         case Enumerations.CharClass.Mage:
             return allMageAbilitys[level];
         default:
             return null;
     }
 }
Ejemplo n.º 48
0
        public List <SelectListItem> GetLanguageLevel()
        {
            List <SelectListItem> languageLevel = Enum.GetValues(typeof(LanguageLevel))
                                                  .Cast <LanguageLevel>()
                                                  .Select(t => new SelectListItem
            {
                Value = Convert.ToInt16(t).ToString(),
                Text  = Enumerations.GetEnumDescription(t)
            }).ToList();

            return(languageLevel);
        }
Ejemplo n.º 49
0
 public static void Kill(Enumerations.Events.Kills enumCase)
 {
     switch (Manage.CurrentAnnouncer)
     {
         case Enumerations.SoundPacks.Portal2:
             Portal2.Kills(enumCase);
             break;
         case Enumerations.SoundPacks.StanlyParable:
             StanleyParable.Kills(enumCase);
             break;
     }
 }
        ///--------------------------------------------------------------------------------
        /// <summary>This method applies enumeration deletes.</summary>
        ///--------------------------------------------------------------------------------
        public void ProcessDeleteEnumerationPerformed(EnumerationEventArgs data)
        {
            try
            {
                bool isItemMatch = false;
                if (data != null && data.Enumeration != null)
                {
                    foreach (EnumerationViewModel item in Enumerations.ToList <EnumerationViewModel>())
                    {
                        if (item.Enumeration.EnumerationID == data.Enumeration.EnumerationID)
                        {
                            // remove item from tabs, if present
                            WorkspaceEventArgs message = new WorkspaceEventArgs();
                            message.ItemID = item.Enumeration.EnumerationID;
                            Mediator.NotifyColleagues <WorkspaceEventArgs>(MediatorMessages.Command_CloseItemRequested, message);

                            // delete children
                            for (int i = item.Items.Count - 1; i >= 0; i--)
                            {
                                if (item.Items[i] is ValueViewModel)
                                {
                                    ValueViewModel child        = item.Items[i] as ValueViewModel;
                                    ValueEventArgs childMessage = new ValueEventArgs();
                                    childMessage.Value         = child.Value;
                                    childMessage.EnumerationID = item.Enumeration.EnumerationID;
                                    childMessage.Solution      = Solution;
                                    childMessage.WorkspaceID   = child.WorkspaceID;
                                    item.ProcessDeleteValuePerformed(childMessage);
                                }
                            }

                            // delete item
                            isItemMatch = true;
                            Enumerations.Remove(item);
                            Model.EnumerationList.Remove(item.Enumeration);
                            Items.Remove(item);
                            Model.ResetModified(true);
                            OnUpdated(this, null);
                            break;
                        }
                    }
                    if (isItemMatch == false)
                    {
                        ShowIssue(DisplayValues.Issue_DeleteItemNotFound);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowIssue(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 51
0
 public static void ChatMessageMap(Int32 sender, Int32 map, String msg, Enumerations.MessageType type)
 {
     for (var i = 0; i < Data.Players.Count; i++) {
         var key = Data.Players.ElementAt(i).Key;
         if (Data.TempPlayers.ContainsKey(key)) {
             if (Data.TempPlayers[key].InGame) {
                 if (Data.Players[key].Characters[Data.TempPlayers[key].CurrentCharacter].Map == map) {
                     ChatMessage(key, sender, msg, type);
                 }
             }
         }
     }
 }
Ejemplo n.º 52
0
        public Int32 GetMaxVital(Enumerations.Vitals vital)
        {
            switch (vital) {

                case Enumerations.Vitals.HP:
                    return 100 + (this.Statistic[(Int32)Enumerations.Stats.Endurance] * 5) + 2;

                case Enumerations.Vitals.MP:
                    return 30 + (this.Statistic[(Int32)Enumerations.Stats.Intelligence] * 10) + 2;

            }
            return 0;
        }
Ejemplo n.º 53
0
 /// <summary>
 /// Initializes a new game
 /// </summary>
 /// <param name="farmName"></param>
 /// <param name="difficulty"></param>
 public Game(string farmName, Enumerations.Difficulty difficulty)
 {
     SeedInventory = new Dictionary<string, List<Seed>>();
       CropInventory = new Dictionary<string, List<Crop>>();
       InitializeInventories();
       FarmName = farmName;
       Difficulty = difficulty;
       _money = 10000.0;
       Fields = new List<FieldSlot>();
       Fields.Add(new FieldSlot());
       Fields.Add(new FieldSlot());
       CurrentWeather = new Weather(25.0, Enumerations.WeatherCondition.Sun, 0);
 }
Ejemplo n.º 54
0
        /// <summary>
        /// Initializes a new instance of class CodeControl
        /// </summary>
        /// <param name="content">Base64 content of the web resource</param>
        /// <param name="type">Web resource type</param>
        public CodeControl(string content, Enumerations.WebResourceType type)
        {
            InitializeComponent();

            if (!string.IsNullOrEmpty(content))
            {
                // Converts base64 content to string
                byte[] b = Convert.FromBase64String(content);
                innerContent = System.Text.Encoding.UTF8.GetString(b);
                originalContent = innerContent;
                innerType = type;
            }
        }
Ejemplo n.º 55
0
 public void Validate(object obj, Enumerations.Action action = Enumerations.Action.All, string[] Except = null)
 {
     if (Except == null) Except = new string[] { };
     foreach (System.Reflection.PropertyInfo property in obj.GetType().GetProperties())
     {
         Exceptions.ValidationException exception = null;
         if (Except.Any(e => e == property.Name))
             continue;
         if (!ValidateByAttribute(obj, property, action, ref exception))
             throw exception;
         if (!property.PropertyType.IsValueType && (!property.PropertyType.ContainsGenericParameters || (property.PropertyType.ContainsGenericParameters && !property.PropertyType.GenericTypeArguments.GetValue(0).GetType().IsValueType)) && property.PropertyType != typeof(string))
             Validate(property.GetValue(obj), action);
     }
 }
Ejemplo n.º 56
0
 public bool ImportSingleContact(Guid clientId, AllClientsContact contact, Enumerations.WebformType webformType)
 {
     bool result = false;
     using (var ctx = new DomainContext())
     {
         var allClientsContactExport = new AllClientsContactExport { Contact = contact };
         var client = ctx.Client.Single(n => n.Id == clientId);
         allClientsContactExport.Account = AllClientsService.GetAllClientsAccount(client);
         var webForms = AllClientsService.GetAllClientsWebforms(allClientsContactExport.Account);
         allClientsContactExport.AllClientsWebform = webForms.Single(n => n.WebformType == webformType);
         result = AllClientsService.ExportContact(allClientsContactExport).Contains("lblThankYou");
     }
     return result;
 }
Ejemplo n.º 57
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "Result" /> class.
 /// </summary>
 /// <param name = "transaction">The transaction that issued the operation.</param>
 /// <param name = "mode">The mode of the operation (begin, commit, read, write, etc).</param>
 /// <param name = "siteNumber">The site number that created the result.</param>
 /// <param name = "rstatus">The result status (success / failure).</param>
 /// <param name = "trans">The ids of all transactions which have blocked the operation from begin successful.</param>
 /// <param name = "val">The value read if it was a read operation.</param>
 /// <param name = "dataItem">The data item that was accessed if one was accessed.</param>
 /// <param name = "ts">The timestamp for which the result object should correspond to.</param>
 public Result(int transaction, Enumerations.OperationMode mode, int siteNumber,
     Enumerations.ResultStatus rstatus, List<int> trans, int val = 0, int dataItem = 0, int ts = 0)
 {
     issuingTransaction = transaction;
     opMode = mode;
     this.siteNumber = siteNumber;
     status = rstatus;
     timeStamp = ts;
     transId = new List<int>();
     if (trans != null)
         transId.AddRange(trans);
     this.val = val;
     this.dataItem = dataItem;
 }
        private string enumName; // the name of the enumeration set.

        public EditEnumForm(string enumName, eFormType type, Enumerations.EnumerationItem enumValue)
        {
            InitializeComponent();
            this.type = type;
            this.enumName = enumName;
            this.enumValue = enumValue;

            if (this.type == eFormType.Edit)
            {
                EnumIdTextBox.Text = enumValue.Id.ToString();
                EnumNameTextBox.Text = enumValue.Name;
                EnumIsDefaultCheckBox.Checked = enumValue.IsDefault;
            }
            LoadLanguage();
        }
Ejemplo n.º 59
0
 /// <summary>
 /// Initializes a new seed
 /// </summary>
 public Seed(string name, double baseSeedGrowth, Enumerations.SeedType seedType, Enumerations.Quality seedQuality, double requiredWater, Crop parentCrop, double optimalTemperature, int cropRate, double baseCropGrowth)
 {
     Name = name;
       BaseSeedGrowth = baseSeedGrowth;
       SeedGrowth = 0;
       BaseCropGrowth = baseCropGrowth;
       Age = 0;
       Health = 100.0;
       SeedType = seedType;
       SeedQuality = seedQuality;
       RequiredWaterBase = requiredWater;
       Crops = new List<Crop>();
       OptimalTemperature = optimalTemperature;
       _cropRate = cropRate;
       ParentCrop = parentCrop;
 }
Ejemplo n.º 60
0
 public PasswordAttribute(string friendlyName, Enumerations.PasswordType passwordType, Enumerations.Action action = Enumerations.Action.All)
     : base(friendlyName, Constants.RegularExpressionPatterns.BadPassword, System.Text.RegularExpressions.RegexOptions.None, false, action)
 {
     PasswordType = passwordType;
     switch (PasswordType)
     {
         case Enumerations.PasswordType.Best:
             Pattern = Constants.RegularExpressionPatterns.BestPassword;
             break;
         case Enumerations.PasswordType.Strong:
             Pattern = Constants.RegularExpressionPatterns.StrongPassword;
             break;
         case Enumerations.PasswordType.Weak:
             Pattern = Constants.RegularExpressionPatterns.WeakPassword;
             break;
     };
 }