private int GetEquipItemID(TypeCondition condition, CharaInfo target_info = null)
    {
        if (target_info == null)
        {
            target_info = userInfo;
        }
        if (target_info == null)
        {
            return(0);
        }
        if (target_info.equipSet == null || target_info.equipSet.Count == 0)
        {
            return(0);
        }
        int temp_id = 0;

        target_info.equipSet.ForEach(delegate(CharaInfo.EquipItem equip)
        {
            if (temp_id == 0 && equip != null && equip.eId != 0)
            {
                EquipItemTable.EquipItemData equipItemData = Singleton <EquipItemTable> .I.GetEquipItemData((uint)equip.eId);
                if (equipItemData != null && condition(equipItemData.type))
                {
                    temp_id = equip.eId;
                }
            }
        });
        return(temp_id);
    }
Exemplo n.º 2
0
        public bool Equals(TypeConditionRuleEmbedded?other)
        {
            if (other == null)
            {
                return(false);
            }

            return(TypeCondition.Equals(other.TypeCondition) &&
                   Allowed.Equals(other.Allowed));
        }
Exemplo n.º 3
0
        public IList <Domain.Type> GetList(TypeCondition condition)
        {
            DynamicParameters parameters = new DynamicParameters();

            StringBuilder fromScript = new StringBuilder();

            fromScript.Append("select * from SKR_TYPE_M as t");

            StringBuilder whereScript = new StringBuilder();

            if (!string.IsNullOrWhiteSpace(condition.Name))
            {
                whereScript.Append(" and t.MEAL_TYPE_NAME > @name");
                parameters.Add("@name", condition.Name);
            }

            string sql = whereScript.Length > 0
                ? $"{fromScript.ToString()} where 1=1 {whereScript.ToString()}"
                : fromScript.ToString();

            IList <Domain.Type> result = new List <Domain.Type>();

            using (DbFixture)
            {
                try
                {
                    IEnumerable <dynamic> dataRows = DbFixture.Db.Connection.Query(sql, parameters);

                    if (dataRows != null && dataRows.Count() > 0)
                    {
                        result = dataRows.ToList()
                                 .Select(r =>
                        {
                            IDictionary <string, object> row = r as IDictionary <string, object>;

                            return(new Domain.Type()
                            {
                                Id = row["TYPE_SEQ_NO"] as string,
                                Name = row["MEAL_TYPE_NAME"] as string,
                                CreateDate = row["CRE_DTE"] as DateTime?,
                                CreateUser = row["CRE_USR"] as string
                            });
                        })
                                 .ToList();
                    }
                }
                catch (Exception exception)
                {
                    Logger.Write(Domain.Enum.EnumLogCategory.Error, exception.ToString());
                }
            }

            return(result);
        }
Exemplo n.º 4
0
        public override int GetHashCode()
        {
            var result = FragmentName.GetHashCode() ^ TypeCondition.GetHashCode();

            if (Directives != null)
            {
                result = Directives.Aggregate(result, (x, y) => x ^ y.GetHashCode());
            }

            return(SelectionSet.Aggregate(result, (x, y) => x ^ y.GetHashCode()));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Faz o DataBind dos valores dos controles de acordo com o ID dos mesmos.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="dataItem"></param>
        public static void BindControlsByID(Control parent, object dataItem)
        {
            Condition cond =
                new TypeCondition(typeof(TextBox)) |
                new TypeCondition(typeof(ListControl)) |
                new TypeCondition(typeof(CheckBox));

            foreach (Control ctl in ObjectQuery.SelectRecursive(parent.Controls, "Controls", cond))
            {
                if (!Logic.StringEmpty(ctl.ID))
                {
                    if (ControlUtil.IsEditable(ctl))
                    {
                        BindControl(ctl, dataItem, ctl.ID.Substring(3));
                    }
                }
            }
        }
Exemplo n.º 6
0
        public override bool Equals(object obj)
        {
            if (obj is FragmentDefinition fragmentDefinition)
            {
                return
                    (FragmentName.Equals(fragmentDefinition.FragmentName) &&
                     TypeCondition.Equals(fragmentDefinition.TypeCondition) &&
                     (
                         Directives == null &&
                         fragmentDefinition.Directives == null ||
                         Directives != null &&
                         fragmentDefinition.Directives != null &&
                         Directives.SequenceEqual(fragmentDefinition.Directives)
                     ) &&
                     SelectionSet.SequenceEqual(fragmentDefinition.SelectionSet));
            }

            return(base.Equals(obj));
        }
Exemplo n.º 7
0
        private void boxTypeCondition_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (boxTypeCondition.SelectedItem == null)
            {
                return;
            }

            if (boxTypeCondition.SelectedIndex == 0)
            {
                ActiveCondition = TypeCondition.Relative;
                UpdateData();
            }

            if (boxTypeCondition.SelectedIndex == 1)
            {
                ActiveCondition = TypeCondition.Absolute;
                UpdateData();
            }
        }
Exemplo n.º 8
0
        private void BoxCriteriaTypeOnSelectedIndexChanged(object sender, EventArgs e)
        {
            if (boxCriteriaType.SelectedIndex == 0)
            {
                activeCondition          = TypeCondition.Relative;
                textFirstCondition.Text  = firstCondition[0].ToString();
                textSecondCondition.Text = secondCondition[0].ToString();

                textFirstCondition.ForeColor = Color.Black;
            }

            if (boxCriteriaType.SelectedIndex == 1)
            {
                activeCondition          = TypeCondition.Absolute;
                textFirstCondition.Text  = firstCondition[1].ToString();
                textSecondCondition.Text = secondCondition[1].ToString();
            }

            textFirstCondition.ForeColor  = Color.Black;
            textSecondCondition.ForeColor = Color.Black;

            UpdateChart();
        }
Exemplo n.º 9
0
        public override bool Equals(object obj)
        {
            if (obj is InlineFragment inlineFragment)
            {
                return
                    ((
                         TypeCondition == null &&
                         inlineFragment.TypeCondition == null ||
                         TypeCondition != null &&
                         inlineFragment.TypeCondition != null &&
                         TypeCondition.Equals(inlineFragment.TypeCondition)
                         ) &&
                     (
                         Directives == null &&
                         inlineFragment.Directives == null ||
                         Directives != null &&
                         inlineFragment.Directives != null &&
                         Directives.SequenceEqual(inlineFragment.Directives)
                     ) &&
                     SelectionSet.SequenceEqual(inlineFragment.SelectionSet));
            }

            return(base.Equals(obj));
        }
 private bool IsSameEquipItemID(CharaInfo new_info, TypeCondition condition)
 {
     return(GetEquipItemID(condition, null) == GetEquipItemID(condition, new_info));
 }
Exemplo n.º 11
0
 public bool Equals(TypeConditionRuleEmbedded other)
 {
     return(TypeCondition.Equals(other.TypeCondition) &&
            Allowed.Equals(other.Allowed));
 }
Exemplo n.º 12
0
 public Condition()
 {
     Type = TypeCondition.Unique;
     Comparision = new Comparison();
     Children = new List<Condition>();
 }
Exemplo n.º 13
0
 public IList <Domain.Type> GetList(TypeCondition condition)
 {
     return(_typeDao.GetList(condition));
 }
Exemplo n.º 14
0
 internal TypeBinding(IBinding prevBinding, Predicate<Type> criteria) : base(prevBinding)
 {
     Condition = new TypeCondition(prevBinding.Condition, criteria);
 }