Example #1
0
        public MenuInfo GetByName(string string_2)
        {
            DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(
                this.dataProviderType_0, this.string_1);

            dataAccessLayer.Open();
            DataTable dataTable =
                dataAccessLayer.ExecuteDataTable("select * from " + this.string_0 + " where NAME=" + string_2);
            MenuInfo menuInfo = null;

            if (dataTable.Rows.Count > 0)
            {
                DataRow dataRow = dataTable.Rows[0];
                menuInfo        = new MenuInfo();
                menuInfo.MenuID = System.Convert.ToString(dataRow["MenuID"]);
                object arg_82_0 = dataRow["NAME"];
                menuInfo.NAME    = System.Convert.ToString(dataRow["NAME"]);
                menuInfo.ORDERBY =
                    new int?((!(dataRow["ORDERBY"] is System.DBNull)) ? System.Convert.ToInt32(dataRow["ORDERBY"]) : -1);
                menuInfo.PROGID   = System.Convert.ToString(dataRow["PROGID"]);
                menuInfo.SHORTCUT = System.Convert.ToString(dataRow["SHORTCUT"]);
                menuInfo.SUBTYPE  =
                    new int?((!(dataRow["SUBTYPE"] is System.DBNull)) ? System.Convert.ToInt32(dataRow["SUBTYPE"]) : -1);
                menuInfo.VISIBLE =
                    new bool?(dataRow["VISIBLE"] is System.DBNull || System.Convert.ToInt32(dataRow["VISIBLE"]) == 1);
                menuInfo.ItemCol =
                    new int?((!(dataRow["ItemCol"] is System.DBNull)) ? System.Convert.ToInt32(dataRow["ItemCol"]) : -1);
                menuInfo.ISPOPMENUITEM =
                    new bool?(!(dataRow["ISPOPMENUITEM"] is System.DBNull) &&
                              System.Convert.ToInt32(dataRow["ISPOPMENUITEM"]) == 1);
                menuInfo.COMPONENTDLLNAME = System.Convert.ToString(dataRow["COMPONENTDLLNAME"]);
                menuInfo.CLASSNAME        = System.Convert.ToString(dataRow["CLASSNAME"]);
                menuInfo.BEGINGROUP       =
                    new bool?(!(dataRow["BEGINGROUP"] is System.DBNull) &&
                              System.Convert.ToInt32(dataRow["BEGINGROUP"]) == 1);
                menuInfo.CAPTION   = System.Convert.ToString(dataRow["CAPTION"]);
                menuInfo.PARENTIDS = System.Convert.ToString(dataRow["PARENTIDS"]);
            }
            dataAccessLayer.Close();
            return(menuInfo);
        }
Example #2
0
        public int Add(MenuInfo menuInfo_0)
        {
            int result;

            if (this.IsExist(menuInfo_0))
            {
                result = 0;
            }
            else
            {
                string string_ =
                    string.Format(
                        "insert into {0}([NAME],PARENTIDS,ORDERBY,[PROGID],[SHORTCUT],SUBTYPE,VISIBLE,ItemCol,ISPOPMENUITEM,COMPONENTDLLNAME,CLASSNAME,BEGINGROUP,CAPTION) values({1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13})",
                        new object[]
                {
                    this.string_0,
                    string.IsNullOrEmpty(menuInfo_0.NAME) ? "NULL" : ("'" + menuInfo_0.NAME + "'"),
                    string.IsNullOrEmpty(menuInfo_0.PARENTIDS) ? "NULL" : ("'" + menuInfo_0.PARENTIDS + "'"),
                    menuInfo_0.ORDERBY.HasValue ? menuInfo_0.ORDERBY.Value.ToString() : "NULL",
                    string.IsNullOrEmpty(menuInfo_0.PROGID) ? "NULL" : ("'" + menuInfo_0.PROGID + "'"),
                    string.IsNullOrEmpty(menuInfo_0.SHORTCUT) ? "NULL" : ("'" + menuInfo_0.SHORTCUT + "'"),
                    menuInfo_0.SUBTYPE.HasValue ? menuInfo_0.SUBTYPE.Value.ToString() : "NULL",
                    menuInfo_0.VISIBLE.HasValue ? (menuInfo_0.VISIBLE.Value ? "1" : "0") : "NULL",
                    menuInfo_0.ItemCol.HasValue ? menuInfo_0.ItemCol.Value.ToString() : "NULL",
                    menuInfo_0.ISPOPMENUITEM.HasValue ? (menuInfo_0.ISPOPMENUITEM.Value ? "1" : "0") : "NULL",
                    string.IsNullOrEmpty(menuInfo_0.COMPONENTDLLNAME)
                                ? "NULL"
                                : ("'" + menuInfo_0.COMPONENTDLLNAME + "'"),
                    string.IsNullOrEmpty(menuInfo_0.CLASSNAME) ? "NULL" : ("'" + menuInfo_0.CLASSNAME + "'"),
                    menuInfo_0.BEGINGROUP.HasValue ? (menuInfo_0.BEGINGROUP.Value ? "1" : "0") : "NULL",
                    string.IsNullOrEmpty(menuInfo_0.CAPTION) ? "NULL" : ("'" + menuInfo_0.CAPTION + "'")
                });
                DataAccessLayerBaseClass dataAccessLayer =
                    DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1);
                dataAccessLayer.Open();
                dataAccessLayer.ExecuteNonQuery(CommandType.Text, string_);
                dataAccessLayer.Close();
                result = 0;
            }
            return(result);
        }
Example #3
0
        public bool IsExist(MenuInfo menuInfo_0)
        {
            string string_;

            if (string.IsNullOrEmpty(menuInfo_0.PROGID))
            {
                string_ = string.Format("select * from {0} where  COMPONENTDLLNAME='{1}' and CLASSNAME='{2}'",
                                        this.string_0, menuInfo_0.COMPONENTDLLNAME, menuInfo_0.CLASSNAME);
            }
            else
            {
                string_ = string.Format("select * from {0} where  PROGID='{1}' ", this.string_0, menuInfo_0.PROGID);
            }
            DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(
                this.dataProviderType_0, this.string_1);

            dataAccessLayer.Open();
            DataTable dataTable = dataAccessLayer.ExecuteDataTable(string_);

            dataAccessLayer.Close();
            return(dataTable.Rows.Count > 0);
        }