public Rolepermission CreateRolepermission(Rolepermission info) { try { Management.BeginTransaction(); Management.CreateRolepermission(info); Management.Commit(); } catch { Management.Rollback(); throw; } return info; }
protected void BtnSave_Click(object sender, EventArgs e) { if (tvMenuItems.CheckedNodes.Count == 0) { UIHelper.Alert(this.UpdatePanel1, "请选择菜单项!"); return; } RolepermissionService.DeleteRolepermissionByRoleidMenuid(new List<string>(){Roleid},new List<string>()); for (int i = 0; i < tvMenuItems.CheckedNodes.Count; i++) { var currentInfo = new Rolepermission() { Roleid = Roleid, Lastmodifieddate = DateTime.Now, Remark = string.Empty }; if (WebContext.Current.CurrentUser != null) { currentInfo.Lastmodifiedby = WebContext.Current.CurrentUser.Username; } currentInfo.Menuid = tvMenuItems.CheckedNodes[i].Value; RolepermissionService.CreateRolepermission(currentInfo); } UIHelper.AlertMessageGoToURL(this.UpdatePanel1, "保存成功!", ResolveUrl("~/Admin/Role_List.aspx")); }
public Rolepermission CreateRolepermission(Rolepermission info) { try { string sqlCommand = @"INSERT INTO ""ROLEPERMISSION"" (""ROLEID"",""MENUID"",""REMARK"",""LASTMODIFIEDDATE"",""LASTMODIFIEDBY"",""RIGHTCODE"") VALUES (:Roleid,:Menuid,:Remark,:Lastmodifieddate,:Lastmodifiedby,:Rightcode)"; this.Database.AddInParameter(":Roleid", info.Roleid);//DBType:VARCHAR2 this.Database.AddInParameter(":Menuid", info.Menuid);//DBType:VARCHAR2 this.Database.AddInParameter(":Remark", info.Remark);//DBType:NVARCHAR2 this.Database.AddInParameter(":Lastmodifieddate", info.Lastmodifieddate);//DBType:DATE this.Database.AddInParameter(":Lastmodifiedby", info.Lastmodifiedby);//DBType:VARCHAR2 this.Database.AddInParameter(":Rightcode", info.Rightcode);//DBType:VARCHAR2 this.Database.ExecuteNonQuery(sqlCommand); } finally { this.Database.ClearParameter(); } return info; }
public Rolepermission UpdateRolepermissionByRoleidMenuid(Rolepermission info) { try { this.Database.AddInParameter(":Roleid", info.Roleid);//DBType:VARCHAR2 this.Database.AddInParameter(":Menuid", info.Menuid);//DBType:VARCHAR2 this.Database.AddInParameter(":Remark", info.Remark);//DBType:NVARCHAR2 this.Database.AddInParameter(":Lastmodifieddate", info.Lastmodifieddate);//DBType:DATE this.Database.AddInParameter(":Lastmodifiedby", info.Lastmodifiedby);//DBType:VARCHAR2 this.Database.AddInParameter(":Rightcode", info.Rightcode);//DBType:VARCHAR2 string sqlCommand = @"UPDATE ""ROLEPERMISSION"" SET ""REMARK""=:Remark , ""LASTMODIFIEDDATE""=:Lastmodifieddate , ""LASTMODIFIEDBY""=:Lastmodifiedby , ""RIGHTCODE""=:Rightcode WHERE ""ROLEID""=:Roleid AND ""MENUID""=:Menuid"; this.Database.ExecuteNonQuery(sqlCommand); } finally { this.Database.ClearParameter(); } return info; }
public Rolepermission UpdateRolepermissionByRoleidMenuid(Rolepermission info) { try { Management.BeginTransaction(); Management.UpdateRolepermissionByRoleidMenuid(info); Management.Commit(); } catch { Management.Rollback(); throw; } return info; }