/// <summary> /// 将DataReader的Column转换为ColumnInfo泛型列表 /// </summary> /// <param name="reader"></param> /// <returns></returns> private static ColumnInfo DataReader2ColumnInfo(IDataReader reader) { ColumnInfo columninfo = new ColumnInfo(); columninfo.Columnid = Convert.ToInt32(reader["columnid"]); columninfo.Columnname= reader["columnname"].ToString(); columninfo.Parentid = Convert.ToInt32(reader["parentid"]); return columninfo; }
protected void btnAddNewColumn_Click(object sender, EventArgs e) { ColumnInfo columninfo = new ColumnInfo(); columninfo.Columnname = tbxColumnname.Text.Trim(); columninfo.Parentid = Convert.ToInt32(dddlParentid.SelectedValue); Columns.CreateColumn(columninfo); lbMessage.Text = "��ӳɹ�!"; RemoveColumnListCache(); BindData(); }
public void EditColumn(ColumnInfo columninfo) { DbParameter[] prams = { DbHelper.MakeInParam("?columnname", (DbType)MySqlDbType.String, 100,columninfo.Columnname), DbHelper.MakeInParam("?columnid", (DbType)MySqlDbType.Int32, 4,columninfo.Columnid), DbHelper.MakeInParam("?parentid", (DbType)MySqlDbType.Int32, 4,columninfo.Parentid) }; DbHelper.ExecuteNonQuery(CommandType.Text, "UPDATE wy_columns SET columnname=?columnname,parentid=?parentid WHERE columnid=?columnid", prams); }
public void CreateColumn(ColumnInfo columninfo) { DbParameter[] prams = { //DbHelper.MakeInParam("?columnid", (DbType)MySqlDbType.Int32, 4,columninfo.Columnid), DbHelper.MakeInParam("?columnname", (DbType)MySqlDbType.String, 50,columninfo.Columnname), DbHelper.MakeInParam("?parentid", (DbType)MySqlDbType.Int32, 4,columninfo.Parentid) }; DbHelper.ExecuteNonQuery(CommandType.Text, "INSERT INTO wy_columns(columnname,parentid) VALUES(?columnname,?columnname)", prams); }
protected void gvColumnList_RowUpdating(object sender, GridViewUpdateEventArgs e) { ColumnInfo columninfo = new ColumnInfo(); columninfo.Columnid = Convert.ToInt32(gvColumnList.Rows[e.RowIndex].Cells[0].Text); columninfo.Columnname = ((TextBox)(gvColumnList.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim(); columninfo.Parentid = Convert.ToInt32((((TextBox)gvColumnList.Rows[e.RowIndex].Cells[2].Controls[0])).Text.Trim()); Columns.EditColumn(columninfo); lbMessage.Text = "���³ɹ�!"; gvColumnList.EditIndex = -1; RemoveColumnListCache(); BindData(); }
/// <summary> /// �༭��Ŀ /// </summary> /// <param name="columninfo"></param> public static void EditColumn(ColumnInfo columninfo) { DatabaseProvider.GetInstance().EditColumn(columninfo); }
/// <summary> /// �½���Ŀ /// </summary> /// <param name="columninfo"></param> public static void CreateColumn(ColumnInfo columninfo) { DatabaseProvider.GetInstance().CreateColumn(columninfo); }