Ejemplo n.º 1
0
 public string this[int index]
 {
     get
     {
         AtawDebug.AssertArgument(index >= 0 && index < fIdList.Count, "index",
                                  string.Format(ObjectUtil.SysCulture, "index必须在0和{1}之间,现在值为{0}不在范围内",
                                                index, fIdList.Count), this);
         return(fIdList[index]);
     }
 }
Ejemplo n.º 2
0
        protected void CopyTo(Array array, int index)
        {
            AtawDebug.AssertArgumentNull(array, "array", this);
            AssertIndex(index, array.Length);
            AtawDebug.AssertArgument(array.Length - index >= Count, "arrayIndex", string.Format(
                                         ObjectUtil.SysCulture, "当前有{0}个元素,而数组的空间为{1},空间不够",
                                         Count, array.Length - index), this);

            fList.CopyTo(array, index);
        }
Ejemplo n.º 3
0
        public static void JoinStringItem(StringBuilder builder, int index, string value, string joinStr)
        {
            AtawDebug.AssertArgumentNull(builder, "builder", null);
            AtawDebug.AssertArgumentNullOrEmpty(value, "value", null);
            AtawDebug.AssertArgumentNull(joinStr, "joinStr", null);
            AtawDebug.AssertArgument(index >= 0, "index", string.Format(ObjectUtil.SysCulture,
                                                                        "index的值不能为负数,现在是{0}", index), null);

            if (index > 0)
            {
                builder.Append(joinStr);
            }
            builder.Append(value);
        }
        private void CreateButton(PageStyle pageStyle, bool isData)
        {
            var  bts  = ModuleConfig.Buttons.Where(a => a.Name == pageStyle.ToString());
            bool isBt = bts != null && bts.Count() > 0;

            if (!isBt)
            {
                CustomButtonConfig bt = new CustomButtonConfig();
                bt.IsData = isData;
                bt.Name   = pageStyle.ToString();
                bt.Text   = pageStyle.GetDescription();
                bt.Client = new ClientConfig()
                {
                    Function = pageStyle.ToString()
                };
                ModuleConfig.Buttons.Add(bt);
            }
            else
            {
                AtawDebug.AssertArgument(bts.Count() == 1, pageStyle.ToString(), string.Format(ObjectUtil.SysCulture,
                                                                                               "同名的系统按钮{0}不能配置多个", pageStyle), this);
                var bt = bts.FirstOrDefault();
                if (!bt.IsData && isData)
                {
                    bt.IsData = true;
                }
                if (bt.Text.IsEmpty())
                {
                    bt.Text = pageStyle.GetDescription();
                }
                if (bt.Client == null)
                {
                    bt.Client = new ClientConfig()
                    {
                        Function = pageStyle.ToString()
                    };
                }
            }

            // return bt;
        }
Ejemplo n.º 5
0
        public static SqlCmdData ByAnd(this SqlCmdData sql, string keyColumn, List <string> valList)
        {
            AtawDebug.AssertArgument(valList != null && valList.Count > 0, "valList", "条件查询不能为空", sql);
            StringBuilder resSb = new StringBuilder(sql.SqlTxt);
            int           i     = sql.ParamIndex;

            foreach (string val in valList)
            {
                i++;
                resSb.Append("  AND ");
                resSb.Append(keyColumn);
                resSb.Append("  =  @p");
                resSb.Append(i.ToString());
                sql.ParamList.Add(new SqlParameter("@p" + i.ToString(), val)
                {
                    DbType = DbType.String
                });
            }
            sql.SqlTxt     = resSb.ToString();
            sql.ParamIndex = i;

            return(sql);
        }
Ejemplo n.º 6
0
 private void AssertIndex(int index, int count)
 {
     AtawDebug.AssertArgument(index >= 0 && index < count, "index", string.Format(
                                  ObjectUtil.SysCulture, "index必须在0和{0}之间,现在值为{1},已经超出范围",
                                  count, index), this);
 }