/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { GetAssignmentResponse response = new GetAssignmentResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Assignment", targetDepth)) { var unmarshaller = AssignmentUnmarshaller.Instance; response.Assignment = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("HIT", targetDepth)) { var unmarshaller = HITUnmarshaller.Instance; response.HIT = unmarshaller.Unmarshall(context); continue; } } return(response); }
public static GetAssignmentResponse GetAssignmentByProductID(GetAssignmentRequest request) { GetAssignmentResponse response = new GetAssignmentResponse(); response.AssignmentList = new List <Assignments>(); response.Error = new Handler.ErrorObject(); try { var bussines = AssignmentData.Select.GetAssignmentByProductID(request.ProductID); if (!bussines.Item1.Error) { foreach (var item in bussines.Item2) { response.AssignmentList.Add(new Assignments() { id = item.id, amount = item.amount, detail = item.detail, idCategory = item.idCategory, idEmployee = item.idEmployee, Min = item.min, Max = item.max, idProduct = item.idProduct, loan = item.loan, createDate = item.createDate, upDateDate = item.upDateDate, deleteDate = item.deleteDate, state = item.state }); } } else { response.Error.InfoError(bussines.Item1); } } catch (Exception ex) { response.Error.InfoError(ex); } return(response); }
private static GetAssignmentResponse Assignments(GetAssignmentResponse request) { GetAssignmentResponse response = new GetAssignmentResponse(); response.Error = new Handler.ErrorObject(); try { tblAssignment bussines = new tblAssignment() { id = request.Assignment.id, amount = request.Assignment.amount, loan = request.Assignment.loan, idProduct = request.Assignment.idProduct, idEmployee = request.Assignment.idEmployee, detail = request.Assignment.detail, max = request.Assignment.Max, min = request.Assignment.Min, idCategory = request.Assignment.idCategory, createDate = request.Assignment.createDate, upDateDate = null, deleteDate = null, state = "Active" }; var result = AssignmentData.Insert.Assignment(bussines); if (result.Item1.Error) { response.Error.InfoError(result.Item1); } else { response.Message = result.Item2.ToString(); } } catch (Exception ex) { response.Error.InfoError(ex); } return(response); }
public static GetAssignmentResponse Assignment(GetAssignmentResponse AssignmentInformation, GetAssignmentRequest request) { GetAssignmentResponse response = new GetAssignmentResponse(); response.Error = new Handler.ErrorObject(); try { request.AssignmentID = Convert.ToInt16(Assignments(AssignmentInformation).Message); var result = Transaction.TransactionConfigurateBussines.Insert.TransactionConfigurate(request.AssignmentID, request.TransactionTypeID, AssignmentInformation.transaction); #region Cellar Update CellarBussines.GetCellarRequest req = new CellarBussines.GetCellarRequest() { ProductID = (int)AssignmentInformation.Assignment.idProduct, CellarAreaID = (int)request.CellarArea }; var data = CellarBussines.Select.GetCellarDataByProductIDAndCellarArea(req).Cellar; int newAmountCellar = (int)data.amount - (int)AssignmentInformation.transaction.amount; CellarBussines.GetCellarRequest requestCellar = new CellarBussines.GetCellarRequest() { CellarID = data.id, amount = newAmountCellar }; CellarBussines.Update.CellarAmount(requestCellar); #endregion #region Condition Update TransactionConfigurateBussines.Insert.ConditionBackUpdate(1, data.id, (int)AssignmentInformation.transaction.idConditionProduct, (int)AssignmentInformation.transaction.amount); #endregion response.Message = result.Message.ToString(); } catch (Exception ex) { response.Error.InfoError(ex); } return(response); }
public static GetAssignmentResponse Assignments(GetAssignmentResponse request) { GetAssignmentResponse response = new GetAssignmentResponse(); try { tblAssignment bussines = new tblAssignment() { id = request.Assignment.id, amount = request.Assignment.amount, detail = request.Assignment.detail, idCategory = request.Assignment.idCategory, idEmployee = request.Assignment.idEmployee, idProduct = request.Assignment.idProduct, min = request.Assignment.Min, max = request.Assignment.Max, loan = request.Assignment.loan, createDate = request.Assignment.createDate, upDateDate = request.Assignment.upDateDate, deleteDate = request.Assignment.deleteDate, state = request.Assignment.state }; var result = AssignmentData.Update.Assignment(bussines); if (result.Item1.Error) { response.Error.InfoError(result.Item1); } else { response.Message = result.Item2; } } catch (Exception ex) { response.Error.InfoError(ex); } return(response); }
public static GetAssignmentResponse GetAssignmentByProductIDAndCategoryID(GetAssignmentWithConditionRequest request) { GetAssignmentResponse response = new GetAssignmentResponse(); response.Error = new Handler.ErrorObject(); response.Assignment = new Assignments(); try { var bussines = AssignmentData.Select.GetAssignmentByProductIDAndCategoryWithCondition(request.ProductID, request.CategoryID, request.ConditionID, request.TransactionTypeID); if (!bussines.Item1.Error) { response.Assignment = new Assignments() { id = bussines.Item2.id, amount = bussines.Item2.amount, detail = bussines.Item2.detail, idCategory = bussines.Item2.idCategory, idEmployee = bussines.Item2.idEmployee, Max = bussines.Item2.max, Min = bussines.Item2.min, idProduct = bussines.Item2.idProduct, loan = bussines.Item2.loan, createDate = bussines.Item2.createDate, upDateDate = bussines.Item2.upDateDate, deleteDate = bussines.Item2.deleteDate, state = bussines.Item2.state }; } else { response.Error.InfoError(bussines.Item1); } } catch (Exception ex) { response.Error.InfoError(ex); } return(response); }
public static GetAssignmentResponse AssignmentAmount(GetAssignmentRequest request) { GetAssignmentResponse response = new GetAssignmentResponse(); response.Error = new Handler.ErrorObject(); try { var result = AssignmentData.Update.AssignmentAmount(request.AssignmentID, request.amount); if (result.Item1.Error) { response.Error.InfoError(result.Item1); } else { response.Message = result.Item2; } } catch (Exception ex) { response.Error.InfoError(ex); } return(response); }