Пример #1
0
        public override void InSerializable(object e)
        {
            if (e is _Files)
            {
                this.Files = e as _Files;
            }

            _Engineering en = e as _Engineering;

            if (en != null)
            {
                en.StrustObject.Add(this.ID, this);
            }

            this.Reveal = new _Reveal(this);
            this.Parent = en;
            if (this.Property == null)
            {
                this.Property = new _Un_Property(this);
            }
            this.NonSeriObject = new _DataObjectList();
            this.NonSeriObject.Add("工程统计", new _Project_Statistics(this));
            this.NonSeriObject.Add("子目增加费", new _IncreaseCosts(this));
            this.NonSeriObject.Add("子目临时计算", new TemporaryCalculate(this));
            this.NonSeriObject.Add("工料机汇总", new _List());
            this.Property.SubSegments.InSerializable(this);
            this.Property.MeasuresProject.InSerializable(this);
            this.Property.OtherProject.InSerializable(this);
            this.Property.Statistics.Calculate();
        }
Пример #2
0
        /// <summary>
        /// 读取文件
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static _Projects BinaryDeserializeByProject(string fileName)
        {
            try
            {
                using (FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
                {
                    BinaryFormatter formater = new BinaryFormatter();
                    long            lenth    = stream.Length;
                    ArrayList       list11   = new ArrayList();
                    _Projects       proj     = null;
                    _Engineering    en       = null;

                    while (stream.Position != lenth)
                    {
                        object obj = formater.Deserialize(stream);
                        if (obj is _Projects)
                        {
                            proj = obj as _Projects;
                            proj.StrustObject = new _DataObjectList();
                        }
                        if (proj != null)
                        {
                            if (obj is _Engineering)
                            {
                                en              = obj as _Engineering;
                                en.Parent       = proj;
                                en.StrustObject = new _DataObjectList();
                                proj.StrustObject.Add(en.Directory.Key, en);
                            }
                            if (obj is _UnitProject)
                            {
                                _UnitProject un = obj as _UnitProject;
                                un.Parent = en;
                                en.StrustObject.Add(un.Directory.Key, un);
                            }
                        }
                    }
                    return(proj);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Пример #3
0
        /*public override void Init(GOLDSOFT.QDJJ.COMMONS._Application p_App)
         * {
         *  base.Init(p_App);
         * }*/

        /// <summary>
        /// 创建一个子对象(仅获取一个新的单项工程对象)
        /// </summary>
        /// <returns></returns>
        public override _COBJECTS Create()
        {
            _Engineering info = new _Engineering(this);

            //info.ObjectState = EObjectState.Creating;
            //项目是唯一的每个新项目都从当前0开始标识

            /*info.Directory.PKey = this.Directory.Key;
             * info.Directory.ImageIndex = 1;
             * info.Directory.Deep = 1;*/
            //通过项目创建单项工程对象时候自动继承项目的属性数据
            //info.Property.Basis = this.Property.Basis.Copy() as _CBasis;
            info.Parent = this;
            this.Clone(info);
            info.PID  = this.ID;
            info.Deep = 1;
            info.Sort = this.EnSort + 1;
            //初始化项目编码
            info.CODE = this.CODE + info.Sort.ToString().PadLeft(2, '0');

            return(info);
        }