Beispiel #1
0
            public MenuItem(string _Key, string Name, DbConnection cnn)
            {
                string sql =
                    @"select 
     feature_name as Name, 
     feature_sql as sql, 
     feature_descr as descr,  
     cnn_id, 
     feature_icon as Icon, 
     feature_ismdilist as isMDIList, 
     feature_targettype as TargetType, 
     feature_update_sql as sqlupdate, 
     feature_FormType as FormType, FEATURE_TABLENAME as TABLENAME, feature_Code, 
     feature_wbs, FEATURE_URL, feature_long_sql as long_sql
from tracker_tb_features
where prj_no = '{0}' and feature_wbs = '{1}'";

                sql =
                    @"select 
     feature_name, 
     feature_sql, 
     feature_descr,
     cnn_id, 
     feature_update_sql, 
     feature_FormType,
     feature_wbs, 
     feature_icon,
     feature_long_sql,
     feature_ismdilist, 
     feature_targettype,
     FEATURE_URL
from tracker_tb_features
where prj_no = '{0}' and feature_wbs = '{1}'";

                sql = string.Format(sql, My.Application.Prj_No, _Key);



                if (cnn != null && cnn.State == ConnectionState.Open)
                {
                    DataTable dt = MyDb.Common.sql2DT(sql, cnn);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        DataRow dr = dt.Rows[0];
                        Key = _Key; Sql = dr["feature_sql"] + "";
                        if (Sql.Trim() == "")
                        {
                            try { Sql = dr["feature_long_sql"] + ""; }
                            catch (Exception ex)
                            { Console.WriteLine(ex.Message); }
                        }// _log.Fatal(ex); } }
                        Sql       = Sql.Replace("%prj_no%", My.Application.Prj_No);
                        SqlUpdate = dr["feature_update_sql"] + "";
                        Icon      = dr["feature_icon"] + "";
                        Descr     = dr["feature_descr"] + "";
                        if (SqlUpdate.Trim() == "")
                        {
                            SqlUpdate = Sql;
                        }
                        Name      = dr["feature_name"] + "";
                        FormType  = dr["feature_FormType"] + ""; //"Tracker.Forms.ucDataGrid";
                        isMDIList = false;
                        int i = 0, _cnn_id = 1; _cnn_id = int.Parse("0" + dr["cnn_id"]);
                        cnn_id     = _cnn_id;
                        i          = int.Parse("0" + dr["feature_ismdilist"] + "");
                        isMDIList  = i.Equals(1) ? true : false;
                        TargetType = 0; byte b = 0; b = byte.Parse("0" + dr["feature_targettype"]);
                        if (b > 0)
                        {
                            TargetType = b;
                        }
                        //TableName = dr["TableName"] + "";
                        //FeatureCode = dr["Feature_Code"] + "";
                        FeatureUrl = dr["FEATURE_URL"] + "";
                    }
                }
            }