public static string Add(string id, string right_id, string role_id, string desc) { RightInfo model = new RightInfo(); model.Id = id; model.Right_Id = right_id; model.Role_Id = role_id; model.Description = desc; bool successs = RightBLL.Add(model); StringBuilder json = new StringBuilder(); json.Append("[{"); json.Append("\"success\":\"" + successs + "\""); json.Append("}]"); return json.ToString(); }
public bool Add(RightInfo model) { StringBuilder sql = new StringBuilder(); sql.Append("insert into BigDog_Admin_Right(Id,Right_Id,Role_Id,Description) values(@Id,@Right_Id,@Role_Id,@desc)"); SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@Id",SqlDbType.NVarChar,50), new SqlParameter("@Right_Id",SqlDbType.NVarChar,50), new SqlParameter("@Role_Id",SqlDbType.NVarChar,200), new SqlParameter("@desc",SqlDbType.NVarChar,200) }; parms[0].Value = model.Id; parms[1].Value = model.Right_Id; parms[2].Value = model.Role_Id; parms[3].Value = model.Description; return SQLHelper.ExecuteNonQuery(CommandType.Text, sql.ToString(), parms) > 0; }
public RightInfo GetById(string id) { StringBuilder sql = new StringBuilder(); sql.Append("select Id,Right_Id,Role_Id,Description from BigDog_Admin_Right where Id=@Id"); SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@Id",SqlDbType.Int) }; parms[0].Value = id; RightInfo model = new RightInfo(); DataTable dt = SQLHelper.GetDs(sql.ToString(), parms).Tables[0]; if (dt.Rows.Count > 0) { model.Id = dt.Rows[0]["Id"].ToString(); model.Right_Id = dt.Rows[0]["Right_Id"].ToString(); model.Role_Id = dt.Rows[0]["Role_Id"].ToString(); model.Description = dt.Rows[0]["Description"].ToString(); return model; } return null; }
public static string Update(string u_id, string u_right_id, string u_role_id, string u_desc) { RightInfo model = new RightInfo(); model.Id = u_id; model.Right_Id = u_right_id; model.Role_Id = u_role_id; model.Description = u_desc; bool success = RightBLL.Update(model); StringBuilder json = new StringBuilder(); json.Append("[{"); json.Append("\"success\":\"" + success + "\""); json.Append("}]"); return json.ToString(); }
public static bool Update(RightInfo model) { return Dal.Update(model); }
public static bool Add(RightInfo model) { return Dal.Add(model); }
public bool Update(RightInfo model) { StringBuilder sql = new StringBuilder(); sql.Append("update BigDog_Admin_Right set Right_Id=@Right_Id,Role_Id=@Role_Id,Description=@Description where Id=@id"); SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@Right_Id",SqlDbType.NVarChar,50), new SqlParameter("@Role_Id",SqlDbType.NVarChar,200), new SqlParameter("@Description",SqlDbType.NVarChar,50), new SqlParameter("@Id",SqlDbType.NVarChar,50) }; parms[0].Value = model.Right_Id; parms[1].Value = model.Role_Id; parms[2].Value = model.Description; parms[3].Value = model.Id; return SQLHelper.ExecuteNonQuery(CommandType.Text, sql.ToString(), parms) > 0; }