コード例 #1
0
        /// <summary>
        /// Nalazi slobodnog workera sa najmanjim costID i prosledjuje mu podatke za obradu.
        /// Cost id workera je definisan njegovim indeksom u listi. Worker sa manjim indeksom ima manjin costID
        /// </summary>
        /// <param name="type">Tip modifikacije po kome worker poziva odgovarajucu akciju nad bazom</param>
        /// <param name="id">Red u bazi koji se menja</param>
        /// <param name="data">Novi podaci za bazu</param>
        /// <param name="retVal">Povratna vrednost koja se odnosi na uspesnost workerove radnje</param>
        public void ChooseWorkerAndSend(ModifyType type, string id, string data)
        {
            bool     found         = false;
            Argument argToWorkWith = new Argument(type, id, data);

            while (!found)
            {
                //go through all workers; check the one with smalest costID; if busy, search for next one; if not, give him the client data for processing
                int cnt = 0;

                foreach (var item in isBusy)
                {
                    if (item)
                    {
                        cnt++;
                    }
                    else
                    {
                        break;
                    }
                }
                if (cnt < _maxNbOfTasks)
                {
                    found                 = true;
                    arguments[cnt]        = argToWorkWith;
                    requestToProcess[cnt] = true;
                }
                else
                {
                    //Svi radnici su zauzeti; cekaj da neki bude oslobodjen
                    Thread.Sleep(200);
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// The dispatcher of the <see cref="PlaylistModified"/> event
 /// </summary>
 /// <param name="playlist">The playlist that was modified</param>
 /// <param name="type">The type of modification that occured</param>
 /// <param name="interactive">Whether the action was performed by the user directly</param>
 private static void DispatchPlaylistModified(PlaylistData playlist, ModifyType type, bool interactive = false)
 {
     if (PlaylistModified != null)
     {
         PlaylistModified(playlist, new ModifiedEventArgs(type, null, interactive));
     }
 }
コード例 #3
0
ファイル: BaseRepository.cs プロジェクト: AbnerTisa/Yhgd
        public virtual T GetData(TKey id, bool getDataOnly = false)
        {
            var d = default(T);

            if (!IsKeyEmpty(id))
            {
                d = dbManager.ExecuteList <T>(CreateQuerySql(id), GetConverter()).FirstOrDefault();
            }

            if (d == null)
            {
                if (!getDataOnly)
                {
                    RepositoryModifyType = ModifyType.Add;
                }
                data = CreateEmptyData();
            }
            else
            {
                if (!getDataOnly)
                {
                    RepositoryModifyType = ModifyType.Update;
                }
                data = d;
            }
            return(data);
        }
コード例 #4
0
 public StatusBonus(BonusType bonusType, ModifyType modifyType, float effectValue, float effectDuration)
 {
     this.bonusType      = bonusType;
     this.modifyType     = modifyType;
     this.effectValue    = effectValue;
     this.effectDuration = effectDuration;
 }
コード例 #5
0
    // EI TOIMI, KORJAA!!!! (poistettu käytöstä)
    public void ModifyTerrainMesh(ModifyType type, Vector2 worldpoint, float radius)
    {
        switch (type)
        {
            case ModifyType.Cut:
                float mapHitpoint = GetNormalizedPos(worldpoint.x) * (detail - 1);
                int firstPoint = Mathf.CeilToInt(GetNormalizedPos(worldpoint.x - radius) * (detail - 1));
                int lastPoint = Mathf.FloorToInt(GetNormalizedPos(worldpoint.x + radius) * (detail - 1));

                //print(firstPoint + " :: " + lastPoint);

                List<float> newVertexHeight = new List<float>();
                for (int i = firstPoint; i < lastPoint + 1; i++)
                {
                    float newY = worldpoint.y - Mathf.Sqrt(Mathf.Pow(Mathf.Abs(mapHitpoint - i), 2) - 1);
                    newVertexHeight.Add(newY);
                    //print("new: " + newY + "  old: " + map[i]);
                }

                UpdateTerrainVertexHeight(firstPoint, newVertexHeight.ToArray());
                break;

            default:
                break;
        }
    }
コード例 #6
0
 public static bool HasInheritModify(ModifyType type)
 {
     return type == ModifyType.Refer ||
          type == ModifyType.Typeof ||
          type == ModifyType.Nullable ||
          type == ModifyType.Pointer;
 }
コード例 #7
0
        public Task <TaskResult> SaveJournalContent(JournalContent content, ModifyType modify)
        {
            Task <TaskResult> res = null;

            if (modify == ModifyType.Update)
            {
                res = ServiceRunTask(service =>
                {
                    service.UpdateJournalContent(content);
                    return(null);
                });
            }
            else if (modify == ModifyType.Insert)
            {
                res = ServiceRunTask(service =>
                {
                    content.exam_date_id = CurrentJournal.exam_date_id;
                    return(service.InsertJournalContent(content));
                });
            }
            else if (modify == ModifyType.Delete)
            {
                res = ServiceRunTask(service =>
                {
                    return(service.DeleteJournalContent(content.id));
                });
            }
            return(res);
        }
コード例 #8
0
        public bool Modify(ModifyType type, string id, string newVersion)   //newVersion contains SID. Client sent it like that.
        {
            bool result = false;

            if (HasPermission(Permission.Modify))
            {
                try
                {
                    result = proxy.Modify(type, id, newVersion);
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
            else
            {
                return(result);
            }
            if (DBChangeEvent != null)
            {
                if (type == ModifyType.Edit)
                {
                    DBChangeEvent(this, "User with SID " + GetSid() + " modified event with ID " + id + " to new value " + newVersion + ".");
                }
                else
                {
                    DBChangeEvent(this, "User with SID " + GetSid() + " deleted event with ID " + id + ".");
                }
            }
            return(result);
        }
コード例 #9
0
        public Task <TaskResult> SavePPEExamBlank(PPEExamBlank content, ModifyType modify, int old_aud = -1)
        {
            Task <TaskResult> res = null;

            if (modify == ModifyType.Update)
            {
                res = ServiceRunTask(service =>
                {
                    service.UpdatePPEExamBlank(content, old_aud);
                    return(null);
                });
            }
            else if (modify == ModifyType.Insert)
            {
                res = ServiceRunTask(service =>
                {
                    content.ppe_exam_id = CurrentPPEExamContent.ppe_exam_id;
                    return(service.InsertPPEExamBlank(content));
                });
            }
            else if (modify == ModifyType.Delete)
            {
                res = ServiceRunTask(service =>
                {
                    return(service.DeletePPEExamBlank(content));
                });
            }
            return(res);
        }
コード例 #10
0
 public void AddBonus(GroupType type, ModifyType modifyType, float value)
 {
     if (!statBonuses.ContainsKey(type))
     {
         statBonuses[type] = new StatBonus();
     }
     statBonuses[type].AddBonus(modifyType, value);
 }
コード例 #11
0
 public ModifyTypeSymbol(ModifyType type)
 {
     Name = "@@" + type.ToString();
     ModifyType = type;
     var g = new GenericSymbol("T", new List<AttributeSymbol>(), new List<Scope>());
     _Generics = new GenericSymbol[] { g };
     _Inherit = new TypeSymbol[] { g };
 }
コード例 #12
0
    public string GetLocalizationText_BonusType(BonusType type, ModifyType modifyType, float value, GroupType restriction, float duration = 0)
    {
        string output = GetBonusTypeString(type);

        if (restriction != GroupType.NO_GROUP)
        {
            output = GetLocalizationText_GroupTypeRestriction(restriction) + ", " + output;
        }

        if (type >= (BonusType)HeroArchetypeData.SpecialBonusStart)
        {
            return(output + "\n");
        }

        output += " <nobr>";

        switch (modifyType)
        {
        case ModifyType.FLAT_ADDITION:
            if (value >= 0)
            {
                output += "+" + value;
            }
            else
            {
                output += value;
            }
            break;

        case ModifyType.ADDITIVE:
            if (value >= 0)
            {
                output += "+" + value + "%";
            }
            else
            {
                output += value + "%";
            }
            break;

        case ModifyType.MULTIPLY:
            output += "x" + (1 + value / 100d).ToString("0.00##");
            break;

        case ModifyType.FIXED_TO:
            output += "is " + value;
            break;
        }

        if (duration > 0)
        {
            output += " for " + duration.ToString("N1") + "s";
        }

        output += "</nobr>\n";

        return(output);
    }
コード例 #13
0
            private void Modify(ModifyType type, string str = null)
            {
                var text   = _rtb.Text;
                var column = _a - Helper.GetLineStart(text, _a);

                if (!(type == ModifyType.Backspace && column == 0))
                {
                    _on = false;
                    var i = Helper.GetLineStart(text, _a);
                    _rtb.Select(i, Helper.GetLineEnd(text, _b) - i);
                    var lines = _rtb.SelectedText.Split('\n');
                    for (var p = 0; p < lines.Length; p++)
                    {
                        if (type == ModifyType.Backspace)
                        {
                            if (column <= lines[p].Length)
                            {
                                lines[p] = lines[p].Substring(0, column - 1) + lines[p].Substring(column);
                            }
                        }
                        else if (type == ModifyType.Delete)
                        {
                            if (column < lines[p].Length)
                            {
                                lines[p] = lines[p].Substring(0, column) + lines[p].Substring(column + 1);
                            }
                        }
                        else
                        {
                            var n = column - lines[p].Length;
                            if (n > 0)
                            {
                                lines[p] += new string(' ', n);
                            }
                            Helper.RequireTrue(str != null);
                            lines[p] = lines[p].Substring(0, column) + str + lines[p].Substring(column);
                        }
                    }
                    _rtb.SelectedText = string.Join("\n", lines);
                    _b = column + Helper.GetLineStart(_rtb.Text, _rtb.SelectionStart + _rtb.SelectionLength - 1);
                    if (type == ModifyType.Backspace)
                    {
                        _a--;
                        _b--;
                    }
                    else if (type == ModifyType.String)
                    {
                        _a += str.Length;
                        _b += str.Length;
                    }
                    _rtb.Select(_a, 0);
                    _counter = 0;
                    _timer.Stop();
                    _timer.Start();
                    _on = true;
                }
            }
コード例 #14
0
 public TypeDefinition AddModify(ModifyType modify)
 {
     if (Modifies.IsReadOnly)
     {
         Modifies = new List <ModifyType>(Modifies);
     }
     Modifies.Add(modify);
     return(this);
 }
コード例 #15
0
    private static void ModifyBuildSetting(ref string projectContent, ProjectSettingType settingType,
                                           string newValue, ModifyType modifyType)
    {
        foreach (string configurationGuid in buildConfigurationGuids)
        {
            string pattern = "/\\* Begin XCBuildConfiguration section \\*/(?:\n|.)+?" + configurationGuid +
                             " /\\* (\\w+?) \\*/ = \\{(?:.|\n)+?buildSettings = \\{\n((?:.|\n)+?)name = \\1;";

            Match m = Regex.Match(projectContent, pattern);

            if (!m.Success)
            {
                Debug.Log("No build setting section!");
            }
            else
            {
                string settingContent = m.Groups[2].Value;
                string settingKey     = settingKeyDict[settingType];
                pattern = Regex.Escape(settingKey) + " = \\(?\n?((?:.|\n)+?)\\)?;";

                Match contentMatch = Regex.Match(settingContent, pattern);
                if (!contentMatch.Success)
                {
                    string addString = "\t\t\t\t" + settingKey + " = ";
                    if (settingType == ProjectSettingType.LibrarySearchPath || settingType == ProjectSettingType.FrameworkSearchPath)
                    {
                        addString = addString + "(\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t" + newValue + ",\n\t\t\t\t);\n";
                    }
                    else
                    {
                        addString = addString + newValue + ";\n";
                    }
                    projectContent = projectContent.Substring(0, m.Groups[2].Index) +
                                     addString + projectContent.Substring(m.Groups[2].Index);
                }
                else
                {
                    string contentValue = contentMatch.Groups[1].Value;
                    pattern = Regex.Escape(newValue);
                    Match valueMatch = Regex.Match(contentValue, pattern);
                    if (!valueMatch.Success)
                    {
                        string addString = newValue;
                        if (modifyType == ModifyType.Append)
                        {
                            addString = contentMatch.Groups[1].Value + addString + ",\n";
                        }
                        projectContent = projectContent.Substring(0, m.Groups[2].Index) +
                                         settingContent.Substring(0, contentMatch.Groups[1].Index) +
                                         addString + settingContent.Substring(contentMatch.Groups[1].Index + contentMatch.Groups[1].Length)
                                         + projectContent.Substring(m.Groups[2].Index + m.Groups[2].Length);
                    }
                }
            }
        }
    }
コード例 #16
0
        public void Modify(MaterialMorpher caller, string name, object val, ModifyType type)
        {
            var uniformVariable = GetUniform(name);

            if (uniformVariable != null)
            {
                uniformVariable.AddModifier(caller, val, type);
                //VisibilityCheck(name, uniformVariable);
            }
        }
コード例 #17
0
ファイル: RawQuery.cs プロジェクト: Jan-Kruse/DotCAML
        private Builder ParseRecursive(Builder builder, XmlNode node, ModifyType modifyType)
        {
            if (node.Name == "#text")
            {
                builder._tree.Add(new RawElement {
                    Xml = node.Value
                });
                return(null);
            }

            var attrs = new List <Attribute>();

            foreach (XmlAttribute attribute in node.Attributes)
            {
                attrs.Add(new Attribute {
                    Name = attribute.Name, Value = attribute.Value
                });
            }

            builder.WriteStart(node.Name, attrs);
            builder._unclosedTags++;

            var found = node.Name == "Query" ? new Builder() : null;

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (node.Name == "Query" && childNode.Name == "Where")
                {
                    var whereBuilder = new Builder();

                    foreach (XmlNode childChildNode in childNode.ChildNodes)
                    {
                        this.ParseRecursive(whereBuilder, childChildNode, modifyType);
                    }

                    found = whereBuilder;
                    continue;
                }

                var result = this.ParseRecursive(builder, childNode, modifyType);

                if (found == null)
                {
                    found = result;
                }
            }

            if (found == null)
            {
                builder._unclosedTags--;
                builder.WriteEnd();
            }

            return(found);
        }
コード例 #18
0
        private BlackBoardValue ModifyValue(BlackBoardValue original, ModifyType type, BlackBoardValue modifier)
        {
            modifier.Type = original.Type;

            switch (type)
            {
            case ModifyType.Set:
                return(modifier.Copy());

            case ModifyType.Add:
            {
                switch (original.Type)
                {
                case BlackBoardValue.ValueType.Int:
                    var v = original.Copy();
                    v.Int = original.Int + modifier.Int;
                    return(v);

                case BlackBoardValue.ValueType.Float:
                    var v2 = original.Copy();
                    v2.Float = original.Float + modifier.Float;
                    return(v2);

                default:
                case BlackBoardValue.ValueType.Bool:
                    break;
                }
            }
            break;

            case ModifyType.Multiply:
            {
                switch (original.Type)
                {
                case BlackBoardValue.ValueType.Int:
                    var v = original.Copy();
                    v.Int = original.Int * modifier.Int;
                    return(v);

                case BlackBoardValue.ValueType.Float:
                    var v2 = original.Copy();
                    v2.Float = original.Float * modifier.Float;
                    return(v2);

                default:
                case BlackBoardValue.ValueType.Bool:
                    break;
                }
            }
            break;
            }

            Debug.LogError("Something strange happened in the Modifier class");
            return(original.Copy());
        }
コード例 #19
0
ファイル: ActorData.cs プロジェクト: v-duong/HeroTowerGame
 public void RemoveTemporaryBonus(float value, BonusType type, ModifyType modifier, bool deferUpdate)
 {
     if (temporaryBonuses.ContainsKey(type))
     {
         temporaryBonuses[type].RemoveBonus(modifier, value);
     }
     if (!deferUpdate)
     {
         UpdateActorData();
     }
 }
コード例 #20
0
 public NodeTotalInfo(BonusType bonus, ModifyType mod, GroupType r)
 {
     this.bonus    = bonus;
     this.mod      = mod;
     this.restrict = r;
     if (mod == ModifyType.MULTIPLY)
     {
         negTotal = 100f;
         posTotal = 100f;
     }
 }
コード例 #21
0
        public override void DrawInspectorGUI()
        {
            referenceType = (ReferenceType)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Reference Type",
                                                                                                "This is how you will provide the response access to a specific gameobject. You can either use a reference, name or use the gameobject that collides with this trigger box."), referenceType);

            switch (referenceType)
            {
            case ReferenceType.GameObjectReference:
                obj = (GameObject)UnityEditor.EditorGUILayout.ObjectField(new GUIContent("GameObject",
                                                                                         "The gameobject that will modified."), obj, typeof(GameObject), true);
                break;

            case ReferenceType.GameObjectName:
                gameObjectName = UnityEditor.EditorGUILayout.TextField(new GUIContent("GameObject Name",
                                                                                      "If you cannot get a reference for a gameobject you can enter it's name here and it will be found (GameObject.Find()) and modified."), gameObjectName);
                break;
            }

            modifyType = (ModifyType)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Modification Type",
                                                                                          "This is the type of modification. Destroy, disable and enable are applied to the gameobject itself whereas disable component and enable component are applied to specific components that belong to the gameobject."), modifyType);

            if (modifyType == ModifyType.DisableComponent || modifyType == ModifyType.EnableComponent)
            {
                if (obj)
                {
                    // Get all components that can be disabled/enabled. Should this be cached?
                    List <UnityEngine.Component> components = GetObjectComponents();

                    if (components.Count == 0) // No components so return out of the function.
                    {
                        componentCount = 0;
                        return;
                    }

                    // The number of components belonging to this gameobject has changed.
                    if (componentCount != components.Count && selectedComponent != null)
                    {
                        // Find the index of the component previously selected
                        selectedComponentIndex = components.FindIndex(c => c == selectedComponent);

                        componentCount = components.Count;
                    }
                    else if (selectedComponent == null) // The selected component has been deleted from the gameobject
                    {
                        selectedComponentIndex = 0;
                    }

                    // TODO: Figure out how to add tooltip
                    selectedComponentIndex = UnityEditor.EditorGUILayout.Popup("Select Component", selectedComponentIndex, components.Select(n => n.GetType().ToString()).ToArray());

                    selectedComponent = components[selectedComponentIndex];
                }
            }
        }
コード例 #22
0
 public InjectionInfos()
 {
     Success = string.Empty;
      Fail = string.Empty;
      InjectableParameter = string.Empty;
      POST = string.Empty;
      URL = string.Empty;
      ModifyType = ModifyType.GET;
      DefaultValue = string.Empty;
      CustomCookieCollection = new CookieCollection();
 }
コード例 #23
0
 public InjectionInfos()
 {
     Success             = string.Empty;
     Fail                = string.Empty;
     InjectableParameter = string.Empty;
     POST                = string.Empty;
     URL                    = string.Empty;
     ModifyType             = ModifyType.GET;
     DefaultValue           = string.Empty;
     CustomCookieCollection = new CookieCollection();
 }
コード例 #24
0
 public static EventNode Load(BinaryReader br, int id, MapEventType type, ModifyType subType)
 {
     return(new EventNode(id, new SetNpcActiveEvent
     {
         IsActive = br.ReadByte(),                  // 2
         NpcId = (NpcCharacterId)br.ReadByte() - 1, // 3
         Unk4 = br.ReadByte(),                      // 4
         Unk5 = br.ReadByte(),                      // 5
         Unk6 = br.ReadUInt16(),                    // 6
         Unk8 = br.ReadUInt16(),                    // 8
     }));
 }
コード例 #25
0
 public static EventNode Load(BinaryReader br, int id, MapEventType type, ModifyType subType)
 {
     return(new EventNode(id, new AddRemoveInventoryItemEvent
     {
         Operation = (QuantityChangeOperation)br.ReadByte(), // 2
         Amount = br.ReadByte(),                             // 3
         Unk4 = br.ReadByte(),                               // 4
         Unk5 = br.ReadByte(),                               // 5
         ItemId = (ItemId)br.ReadUInt16(),                   // 6
         Unk8 = br.ReadUInt16(),                             // 8
     }));
 }
コード例 #26
0
 public static EventNode Load(BinaryReader br, int id, MapEventType type, ModifyType subType)
 {
     return(new EventNode(id, new DummyModifyEvent
     {
         Unk2 = br.ReadByte(),   // 2
         Unk3 = br.ReadByte(),   // 3
         Unk4 = br.ReadByte(),   // 4
         Unk5 = br.ReadByte(),   // 5
         Unk6 = br.ReadUInt16(), // 6
         Unk8 = br.ReadUInt16(), // 8
     }));
 }
コード例 #27
0
 public static EventNode Load(BinaryReader br, int id, MapEventType type, ModifyType subType)
 {
     return(new EventNode(id, new SetMapLightingEvent
     {
         Unk2 = br.ReadByte(),                        // 2
         Unk3 = br.ReadByte(),                        // 3
         Unk4 = br.ReadByte(),                        // 4
         Unk5 = br.ReadByte(),                        // 5
         LightLevel = (LightingLevel)br.ReadUInt16(), // 6
         Unk8 = br.ReadUInt16(),                      // 8
     }));
 }
コード例 #28
0
 public static EventNode Load(BinaryReader br, int id, MapEventType type, ModifyType subType)
 {
     return(new EventNode(id, new SetPartyLeaderEvent
     {
         Unk2 = br.ReadByte(),                              // 2
         Unk3 = br.ReadByte(),                              // 3
         Unk4 = br.ReadByte(),                              // 4
         Unk5 = br.ReadByte(),                              // 5
         PartyMemberId = (PartyCharacterId)br.ReadUInt16(), // 6
         Unk8 = br.ReadUInt16(),                            // 8
     }));
 }
コード例 #29
0
ファイル: errDemo.cs プロジェクト: mrpanwei/DesignPattern
 /// <summary>
 /// Designs the patterns.编码6大原则.单一职责原则. user opr. user info modity.
 /// </summary>
 /// <returns><c>true</c>, if patterns.编码6大原则.单一职责原则. user opr. user info modity was designed, <c>false</c> otherwise.</returns>
 /// <param name="modifyType">Modify type.</param>
 bool UserOpr.UserInfoModity(ModifyType modifyType)
 {
     if (modifyType == ModifyType.Modify_UserName)
     {
         //这里是更新用户名的具体操作方法
     }
     else if (modifyType == ModifyType.Modify_CellPhone)
     {
         //这里是更新联系方式的具体操作方法
     }
     return(true);
 }
コード例 #30
0
 public static EventNode Load(BinaryReader br, int id, MapEventType type, ModifyType subType)
 {
     return(new EventNode(id, new SetTemporarySwitchEvent
     {
         SwitchValue = br.ReadByte(), // 2
         Unk3 = br.ReadByte(),        // 3
         Unk4 = br.ReadByte(),        // 4
         Unk5 = br.ReadByte(),        // 5
         SwitchId = br.ReadUInt16(),  // 6
         Unk8 = br.ReadUInt16(),      // 8
     }));
 }
コード例 #31
0
 public static EventNode Load(BinaryReader br, int id, MapEventType type, ModifyType subType)
 {
     return(new EventNode(id, new ChangePartyGoldEvent
     {
         Operation = (QuantityChangeOperation)br.ReadByte(), // 2
         Unk3 = br.ReadByte(),                               // 3
         Unk4 = br.ReadByte(),                               // 4
         Unk5 = br.ReadByte(),                               // 5
         Amount = br.ReadUInt16(),                           // 6
         Unk8 = br.ReadUInt16(),                             // 8
     }));
 }
コード例 #32
0
ファイル: ActorData.cs プロジェクト: v-duong/HeroTowerGame
 public void AddTemporaryBonus(float value, BonusType type, ModifyType modifier, bool deferUpdate)
 {
     if (!temporaryBonuses.ContainsKey(type))
     {
         temporaryBonuses.Add(type, new StatBonus());
     }
     temporaryBonuses[type].AddBonus(modifier, value);
     if (!deferUpdate)
     {
         UpdateActorData();
     }
 }
コード例 #33
0
    public void RemoveArchetypeStatBonus(BonusType type, GroupType restriction, ModifyType modifier, float value)
    {
        if (type >= (BonusType)HeroArchetypeData.SpecialBonusStart)
        {
            RemoveSpecialBonus(type);
            return;
        }

        if (!archetypeStatBonuses.ContainsKey(type))
        {
            return;
        }
        archetypeStatBonuses[type].RemoveBonus(restriction, modifier, value);
    }
コード例 #34
0
 public static bool HasContainModify(Scope type, ModifyType modify)
 {
     var t = type as ClassTemplateInstance;
     if (t == null)
     {
         return false;
     }
     var m = t.Type as ModifyTypeSymbol;
     if (m == null)
     {
         return false;
     }
     return m.ModifyType == modify;
 }
コード例 #35
0
ファイル: PlaylistManager.cs プロジェクト: uQr/stoffi
 /// <summary>
 /// The dispatcher of the <see cref="PlaylistModified"/> event
 /// </summary>
 /// <param name="playlist">The playlist that was modified</param>
 /// <param name="type">The type of modification that occured</param>
 /// <param name="interactive">Whether the action was performed by the user directly</param>
 private static void DispatchPlaylistModified(PlaylistData playlist, ModifyType type, bool interactive = false)
 {
     if (PlaylistModified != null)
         PlaylistModified(playlist, new ModifiedEventArgs(type, null, interactive));
 }
コード例 #36
0
ファイル: PlaylistManager.cs プロジェクト: uQr/stoffi
 /// <summary>
 /// Creates an instance of the ModifiedEventArgs class
 /// </summary>
 /// <param name="type">The type of modification that occured</param>
 /// <param name="data">The data of the modification</param>
 /// <param name="interactive">Whether the action was performed by the user directly</param>
 public ModifiedEventArgs(ModifyType type, object data, bool interactive = false)
 {
     Type = type;
     Data = data;
     Interactive = interactive;
 }
コード例 #37
0
ファイル: Att_RosterGroupServices.cs プロジェクト: dtafe/vnr
        public DataTable GetTableRosterGroupByMonth(DateTime MonthYear, ModifyType Type)
        {
            if (lstShift_RosterGroup == null || lstShift_RosterGroup.Count == 0)
                return new DataTable();

            DateTime BeginMonth = new DateTime(MonthYear.Year, MonthYear.Month, 1);
            DateTime EndMonth = BeginMonth.AddMonths(1).AddMinutes(-1);
            List<string> lstShiftCode = lstShift_RosterGroup.Select(m => m.Code).Distinct().ToList();
            DataTable dt = GetSchemaRosterGroup(lstShiftCode);
            if (Type == ModifyType.E_CREATE)
            {
                for (DateTime datecheck = BeginMonth; datecheck < EndMonth; datecheck = datecheck.AddDays(1))
                {
                    DataRow dr = dt.NewRow();
                    dr[Att_ChangeRosterGroupEntity.FieldNames.DayOfMonth] = datecheck.ToString("dd/MM/yyyy");
                    string DayOfWeek = string.Empty;
                    switch (datecheck.DayOfWeek)
                    {
                        case System.DayOfWeek.Monday:
                            DayOfWeek = System.DayOfWeek.Monday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Tuesday:
                            DayOfWeek = System.DayOfWeek.Tuesday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Wednesday:
                            DayOfWeek = System.DayOfWeek.Wednesday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Thursday:
                            DayOfWeek = System.DayOfWeek.Thursday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Friday:
                            DayOfWeek = System.DayOfWeek.Friday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Saturday:
                            DayOfWeek = System.DayOfWeek.Saturday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Sunday:
                            DayOfWeek = System.DayOfWeek.Sunday.ToString().TranslateString();
                            break;
                    }
                    dr[Att_ChangeRosterGroupEntity.FieldNames.DayOfWeek] = DayOfWeek;
                    dt.Rows.Add(dr);
                }

            }
            else
            {
                var lstRosterGroup = new List<RosterGroupModel>();
                var lstShift = new List<Cat_Shift>();
                using (var context = new VnrHrmDataContext())
                {
                    var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                    lstRosterGroup = unitOfWork.CreateQueryable<Att_RosterGroup>(m => m.DateStart != null && m.DateEnd != null && m.DateStart <= EndMonth && m.DateEnd >= BeginMonth)
                        .Select(m => new RosterGroupModel()
                        {
                            ID = m.ID,
                            RosterGroupName = m.RosterGroupName,
                            DateStart = m.DateStart.Value,
                            DateEnd = m.DateEnd.Value,
                            MonShiftID = m.MonShiftID,
                            TueShiftID = m.TueShiftID,
                            WedShiftID = m.WedShiftID,
                            ThuShiftID = m.ThuShiftID,
                            FriShiftID = m.FriShiftID,
                            SatShiftID = m.SatShiftID,
                            SunShiftID = m.SunShiftID
                        })
                        .ToList();
                    lstShift = unitOfWork.CreateQueryable<Cat_Shift>().ToList();
                }

                for (DateTime datecheck = BeginMonth; datecheck < EndMonth; datecheck = datecheck.AddDays(1))
                {
                    DataRow dr = dt.NewRow();
                    var lstRosterGroupByDate = lstRosterGroup.Where(m => m.DateStart <= datecheck && m.DateEnd >= datecheck).ToList();
                    dr[Att_ChangeRosterGroupEntity.FieldNames.DayOfMonth] = datecheck.ToString("dd/MM/yyyy");
                    string DayOfWeek = string.Empty;
                    switch (datecheck.DayOfWeek)
                    {
                        case System.DayOfWeek.Monday:
                            DayOfWeek = System.DayOfWeek.Monday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Tuesday:
                            DayOfWeek = System.DayOfWeek.Tuesday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Wednesday:
                            DayOfWeek = System.DayOfWeek.Wednesday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Thursday:
                            DayOfWeek = System.DayOfWeek.Thursday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Friday:
                            DayOfWeek = System.DayOfWeek.Friday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Saturday:
                            DayOfWeek = System.DayOfWeek.Saturday.ToString().TranslateString();
                            break;
                        case System.DayOfWeek.Sunday:
                            DayOfWeek = System.DayOfWeek.Sunday.ToString().TranslateString();
                            break;
                    }
                    dr[Att_ChangeRosterGroupEntity.FieldNames.DayOfWeek] = DayOfWeek;

                    foreach (var ShiftCode in lstShiftCode)
                    {
                        Guid ShiftID = lstShift.Where(m => m.Code == ShiftCode).Select(m => m.ID).FirstOrDefault();
                        if (ShiftID == null || ShiftID == Guid.Empty)
                            continue;

                        string NameOfGroup = string.Empty;
                        switch (datecheck.DayOfWeek)
                        {
                            case System.DayOfWeek.Monday:
                                NameOfGroup = lstRosterGroupByDate.Where(m => m.MonShiftID != null && m.MonShiftID.Value == ShiftID).Select(m => m.RosterGroupName).FirstOrDefault();
                                break;
                            case System.DayOfWeek.Tuesday:
                                NameOfGroup = lstRosterGroupByDate.Where(m => m.TueShiftID != null && m.TueShiftID.Value == ShiftID).Select(m => m.RosterGroupName).FirstOrDefault();
                                break;
                            case System.DayOfWeek.Wednesday:
                                NameOfGroup = lstRosterGroupByDate.Where(m => m.WedShiftID != null && m.WedShiftID.Value == ShiftID).Select(m => m.RosterGroupName).FirstOrDefault();
                                break;
                            case System.DayOfWeek.Thursday:
                                NameOfGroup = lstRosterGroupByDate.Where(m => m.ThuShiftID != null && m.ThuShiftID.Value == ShiftID).Select(m => m.RosterGroupName).FirstOrDefault();
                                break;
                            case System.DayOfWeek.Friday:
                                NameOfGroup = lstRosterGroupByDate.Where(m => m.FriShiftID != null && m.FriShiftID.Value == ShiftID).Select(m => m.RosterGroupName).FirstOrDefault();
                                break;
                            case System.DayOfWeek.Saturday:
                                NameOfGroup = lstRosterGroupByDate.Where(m => m.SatShiftID != null && m.SatShiftID.Value == ShiftID).Select(m => m.RosterGroupName).FirstOrDefault();
                                break;
                            case System.DayOfWeek.Sunday:
                                NameOfGroup = lstRosterGroupByDate.Where(m => m.SunShiftID != null && m.SunShiftID.Value == ShiftID).Select(m => m.RosterGroupName).FirstOrDefault();
                                break;
                        }
                        dr[ShiftCode] = NameOfGroup;
                    }
                    dt.Rows.Add(dr);
                }
            }

            return dt;

        }
コード例 #38
0
 public ModifyTypeStructure(ModifyType type)
 {
     ModifyType = type;
 }