public async Task <DataProviderVoidModel> CreateChecks(List <DealCheck> checks, string checkListId, string objectId) { var model = new DataProviderVoidModel(new ResultMessage(0, DataProvider.Models.MessageType.Information, "")); if (checks.Any()) { var listQuery = new List <Query>(); var queryIdentifier2 = Guid.NewGuid().ToString(); var query2 = new Query(queryIdentifier2, "UpsertCheckList"); query2.Parameters.Add(new QueryParameter("in", "CheckListName", "Лист проверок", SqlDbType.NVarChar)); query2.Parameters.Add(new QueryParameter("in", "CheckList_Id", checkListId, SqlDbType.Int)); query2.Parameters.Add(new QueryParameter("in", "Object_Id", objectId, SqlDbType.Int)); listQuery.Add(query2); foreach (var check in checks) { var queryIdentifier = Guid.NewGuid().ToString(); var query = new Query(queryIdentifier, "UpsertCheck"); query.ParentQueryGUID.Add(queryIdentifier2); query.Parameters.Add(new QueryParameter("in", "CheckType_Id", check.CheckTypeId, SqlDbType.Int)); query.Parameters.Add(new QueryParameter("in", "Task", check.Task, SqlDbType.NVarChar)); listQuery.Add(query); } var result = await _sessionQueryExecutor.Execute(listQuery).ConfigureAwait(false); model = new DataProviderVoidModel(result.ResultMessage); } return(model); }
public async Task <DataProviderVoidModel> UpdateObject(UpdateDealObject dealObject) { var queryIdentifier1 = Guid.NewGuid().ToString(); var query1 = new Query(queryIdentifier1, "UpsertUserObject"); query1.Parameters.Add(new QueryParameter("in", "ObjectCategory_Id", dealObject.ObjectCategoryId, SqlDbType.Int)); query1.Parameters.Add(new QueryParameter("in", "ObjectStatus_Id", dealObject.ObjectStatusId, SqlDbType.Int)); query1.Parameters.Add(new QueryParameter("in", "ObjectName", dealObject.ObjectName, SqlDbType.NVarChar)); query1.Parameters.Add(new QueryParameter("in", "Object_Id", dealObject.ObjectId, SqlDbType.Int)); if (!string.IsNullOrEmpty(dealObject.Description)) { query1.Parameters.Add(new QueryParameter("in", "Description", dealObject.Description, SqlDbType.NVarChar)); } var listQuery = new List <Query> { query1 }; var result = await _sessionQueryExecutor.Execute(listQuery).ConfigureAwait(false); var model = new DataProviderVoidModel(result.ResultMessage); return(model); }
public async Task <DataProviderVoidModel> DeleteObject(string objectId) { var queryIdentifier1 = Guid.NewGuid().ToString(); var query1 = new Query(queryIdentifier1, "DeleteUserObject"); query1.Parameters.Add(new QueryParameter("in", "Object_Id", objectId, SqlDbType.Int)); var listQuery = new List <Query> { query1 }; var result = await _sessionQueryExecutor.Execute(listQuery).ConfigureAwait(false); var model = new DataProviderVoidModel(result.ResultMessage); return(model); }