Ejemplo n.º 1
0
        /// <summary>
        /// 保存试验数据函数
        /// </summary>
        private void Save()
        {
            // 提取参数
            List <RoutineSoilTest> rsts = new List <RoutineSoilTest>();

            for (int i = 0; i < dtRST.Rows.Count; i++)
            {
                double          num;
                string          zkNumber        = dtRST.Rows[i]["zkNumber"].ToString();
                double          sampleDepth     = Convert.ToDouble(dtRST.Rows[i]["sampleDepth"]);
                string          sampleLayer     = dtRST.Rows[i]["sampleLayer"].ToString();
                double          waterLevel      = double.TryParse(dtRST.Rows[i]["waterLevel"].ToString(), out num) ? num : -0.19880205;
                double          density         = double.TryParse(dtRST.Rows[i]["density"].ToString(), out num) ? num : -0.19880205;
                double          specificGravity = double.TryParse(dtRST.Rows[i]["specificGravity"].ToString(), out num) ? num : -0.19880205;
                double          voidRatio       = double.TryParse(dtRST.Rows[i]["voidRatio"].ToString(), out num) ? num : -0.19880205;
                double          saturation      = double.TryParse(dtRST.Rows[i]["saturation"].ToString(), out num) ? num : -0.19880205;
                double          liquidLimit     = double.TryParse(dtRST.Rows[i]["liquidLimit"].ToString(), out num) ? num : -0.19880205;
                double          plasticLimit    = double.TryParse(dtRST.Rows[i]["plasticLimit"].ToString(), out num) ? num : -0.19880205;
                double          plasticIndex    = double.TryParse(dtRST.Rows[i]["plasticIndex"].ToString(), out num) ? num : -0.19880205;
                double          liquidityIndex  = double.TryParse(dtRST.Rows[i]["liquidityIndex"].ToString(), out num) ? num : -0.19880205;
                double          compressibility = double.TryParse(dtRST.Rows[i]["compressibility"].ToString(), out num) ? num : -0.19880205;
                double          modulus         = double.TryParse(dtRST.Rows[i]["modulus"].ToString(), out num) ? num : -0.19880205;
                double          frictionAngle   = double.TryParse(dtRST.Rows[i]["frictionAngle"].ToString(), out num) ? num : -0.19880205;
                double          cohesion        = double.TryParse(dtRST.Rows[i]["cohesion"].ToString(), out num) ? num : -0.19880205;
                double          permeability    = double.TryParse(dtRST.Rows[i]["permeability"].ToString(), out num) ? num : -0.19880205;
                RoutineSoilTest rst             = new RoutineSoilTest(zkNumber, sampleDepth, sampleLayer, waterLevel, density, specificGravity, voidRatio, saturation, liquidLimit, plasticLimit, plasticIndex, liquidityIndex, compressibility, modulus, frictionAngle, cohesion, permeability);
                rsts.Add(rst);
            }

            // 保存试验数据到数据库
            GC.Collect();
            GC.WaitForPendingFinalizers();
            RoutineSoilTestDataBase.Refresh(Program.currentProject, rsts);
        }
Ejemplo n.º 2
0
        // 查看/添加常规土工试验数据函数
        private void ShowAddRoutineSoilTestData()
        {
            this.ContectGrid.Children.Clear();

            // 实例化一个RoutineSoilTest类列表,并读取数据库信息赋值给此实例
            List <RoutineSoilTest> rsts = RoutineSoilTestDataBase.ReadAllData(Program.currentProject);

            // 实例化RoutineSoilTestControl用户控件,并赋值
            RoutineSoilTestControl rstc = new RoutineSoilTestControl(rsts);

            this.ContectGrid.Children.Add(rstc);
        }
Ejemplo n.º 3
0
        // 单击菜单"项目"-"打开项目"
        private void OpenProjectMenu_Click(object sender, RoutedEventArgs e)
        {
            // 隐藏项目基本信息窗口
            foreach (TreeViewItem item in this.ProjectTreeView.Items)
            {
                item.IsSelected = false;
            }

            // 重置窗口
            SetProgramText();

            // 打开
            ProjectList projectList = new ProjectList();

            projectList.ShowDialog();
            if (projectList.DialogResult == true)
            {
                MenuIsEnable(true);
                SetProgramText(Program.currentProject);

                // 赋值钻孔列表
                bind.ReSetZkItem(Program.currentProject);

                // 赋值原位测试-静力触探列表
                if (CPTDataBase.ReadJkList(Program.currentProject).Count > 0)
                {
                    bind.AddItemToSecondTree(2, "静力触探");
                }
                bind.ReSetJkItem(Program.currentProject);

                // 赋值室内试验-土工常规
                if (RoutineSoilTestDataBase.ReadAllData(Program.currentProject).Count > 0)
                {
                    bind.AddItemToSecondTree(3, "土工常规");
                    bind.TreeItem[3].IsExpanded = true;
                }

                // 赋值室内试验-颗粒分析
                if (GrainAnalysisTestDataBase.ReadAllData(Program.currentProject).Count > 0)
                {
                    bind.AddItemToSecondTree(3, "颗粒分析");
                    bind.TreeItem[3].IsExpanded = true;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 筛选数据函数
        /// </summary>
        /// <param name="_zk">钻孔编号</param>
        /// <param name="_layer">分层编号</param>
        private void SelectData(string _zk, string _layer)
        {
            if (_zk == "全部钻孔")
            {
                _zk = "";
            }
            if (_layer == "全部分层")
            {
                _layer = "";
            }
            if (_layer != "")
            {
                _layer = _layer.Substring(0, _layer.IndexOf("   "));
            }
            List <RoutineSoilTest> rsts = RoutineSoilTestDataBase.SelectByZkAndLayer(Program.currentProject, _zk, _layer);

            RefreshTestDataListDataGrid(rsts);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 初始化项目数据库,创建基本表结构
        /// </summary>
        /// <param name="_projectName">项目名称</param>
        private static void Initial(string _projectName)
        {
            // 创建连接到项目信息数据库
            string sql = "Data Source=" + Program.ReadProgramPath() + "\\" + _projectName + ".gsygeo";

            using (SQLiteConnection conn = new SQLiteConnection(sql))
            {
                // 打开连接
                conn.Open();

                // 新建项目基本信息表projectBasicInfo 设置 项目名称 所在省份 所在县市 为空字符串
                // 表头 项目名称name 所在省份province 所在县市city
                sql = "create table projectBasicInfo(name varchar(255),province varchar(255),city varchar(255))";
                new SQLiteCommand(sql, conn).ExecuteNonQuery();
                sql = "insert into projectBasicInfo(name,province,city) values('','','')";
                new SQLiteCommand(sql, conn).ExecuteNonQuery();

                // 新建项目岩土分层信息表projectLayer
                // 表头 分层编号number 分层名称name 地质年代geo 分层描述description
                sql = "create table projectLayer(number varchar(255),name varchar(255),geo varchar(255),description text)";
                new SQLiteCommand(sql, conn).ExecuteNonQuery();

                // 新建项目公司信息表projectCompany 设置初始空字符串
                // 表头 公司名称companyName 资质代码companyCode 绘图人drawer 报告编写人writer 校核人checker 审查人inspector 核定人approver 批准人finalApprover
                sql = "create table projectCompany(companyName varchar(255),companyCode varchat(255),drawer varchat(255),writer varchat(255),checker varchar(255),inspector varchar(255),approver varchar(255),finalApprover varchar(255))";
                new SQLiteCommand(sql, conn).ExecuteNonQuery();
                sql = "insert into projectCompany(companyName,companyCode,drawer,writer,checker,inspector,approver,finalApprover) values('','','','','','','','')";
                new SQLiteCommand(sql, conn).ExecuteNonQuery();
            }

            // 创建必要数据表
            BoreholeDataBase.Initial(_projectName);
            CPTDataBase.Initial(_projectName);
            RoutineSoilTestDataBase.Initial(_projectName);
            GrainAnalysisTestDataBase.Initial(_projectName);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 单击菜单"工具"-"导入旧版数据"
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ImportOldDataMenu_Click(object sender, RoutedEventArgs e)
        {
            // 检查是否关闭当前项目
            if (Program.currentProject != null)
            {
                MessageBox.Show("您有正处于打开状态的项目,请关闭当前项目后再执行本操作。");
                return;
            }

            // 选择输出目录
            string folderPath;

            System.Windows.Forms.FolderBrowserDialog programPathBrowser = new System.Windows.Forms.FolderBrowserDialog();
            if (programPathBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                folderPath = programPathBrowser.SelectedPath;
            }
            else
            {
                return;
            }

            if (folderPath.Substring(folderPath.LastIndexOf(@"\") + 1) != "金浪岩土")
            {
                MessageBox.Show("选择的文件夹不正确,请选择\"金浪岩土\"文件夹!");
                return;
            }

            // 耐心等候提示
            MessageBox.Show("导入过程可能需要15-30秒的时间,请耐心等候,点击\"确定\"继续。");

            // 遍历项目文件夹
            List <string> projectlist       = new List <string>();
            List <string> ignoreprojectlist = new List <string>();
            DirectoryInfo dir = new DirectoryInfo(folderPath);

            foreach (DirectoryInfo dChild in dir.GetDirectories("*"))
            {
                // 获取项目名称
                string projectName = dChild.ToString();

                // 获取项目文件夹路径
                string projectPath = folderPath + @"\" + dChild + @"\";

                // 新建项目
                if (!string.IsNullOrEmpty(projectName) && !string.IsNullOrWhiteSpace(projectName))
                {
                    ProjectDataBase.Create(projectName);
                }

                // 读取分层信息
                StreamReader reader    = new StreamReader(projectPath + "基本信息.txt");
                int          countLine = 0;
                while (true)
                {
                    countLine++;
                    string line = reader.ReadLine();
                    if (countLine <= 3)
                    {
                        continue;
                    }
                    if (line == null)
                    {
                        break;
                    }

                    string number = line.Substring(0, line.IndexOf("/"));
                    line = line.Substring(line.IndexOf("/") + 1);
                    string name = line.Substring(0, line.IndexOf("/"));
                    line = line.Substring(line.IndexOf("/") + 1);
                    string description = line;
                    string geo         = "Q4al";
                    ProjectDataBase.AddLayer(projectName, number, name, geo, description);
                }
                reader.Close();

                // 读取钻孔信息
                List <string> numlist = ProjectDataBase.ReadLayerNumberList(projectName);
                List <string> deslist = ProjectDataBase.ReadLayerDescriptionList(projectName);
                DirectoryInfo dirZk   = new DirectoryInfo(projectPath + @"钻孔\");
                foreach (FileInfo dZkFile in dirZk.GetFiles("*.txt"))
                {
                    // 读取基本信息
                    StreamReader zkReader = new StreamReader(projectPath + @"钻孔\" + dZkFile.ToString());
                    zkReader.ReadLine();
                    string zkname = zkReader.ReadLine();
                    zkReader.ReadLine();
                    double zkaltitude = Convert.ToDouble(zkReader.ReadLine());
                    BoreholeDataBase.AddZkBasicInfo(projectName, zkname, zkaltitude, Constants.NullNumber, Constants.NullNumber, Constants.NullNumber, Constants.NullNumber);
                    zkReader.ReadLine();

                    // 读取分层信息
                    List <string> zknumberlist      = new List <string>();
                    List <string> zknamelist        = new List <string>();
                    List <string> zkgeolist         = new List <string>();
                    List <string> zkdescriptionlist = new List <string>();
                    List <double> zkdepthlist       = new List <double>();
                    while (true)
                    {
                        string line = zkReader.ReadLine();
                        if (line == "===取样===")
                        {
                            break;
                        }

                        zknumberlist.Add(line.Substring(0, line.IndexOf("/")));
                        line = line.Substring(line.IndexOf("/") + 1);
                        zknamelist.Add(line.Substring(0, line.IndexOf("/")));
                        line = line.Substring(line.IndexOf("/") + 1);
                        zkdepthlist.Add(Convert.ToDouble(line));
                        zkgeolist.Add("Q4al");
                        int index = numlist.IndexOf(zknumberlist[zknumberlist.Count - 1]);
                        zkdescriptionlist.Add(deslist[index]);
                    }
                    BoreholeDataBase.AddLayerListToZk(projectName, zkname, zknumberlist, zknamelist, zkgeolist, zkdescriptionlist, zkdepthlist);

                    // 读取取样信息
                    List <string> spnumberlist      = new List <string>();
                    List <double> spdepthlist       = new List <double>();
                    List <int>    spisdisturbedlist = new List <int>();
                    countLine = 0;
                    while (true)
                    {
                        string line = zkReader.ReadLine();
                        if (line == "===标贯===")
                        {
                            break;
                        }

                        countLine++;
                        spnumberlist.Add(countLine.ToString());
                        spdepthlist.Add(Convert.ToDouble(line.Substring(0, line.IndexOf("/"))));
                        line = line.Substring(line.IndexOf("/") + 1);
                        spisdisturbedlist.Add(line == "扰" ? 1 : 0);
                    }
                    BoreholeDataBase.AddSampleListToZk(projectName, zkname, spnumberlist, spdepthlist, spisdisturbedlist);

                    // 读取标贯信息
                    List <string> ntnumberlist = new List <string>();
                    List <double> ntdepthlist  = new List <double>();
                    List <double> ntvaluelist  = new List <double>();
                    List <string> nttypelist   = new List <string>();
                    countLine = 0;
                    while (true)
                    {
                        string line = zkReader.ReadLine();
                        if (line == null)
                        {
                            break;
                        }

                        countLine++;
                        ntnumberlist.Add(countLine.ToString());
                        ntdepthlist.Add(Convert.ToDouble(line.Substring(0, line.IndexOf("/"))));
                        line = line.Substring(line.IndexOf("/") + 1);
                        ntvaluelist.Add(Convert.ToDouble(line));
                        nttypelist.Add("N");
                    }
                    BoreholeDataBase.AddNTestListToZk(projectName, zkname, ntnumberlist, ntdepthlist, ntvaluelist, nttypelist);

                    zkReader.Close();
                }

                // 读取静力触探信息
                DirectoryInfo dirJk = new DirectoryInfo(projectPath + @"静力触探\");
                foreach (FileInfo dJkFile in dirJk.GetFiles("*.txt"))
                {
                    // 读取基本信息
                    StreamReader jkReader = new StreamReader(projectPath + @"静力触探\" + dJkFile.ToString());
                    jkReader.ReadLine();
                    string jkname = jkReader.ReadLine();
                    jkReader.ReadLine();
                    double jkaltitude = Convert.ToDouble(jkReader.ReadLine());
                    CPTDataBase.AddJkBasicInfo(projectName, jkname, jkaltitude, Constants.NullNumber, Constants.NullNumber);
                    jkReader.ReadLine();

                    // 读取分层信息
                    List <string> jknumberlist      = new List <string>();
                    List <string> jknamelist        = new List <string>();
                    List <string> jkgeolist         = new List <string>();
                    List <string> jkdescriptionlist = new List <string>();
                    List <double> jkdepthlist       = new List <double>();
                    while (true)
                    {
                        string line = jkReader.ReadLine();
                        if (line == "===Ps值===")
                        {
                            break;
                        }

                        jknumberlist.Add(line.Substring(0, line.IndexOf("/")));
                        line = line.Substring(line.IndexOf("/") + 1);
                        jknamelist.Add(line.Substring(0, line.IndexOf("/")));
                        line = line.Substring(line.IndexOf("/") + 1);
                        jkdepthlist.Add(Convert.ToDouble(line));
                        jkgeolist.Add("Q4al");
                        int index = numlist.IndexOf(jknumberlist[jknumberlist.Count - 1]);
                        jkdescriptionlist.Add(deslist[index]);
                    }
                    CPTDataBase.AddLayerListToJk(projectName, jkname, jknumberlist, jknamelist, jkgeolist, jkdescriptionlist, jkdepthlist);

                    // 读取Ps值信息
                    List <double> pslist = new List <double>();
                    while (true)
                    {
                        string line = jkReader.ReadLine();
                        if (line == null)
                        {
                            break;
                        }

                        pslist.Add(Convert.ToDouble(line));
                    }
                    CPTDataBase.AddPsListToJk(projectName, jkname, pslist);
                }

                // 读取土工试验
                StreamReader           rstReader = new StreamReader(projectPath + @"土工试验\NormalTest.txt");
                List <RoutineSoilTest> rsts      = new List <RoutineSoilTest>();
                while (true)
                {
                    string line = rstReader.ReadLine();
                    if (line == null)
                    {
                        break;
                    }

                    string zkNumber = line.Substring(0, line.IndexOf("/"));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double sampleDepth = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);

                    string         sampleLayer = ProjectDataBase.ReadLayerNumberList(projectName)[0];
                    List <ZkLayer> layers      = BoreholeDataBase.ReadZkLayer(projectName, zkNumber);
                    for (int i = 0; i < layers.Count; i++)
                    {
                        if (sampleDepth <= layers[i].Depth)
                        {
                            sampleLayer = layers[i].Number;
                            break;
                        }
                    }

                    double waterLevel = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double density = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double specificGravity = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double voidRatio = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double saturation = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double liquidLimit = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double plasticLimit = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double plasticIndex = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double liquidityIndex = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double compressibility = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double modulus = Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double frictionAngle = Convert.ToDouble(line.Substring(0, line.IndexOf("/"))) == 0 ? Constants.NullNumber : Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double cohesion = Convert.ToDouble(line.Substring(0, line.IndexOf("/"))) == 0 ? Constants.NullNumber : Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    line = line.Substring(line.IndexOf("/") + 1);
                    double          permeability = line.Substring(0, line.IndexOf("/")) == "0.000000E+000" ? Constants.NullNumber : Convert.ToDouble(line.Substring(0, line.IndexOf("/")));
                    RoutineSoilTest rst          = new RoutineSoilTest(zkNumber, sampleDepth, sampleLayer, waterLevel, density, specificGravity, voidRatio, saturation, liquidLimit, plasticLimit, plasticIndex, liquidityIndex, compressibility, modulus, frictionAngle, cohesion, permeability);
                    rsts.Add(rst);
                }
                rstReader.Close();

                GC.Collect();
                GC.WaitForPendingFinalizers();
                RoutineSoilTestDataBase.Refresh(projectName, rsts);

                projectlist.Add(projectName);
            }

            // 成功提示
            StringBuilder sb = new StringBuilder();

            if (projectlist.Count > 0)
            {
                sb.AppendLine("已成功导入以下项目:");
                for (int i = 0; i < projectlist.Count; i++)
                {
                    sb.AppendLine((i + 1).ToString() + projectlist[i]);
                }
            }
            else
            {
                sb.AppendLine("没有导入任何项目。");
            }
            MessageBox.Show(sb.ToString());
        }
Ejemplo n.º 7
0
        // TreeView选择节点变化时激活不同的内容控件
        private void ProjectTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            // 读取选中节点
            TreeViewItem selectedItem = (TreeViewItem)e.NewValue;

            // 根据选中状况清空窗口中的控件
            if (selectedItem == null)
            {
                this.ContectGrid.Children.Clear();
                return;
            }

            if (selectedItem.Header.ToString() != "基本信息" && selectedItem.Parent != null)
            {
                this.ContectGrid.Children.Clear();
            }

            // 选中一级节点时
            // 选中"基本信息"
            if (selectedItem.Header.ToString() == "基本信息")
            {
                ProjectBasicInfo prjb = new ProjectBasicInfo();
                this.ContectGrid.Children.Add(prjb);
            }

            // 选中二级、三级节点时
            if (selectedItem.Parent != null)
            {
                // 读取父节点
                TreeViewItem parentItem = (TreeViewItem)selectedItem.Parent;

                // 选中"钻孔"子节点
                if (parentItem.Header.ToString() == "钻孔")
                {
                    // 读取当前所选钻孔名称
                    string prj    = Program.currentProject;
                    string zkName = selectedItem.Header.ToString();

                    // 实例化一个Borehole类,并将当前所选钻孔的数据库信息赋值给此实例
                    Borehole bh = new Borehole(zkName, BoreholeDataBase.ReadAltitude(prj, zkName));
                    bh.X = BoreholeDataBase.ReadXAxis(prj, zkName);
                    bh.Y = BoreholeDataBase.ReadYAxis(prj, zkName);
                    bh.InitialWaterLevel = BoreholeDataBase.ReadInitialWaterLevel(prj, zkName);
                    bh.StableWaterLevel  = BoreholeDataBase.ReadStableWaterLevel(prj, zkName);
                    bh.Layers            = BoreholeDataBase.ReadZkLayer(prj, zkName);
                    bh.Samples           = BoreholeDataBase.ReadZkSample(prj, zkName);
                    bh.NTests            = BoreholeDataBase.ReadZkNTest(prj, zkName);

                    // 实例化BoreholeControl用户控件,并赋值
                    BoreholeControl bhc = new BoreholeControl(bh);
                    this.ContectGrid.Children.Add(bhc);
                }

                // 选取"原位测试"-"静力触探"子节点
                if (parentItem.Header.ToString() == "静力触探")
                {
                    // 读取当前所选触探孔名称
                    string prj    = Program.currentProject;
                    string jkName = selectedItem.Header.ToString();

                    // 实例化一个CPT类,并将当前所选触探孔的数据库信息赋值给此实例
                    CPT cpt = new CPT(jkName, CPTDataBase.ReadAltitude(prj, jkName));
                    cpt.X      = CPTDataBase.ReadXAxis(prj, jkName);
                    cpt.Y      = CPTDataBase.ReadYAxis(prj, jkName);
                    cpt.Layers = CPTDataBase.ReadJkLayer(prj, jkName);
                    cpt.PsList = CPTDataBase.ReadJkPs(prj, jkName);

                    // 实例化CPTControl用户控件,并赋值
                    CPTControl cptc = new CPTControl(cpt);
                    this.ContectGrid.Children.Add(cptc);
                }

                // 选取"室内试验"-"土工常规"子节点
                if (selectedItem.Header.ToString() == "土工常规")
                {
                    // 实例化一个RoutineSoilTest类列表,并读取数据库信息赋值给此实例
                    List <RoutineSoilTest> rsts = RoutineSoilTestDataBase.ReadAllData(Program.currentProject);

                    // 实例化RoutineSoilTestControl用户控件,并赋值
                    RoutineSoilTestControl rstc = new RoutineSoilTestControl(rsts);
                    this.ContectGrid.Children.Add(rstc);
                }

                // 选取"室内试验"-"颗粒分析"子节点
                if (selectedItem.Header.ToString() == "颗粒分析")
                {
                    // 实例化一个RoutineSoilTest类列表,并读取数据库信息赋值给此实例
                    List <GrainAnalysisTest> gats = GrainAnalysisTestDataBase.ReadAllData(Program.currentProject);

                    // 实例化RoutineSoilTestControl用户控件,并赋值
                    GrainAnalysisTestControl gatc = new GrainAnalysisTestControl(gats);
                    this.ContectGrid.Children.Add(gatc);
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 筛选统计数据
        /// </summary>
        /// <returns></returns>
        public static StatisticWordLoad SelectStatisticData()
        {
            // 定义统计数据列表
            StatisticWordLoad statisticData = new StatisticWordLoad();

            // 读取钻孔列表
            List <Borehole> zkList = BoreholeDataBase.ReadZkListAsClass(Program.currentProject);

            // 统计钻孔数量
            int countZk = zkList.Count;

            double countZkDepth = 0;
            int    countUndisturbedSample = 0, countDisturbedSample = 0;
            int    countNTestStandard = 0, countNTestN10 = 0, countNTestN635 = 0, countNTestN120 = 0;

            foreach (Borehole zk in zkList)
            {
                // 统计钻孔进尺
                countZkDepth += zk.Layers[zk.Layers.Count - 1].Depth;

                // 统计原状样、扰动样数量
                foreach (ZkSample sample in zk.Samples)
                {
                    if (sample.IsDisturbed)
                    {
                        countDisturbedSample++;
                    }
                    else
                    {
                        countUndisturbedSample++;
                    }
                }

                // 统计标贯/动探数量
                foreach (ZkNTest ntest in zk.NTests)
                {
                    if (ntest.Type == ZkNTest.ntype.N)
                    {
                        countNTestStandard++;
                    }
                    else if (ntest.Type == ZkNTest.ntype.N10)
                    {
                        countNTestN10++;
                    }
                    else if (ntest.Type == ZkNTest.ntype.N635)
                    {
                        countNTestN635++;
                    }
                    else
                    {
                        countNTestN120++;
                    }
                }
            }

            // 读取土工常规试验列表
            List <RoutineSoilTest> rstList = RoutineSoilTestDataBase.ReadAllData(Program.currentProject);

            // 统计常规试验数量、室内渗透试验数量
            int    countRST = 0, countPermeability = 0;
            double n = -0.19880205;

            foreach (RoutineSoilTest rst in rstList)
            {
                // 统计室内渗透试验
                if (rst.permeability != n)
                {
                    countPermeability++;
                }

                //统计土工常规试验
                if (rst.waterLevel != n ||
                    rst.voidRatio != n ||
                    rst.specificGravity != n ||
                    rst.saturation != n ||
                    rst.plasticLimit != n ||
                    rst.plasticIndex != n ||
                    rst.modulus != n ||
                    rst.liquidLimit != n ||
                    rst.liquidityIndex != n ||
                    rst.frictionAngle != n ||
                    rst.density != n ||
                    rst.compressibility != n ||
                    rst.cohesion != n)
                {
                    countRST++;
                }
            }

            // 读取颗粒分析试验列表
            List <GrainAnalysisTest> gatList = GrainAnalysisTestDataBase.ReadAllData(Program.currentProject);

            // 统计颗分试验数量
            int countGAT = gatList.Count;

            // 读取静力触探列表
            List <CPT> jkList = CPTDataBase.ReadJkListAsClass(Program.currentProject);

            // 统计钻孔数量
            int countJk = jkList.Count;

            // 统计静力触探进尺
            double countJkDepth = 0;

            foreach (CPT jk in jkList)
            {
                countJkDepth += jk.Layers[jk.Layers.Count - 1].Depth;
            }

            // 赋值给统计列表
            statisticData.CountBorehole        = countZk;
            statisticData.CountBoreholePacking = countZk;
            statisticData.Borehole             = countZkDepth;
            statisticData.BoreholePacking      = countZkDepth;
            statisticData.UndisturbedSample    = countUndisturbedSample;
            statisticData.DisturbedSample      = countDisturbedSample;
            statisticData.NTestStandard        = countNTestStandard;
            statisticData.NTestN10             = countNTestN10;
            statisticData.NTestN635            = countNTestN635;
            statisticData.NTestN120            = countNTestN120;
            statisticData.CountCPT             = countJk;
            statisticData.CPT          = countJkDepth;
            statisticData.RST          = countRST;
            statisticData.Permeability = countPermeability;
            statisticData.GAT          = countGAT;

            // 返回
            return(statisticData);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 筛选统计数据
        /// </summary>
        /// <returns></returns>
        public static List <StatisticRST> SelectStatisticData()
        {
            // 定义统计数据列表
            List <StatisticRST> statisticList = new List <StatisticRST>();

            // 定义分层编号列表、分层岩土名称列表、试验类型列表
            List <string> layerNumberList = ProjectDataBase.ReadLayerNumberList(Program.currentProject);
            List <string> layerNameList   = ProjectDataBase.ReadLayerNameList(Program.currentProject);

            // 在分层编号列表中循环,赋值统计数据列表
            for (int i = 0; i < layerNumberList.Count; i++)
            {
                // 层号、岩土名称
                string layerNumber = layerNumberList[i];
                string layerName   = layerNameList[i];

                // 读取分层试验数据
                List <RoutineSoilTest> rsts = RoutineSoilTestDataBase.SelectByZkAndLayer(Program.currentProject, "", layerNumber);

                List <double> datalist_waterLevel      = new List <double>();
                List <double> datalist_density         = new List <double>();
                List <double> datalist_specificGravity = new List <double>();
                List <double> datalist_voidRatio       = new List <double>();
                List <double> datalist_saturation      = new List <double>();
                List <double> datalist_liquidLimit     = new List <double>();
                List <double> datalist_plasticLimit    = new List <double>();
                List <double> datalist_plasticIndex    = new List <double>();
                List <double> datalist_liquidityIndex  = new List <double>();
                List <double> datalist_compressibility = new List <double>();
                List <double> datalist_modulus         = new List <double>();
                List <double> datalist_frictionAngle   = new List <double>();
                List <double> datalist_cohesion        = new List <double>();
                List <double> datalist_permeability    = new List <double>();

                for (int j = 0; j < rsts.Count; j++)
                {
                    datalist_waterLevel.Add(rsts[j].waterLevel);
                    datalist_density.Add(rsts[j].density);
                    datalist_specificGravity.Add(rsts[j].specificGravity);
                    datalist_voidRatio.Add(rsts[j].voidRatio);
                    datalist_saturation.Add(rsts[j].saturation);
                    datalist_liquidLimit.Add(rsts[j].liquidLimit);
                    datalist_plasticLimit.Add(rsts[j].plasticLimit);
                    datalist_plasticIndex.Add(rsts[j].plasticIndex);
                    datalist_liquidityIndex.Add(rsts[j].liquidityIndex);
                    datalist_compressibility.Add(rsts[j].compressibility);
                    datalist_modulus.Add(rsts[j].modulus);
                    datalist_frictionAngle.Add(rsts[j].frictionAngle);
                    datalist_cohesion.Add(rsts[j].cohesion);
                    datalist_permeability.Add(rsts[j].permeability);
                }

                // 赋值统计数据列表
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[0], datalist_waterLevel, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[1], datalist_density, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[2], datalist_specificGravity, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[3], datalist_voidRatio, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[4], datalist_saturation, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[5], datalist_liquidLimit, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[6], datalist_plasticLimit, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[7], datalist_plasticIndex, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[8], datalist_liquidityIndex, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[9], datalist_compressibility, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[10], datalist_modulus, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[11], datalist_frictionAngle, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[12], datalist_cohesion, 6));
                statisticList.Add(new StatisticRST(layerNumber, layerName, typeList[13], datalist_permeability, 6));
            }

            // 返回
            return(statisticList);
        }