//添加元属性页面
        public IActionResult add_ysx()
        {
            var p = new YSX_Model("1");

            ViewData["YSX_Model"] = p;
            //维度信息查询
            M_Db_Operate m_Db_Operate = new M_Db_Operate();
            var          collection   = m_Db_Operate.database.GetCollection <Dimension_Information_Model>("Dimension_Information");

            //查询维度
            List <string> key = new List <string>();

            key.Add("TYPE");
            List <string> value = new List <string>();

            value.Add("资产类别维度");
            var type0 = m_Db_Operate.Inquire_Data(collection, key, value);

            value[0] = "应用特性维度";
            var type1 = m_Db_Operate.Inquire_Data(collection, key, value);

            value[0] = "管理者维度";
            var type2 = m_Db_Operate.Inquire_Data(collection, key, value);

            value[0] = "自定义维度";
            var type3 = m_Db_Operate.Inquire_Data(collection, key, value);

            ViewData["type0"] = type0;
            ViewData["type1"] = type1;
            ViewData["type2"] = type2;
            ViewData["type3"] = type3;

            return(View());
        }
Пример #2
0
        [HttpGet]//查询资产类别的信息
        public List <List <string> > Get_Type(string type)
        {
            //从数据库获取类别信息并返回 获取到的元属性名称
            List <string> zy_name = new List <string>();
            List <string> kz_name = new List <string>();

            List <string> key = new List <string>();

            key.Add("ID");
            Class_template old = new Class_template(type);

            for (int i = 0; i < old.ZC_SX.Count; i++)
            {
                M_Db_Operate  m_Db_Operate = new M_Db_Operate();
                var           collection   = m_Db_Operate.database.GetCollection <YSX_Model>("Meta_attribute");
                List <string> value        = new List <string>();
                value.Add(old.ZC_SX[i]);
                var resu = m_Db_Operate.Inquire_Data(collection, key, value);
                if (resu[0].Dimension_dic["资产类别维度"].Contains("专用集"))
                {
                    zy_name.Add(resu[0].Name);
                }
                else if (resu[0].Dimension_dic["资产类别维度"].Contains("扩展集"))
                {
                    kz_name.Add(resu[0].Name);
                }
            }
            List <List <string> > data = new List <List <string> >();

            data.Add(zy_name);
            data.Add(kz_name);
            return(data);
        }
        //查询维度方式3:维度名称
        public IActionResult query_wd_3(IFormCollection f)
        {
            string data_name = f["data_name"];

            try
            {
                //这里用来查询数据库整合数据
                M_Db_Operate m_Db_Operate = new M_Db_Operate();
                var          collection   = m_Db_Operate.database.GetCollection <Dimension_Information_Model>("Dimension_Information");

                List <string> key = new List <string>();
                key.Add("NAME");
                List <string> value = new List <string>();
                value.Add(data_name);
                var Result = m_Db_Operate.Inquire_Data(collection, key, value);
                ViewData["wd_name1"]   = null;
                ViewData["wd_name2"]   = null;
                ViewData["pf_name2"]   = null;
                ViewData["data_name3"] = data_name;
                ViewData["data"]       = Result;
            }
            catch (InvalidCastException e)
            {
                ViewData["e"] = e.ToString();
                return(View("../Home/query_ERROR"));
            }
            return(View("query_wd"));
        }
Пример #4
0
        //资产类别修改界面
        public IActionResult manage_zc_type()
        {
            ViewData["ty_names"] = ty_names;
            //从数据库中读取数据
            M_Db_Operate m_Db_Operate = new M_Db_Operate();
            var          collection   = m_Db_Operate.database.GetCollection <YSX_Model>("Meta_attribute");
            var          result       = m_Db_Operate.Inquire_Data(collection, type: 2).ToList();

            return(View());
        }
        //元属性查询方式2:元属性名称查询
        public IActionResult query_ysx_2(IFormCollection f)
        {
            string ysx_2 = f["ysx_name"];
            var    p     = new YSX_Model();

            try
            {
                //这里用来查询数据库,整合数据
                M_Db_Operate m_Db_Operate = new M_Db_Operate();
                var          collection   = m_Db_Operate.database.GetCollection <YSX_Model>("Meta_attribute");

                List <string> key = new List <string>();
                key.Add("Name");
                List <string> value = new List <string>();
                value.Add(ysx_2);
                var Result = m_Db_Operate.Inquire_Data(collection, key, value);

                string[] wd_name = new string[4];
                wd_name[0] = "应用特性维度";
                wd_name[1] = "管理者维度";
                wd_name[2] = "扩展资产类别维度";
                wd_name[3] = "自定义维度";
                for (var i = 0; i < Result.Count; i++)
                {
                    for (var j = 0; j < wd_name.Length; j++)
                    {
                        try
                        {
                            var a = Result[i].Dimension_dic[wd_name[j]];
                        }
                        catch
                        {
                            Result[i].Dimension_dic.Add(wd_name[j], "null");
                        };
                    }
                }

                ViewData["ysx_name"] = ysx_2;
                ViewData["wd_name"]  = null;
                ViewData["f_l"]      = null;
                ViewData["wd_list"]  = wd_name.ToList <string>();
                ViewData["YSX_DATA"] = Result;
            }
            catch (InvalidCastException e)
            {
                ViewData["e"] = e.ToString();
                return(View("query_ERROR"));
            }
            ViewData["YSX_Model"] = p;
            return(View("query_ysx"));
        }
        //TODO:添加一些资产
        public IActionResult add_zc_ten()
        {
            M_Db_Operate m_Db_Ct = new M_Db_Operate();
            var          coll    = m_Db_Ct.database.GetCollection <Class_template>("Class_templates");
            M_Db_Operate zc_db   = new M_Db_Operate();
            var          zc_coll = zc_db.database.GetCollection <SJ_ZC_Model>("ZC_data");
            int          number  = zc_db.Inquire_Data(zc_coll, type: 2).Count;
            var          types   = m_Db_Ct.Inquire_Data(coll, type: 2);

            foreach (var type in types)
            {
                List <SJ_ZC_Model> sj_zc_s = new List <SJ_ZC_Model>();
                var res = m_Db_Ct.Get_Aggregate("Class_templates",
                                                new List <string>()
                {
                    "TPYE"
                },
                                                new List <string>()
                {
                    type.TPYE
                },
                                                new List <string>()
                {
                    "Meta_attribute"
                },
                                                new List <string>()
                {
                    "ZC_SX"
                },
                                                new List <string>()
                {
                    "ID"
                },
                                                new List <string>()
                {
                    "ZC_SX"
                })[0];
                for (int i = 0; i < 27273; i++)
                {
                    number++;
                    SJ_ZC_Model sJ_ZC = new SJ_ZC_Model(res, type.TPYE, number);
                    sj_zc_s.Add(sJ_ZC);
                }
                zc_coll.InsertMany(sj_zc_s);
            }
            //总条目数
            return(query_zc());
        }
        public Class_template(String type)
        {
            ZC_SX = new List <string>();
            TPYE  = type;
            M_Db_Operate m_Db_Operate = new M_Db_Operate();
            var          client       = new MongoClient("mongodb://127.0.0.1:27017");
            var          database     = client.GetDatabase("test");
            var          collection   = database.GetCollection <Class_template>("Class_templates");

            List <string> key   = new List <string>();
            List <string> value = new List <string>();

            key.Add("TPYE");
            value.Add(type);
            ZC_SX = m_Db_Operate.Inquire_Data(collection, key, value)[0].ZC_SX;
        }
Пример #8
0
        [HttpGet]//获取元属性信息
        public YSX_Model Get_YSX_XX(string Name, string Type)
        {
            M_Db_Operate m_Db_Operate = new M_Db_Operate();
            var          collection   = m_Db_Operate.database.GetCollection <YSX_Model>("Meta_attribute");

            List <string> key   = new List <string>();
            List <string> value = new List <string>();

            key.Add("Dimension_dic." + "资产类别维度");
            value.Add(Type);
            key.Add("Name");
            value.Add(Name);
            var Result = m_Db_Operate.Inquire_Data(collection, key, value);

            return(Result[0]);
        }
Пример #9
0
 [HttpGet] //获取维度信息
 public Dimension_Information_Model Get_WD_XX(string Name)
 {
     try
     {
         List <string> key   = new List <string>();
         List <string> value = new List <string>();
         key.Add("NAME");
         value.Add(Name);
         M_Db_Operate m_Db_Operate = new M_Db_Operate();
         var          collection   = m_Db_Operate.database.GetCollection <Dimension_Information_Model>("Dimension_Information");
         var          resule       = m_Db_Operate.Inquire_Data(collection, key, value);
         return(resule[0]);
     }
     catch
     {
         return(null);
     }
 }
        public Class_templates(string TYPE)
        {
            TPYE  = TYPE;
            KZ_SX = new List <string>();
            //从数据库中读取资产类别的元属性名称
            M_Db_Operate  m_Db_Operate = new M_Db_Operate();
            var           client       = new MongoClient("mongodb://127.0.0.1:27017");
            var           database     = client.GetDatabase("test");
            var           collection   = database.GetCollection <Class_templates>("Class_templates");
            List <string> key          = new List <string>();

            key.Add("TPYE");
            List <string> value = new List <string>();

            value.Add(TPYE);
            //读取
            KZ_SX = m_Db_Operate.Inquire_Data(collection, key, value)[0].KZ_SX;
        }
Пример #11
0
        [HttpGet]//获取已有类别下的类别名称
        public List <string> Get_Two_Type(string type)
        {
            //从数据库获取类别信息并返回 获取到的元属性名称
            List <string> data  = new List <string>();
            List <string> key   = new List <string>();
            List <string> value = new List <string>();

            key.Add("F_id");
            value.Add(type);
            M_Db_Operate m_Db_Operate = new M_Db_Operate();
            var          collection   = m_Db_Operate.database.GetCollection <Class_template>("Class_templates");
            var          resule       = m_Db_Operate.Inquire_Data(collection, key, value);

            for (int i = 0; i < resule.Count; i++)
            {
                data.Add(resule[i].TPYE);
            }
            return(data);
        }
Пример #12
0
        [HttpGet]//获取维度下全部元属性名称
        public Dictionary <string, string> Get_YSXS_Name(string WD, string Name)
        {
            M_Db_Operate m_Db_Operate = new M_Db_Operate();
            var          collection   = m_Db_Operate.database.GetCollection <YSX_Model>("Meta_attribute");

            List <string> key   = new List <string>();
            List <string> value = new List <string>();

            key.Add("Dimension_dic." + WD);
            value.Add(Name);
            var Result = m_Db_Operate.Inquire_Data(collection, key, value);
            Dictionary <string, string> names = new Dictionary <string, string>();

            foreach (var i in Result)
            {
                names.Add(i.ID, i.Name);
            }
            return(names);
        }
Пример #13
0
        [HttpGet]//根据资产类别获取该类别下全部维度名称
        public List <string> Get_WD_name(string Type)
        {
            List <string> name = new List <string>();

            try
            {
                List <string> key   = new List <string>();
                List <string> value = new List <string>();
                key.Add("TYPE");
                value.Add(Type);
                M_Db_Operate m_Db_Operate = new M_Db_Operate();
                var          collection   = m_Db_Operate.database.GetCollection <Dimension_Information_Model>("Dimension_Information");
                var          resule       = m_Db_Operate.Inquire_Data(collection, key, value);
                for (int i = 0; i < resule.Count; i++)
                {
                    name.Add(resule[i].NAME);
                }
            }
            catch
            {
                return(null);
            }
            return(name);
        }
Пример #14
0
        public SX_Model(string Names)
        {
            M_Db_Operate m_Db_Operate = new M_Db_Operate();
            var          client       = new MongoClient("mongodb://127.0.0.1:27017");
            var          database     = client.GetDatabase("test");
            var          collection   = database.GetCollection <YSX_Model>("Meta_attribute");

            List <string> key0 = new List <string>();

            key0.Add("Name");
            List <string> value0 = new List <string>();

            value0.Add(Names);
            var ysx0 = m_Db_Operate.Inquire_Data(collection, key0, value0);  //查询数据

            ID            = ysx0[0].ID;
            Name          = ysx0[0].Name;
            Length        = ysx0[0].Length;
            Remarks       = ysx0[0].Remarks;
            Unit          = ysx0[0].Unit;
            Dimension_dic = ysx0[0].Dimension_dic;
            Edition       = ysx0[0].Edition;
            // _id = ysx0[0]._id;
        }
Пример #15
0
        public SJ_ZC_Model(BsonDocument res, string type, int number)
        {
            Random ra = new Random();

            ZC_SX = new List <SJ_SX_Model>();
            M_Db_Operate YSX_db   = new M_Db_Operate();
            var          ysx_coll = YSX_db.database.GetCollection <YSX_Model>("Meta_attribute");
            int          j        = 0;

            ZCBM = number.ToString();
            while (true)
            {
                try
                {
                    SJ_SX_Model sx = new SJ_SX_Model();
                    sx.mp = res["ZC_SX"][j]["ID"].ToString();
                    if (sx.mp == "0002")
                    {
                        sx.V = type;
                        ZC_SX.Add(sx);
                        j++;
                        continue;
                    }
                    if (sx.mp == "0003")
                    {
                        sx.V = number.ToString();
                        ZC_SX.Add(sx);
                        j++;
                        continue;
                    }
                    if (sx.mp == "0004")
                    {
                        sx.V = type + ra.Next(15).ToString();
                        ZC_SX.Add(sx);
                        j++;
                        continue;
                    }
                    if (res["ZC_SX"][j]["Name"].ToString() == "文物标识")
                    {
                        sx.V = ra.Next(2).ToString();
                        if (sx.V == "1")
                        {
                            var ww_ysx = YSX_db.Inquire_Data(ysx_coll, new List <string>()
                            {
                                "Dimension_dic.应用特性维度"
                            }, new List <string> {
                                "文物信息"
                            });
                            foreach (var ww in ww_ysx)
                            {
                                SJ_SX_Model ww_s = new SJ_SX_Model();
                                if (ww.Data_Type == "整型")
                                {
                                    ww_s.V = ra.Next(1, 100).ToString();
                                }
                                else if (ww.Data_Type == "时间型")
                                {
                                    ww_s.V = Convert.ToDateTime("2007-1-1").AddDays(ra.Next(1000)).ToString();
                                }
                                else
                                {
                                    ww_s.V = ww.Name + ra.Next(1, 100).ToString();
                                }
                                ww_s.mp = ww.ID;
                                ZC_SX.Add(ww_s);
                            }
                        }
                    }
                    else if (res["ZC_SX"][j]["Name"].ToString() == "是否包含物联网传感")
                    {
                        sx.V = ra.Next(2).ToString();
                        if (sx.V == "1")
                        {
                            var wlw_ysx = YSX_db.Inquire_Data(ysx_coll, new List <string>()
                            {
                                "Dimension_dic.应用特性维度"
                            }, new List <string> {
                                "物联网信息"
                            });
                            foreach (var wlw in wlw_ysx)
                            {
                                SJ_SX_Model wlw_s = new SJ_SX_Model();
                                if (wlw.Data_Type == "整型")
                                {
                                    wlw_s.V = ra.Next(1, 100).ToString();
                                }
                                else if (wlw.Data_Type == "时间型")
                                {
                                    wlw_s.V = Convert.ToDateTime("2007-1-1").AddDays(ra.Next(1000)).ToString();
                                }
                                else
                                {
                                    wlw_s.V = wlw.Name + ra.Next(1, 100).ToString();
                                }
                                wlw_s.mp = wlw.ID;
                                ZC_SX.Add(wlw_s);
                            }
                        }
                    }
                    else if (res["ZC_SX"][j]["Name"].ToString() == "陈列品标识")
                    {
                        sx.V = ra.Next(2).ToString();
                        if (sx.V == "1")
                        {
                            var bb_ysx = YSX_db.Inquire_Data(ysx_coll, new List <string>()
                            {
                                "Dimension_dic.应用特性维度"
                            }, new List <string> {
                                "标本信息"
                            });
                            foreach (var bb in bb_ysx)
                            {
                                SJ_SX_Model bb_s = new SJ_SX_Model();
                                if (bb.Data_Type == "整型")
                                {
                                    bb_s.V = ra.Next(1, 100).ToString();
                                }
                                else if (bb.Data_Type == "时间型")
                                {
                                    bb_s.V = Convert.ToDateTime("2007-1-1").AddDays(ra.Next(1000)).ToString();
                                }
                                else
                                {
                                    bb_s.V = bb.Name + ra.Next(1, 100).ToString();
                                }
                                bb_s.mp = bb.ID;
                                ZC_SX.Add(bb_s);
                            }
                        }
                    }
                    else
                    {
                        if (res["ZC_SX"][j]["Data_Type"].ToString() == "整型")
                        {
                            sx.V = ra.Next(1, 100).ToString();
                        }
                        else if (res["ZC_SX"][j]["Data_Type"].ToString() == "时间型")
                        {
                            sx.V = Convert.ToDateTime("2007-1-1").AddDays(ra.Next(1000)).ToString();
                        }
                        else
                        {
                            sx.V = res["ZC_SX"][j]["Name"].ToString() + ra.Next(1, 100).ToString();
                        }
                    }
                    ZC_SX.Add(sx);
                    j++;
                }
                catch
                {
                    break;
                }
            }
        }
        //TODO:资产查询界面
        public IActionResult query_zc()
        {
            M_Db_Operate m_Db_Operate = new M_Db_Operate();

            //var zc_coll = m_Db_Operate.database.GetCollection<BsonDocument>("ZC_data");
            //string pipelineJson1 = "{$match:{'ZCBM.V':'1',}}";
            //string pipelineJson2 = "{$lookup:{from: 'Meta_attribute',localField: 'ZY_SX.mp',foreignField: 'ID',as: 'ZY_SX_N'}}";
            //string pipelineJson3 = "{$lookup:{from: 'Meta_attribute',localField: 'KJ_SX.mp',foreignField: 'ID',as: 'KJ_SX_N'}}";
            //IList<IPipelineStageDefinition> stages = new List<IPipelineStageDefinition>();
            //PipelineStageDefinition<BsonDocument, BsonDocument> stage1 =
            //    new JsonPipelineStageDefinition<BsonDocument, BsonDocument>(pipelineJson1);
            //PipelineStageDefinition<BsonDocument, BsonDocument> stage2 =
            //    new JsonPipelineStageDefinition<BsonDocument, BsonDocument>(pipelineJson2);
            //PipelineStageDefinition<BsonDocument, BsonDocument> stage3 =
            //    new JsonPipelineStageDefinition<BsonDocument, BsonDocument>(pipelineJson3);
            ////stages.Add(stage1);
            //stages.Add(stage2);
            //stages.Add(stage3);
            //PipelineDefinition<BsonDocument, BsonDocument> pipeline = new PipelineStagePipelineDefinition<BsonDocument, BsonDocument>(stages);
            //var result = zc_coll.Aggregate(pipeline).ToList();

            List <List <string> > ZC_datas = new List <List <string> >();
            //for (int i = 0; i < result.Count; i++)
            //{
            //    List<string> ZC_data = new List<string>();
            //    ZC_data.Add(sx_name[0] + ":" + result[i]["SJZCFLBM"]["V"].ToString());
            //    ZC_data.Add(sx_name[1] + ":" + result[i]["SJZCFLMC"]["V"].ToString());
            //    ZC_data.Add(sx_name[2] + ":" + result[i]["ZCBM"]["V"].ToString());
            //    ZC_data.Add(sx_name[3] + ":" + result[i]["ZCMC"]["V"].ToString());
            //    ZC_data.Add(sx_name[4] + ":" + result[i]["YWMC"]["V"].ToString());
            //    ZC_data.Add(sx_name[5] + ":" + result[i]["SL"]["V"].ToString());
            //    ZC_data.Add(sx_name[6] + ":" + result[i]["JLDW"]["V"].ToString());
            //    ZC_data.Add(sx_name[7] + ":" + result[i]["ZMJZ"]["V"].ToString());
            //    ZC_data.Add(sx_name[8] + ":" + result[i]["JZLX"]["V"].ToString());
            //    ZC_data.Add(sx_name[9] + ":" + result[i]["BiZ"]["V"].ToString());
            //    ZC_data.Add(sx_name[10] + ":" + result[i]["GB"]["V"].ToString());
            //    ZC_data.Add(sx_name[11] + ":" + result[i]["QDRQ"]["V"].ToString());
            //    ZC_data.Add(sx_name[12] + ":" + result[i]["KSKYRQ"]["V"].ToString());
            //    ZC_data.Add(sx_name[13] + ":" + result[i]["YT"]["V"].ToString());
            //    ZC_data.Add(sx_name[14] + ":" + result[i]["SYZK"]["V"].ToString());
            //    ZC_data.Add(sx_name[15] + ":" + result[i]["SYFX"]["V"].ToString());
            //    ZC_data.Add(sx_name[16] + ":" + result[i]["QDFS"]["V"].ToString());
            //    ZC_data.Add(sx_name[17] + ":" + result[i]["KJPZH"]["V"].ToString());
            //    ZC_data.Add(sx_name[18] + ":" + result[i]["SYBM"]["V"].ToString());
            //    ZC_data.Add(sx_name[19] + ":" + result[i]["SYR"]["V"].ToString());
            //    ZC_data.Add(sx_name[20] + ":" + result[i]["BZ"]["V"].ToString());
            //    string kz_sx = "";
            //    var j = 0;
            //    while (true)
            //    {
            //        try
            //        {
            //            var name1 = result[i]["ZY_SX_N"][j]["Name"].ToString();
            //            var Value = result[0]["ZY_SX"][j]["V"].ToString();
            //            kz_sx += name1 + " : " + Value + "     ";
            //            j++;
            //        }
            //        catch
            //        {
            //            break;
            //        }
            //    }
            //    j = 0;
            //    while (true)
            //    {
            //        try
            //        {
            //            var name1 = result[i]["KJ_SX_N"][j]["Name"].ToString();
            //            var Value = result[0]["KJ_SX"][j]["V"].ToString();
            //            kz_sx += name1 + " : " + Value + "     ";
            //            j++;
            //        }
            //        catch
            //        {
            //            break;
            //        }
            //    }
            //    ZC_data.Add(kz_sx);
            //    ZC_datas.Add(ZC_data);
            //}
            //查询管理者维度
            var collection1 = m_Db_Operate.database.GetCollection <Dimension_Information_Model>("Dimension_Information");

            List <string> key = new List <string>();

            key.Add("TYPE");
            List <string> value = new List <string>();

            value.Add("管理者维度");
            var           Result = m_Db_Operate.Inquire_Data(collection1, key, value);
            List <string> name   = new List <string>();

            for (var i = 0; i < Result.Count; i++)
            {
                name.Add(Result[i].NAME);
            }
            ViewData["glz_list"] = name;
            ViewData["ZC_datas"] = ZC_datas;
            ViewData["sx_name"]  = sx_name;
            return(View("query_zc"));
        }
        //按照管理者维度查找
        //public IActionResult query_zc_3(IFormCollection f)
        //{
        //    string guanlizhe = f["glz"];
        //    try
        //    {
        //        M_Db_Operate m_Db_Operate = new M_Db_Operate();
        //        var collection1 = m_Db_Operate.database.GetCollection<Dimension_Information_Model>("Dimension_Information");

        //        List<string> key1 = new List<string>();
        //        key1.Add("TYPE");
        //        List<string> value1 = new List<string>();
        //        value1.Add("管理者维度");
        //        var Result1 = m_Db_Operate.Inquire_Data(collection1, key1, value1);
        //        List<string> name = new List<string>();
        //        for (var i = 0; i < Result1.Count; i++)
        //        {
        //            name.Add(Result1[i].NAME);
        //        }
        //        ViewData["glz_list"] = name;
        //        //在这里查询数据库并整合数据
        //        var collection = m_Db_Operate.database.GetCollection<YSX_Model>("Meta_attribute");

        //        List<string> key = new List<string>();
        //        key.Add("Dimension_dic.管理者维度");
        //        List<string> value = new List<string>();
        //        value.Add(guanlizhe);
        //        var Result = m_Db_Operate.Inquire_Data(collection, key, value);

        //        List<string> results = new List<string>();
        //        for (var i = 0; i < Result.Count; i++)
        //        {
        //            results.Add(Result[i].Name);
        //        }
        //        List<string> value2 = new List<string>();
        //        value2.Add("默认管理者");
        //        Result = m_Db_Operate.Inquire_Data(collection, key, value2);
        //        for (var i = 0; i < Result.Count; i++)
        //        {
        //            results.Add(Result[i].Name);
        //        }
        //        var collection2 = m_Db_Operate.database.GetCollection<SJ_ZC_Model>("ZC_data");
        //        FilterDefinitionBuilder<SJ_ZC_Model> builderFilter = Builders<SJ_ZC_Model>.Filter;
        //        var result = collection2.FindSync<SJ_ZC_Model>(builderFilter.Empty).ToList();

        //        List<List<string>> ZC_datas = new List<List<string>>();
        //        for (var i = 0; i < result.Count; i++)
        //        {
        //            List<string> ZC_data = new List<string>();
        //            ZC_data.Add(sx_name[0] + ":" +result[i].SJZCFLBM.V.ToString());
        //            ZC_data.Add(sx_name[1] + ":" +result[i].SJZCFLMC.V.ToString());
        //            ZC_data.Add(sx_name[2] + ":" +result[i].ZCBM.V.ToString());
        //            ZC_data.Add(sx_name[3] + ":" +result[i].ZCMC.V.ToString());
        //            ZC_data.Add(sx_name[4] + ":" +result[i].YWMC.V.ToString());
        //            ZC_data.Add(sx_name[5] + ":" +result[i].SL.V.ToString());
        //            ZC_data.Add(sx_name[6] + ":" +result[i].JLDW.V.ToString());
        //            ZC_data.Add(sx_name[7] + ":" +result[i].ZMJZ.V.ToString());
        //            ZC_data.Add(sx_name[8] + ":" +result[i].JZLX.V.ToString());
        //            ZC_data.Add(sx_name[9] + ":" +result[i].BiZ.V.ToString());
        //            ZC_data.Add(sx_name[10] + ":" +result[i].GB.V.ToString());
        //            ZC_data.Add(sx_name[11] + ":" +result[i].QDRQ.V.ToString());
        //            ZC_data.Add(sx_name[12] + ":" +result[i].KSKYRQ.V.ToString());
        //            ZC_data.Add(sx_name[13] + ":" +result[i].YT.V.ToString());
        //            ZC_data.Add(sx_name[14] + ":" +result[i].SYZK.V.ToString());
        //            ZC_data.Add(sx_name[15] + ":" +result[i].SYFX.V.ToString());
        //            ZC_data.Add(sx_name[16] + ":" +result[i].QDFS.V.ToString());
        //            ZC_data.Add(sx_name[17] + ":" +result[i].KJPZH.V.ToString());
        //            ZC_data.Add(sx_name[18] + ":" +result[i].SYBM.V.ToString());
        //            ZC_data.Add(sx_name[19] + ":" +result[i].SYR.V.ToString());
        //            ZC_data.Add(sx_name[20] + ":" +result[i].BZ.V.ToString());
        //            string kz_sx = "";
        //            M_Db_Operate m_Db_ = new M_Db_Operate();
        //            var coll = m_Db_.database.GetCollection<YSX_Model>("Meta_attribute");
        //            List<string> key2 = new List<string>();
        //            key2.Add("ID");
        //            for (var j = 0; j < result[i].ZY_SX.Count; j++)
        //            {
        //                List<string> value3 = new List<string>();
        //                value3.Add(result[i].ZY_SX[j].mp.ToString());
        //                var su = m_Db_.Inquire_Data(coll, key2, value3);
        //                kz_sx += su[0].Name.ToString() + " : " + result[i].ZY_SX[j].V.ToString() + "     ";
        //            }
        //            for (var j = 0; j < result[i].KJ_SX.Count; j++)
        //            {
        //                List<string> value3 = new List<string>();
        //                value3.Add(result[i].KJ_SX[j].mp.ToString());
        //                var su = m_Db_.Inquire_Data(coll, key2, value3);
        //                kz_sx += su[0].Name.ToString() + " : " + result[i].KJ_SX[j].V.ToString() + "     ";
        //            }
        //            ZC_data.Add(kz_sx);
        //            ZC_datas.Add(ZC_data);
        //        }
        //        ViewData["ZC_datas"] = ZC_datas;
        //        ViewData["sx_name"] = sx_name;
        //    }
        //    catch (InvalidCastException e)
        //    {
        //        ViewData["e"] = e.ToString();
        //        return View("query_ERROR");
        //    }
        //    ViewData["glz"] = guanlizhe;
        //    ViewData["zc_name"] = null;
        //    ViewData["ysx_name"] = null;
        //    ViewData["ysx_value"] = null;
        //    return View("query_zc");
        //}

        //添加资产完成动作
        public IActionResult addZC_OK(IFormCollection f)
        {
            string Kindda, One_Class;

            Kindda    = f["Kindda"];
            One_Class = f["One_Class"];
            //Two_Class = f["Two_Class"];
            SJ_ZC_Model SJ_ZC = new SJ_ZC_Model();

            for (int i = 1; i < ty_names.Count; i++)
            {
                SJ_SX_Model sJ_SX_ = new SJ_SX_Model();
                sJ_SX_.V = f[ty_names[i - 1]];
                if (i > 9)
                {
                    sJ_SX_.mp = "00" + i.ToString();
                }
                else
                {
                    sJ_SX_.mp = "000" + i.ToString();
                }
                SJ_ZC.ZC_SX.Add(sJ_SX_);
            }
            SJ_ZC.ZCBM = f["资产编码"];
            Class_template old = new Class_template();

            if (One_Class == "不选择--")
            {
                old = new Class_template(Kindda);
            }
            else
            {
                old = new Class_template(One_Class);
            }
            List <string> key = new List <string>();

            key.Add("ID");
            M_Db_Operate m_Db_Operate = new M_Db_Operate();
            var          collection   = m_Db_Operate.database.GetCollection <YSX_Model>("Meta_attribute");

            for (var i = 1; i < old.ZC_SX.Count; i++)
            {
                SJ_SX_Model   sj_sx = new SJ_SX_Model();
                List <string> value = new List <string>();
                value.Add(old.ZC_SX[i].ToString());
                var resu = m_Db_Operate.Inquire_Data(collection, key, value);
                sj_sx.V  = f[resu[0].Name];
                sj_sx.mp = resu[0].ID.ToString();
                SJ_ZC.ZC_SX.Add(sj_sx);
                if (resu[0].Name == "文物标识")
                {
                    var re_ww = m_Db_Operate.Inquire_Data(collection, new List <string> {
                        "Dimension_dic.应用特性维度"
                    }, new List <string> {
                        "文物信息"
                    });
                    for (int j = 0; j < re_ww.Count; j++)
                    {
                        sj_sx    = new SJ_SX_Model();
                        sj_sx.V  = f[re_ww[j].Name];
                        sj_sx.mp = re_ww[j].ID.ToString();
                        SJ_ZC.ZC_SX.Add(sj_sx);
                    }
                }
                else if (resu[0].Name == "是否包含物联网传感")
                {
                    var re_ww = m_Db_Operate.Inquire_Data(collection, new List <string> {
                        "Dimension_dic.应用特性维度"
                    }, new List <string> {
                        "物联网信息"
                    });
                    for (int j = 0; j < re_ww.Count; j++)
                    {
                        sj_sx    = new SJ_SX_Model();
                        sj_sx.V  = f[re_ww[j].Name];
                        sj_sx.mp = re_ww[j].ID.ToString();
                        SJ_ZC.ZC_SX.Add(sj_sx);
                    }
                }
                else if (resu[0].Name == "陈列品标识")
                {
                    var re_ww = m_Db_Operate.Inquire_Data(collection, new List <string> {
                        "Dimension_dic.应用特性维度"
                    }, new List <string> {
                        "标本信息"
                    });
                    for (int j = 0; j < re_ww.Count; j++)
                    {
                        sj_sx    = new SJ_SX_Model();
                        sj_sx.V  = f[re_ww[j].Name];
                        sj_sx.mp = re_ww[j].ID.ToString();
                        SJ_ZC.ZC_SX.Add(sj_sx);
                    }
                }
            }
            try
            {
                M_Db_Operate m_Db = new M_Db_Operate();
                var          coll = m_Db.database.GetCollection <SJ_ZC_Model>("ZC_data");
                coll.InsertOne(SJ_ZC);
                return(View("../Home/add_OK"));
            }
            catch (InvalidCastException e)
            {
                ViewData["e"] = e.ToString();
                return(View("../Home/add_ERROR"));
            };
        }
 //资产修改完成动作result[0].SJZCFLBM
 public IActionResult Updata_zc_OK(IFormCollection f)
 {
     try
     {
         string id;
         if (f["zc_id"] == "-- 资产编码 --")
         {
             id = f["int_zc_"];
         }
         else
         {
             id = f["zc_id"];
         }
         List <SJ_SX_Model> new_ZC_SX    = new List <SJ_SX_Model>();
         M_Db_Operate       m_Db_Operate = new M_Db_Operate();
         var coll   = m_Db_Operate.database.GetCollection <SJ_ZC_Model>("ZC_data");
         var result = m_Db_Operate.Get_Aggregate(
             "ZC_data",
             new List <string>()
         {
             "ZCBM"
         },
             new List <string>()
         {
             id
         },
             new List <string>()
         {
             "Meta_attribute"
         },
             new List <string>()
         {
             "ZC_SX.mp"
         },
             new List <string>()
         {
             "ID"
         },
             new List <string>()
         {
             "ZC_SXN"
         }
             )[0];
         M_Db_Operate       m_Db       = new M_Db_Operate();
         var                collection = m_Db.database.GetCollection <YSX_Model>("Meta_attribute");
         int                j          = 0;
         int[]              flag       = { 1, 1, 1 };
         List <SJ_SX_Model> del_sx     = new List <SJ_SX_Model>();
         while (true)
         {
             try
             {
                 SJ_SX_Model sx = new SJ_SX_Model();
                 sx.V = f[result["ZC_SXN"][j]["ID"].ToString()];
                 int u = 0;
                 while (true)
                 {
                     try
                     {
                         if (result["ZC_SX"][u]["mp"].ToString() == result["ZC_SXN"][j]["ID"].ToString())
                         {
                             sx.mp = result["ZC_SX"][u]["mp"].ToString();
                             break;
                         }
                         u++;
                     }
                     catch
                     {
                         break;
                     }
                 }
                 //sx.mp = result["ZC_SX"][j]["mp"].ToString();
                 new_ZC_SX.Add(sx);
                 if (result["ZC_SXN"][j]["Name"].ToString() == "文物标识")
                 {
                     if (sx.V == "1")
                     {
                         var ww_resu = m_Db.Inquire_Data(collection, new List <string>()
                         {
                             "Dimension_dic.应用特性维度"
                         }, new List <string>()
                         {
                             "文物信息"
                         });
                         foreach (var ysx in ww_resu)
                         {
                             SJ_SX_Model ww_sx = new SJ_SX_Model();
                             ww_sx.V  = f[ysx.ID];
                             ww_sx.mp = ysx.ID;
                             new_ZC_SX.Add(ww_sx);
                         }
                     }
                     if (sx.V == "0")
                     {
                         var ww_resu = m_Db.Inquire_Data(collection, new List <string>()
                         {
                             "Dimension_dic.应用特性维度"
                         }, new List <string>()
                         {
                             "文物信息"
                         });
                         foreach (var ysx in ww_resu)
                         {
                             SJ_SX_Model ww_sx = new SJ_SX_Model();
                             ww_sx.V  = f[ysx.ID];
                             ww_sx.mp = ysx.ID;
                             del_sx.Add(ww_sx);
                         }
                     }
                 }
                 else if (result["ZC_SXN"][j]["Name"].ToString() == "是否包含物联网传感")
                 {
                     if (sx.V == "1")
                     {
                         var wlw_resu = m_Db.Inquire_Data(collection, new List <string>()
                         {
                             "Dimension_dic.应用特性维度"
                         }, new List <string>()
                         {
                             "物联网信息"
                         });
                         foreach (var ysx in wlw_resu)
                         {
                             SJ_SX_Model wlw_sx = new SJ_SX_Model();
                             wlw_sx.V  = f[ysx.ID];
                             wlw_sx.mp = ysx.ID;
                             new_ZC_SX.Add(wlw_sx);
                         }
                     }
                     if (sx.V == "0")
                     {
                         var wlw_resu = m_Db.Inquire_Data(collection, new List <string>()
                         {
                             "Dimension_dic.应用特性维度"
                         }, new List <string>()
                         {
                             "物联网信息"
                         });
                         foreach (var ysx in wlw_resu)
                         {
                             SJ_SX_Model wlw_sx = new SJ_SX_Model();
                             wlw_sx.V  = f[ysx.ID];
                             wlw_sx.mp = ysx.ID;
                             del_sx.Add(wlw_sx);
                         }
                     }
                 }
                 else if (result["ZC_SXN"][j]["Name"].ToString() == "陈列品标识")
                 {
                     if (sx.V == "1")
                     {
                         var bb_resu = m_Db.Inquire_Data(collection, new List <string>()
                         {
                             "Dimension_dic.应用特性维度"
                         }, new List <string>()
                         {
                             "标本信息"
                         });
                         foreach (var ysx in bb_resu)
                         {
                             SJ_SX_Model bb_sx = new SJ_SX_Model();
                             bb_sx.V  = f[ysx.ID];
                             bb_sx.mp = ysx.ID;
                             new_ZC_SX.Add(bb_sx);
                         }
                     }
                     if (sx.V == "0")
                     {
                         var bb_resu = m_Db.Inquire_Data(collection, new List <string>()
                         {
                             "Dimension_dic.应用特性维度"
                         }, new List <string>()
                         {
                             "标本信息"
                         });
                         foreach (var ysx in bb_resu)
                         {
                             SJ_SX_Model bb_sx = new SJ_SX_Model();
                             bb_sx.V  = f[ysx.ID];
                             bb_sx.mp = ysx.ID;
                             del_sx.Add(bb_sx);
                         }
                     }
                 }
                 j++;
             }
             catch
             {
                 foreach (var del in del_sx)
                 {
                     new_ZC_SX.Remove(del);
                     for (int i = 0; i < new_ZC_SX.Count; i++)
                     {
                         if (new_ZC_SX[i].mp == del.mp)
                         {
                             new_ZC_SX.RemoveAt(i);
                             break;
                         }
                     }
                 }
                 break;
             }
         }
         m_Db_Operate.Up_Data(coll, "ZCBM", f["0003"], "ZC_SX", new_ZC_SX);
         return(View("../Home/add_OK"));
     }
     catch (InvalidCastException e)
     {
         ViewData["e"] = e.ToString();
         return(View("../Home/add_ERROR"));
     };
 }
        //按照资产编码查找
        public IActionResult query_zc_2(IFormCollection f)
        {
            string zc_name = f["zc_name"];

            try
            {
                M_Db_Operate m_Db_Operate = new M_Db_Operate();
                var          collection1  = m_Db_Operate.database.GetCollection <Dimension_Information_Model>("Dimension_Information");

                List <string> key1 = new List <string>();
                key1.Add("TYPE");
                List <string> value1 = new List <string>();
                value1.Add("管理者维度");
                var           Result = m_Db_Operate.Inquire_Data(collection1, key1, value1);
                List <string> name   = new List <string>();
                for (var i = 0; i < Result.Count; i++)
                {
                    name.Add(Result[i].NAME);
                }
                ViewData["glz_list"] = name;
                //在这里查询数据库并整合数据

                var           collection = m_Db_Operate.database.GetCollection <SJ_ZC_Model>("ZC_data");
                List <string> key        = new List <string>();
                List <string> value      = new List <string>();
                key.Add("ZCBM");
                value.Add(zc_name.ToString());

                var result = m_Db_Operate.Get_Aggregate(
                    "ZC_data",
                    key,
                    value,
                    new List <string>()
                {
                    "Meta_attribute"
                },
                    new List <string>()
                {
                    "ZC_SX.mp"
                },
                    new List <string>()
                {
                    "ID"
                },
                    new List <string>()
                {
                    "ZC_SXN"
                }
                    );
                List <List <string> > ZC_datas = new List <List <string> >();
                for (var i = 0; i < result.Count; i++)
                {
                    List <string> ZC_data = new List <string>();
                    string        kz_sx   = "";
                    int           j       = 0;
                    while (true)
                    {
                        try
                        {
                            if (result[i]["ZC_SXN"][j]["Dimension_dic"]["资产类别维度"].ToString().Contains("通用集"))
                            {
                                string uu = result[i]["ZC_SXN"][j]["Name"].ToString() + ":";
                                int    k  = 0;
                                while (true)
                                {
                                    try
                                    {
                                        if (result[i]["ZC_SXN"][j]["ID"].ToString() == result[i]["ZC_SX"][k]["mp"].ToString())
                                        {
                                            uu += result[i]["ZC_SX"][k]["V"].ToString();
                                            break;
                                        }
                                        k++;
                                    }
                                    catch
                                    {
                                        ;
                                    }
                                }
                                ZC_data.Add(uu);
                            }
                            else
                            {
                                string uu = result[i]["ZC_SXN"][j]["Name"].ToString() + ":";
                                int    k  = 0;
                                while (true)
                                {
                                    try
                                    {
                                        if (result[i]["ZC_SXN"][j]["ID"].ToString() == result[i]["ZC_SX"][k]["mp"].ToString())
                                        {
                                            uu += result[i]["ZC_SX"][k]["V"].ToString();
                                            break;
                                        }
                                        k++;
                                    }
                                    catch
                                    {
                                        ;
                                    }
                                }
                                ZC_data.Add(uu);
                            }
                        }
                        catch
                        {
                            break;
                        }
                        j++;
                    }
                    ZC_data.Add(kz_sx);
                    ZC_datas.Add(ZC_data);
                }
                ViewData["ZC_datas"] = ZC_datas;
                ViewData["sx_name"]  = sx_name;
            }
            catch (InvalidCastException e)
            {
                ViewData["e"] = e.ToString();
                return(View("query_ERROR"));
            }

            ViewData["wd_type"]   = null;
            ViewData["wd_xx"]     = null;
            ViewData["zc_name"]   = null;
            ViewData["ysx_name"]  = null;
            ViewData["ysx_value"] = null;

            return(View("query_zc"));
        }
Пример #20
0
 //资产类别修改完成
 public IActionResult addZCTYPE_OK(IFormCollection f)
 {
     try
     {
         string Kindda, One_Class, type;
         Kindda    = f["Kindda"];
         One_Class = f["One_Class"];
         if (One_Class == "不选择--")
         {
             type = Kindda;
         }
         else if (One_Class == "-- 大类 -- ")
         {
             type = null;
         }
         else if (Kindda == "-- 门类 -- ")
         {
             type = null;
         }
         else
         {
             type = One_Class;
         }
         if (type == null)
         {
             ViewData["e"] = "类别错误";
             return(View("../Home/add_ERROR"));
         }
         Class_template zc_type      = new Class_template();
         M_Db_Operate   m_Db_Operate = new M_Db_Operate();
         var            collection   = m_Db_Operate.database.GetCollection <YSX_Model>("Meta_attribute");
         List <string>  key          = new List <string>();
         key.Add("Name");
         int i = 1;
         while (true)
         {
             var name = f["kz_key_" + i.ToString()];
             if (name.ToString() == "")
             {
                 break;
             }
             else
             {
                 List <string> value = new List <string>();
                 value.Add(name);
                 var Result = m_Db_Operate.Inquire_Data(collection, key, value);
                 zc_type.ZC_SX.Add(Result[0].ID.ToString());
                 i++;
             }
         }
         Class_template old = new Class_template();
         old = new Class_template(type);
         for (var j = 0; j < old.ZC_SX.Count; j++)
         {
             zc_type.ZC_SX.Add(old.ZC_SX[j]);
         }
         i = 1;
         while (true)
         {
             var name = f["sc_key_" + i.ToString()];
             if (name.ToString() == "")
             {
                 break;
             }
             else
             {
                 List <string> value = new List <string>();
                 value.Add(name);
                 var Result = m_Db_Operate.Inquire_Data(collection, key, value);
                 zc_type.ZC_SX.Remove(Result[0].ID.ToString());
                 while (zc_type.ZC_SX.Equals(Result[0].ID.ToString()))
                 {
                     zc_type.ZC_SX.Remove(Result[0].ID.ToString());
                 }
             }
             i++;
         }
         M_Db_Operate m_Db_Ct = new M_Db_Operate();
         var          coll    = m_Db_Ct.database.GetCollection <Class_template>("Class_templates");
         m_Db_Ct.Up_Data(coll, "TPYE", type, "ZC_SX", zc_type.ZC_SX);
         return(View("../Home/add_OK"));
     }
     catch (InvalidCastException e)
     {
         ViewData["e"] = e.ToString();
         return(View("../Home/add_ERROR"));
     }
 }
        //按照指定的元属性值查找
        public IActionResult query_zc_1(IFormCollection f)
        {
            var ysx_name  = f["ysx_name"];
            var ysx_value = f["ysx_value"];

            try
            {
                //查询管理者维度

                M_Db_Operate m_Db_Operate = new M_Db_Operate();
                var          collection1  = m_Db_Operate.database.GetCollection <Dimension_Information_Model>("Dimension_Information");

                List <string> key1 = new List <string>();
                key1.Add("TYPE");
                List <string> value1 = new List <string>();
                value1.Add("管理者维度");
                var           Result = m_Db_Operate.Inquire_Data(collection1, key1, value1);
                List <string> name   = new List <string>();
                for (var i = 0; i < Result.Count; i++)
                {
                    name.Add(Result[i].NAME);
                }
                ViewData["glz_list"] = name;
                //在这里查询数据库并整合数据

                M_Db_Operate m_Db_ = new M_Db_Operate();
                var          coll  = m_Db_.database.GetCollection <YSX_Model>("Meta_attribute");
                var          res   = m_Db_.Inquire_Data(coll, new List <string> {
                    "Name"
                }, new List <string> {
                    ysx_name.ToString()
                })[0];
                //var collection = m_Db_Operate.database.GetCollection<SJ_ZC_Model>("ZC_data");
                //List<string> key = new List<string>();
                //List<string> value = new List<string>();
                //key.Add("ZC_SX.mp");
                //key.Add("ZC_SX.V");
                //value.Add(res.ID);
                //value.Add(ysx_value.ToString());
                //List <BsonDocument> result = m_Db_Operate.Get_Aggregate(
                //    "ZC_data",
                //    key,
                //    value,
                //    new List<string>() { "Meta_attribute" },
                //    new List<string>() { "ZC_SX.mp" },
                //    new List<string>() { "ID" },
                //    new List<string>() { "ZC_SXN" }
                //    );
                #region 聚合查询方法
                IList <IPipelineStageDefinition> stages = new List <IPipelineStageDefinition>();
                string match  = "{$match:{ 'ZC_SX':{ 'V':'" + ysx_value.ToString() + "','mp':'" + res.ID + "'}}}";
                string lookup = "{$lookup:{from: 'Meta_attribute',localField: 'ZC_SX.mp',foreignField: 'ID', as: 'ZC_SXN'}}";
                string skip   = "{$skip: 0}";
                string limit  = "{$limit:30}";
                PipelineStageDefinition <BsonDocument, BsonDocument> stage1 =
                    new JsonPipelineStageDefinition <BsonDocument, BsonDocument>(match);
                PipelineStageDefinition <BsonDocument, BsonDocument> stage2 =
                    new JsonPipelineStageDefinition <BsonDocument, BsonDocument>(lookup);
                PipelineStageDefinition <BsonDocument, BsonDocument> stage3 =
                    new JsonPipelineStageDefinition <BsonDocument, BsonDocument>(skip);
                PipelineStageDefinition <BsonDocument, BsonDocument> stage4 =
                    new JsonPipelineStageDefinition <BsonDocument, BsonDocument>(limit);
                stages.Add(stage1);
                stages.Add(stage2);
                stages.Add(stage3);
                stages.Add(stage4);
                PipelineDefinition <BsonDocument, BsonDocument> pipeline = new PipelineStagePipelineDefinition <BsonDocument, BsonDocument>(stages);
                var oll = m_Db_Operate.database.GetCollection <BsonDocument>("ZC_data");
                List <BsonDocument> result = oll.Aggregate(pipeline).ToList();

                List <List <string> > ZC_datas = new List <List <string> >();
                for (var i = 0; i < result.Count; i++)
                {
                    List <string> ZC_data = new List <string>();
                    string        kz_sx   = "";
                    int           j       = 0;
                    while (true)
                    {
                        try
                        {
                            if (result[i]["ZC_SXN"][j]["Dimension_dic"]["资产类别维度"].ToString().Contains("通用集"))
                            {
                                string uu = result[i]["ZC_SXN"][j]["Name"].ToString() + ":";
                                int    k  = 0;
                                while (true)
                                {
                                    try
                                    {
                                        if (result[i]["ZC_SXN"][j]["ID"].ToString() == result[i]["ZC_SX"][k]["mp"].ToString())
                                        {
                                            uu += result[i]["ZC_SX"][k]["V"].ToString();
                                            break;
                                        }
                                        k++;
                                    }
                                    catch
                                    {
                                        ;
                                    }
                                }
                                ZC_data.Add(uu);
                            }
                            else
                            {
                                string uu = result[i]["ZC_SXN"][j]["Name"].ToString() + ":";
                                int    k  = 0;
                                while (true)
                                {
                                    try
                                    {
                                        if (result[i]["ZC_SXN"][j]["ID"].ToString() == result[i]["ZC_SX"][k]["mp"].ToString())
                                        {
                                            uu += result[i]["ZC_SX"][k]["V"].ToString();
                                            break;
                                        }
                                        k++;
                                    }
                                    catch
                                    {
                                        ;
                                    }
                                }
                                ZC_data.Add(uu);
                            }
                        }
                        catch
                        {
                            break;
                        }
                        j++;
                    }
                    ZC_data.Add(kz_sx);
                    ZC_datas.Add(ZC_data);
                }
                #endregion
                #region 其他方法
                //var collection = m_Db_Operate.database.GetCollection<BsonDocument>("ZC_data");
                //FilterDefinitionBuilder<BsonDocument> builderFilter = Builders<BsonDocument>.Filter;
                //var filter = builderFilter.ElemMatch("ZC_SX", builderFilter.And(builderFilter.Eq("V", ysx_value.ToString()), builderFilter.Eq("mp", res.ID)));
                //var result = collection.Find(filter).ToList();
                //List <List<string>> ZC_datas = new List<List<string>>();
                //FilterDefinitionBuilder<YSX_Model> builderFilter1 = Builders<YSX_Model>.Filter;
                //FilterDefinition<YSX_Model> filt = builderFilter1.And(builderFilter1.Ne("ID", ""));
                //var res2 = coll.Find(filt).ToList();
                //for (var i = 0; i < result.Count; i++)
                //{
                //    List<string> ZC_data = new List<string>();
                //    string kz_sx = "";
                //    int j = 0;
                //    while (true)
                //    {
                //        try
                //        {
                //            YSX_Model q = res2.TakeWhile(x => x.ID == result[i]["ZC_SX"][j]["mp"].ToString()).First();
                //            if (q.Dimension_dic["资产类别维度"].ToString().Contains("通用集"))
                //            {
                //                ZC_data.Add(q.Name.ToString() + ":" + result[i]["ZC_SX"][j]["V"].ToString());
                //            }
                //            else
                //            {
                //                kz_sx += q.Name.ToString() + ":" + result[i]["ZC_SX"][j]["V"].ToString();
                //            }
                //        }
                //        catch
                //        {
                //            break;
                //        }
                //        j++;
                //    }
                //    ZC_data.Add(kz_sx);
                //    ZC_datas.Add(ZC_data);
                //}
                #endregion
                ViewData["ZC_datas"] = ZC_datas;
                ViewData["sx_name"]  = sx_name;
            }
            catch (InvalidCastException e)
            {
                ViewData["e"] = e.ToString();
                return(View("query_ERROR"));
            }

            ViewData["wd_type"]   = null;
            ViewData["wd_xx"]     = null;
            ViewData["zc_name"]   = null;
            ViewData["ysx_name"]  = ysx_name;
            ViewData["ysx_value"] = ysx_value;

            return(View("query_zc"));
        }