public MenuInfo GetByClassName(string string_2, string string_3) { MenuInfo menuInfo = null; try { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); DataTable dataTable = dataAccessLayer.ExecuteDataTable(string.Concat(new string[] { "select * from ", this.string_0, " where COMPONENTDLLNAME='", string_2, "' and CLASSNAME='", string_3, "'" })); if (dataTable.Rows.Count > 0) { DataRow dataRow = dataTable.Rows[0]; menuInfo = new MenuInfo(); menuInfo.MenuID = System.Convert.ToString(dataRow["MenuID"]); menuInfo.NAME = System.Convert.ToString(dataRow["NAME"]); object arg_C4_0 = dataRow["ORDERBY"]; 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(); } catch { } return(menuInfo); }
public MenuInfo Load(string string_2) { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); DataTable table = dataAccessLayer.ExecuteDataTable("select * from " + this.string_0 + " where MenuID=" + string_2); MenuInfo info = null; if (table.Rows.Count > 0) { DataRow row = table.Rows[0]; info = new MenuInfo { MenuID = Convert.ToString(row["MenuID"]) }; object obj1 = row["NAME"]; info.NAME = Convert.ToString(row["NAME"]); info.ORDERBY = new int?(!(row["ORDERBY"] is DBNull) ? Convert.ToInt32(row["ORDERBY"]) : -1); info.PROGID = Convert.ToString(row["PROGID"]); info.SHORTCUT = Convert.ToString(row["SHORTCUT"]); info.SUBTYPE = new int?(!(row["SUBTYPE"] is DBNull) ? Convert.ToInt32(row["SUBTYPE"]) : -1); info.VISIBLE = new bool?(!(row["VISIBLE"] is DBNull) ? (Convert.ToInt32(row["VISIBLE"]) == 1) : true); info.ItemCol = new int?(!(row["ItemCol"] is DBNull) ? Convert.ToInt32(row["ItemCol"]) : -1); info.ISPOPMENUITEM = new bool?(!(row["ISPOPMENUITEM"] is DBNull) ? (Convert.ToInt32(row["ISPOPMENUITEM"]) == 1) : false); info.COMPONENTDLLNAME = Convert.ToString(row["COMPONENTDLLNAME"]); info.CLASSNAME = Convert.ToString(row["CLASSNAME"]); info.BEGINGROUP = new bool?(!(row["BEGINGROUP"] is DBNull) ? (Convert.ToInt32(row["BEGINGROUP"]) == 1) : false); info.CAPTION = Convert.ToString(row["CAPTION"]); info.PARENTIDS = Convert.ToString(row["PARENTIDS"]); } dataAccessLayer.Close(); return(info); }
public void Update(MenuInfo menuInfo_0) { string str = string.Format("update {0} set PARENTIDS='{1}' where MenuID={2}", this.string_0, string.IsNullOrEmpty(menuInfo_0.PARENTIDS) ? "NULL" : ("'" + menuInfo_0.PARENTIDS + "'"), menuInfo_0.MenuID); DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); dataAccessLayer.ExecuteNonQuery(CommandType.Text, str); dataAccessLayer.Close(); }
public int Add(MenuInfo menuInfo_0) { if (!this.IsExist(menuInfo_0)) { string str = 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, str); dataAccessLayer.Close(); } return(0); }
public void ClearAll() { try { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); dataAccessLayer.ExecuteNonQuery("delete from " + this.string_0, new object[0]); dataAccessLayer.Close(); } catch { } }
public System.Collections.Generic.List <MenuInfo> Load() { System.Collections.Generic.List <MenuInfo> list = new System.Collections.Generic.List <MenuInfo>(); try { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); DataTable dataTable = dataAccessLayer.ExecuteDataTable("select * from " + this.string_0); for (int i = 0; i < dataTable.Rows.Count; i++) { DataRow dataRow = dataTable.Rows[i]; MenuInfo menuInfo = new MenuInfo(); menuInfo.MenuID = System.Convert.ToString(dataRow["MenuID"]); menuInfo.NAME = System.Convert.ToString(dataRow["NAME"]); object arg_8E_0 = dataRow["ORDERBY"]; 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.PARENTIDS = System.Convert.ToString(dataRow["PARENTIDS"]); menuInfo.BEGINGROUP = new bool?(!(dataRow["BEGINGROUP"] is System.DBNull) && System.Convert.ToInt32(dataRow["BEGINGROUP"]) == 1); menuInfo.CAPTION = System.Convert.ToString(dataRow["CAPTION"]); list.Add(menuInfo); } dataAccessLayer.Close(); } catch { } return(list); }
private void btnTestConnection_Click(object sender, EventArgs e) { DataProviderType oleDb = DataProviderType.OleDb; string str = ""; if (this.radioGroup1.SelectedIndex == 0) { str = this.SQLTemplete.Replace("#SERVER#", this.txtServer.Text) .Replace("#USER#", this.txtUser.Text) .Replace("#PASSWORD#", this.txtPassword.Text) .Replace("#DATABASE#", this.txtDatabase.Text); oleDb = DataProviderType.Sql; } else if (this.radioGroup1.SelectedIndex == 1) { str = this.OraceleTemplete.Replace("#SERVER#", this.txtServer.Text) .Replace("#USER#", this.txtUser.Text) .Replace("#PASSWORD#", this.txtPassword.Text); oleDb = DataProviderType.OleDb; } else { str = this.OLETemplete.Replace("#DATABASE#", this.txtServer.Text); } if (str != "") { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(oleDb, str); try { try { if (dataAccessLayer.Open()) { MessageBox.Show("连接成功!"); dataAccessLayer.Close(); } } catch (Exception exception) { MessageBox.Show(exception.Message); } } finally { } } }
public string GetCodeByName(string string_8) { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer( DataProviderType.OleDb, this.ConnectionStr); string str = string.Format("select {0},{1} from {2} where {0}='{3}'", new object[] { this.NameFieldName, this.CodeFieldName, this.TableFieldName, string_8 }); dataAccessLayer.Open(); DataTable table = dataAccessLayer.ExecuteDataTable(str); if (table.Rows.Count > 0) { string_8 = table.Rows[0][this.CodeFieldName].ToString(); } dataAccessLayer.Close(); return(string_8); }
public NameValueCollection GetCodeDomain() { NameValueCollection values = new NameValueCollection(); DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer( DataProviderType.OleDb, this.ConnectionStr); string str = string.Format("select {0},{1} from {2}", this.NameFieldName, this.CodeFieldName, this.TableFieldName); dataAccessLayer.Open(); DataTable table = dataAccessLayer.ExecuteDataTable(str); for (int i = 0; i < table.Rows.Count; i++) { string name = table.Rows[i][this.NameFieldName].ToString().Trim(); string str3 = table.Rows[i][this.CodeFieldName].ToString().Trim(); values.Add(name, str3); } dataAccessLayer.Close(); return(values); }
public bool IsExist(MenuInfo menuInfo_0) { string str = ""; if (string.IsNullOrEmpty(menuInfo_0.PROGID)) { str = string.Format("select * from {0} where COMPONENTDLLNAME='{1}' and CLASSNAME='{2}'", this.string_0, menuInfo_0.COMPONENTDLLNAME, menuInfo_0.CLASSNAME); } else { str = 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 table = dataAccessLayer.ExecuteDataTable(str); dataAccessLayer.Close(); return(table.Rows.Count > 0); }
public List <MenuInfo> Load() { List <MenuInfo> list = new List <MenuInfo>(); try { DataAccessLayerBaseClass dataAccessLayer = DataAccessLayerFactory.GetDataAccessLayer(this.dataProviderType_0, this.string_1); dataAccessLayer.Open(); DataTable table = dataAccessLayer.ExecuteDataTable("select * from " + this.string_0); for (int i = 0; i < table.Rows.Count; i++) { DataRow row = table.Rows[i]; MenuInfo item = new MenuInfo { MenuID = Convert.ToString(row["MenuID"]), NAME = Convert.ToString(row["NAME"]) }; object obj1 = row["ORDERBY"]; item.ORDERBY = new int?(!(row["ORDERBY"] is DBNull) ? Convert.ToInt32(row["ORDERBY"]) : -1); item.PROGID = Convert.ToString(row["PROGID"]); item.SHORTCUT = Convert.ToString(row["SHORTCUT"]); item.SUBTYPE = new int?(!(row["SUBTYPE"] is DBNull) ? Convert.ToInt32(row["SUBTYPE"]) : -1); item.VISIBLE = new bool?(!(row["VISIBLE"] is DBNull) ? (Convert.ToInt32(row["VISIBLE"]) == 1) : true); item.ItemCol = new int?(!(row["ItemCol"] is DBNull) ? Convert.ToInt32(row["ItemCol"]) : -1); item.ISPOPMENUITEM = new bool?(!(row["ISPOPMENUITEM"] is DBNull) ? (Convert.ToInt32(row["ISPOPMENUITEM"]) == 1) : false); item.COMPONENTDLLNAME = Convert.ToString(row["COMPONENTDLLNAME"]); item.CLASSNAME = Convert.ToString(row["CLASSNAME"]); item.PARENTIDS = Convert.ToString(row["PARENTIDS"]); item.BEGINGROUP = new bool?(!(row["BEGINGROUP"] is DBNull) ? (Convert.ToInt32(row["BEGINGROUP"]) == 1) : false); item.CAPTION = Convert.ToString(row["CAPTION"]); list.Add(item); } dataAccessLayer.Close(); } catch { } return(list); }