Beispiel #1
0
        /// <summary>
        /// 读取用户价格库数据
        /// </summary>
        /// <returns></returns>
        public ZiboSoft.Commons.Common.CResult Load()
        {
            _Files files = new _Files();

            files.ExtName  = _Files.用户价格库扩展名;
            files.DirName  = string.Format("{0}库文件\\系统库", this.m_PriceLibrary.Parent.Parent.Global.AppFolder.FullName);
            files.FileName = "用户价格库";
            CResult result = new CResult(false);

            try
            {
                FileInfo info = new FileInfo(files.FullName);
                if (info.Exists)
                {//文件存在的时候读取
                    m_PriceLibrary.UserPriceLibraryList = CFiles.Deserialize(files.FullName) as _UserPriceLibraryList;
                }
                result.Success = true;
                return(result);
            }
            catch (Exception ex)
            {
                result.Success          = false;
                result.ErrorInformation = ex.Message;
                return(result);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 读取文件
 /// </summary>
 /// <returns></returns>
 public void Load()
 {
     try
     {
         string m_Path = string.Format("{0}库文件\\用户价格库\\{1}", APP.Application.Global.AppFolder.FullName, APP.GoldSoftClient.GlodSoftDiscern.CurrNo);
         ToolKit.GetDirectoryInfo(m_Path);
         _Files files = new _Files();
         files.ExtName  = _Files.用户价格库扩展名;
         files.DirName  = m_Path;
         files.FileName = APP.GoldSoftClient.GlodSoftDiscern.CurrNo;
         FileInfo info = new FileInfo(files.FullName);
         if (info.Exists)
         {
             //文件存在的时候读取
             _UserPriceLibrarySource cs = CFiles.Deserialize(files.FullName) as _UserPriceLibrarySource;
             if (cs != null)
             {
                 this.m_UserPriceLibrarySource = cs;
             }
         }
         else
         {
             this.m_UserPriceLibrarySource = new _UserPriceLibrarySource();
             CFiles.BinarySerialize(this.m_UserPriceLibrarySource, files.FullName);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        /// <summary>
        /// 读取模板数据
        /// </summary>
        /// <param name="FilePath"></param>
        /// <returns></returns>
        public void Load(string FilePath)
        {
            DataTable dt = CFiles.Deserialize(FilePath) as DataTable;

            if (dt == null)
            {
                dt = (CFiles.Deserialize(FilePath) as DataSet).Tables[0];
            }
            m_DataSource = dt;

            if (!this.m_DataSource.Columns.Contains("Check"))
            {
                this.m_DataSource.Columns.Add("Check", typeof(bool));
                for (int i = 0; i < this.m_DataSource.Rows.Count; i++)
                {
                    if (this.m_DataSource.Rows[i]["IsCheck"].ToString() == "1")
                    {
                        this.m_DataSource.Rows[i]["Check"] = true;
                    }
                    else
                    {
                        this.m_DataSource.Rows[i]["Check"] = false;
                    }
                }
            }
        }
 /// <summary>
 /// 读取文件
 /// </summary>
 /// <returns></returns>
 public void Load()
 {
     try
     {
         string m_Path = string.Format("{0}库文件\\信息价格库\\", APP.Application.Global.AppFolder.FullName);
         ToolKit.GetDirectoryInfo(m_Path);
         _Files files = new _Files();
         files.ExtName  = _Files.信息价格库扩展名;
         files.DirName  = m_Path;
         files.FileName = "信息价格库";
         FileInfo info = new FileInfo(files.FullName);
         if (info.Exists)
         {
             //文件存在的时候读取
             _InformationPriceLibrarySource cs = CFiles.Deserialize(files.FullName) as _InformationPriceLibrarySource;
             if (cs != null)
             {
                 this.m_InformationPriceLibrarySource = cs;
             }
         }
         else
         {
             this.m_InformationPriceLibrarySource = new _InformationPriceLibrarySource();
             CFiles.BinarySerialize(this.m_InformationPriceLibrarySource, files.FullName);
         }
     }
     catch (Exception e)
     {
         throw e;
         return;
     }
 }
Beispiel #5
0
        public void Load()
        {
            _Files files = new _Files();

            files.ExtName  = _Files.用户规则库扩展名;
            files.DirName  = string.Format("{0}库文件\\系统库", this.Parent.Parent.Global.AppFolder.FullName);
            files.FileName = "用户规则库";
            CResult result = new CResult(false);

            try
            {
                FileInfo info = new FileInfo(files.FullName);
                if (info.Exists)
                {//文件存在的时候读取
                    this.m_DataSource = (CFiles.Deserialize(files.FullName) as _UserRules).m_DataSource;
                }

                result.Success = true;
            }
            catch (Exception ex)
            {
                result.Success          = false;
                result.ErrorInformation = ex.Message;
            }
        }
Beispiel #6
0
        /// <summary>
        /// 读取模板文件
        /// </summary>
        /// <param name="p_FileName"></param>
        public void Load(string p_FileName)
        {
            //更换模板
            DataTable table = CFiles.Deserialize(p_FileName) as DataTable;

            this.Unit.DataTemp.MSDataTemp.FileName = p_FileName;
            //this.Unit.DataTemp.MSDataTemp.IsChange = true;
            //删除当前模板
            this.Unit.StructSource.ModelMetaanalysis.RemoveAll();
            this.LoadDefault(table);
            this.Calculate();
        }
Beispiel #7
0
        /// <summary>
        /// 根据路径文件仅仅加载一个文件对象(此方式不包含业务对象)
        /// </summary>
        /// <param name="p_File">文件对象</param>
        /// <returns></returns>
        public CResult LoadOnlyObject(FileInfo p_File)
        {
            CResult result = new CResult(false);

            //文件不存在直接返回
            if (!p_File.Exists)
            {
                return(result);
            }
            result.Value   = CFiles.Deserialize(p_File.FullName);
            result.Success = true;
            return(result);
        }
Beispiel #8
0
        /// <summary>
        ///从指定文件初始化数据集
        /// </summary>
        public void Load(string p_FileName)
        {
            //更换模板
            DataTable table = CFiles.Deserialize(p_FileName) as DataTable;

            this.Unit.DataTemp.ODataTemp.FileName = p_FileName;
            this.Unit.DataTemp.ODataTemp.IsChange = true;
            //删除当前模板
            this.Unit.StructSource.ModelOtherProject.Clear();
            this.Unit.StructSource.ModelOtherProject.AcceptChanges();
            this.LoadDefault(table);
            this.Calculate();
            this.FastCalculate();
        }
Beispiel #9
0
        public void Load(string p_FileName)
        {
            /*object obj = CFiles.Deserialize(Path);
             * this.m_Source = obj as DataTable;
             * this.m_FilePath = Path;
             * FileInfo info = new FileInfo(Path);
             * this.m_FileName = info.Name.Replace(info.Extension, "");*/
            try
            {
                using (var calculator = new Calculator(CurrentBusiness, Unit))
                {
                    //删除工料机,子目取费。安装增加费
                    DataRow[] rowsGLJ = this.Unit.StructSource.ModelQuantity.Select("SSLB=1");
                    calculator.Entities.AddRange(_Entity_SubInfo.ParseMore(rowsGLJ));
                    foreach (DataRow item in rowsGLJ)
                    {
                        item.Delete();
                    }
                    DataRow[] rowsQF = this.Unit.StructSource.ModelSubheadingsFee.Select("SSLB=1");
                    calculator.Entities.AddRange(_Entity_SubInfo.ParseMore(rowsQF));
                    foreach (DataRow item in rowsQF)
                    {
                        item.Delete();
                    }
                    DataRow[] rowsZJF = this.Unit.StructSource.ModelIncreaseCosts.Select("SSLB=1");
                    calculator.Entities.AddRange(_Entity_SubInfo.ParseMore(rowsZJF));
                    foreach (DataRow item in rowsZJF)
                    {
                        item.Delete();
                    }
                    //更换模板
                    DataTable table = CFiles.Deserialize(p_FileName) as DataTable;
                    this.Unit.DataTemp.MDataTemp.FileName = p_FileName;
                    this.Unit.DataTemp.MDataTemp.IsChange = true;
                    //删除当前模板
                    this.Unit.StructSource.ModelMeasures.Clear();
                    this.Unit.StructSource.ModelMeasures.Add(this.Current);
                    this.Unit.StructSource.ModelMeasures.AcceptChanges();
                    this.LoadTempletTable(table, calculator);
                }

                CurrentBusiness.FastCalculate();
            }
            catch (Exception e)
            {
                throw e;
            }
        }