/// <summary> /// DataTable 转对象 /// </summary> /// <param name="sql"></param> /// <returns></returns> public static MakeCollectionsModes ConvertDataTableToModel(string sql) { error = string.Empty; DataTable dt = SqlHelper.GetTable(sql, ref error); DataRow dr = dt.Rows[0]; MakeCollectionsModes makecollectionsmode = new MakeCollectionsModes(); makecollectionsmode.Id = dr["Id"] == null ? "" : dr["Id"].ToString(); makecollectionsmode.MakeCollectionsMode = dr["MakeCollectionsMode"] == null ? "" : dr["MakeCollectionsMode"].ToString(); return(makecollectionsmode); }
private void LoadPage() { string sql = string.Empty; string error = string.Empty; if (ToolManager.CheckQueryString("Id")) { sql = string.Format(@" select * from MakeCollectionsMode where Id='{0}' ", ToolManager.GetQueryString("Id")); this.trNumber.Visible = false; //sql = string.Format(@" select * from MakeCollectionsMode where Id='{0}' ", "7"); MakeCollectionsModes makecollectionsmode = MakeCollectionsModeManager.ConvertDataTableToModel(sql); this.txtNumber.Text = makecollectionsmode.Id; this.txtMakeCollectionsMode.Text = makecollectionsmode.MakeCollectionsMode; btnSubmit.Text = "修改"; } else { btnSubmit.Text = "添加"; } }
/// <summary> /// 编辑收款方式 /// </summary> /// <param name="user"></param> /// <param name="error"></param> /// <returns></returns> public static bool EditMakeCollectionsMode(MakeCollectionsModes makecollectionsmode, ref string error) { sql = string.Format(@" update MakeCollectionsMode set MakeCollectionsMode='{0}' where Id='{1}'", makecollectionsmode.MakeCollectionsMode, makecollectionsmode.Id); return(SqlHelper.ExecuteSql(sql, ref error)); }