Exemple #1
0
        public ActionResult CellarDetail(int AnchorTransactionID, int TransactionTypeID)
        {
            ViewBag.Title   = "Detail Product Assignation";
            ViewBag.Message = "";

            CellarBussines.GetCellarRequest request = new CellarBussines.GetCellarRequest()
            {
                CellarID = AnchorTransactionID,
            };
            TransactionConfigurateBussines.GetTransactionConfigurateRequest requestTransaction = new TransactionConfigurateBussines.GetTransactionConfigurateRequest()
            {
                AnchorTransactionID = AnchorTransactionID,
                TransactionTypeID   = TransactionTypeID
            };

            CellarBussines.GetCellarResponse c = CellarBussines.Select.GetCellar(request);
            int to = TransactionConfigurateBussines.Select.GetTotalAmountToTransaction(requestTransaction).TotalAmount;

            request.ProductID = (int)c.Cellar.idProduct;
            var model = new CellarViewModels()
            {
                Error                = c.Error,
                total                = to,
                Cellar               = c.Cellar,
                Transaction          = new Transactions(),
                TransactionList      = TransactionConfigurateBussines.Select.GetTransactionList(requestTransaction).TransactionList,
                ProductList          = ProductBussines.Select.GetProduct().ProductList,
                CellarAreaList       = CellarAreaBussines.Select.GetCellarAreaList().CellarAreaList,
                CellarList           = CellarBussines.Select.GetCellarByProductID(request).CellarList,
                ProviderList         = ProviderBussines.Select.GetProviderList().ProviderList,
                ConditionProductList = ConditionProductBussines.Select.GetConditionProductList().ConditionProductList
            };

            return(PartialView(model));
        }
Exemple #2
0
        public ActionResult CellarUpdate(int id)
        {
            CellarBussines.GetCellarRequest request = new CellarBussines.GetCellarRequest()
            {
                CellarID = id,
            };
            CellarBussines.GetCellarResponse c = CellarBussines.Select.GetCellar(request);
            request.ProductID = (int)c.Cellar.idProduct;
            ProductBussines.GetProductRequest request2 = new ProductBussines.GetProductRequest()
            {
                ProductID = (int)c.Cellar.idProduct
            };
            var model = new CellarViewModels()
            {
                Error                = c.Error,
                Cellar               = c.Cellar,
                CellarAreaList       = CellarAreaBussines.Select.GetCellarAreaList().CellarAreaList,
                ConditionProductList = ConditionProductBussines.Select.GetConditionProductList().ConditionProductList
            };

            ViewBag.Title   = "Update Product Assignation To " + ProductBussines.Select.GetProduct(request2).Product.name;
            ViewBag.Message = "";

            return(PartialView(model));
        }
        public JsonResult ActualAmountByAssignment(int ProductID, int CellarArea, int condition, int transactionType)
        {
            CellarBussines.GetCellarRequest request = new CellarBussines.GetCellarRequest()
            {
                ProductID         = ProductID,
                CellarAreaID      = CellarArea,
                conditionID       = condition,
                TransactionTypeID = transactionType
            };

            var cellarInformation = CellarBussines.Select.GetCellarByProductIDAndCellarArea(request).Cellar;

            TransactionTypeConditionDetailBussines.GetTransactionTypeConditionDetailRequest requestCondition = new TransactionTypeConditionDetailBussines.GetTransactionTypeConditionDetailRequest()
            {
                ConditionID       = condition,
                TransactionTypeID = 1,
                TransactionID     = cellarInformation.id
            };

            return(Json(
                       new {
                AmountTotal = cellarInformation.amount,
                AmountCondition = TransactionTypeConditionDetailBussines.Select.GetTransactionTypeConditionDetail(requestCondition).TransactionTypeConditionDetail.amount
//                    ActualAmount = CellarBussines.Select.GetCellarByProductIDAndCellarArea(request).Cellar.amount
            },
                       JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public ActionResult CellarCreate(CellarViewModels data)
        {
            CellarBussines.GetCellarResponse CellarInformation = new CellarBussines.GetCellarResponse()
            {
                Cellar      = data.Cellar,
                transaction = data.Transaction
            };
            CellarInformation.Cellar.amount     = data.Transaction.amount;
            CellarInformation.Cellar.createDate = data.Transaction.createDate;
            CellarBussines.GetCellarRequest request = new CellarBussines.GetCellarRequest()
            {
                TransactionTypeID = 1
            };
            CellarBussines.Insert.Cellar(CellarInformation, request);

            return(RedirectToAction("CellarView", new { successful = true, ResultAction = "All Changes was successful" }));
        }
            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);
            }
Exemple #6
0
        public ActionResult CellarNewCellar(CellarViewModels data)
        {
            CellarBussines.GetCellarRequest request = new CellarBussines.GetCellarRequest()
            {
                CellarID          = data.Cellar.id,
                TransactionTypeID = 1
            };
            CellarBussines.GetCellarResponse cellarInformation = new CellarBussines.GetCellarResponse();
            cellarInformation.transaction = data.Transaction;

            int oldAmount     = (int)CellarBussines.Select.GetCellar(request).Cellar.amount;
            int currentAmount = (int)data.Transaction.amount;
            int newAmount     = oldAmount + currentAmount;

            request.amount = newAmount;

            cellarInformation.Cellar = new Cellars
            {
                id     = data.Cellar.id,
                amount = newAmount
            };
            CellarBussines.Update.Cellar(cellarInformation, request);
            return(RedirectToAction("CellarView", new { successful = true, ResultAction = "All Changes was successful" }));
        }