public static bool UpdateData(string editModelId, string editModelName, string editColName, string editValue, string colType) { DB.BLL.Person bllPerson = new DB.BLL.Person(); int id; if (editModelId != null && editModelId.Trim() != "") { id = int.Parse(editModelId); } else { return(false); } editColName = editColName.TrimStart('_'); if (editColName.ToLower().Equals("username")) { bool result = bllPerson.Exists(id, editColName, editValue); if (result == true) { return(false); } if (string.IsNullOrEmpty(editValue.Trim())) { return(false); } } else if (editColName.ToLower().Equals("names")) { bool result = bllPerson.Exists(id, editColName, editValue); if (result == true) { return(false); } if (string.IsNullOrEmpty(editValue.Trim())) { return(false); } } if (colType.Equals("password")) { editValue = DESEncrypt.Encrypt(editValue); } if (editColName.ToLower().Equals("privilege")) { string val = string.Empty; switch (editValue) { case "1": val = "2"; break; case "2": val = "1"; break; case "3": val = "3"; break; } return(bllPerson.Update(id, editColName, editValue) && bllPerson.Update(id, "Roles", val)); } else { return(bllPerson.Update(id, editColName, editValue)); } }