private bool CheckIfGUIDExists() { string[] payload = { UserGUID.ToString() }; DataTable output = _DB.GetData("SELECT * FROM Users WHERE GUID = @val1", payload).Tables[0]; if (output.Rows.Count != 0) { return(true); } return(false); }
public bool Create(TaskItem item) { item.ItemGUID = Guid.NewGuid().ToString(); string[] payload = { item.ItemGUID, UserGUID.ToString(), item.TaskName, item.TaskDescription, item.IsDone }; if (_DB.ExcecuteQuery("INSERT INTO `Tasks` (GUID, User, TaskName, TaskDescription, IsDone) VALUES(@val1, @val2, @val3, @val4, @val5)", payload)) { Tasks.Add(item); return(true); } return(false); }
public bool Update(TaskItem item) { var task_item = Tasks.FirstOrDefault(r => r.ItemGUID == item.ItemGUID); if (task_item != null) { string[] payload = { item.ItemGUID, UserGUID.ToString(), item.TaskName, item.TaskDescription, item.IsDone }; if (_DB.ExcecuteQuery("UPDATE `Tasks` SET User = @val2, TaskName = @val3, TaskDescription = @val4, IsDone = @val5 WHERE GUID = @val1", payload)) { task_item = item; return(true); } } return(false); }
private bool CreateNewUser(UserParameters data) { UserGUID = Guid.NewGuid(); while (CheckIfGUIDExists()) { UserGUID = Guid.NewGuid(); } FirstName = data.FirstName; LastName = data.LastName; Email = data.Email; Password = data.Password; UserTask = new TaskList(UserGUID); UserTask.Retrieve(); string[] payload = { UserGUID.ToString(), FirstName, LastName, Email, Password }; return(_DB.ExcecuteQuery("INSERT INTO `Users` (GUID, FirstName, LastName, Email, Password) VALUES(@val1, @val2, @val3, @val4, @val5)", payload)); }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "InfoPageID") { ret = true; if (InfoPageID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoPageGUID") { ret = true; if (InfoPageGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserID") { ret = true; if (UserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserGUID") { ret = true; if (UserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedUserID") { ret = true; if (CreatedUserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedUserGUID") { ret = true; if (CreatedUserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoPageName") { ret = true; if (InfoPageName.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoPageDescription") { ret = true; if (InfoPageDescription.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoCategoryID") { ret = true; if (InfoCategoryID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoCategoryGUID") { ret = true; if (InfoCategoryGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "AccessGroupID") { ret = true; if (AccessGroupID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "AccessGroupGUID") { ret = true; if (AccessGroupGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "AsyncLoading") { ret = true; if (AsyncLoading.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Commentable") { ret = true; if (Commentable.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CommentorRoleList") { ret = true; if (CommentorRoleList.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CommentorGroupList") { ret = true; if (CommentorGroupList.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CommentorHideRoleList") { ret = true; if (CommentorHideRoleList.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CommentorHideGroupList") { ret = true; if (CommentorHideGroupList.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "ExpiryDate") { ret = true; if (ExpiryDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsCommon") { ret = true; if (IsCommon.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsPublic") { ret = true; if (IsPublic.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDeleted") { ret = true; if (IsDeleted.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "DataID") { ret = true; if (DataID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataGUID") { ret = true; if (DataGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserID") { ret = true; if (UserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserGUID") { ret = true; if (UserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "ParentDataID") { ret = true; if (ParentDataID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "ParentDataGUID") { ret = true; if (ParentDataGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataTypeID") { ret = true; if (DataTypeID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataTypeGUID") { ret = true; if (DataTypeGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataValue") { ret = true; if (DataValue.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefTypeID") { ret = true; if (DataRefTypeID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefTypeGUID") { ret = true; if (DataRefTypeGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefID") { ret = true; if (DataRefID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDeleted") { ret = true; if (IsDeleted.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "InfoDetailID") { ret = true; if (InfoDetailID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoDetailGUID") { ret = true; if (InfoDetailGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserID") { ret = true; if (UserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserGUID") { ret = true; if (UserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoPageID") { ret = true; if (InfoPageID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoPageGUID") { ret = true; if (InfoPageGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoSectionID") { ret = true; if (InfoSectionID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoSectionGUID") { ret = true; if (InfoSectionGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoDetailName") { ret = true; if (InfoDetailName.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoDetailDescription") { ret = true; if (InfoDetailDescription.ToString() == columnValue) { valueMatched = true; } } if (columnName == "HideDetailName") { ret = true; if (HideDetailName.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDeleted") { ret = true; if (IsDeleted.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "InfoCategoryID") { ret = true; if (InfoCategoryID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoCategoryGUID") { ret = true; if (InfoCategoryGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoCategoryName") { ret = true; if (InfoCategoryName.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserID") { ret = true; if (UserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserGUID") { ret = true; if (UserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDefault") { ret = true; if (IsDefault.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsSystem") { ret = true; if (IsSystem.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }
public void Retrieve() { string[] payload = { UserGUID.ToString() }; ExtractFromDataSet(_DB.GetData("SELECT * FROM `Tasks` WHERE User = @val1", payload)); }