Esempio n. 1
0
 private void RefreshData()
 {
     TE_ID.EditValue               = _guideLine.ID;
     TE_Name.EditValue             = _guideLine.GuideLineName;
     TE_ORDER.EditValue            = _guideLine.DisplayOrder;
     TE_SF.EditValue               = _guideLine.GuideLineMethod;
     _fgList                       = MC_GuideLine.GetFieldGroupsFromMeta(_guideLine.GuideLineMeta);
     this.te_Description.EditValue = _guideLine.Description;
     _treeData                     = new TreeObj_GuideLineFieldList();
     foreach (MD_GuideLineFieldGroup _glg in _fgList)
     {
         TreeObj_GuideLineFieldGroup _group = new TreeObj_GuideLineFieldGroup(_glg);
         TreeObj_GuidelLineFieldItem _item  = _group as TreeObj_GuidelLineFieldItem;
         foreach (MD_GuideLineFieldName _fname in _glg.Fields)
         {
             TreeObj_GuidelLineFieldItem _fitem = new TreeObj_GuidelLineFieldItem(_fname);
             _item.Children.Add(_fitem);
         }
         _treeData.Add(_item);
     }
     this.treeList1.DataSource = _treeData;
     _pList = MC_GuideLine.GetParametersFromMeta(_guideLine.GuideLineMeta);
     this.gridParameter.DataSource = _pList;
     _dList = MC_GuideLine.GetDetaiDefinelFromMeta(_guideLine.GuideLineMeta);
     this.gridDetail.DataSource = _dList;
     this._haveChange           = false;
 }
Esempio n. 2
0
        /// <summary>
        /// 取指标定义
        /// </summary>
        /// <param name="guideLineId"></param>
        /// <returns></returns>
        public async static Task <MD_GuideLine> GetGuidelineDefine(string guideLineId)
        {
            MD_GuideLine define = null;

            if (!string.IsNullOrEmpty(guideLineId))
            {
                if (GuidelineDefine.ContainsKey(guideLineId))
                {
                    define = GuidelineDefine[guideLineId];
                }
                else
                {
                    using (MySqlConnection cn = MysqlDBHelper.OpenConnection())
                    {
                        try
                        {
                            MySqlCommand cmd = new MySqlCommand(SqlGetGuidelineDefine, cn);
                            cmd.Parameters.Add(new MySqlParameter("@Id", Convert.ToInt64(guideLineId)));

                            using (MySqlDataReader dr = cmd.ExecuteReader())
                            {
                                while (await dr.ReadAsync())
                                {
                                    string id           = dr.IsDBNull(0) ? "" : dr.GetInt64(0).ToString();
                                    string name         = dr.IsDBNull(1) ? "" : dr.GetString(1);
                                    string groupname    = dr.IsDBNull(2) ? "" : dr.GetString(2);
                                    string zbmeta1      = dr.IsDBNull(3) ? "" : dr.GetString(3);
                                    string fatherid     = dr.IsDBNull(4) ? "0" : dr.GetInt64(4).ToString();
                                    string zbmeta2      = dr.IsDBNull(5) ? "" : dr.GetString(5);
                                    int    displayorder = dr.IsDBNull(6) ? 0 : Convert.ToInt32(dr.GetInt32(6));
                                    string descript     = dr.IsDBNull(7) ? "" : dr.GetString(7);
                                    string fullMeta     = zbmeta1 + zbmeta2;

                                    define               = new MD_GuideLine(id, name, groupname, fatherid, displayorder, descript);
                                    define.Parameters    = MC_GuideLine.GetParametersFromMeta(fullMeta);
                                    define.ResultGroups  = MC_GuideLine.GetFieldGroupsFromMeta(fullMeta);
                                    define.DetailDefines = MC_GuideLine.GetDetaiDefinelFromMeta(fullMeta);

                                    GuidelineDefine.Add(guideLineId, define);
                                }
                            }
                        }
                        catch (Exception exception)
                        {
                            string errorMessage = string.Format("取指标[{0}]的定义出错,错误信息为{1}", guideLineId, exception.Message);
                            MysqlLogWriter.WriteSystemLog(errorMessage, "ERROR");
                        }
                    }
                }
            }
            return(define);
        }