/// <summary> /// Deletes a customField /// </summary> /// <param name="id">CustomField Id</param> /// <param name="tablename">Name of the table were the customField belongs</param> /// <author>Galaviz Alejos Luis Angel</author> public void DeleteField(string id, string tablename) { String dataPermissions = Session["Permissions"].ToString(); String dataPermissionsClient = Session["PermissionsClient"].ToString(); bool access = false; bool accessClient = false; // access = getpermissions("users", "r"); access = validatepermissions.getpermissions("custom_fields", "d", dataPermissions); accessClient = validatepermissions.getpermissions("custom_fields", "d", dataPermissionsClient); if (access == true && accessClient == true) { CustomFieldsTable cft = new CustomFieldsTable("MovementFields"); cft.deleteRows(id); } }
/// <summary> /// This method allows to delete several customfields from the db /// </summary> /// <param name="array"> /// It's an array of customs fields ids /// </param> /// <author> /// Luis Gonzalo Quijada Romero /// </author> /// <returns> /// Returns a message string /// </returns> public String deleteFields(List <String> array, string tablename) { String dataPermissions = Session["Permissions"].ToString(); String dataPermissionsClient = Session["PermissionsClient"].ToString(); bool access = false; bool accessClient = false; // access = getpermissions("users", "r"); access = validatepermissions.getpermissions("custom_fields", "r", dataPermissions); accessClient = validatepermissions.getpermissions("custom_fields", "r", dataPermissionsClient); if (access == true && accessClient == true) { CustomFieldsTable cft = new CustomFieldsTable(tablename); if (this.Request.IsAjaxRequest()) //only available with AJAX { try //tryign to delete the fields { if (array.Count == 0) { return(null); //if array is empty there are no fields to delete } foreach (String id in array) //froeach id in the array we must delete the document with that id from the db { cft.deleteRows(id); } return("Borrado"); } catch (Exception e) { return(null); } } return(null); } else { return(null); } }