예제 #1
0
 public _CDirectories this[int p_key]
 {
     get
     {
         if (this.m_Directories != null)
         {
             if (this.m_Directories.Rows.Contains(p_key))
             {
                 DataRow row = this.m_Directories.Rows.Find(p_key);
                 if (row != null)
                 {
                     _CDirectories info = new _CDirectories();
                     info.m_ParentFieldName = Convert.ToInt32(row["ParentFieldName"]);
                     info.m_NodeName        = row["NodeName"].ToString();
                     info.m_ImageIndex      = Convert.ToInt32(row["ImageIndex"]);
                     info.m_Path            = row["Path"].ToString();
                     info.TypeName          = Convert.ToInt32(row["TypeName"]);
                     info.m_Key             = Convert.ToInt32(row["Key"]);
                     return(info);
                 }
             }
         }
         return(null);
     }
 }
예제 #2
0
        /// <summary>
        /// 批量增加单位工程时候使用的
        /// </summary>
        /// <returns></returns>
        public _CDirectories Clone()
        {
            _CDirectories info = new _CDirectories();

            info.m_Directories            = this.GetFilter();
            info.m_Directories.PrimaryKey = new DataColumn[] { info.m_Directories.Columns["Key"] };
            return(info);
        }
예제 #3
0
        /// <summary>
        /// 删除指定的字典
        /// </summary>
        /// <param name="info"></param>
        public void Remove(_CDirectories info)
        {
            DataRow row = this.m_Directories.Rows.Find(info.Key);

            row.Delete();
            row.AcceptChanges();
            this.m_Directories.AcceptChanges();
        }
예제 #4
0
        /// <summary>
        /// 确定接收变更(以添加的方式)(调用此方法会把所有属性添加到清单表格中)
        /// </summary>
        public void AcceptChanges(_CDirectories info)
        {
            DataRow row = this.m_Directories.NewRow();

            row.BeginEdit();
            row["ParentFieldName"] = info.m_ParentFieldName;
            row["NodeName"]        = info.m_NodeName;
            row["ImageIndex"]      = info.m_ImageIndex;
            row["Path"]            = info.m_Path;
            row["TypeName"]        = info.TypeName;
            row["Sort"]            = info.Sort;
            row.EndEdit();
            this.m_Directories.Rows.Add(row);
            this.m_Directories.AcceptChanges();
            //取最后一行的编号作为当前的key返回给对象
            info.Key = (int)this.m_Directories.Rows[this.m_Directories.Rows.Count - 1]["Key"];
        }
예제 #5
0
        /// <summary>
        /// 获取删选过后的结果集合(去除所有单位工程)
        /// </summary>
        /// <returns></returns>
        public _CArrayList GetFilter()
        {
            ArrayList list = this.Clone() as ArrayList;

            for (int i = 0; i < list.Count; i++)
            {
                _CDirectories info = list[i] as _CDirectories;
                if (info.TypeName == 操作类型.单位工程)
                {
                    list.Remove(list[i]);
                }
            }

            _CArrayList listA = new _CArrayList();

            listA.AddRange(list.ToArray());
            return(listA);
        }
예제 #6
0
        /// <summary>
        /// 根据操作类型 添加还是编辑
        /// </summary>
        /// <param name="p_AccType"></param>
        public void AcceptChanges(EAcceptType p_AccType, _CDirectories info)
        {
            switch (p_AccType)
            {
            case EAcceptType.New:
                this.AcceptChanges(info);
                break;

            case EAcceptType.Edit:
                DataRow row = this.m_Directories.Rows.Find(info.Key);
                row.BeginEdit();
                row["ParentFieldName"] = info.m_ParentFieldName;
                row["NodeName"]        = info.m_NodeName;
                row["ImageIndex"]      = info.m_ImageIndex;
                row["Path"]            = info.m_Path;
                row["TypeName"]        = info.TypeName;
                row["Sort"]            = info.Sort;
                row.EndEdit();
                this.m_Directories.AcceptChanges();
                break;
            }
        }
예제 #7
0
 /// <summary>
 /// 用于添加项目清单的集合添加方法
 /// </summary>
 /// <param name="value">集合清单</param>
 /// <returns>所在集合中的位置</returns>
 public int Add(_CDirectories value)
 {
     value.Key = base.Add(value);
     return(value.Key);
 }