예제 #1
0
        public IActionResult PostExpense(string expenseType, double totalAmount, string description)
        {
            if (expenseType == null || expenseType == "undefined")
            {
                return(Json(new { success = false, message = "Expense is empty" }));
            }
            try
            {
                var claimIntetity = (ClaimsIdentity)User.Identity;
                var claim         = claimIntetity.FindFirst(ClaimTypes.NameIdentifier);



                CurrentMovement currentMovement = new CurrentMovement()
                {
                    //AccountingBookId
                    CurrentDate  = DateTime.Now,
                    Description  = description,
                    IsInflow     = false,
                    MovementType = expenseType,
                    Sum          = totalAmount,
                    UserId       = claim.Value,
                    Cleared      = false
                };
                _unitOfWork.CurrentMovement.Add(currentMovement);
                _unitOfWork.Save();
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }));
            }
            return(Json(new { success = true, message = "Refunded successfully" }));
        }
 void IUnitBehaviour.DoUpdate(int deltaTime)
 {
     if (!CurrentMovement.Update(unit, deltaTime))
     {
         ResetCurrentMovement();
     }
 }
예제 #3
0
        public IActionResult ClearCashDesk(CurrentMovementViewModel currentMovementVM)
        {
            if (currentMovementVM == null)
            {
                return(Json(new { success = false, data = "Empty data" }));
            }
            try
            {
                var claimIntetity = (ClaimsIdentity)User.Identity;
                var claim         = claimIntetity.FindFirst(ClaimTypes.NameIdentifier);

                AccountingBook accountingBook = new AccountingBook
                {
                    AccountingDate = DateTime.Now,
                    CashLeft       = currentMovementVM.cashLeft,
                    InFlowSum      = currentMovementVM.totalInflow,
                    OutFlowSum     = currentMovementVM.totalOutflow,
                    UserId         = claim.Value
                };

                _unitOfWork.AccountingBook.Add(accountingBook);
                _unitOfWork.Save();

                _unitOfWork.CurrentMovement.setAccountingBookId(accountingBook.Id);



                CurrentMovement currentMovement = new CurrentMovement()
                {
                    //AccountingBookId
                    CurrentDate  = DateTime.Now,
                    Description  = "After Cleared",
                    IsInflow     = true,
                    MovementType = CashDeskStaticValues.StaticValues().FirstOrDefault(u => u.Key == "CashDeskClearInFlow").Key,
                    Sum          = currentMovementVM.cashLeft,
                    UserId       = claim.Value,
                    Cleared      = false,
                };

                _unitOfWork.CurrentMovement.Add(currentMovement);


                _unitOfWork.Save();

                return(RedirectToAction("ClearingCashDesk"));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, data = ex.Message }));
            }
        }
        /// <summary>
        /// Decides on the next movement. Here we use the state sequence.
        /// </summary>
        override protected void DecideOnNextMovement()
        {
            // If DEAD do nothing
            if (State == EnemyState.DEAD)
            {
                return;
            }
            // If DAMAGED do nothing
            if (State == EnemyState.DAMAGED)
            {
                return;
            }

            // Check for phase exit
            if (willExitPhase || CheckPhaseExitCondition(phaseInfo [currentPhase]))
            {
                willExitPhase = true;
                if (!CurrentMovement.LosingControl())
                {
                    ChangePhase(currentPhase + 1, 0);
                }
                return;
            }

            // Should we exit this state
            if (willExitState || CheckStateExitCondition(phaseInfo[currentPhase].stateInfo[currentState]))
            {
                willExitState = true;
                if (!CurrentMovement.LosingControl())
                {
                    // Advance to next state
                    ChangeState(currentState + 1);
                }
            }

            // Check for phase exit again
            if (willExitPhase || CheckPhaseExitCondition(phaseInfo [currentPhase]))
            {
                willExitPhase = true;
                if (!CurrentMovement.LosingControl())
                {
                    ChangePhase(currentPhase + 1, 0);
                }
                return;
            }
        }
예제 #5
0
 public Particle Lerp(Particle other, float interpolation)
 {
     return(new Particle
     {
         Position = Position.Lerp(other.Position, interpolation),
         Acceleration = Acceleration.Lerp(other.Acceleration, interpolation),
         Rotation = Rotation.Lerp(other.Rotation, interpolation),
         CurrentMovement = CurrentMovement.Lerp(other.CurrentMovement, interpolation),
         ElapsedTime = ElapsedTime.Lerp(other.ElapsedTime, interpolation),
         Size = Size.Lerp(other.Size, interpolation),
         Color = Color.Lerp(other.Color, interpolation),
         IsActive = IsActive && other.IsActive && ElapsedTime < other.ElapsedTime,
         CurrentUV = other.CurrentUV,
         Material = other.Material,
         CurrentFrame = other.CurrentFrame,
     });
 }
예제 #6
0
        private void Update()
        {
            bool isPlayingChoreography = TimelineViewBehaviour.Instance != null && TimelineViewBehaviour.Instance.IsPlayingState;

            if (!isPlayingChoreography)
            {
                // Convenience hot key for pointing camera to origin, for better Haxxis usability while editing (but not during a camera sequence as in choreography)
                if (Input.GetButtonDown("Point camera to origin") && HaxxisGlobalSettings.Instance.IsVgsJob == false)
                {
                    MainCamera.transform.LookAt(Vector3.zero);
                }
            }
            else
            {
                if (CurrentMovement != null)
                {
                    do
                    {
                        SwitchingMovements = false;
                        CameraParent.transform.position = CurrentMovement.MovementUpdate(PriorPoint, CurrentPoint, NextPoint, Time.time);
                    } while (SwitchingMovements);
                }


                if (CurrentLookMovement != null)
                {
                    do
                    {
                        SwitchingLookMovements             = false;
                        CameraLookPoint.transform.position = CurrentLookMovement.MovementUpdate(PriorLookPoint,
                                                                                                CurrentLookPoint, NextLookPoint, Time.time);
                    } while (SwitchingLookMovements);
                }
                UpdateCameraLook();
            }
        }
예제 #7
0
        public IActionResult LocalSaleSubmitted(string postOrderString, string[] postOrderDetailList)
        {
            var userName      = User.Identity.Name;
            var claimIntetity = (ClaimsIdentity)User.Identity;
            var claim         = claimIntetity.FindFirst(ClaimTypes.NameIdentifier);


            if (postOrderString == null)
            {
                return(Json(new { success = false, message = "empty content" }));
            }

            int headerId = -1;

            try
            {
                string[]    orderHeadeArray = postOrderString.Split(new char[] { ',' });
                string      FullName        = orderHeadeArray[0];
                string      Adress          = orderHeadeArray[1];
                string      TelNo           = orderHeadeArray[2];
                string      Comment         = orderHeadeArray[3];
                double      TotalAmount     = Convert.ToDouble(orderHeadeArray[4].Trim());
                OrderHeader header          = new OrderHeader()
                {
                    Adress        = Adress,
                    Comment       = Comment,
                    FullName      = FullName,
                    OrderDate     = DateTime.Now,
                    PaymentStatus = StaticValue.LocalSaleProcess,
                    PhoneNumber   = TelNo,
                    PickUpDate    = DateTime.Now,
                    Status        = StaticValue.LocalSaleProcess,
                    TotalAmount   = TotalAmount
                };

                _unitOfWork.OrderHeader.Add(header);



                CurrentMovement currentMovement = new CurrentMovement()
                {
                    //AccountingBookId
                    CurrentDate  = DateTime.Now,
                    Description  = Utility.StaticValues.Accounting.LocalSale,
                    IsInflow     = true,
                    MovementType = Utility.StaticValues.Accounting.LocalSale,
                    Sum          = TotalAmount,
                    UserId       = claim.Value,
                    Cleared      = false,
                };

                _unitOfWork.CurrentMovement.Add(currentMovement);

                _unitOfWork.Save();

                foreach (var orderItem in postOrderDetailList)
                {
                    string[]    orderDetailArray = orderItem.Split(new char[] { ',' });
                    var         productId        = Convert.ToInt32(orderDetailArray[3]);
                    var         quantity         = Convert.ToInt32(orderDetailArray[0]);
                    var         price            = Convert.ToDouble(orderDetailArray[1]);
                    OrderDetail orderDetail      = new OrderDetail()
                    {
                        Count         = quantity,
                        OrderHeaderId = header.Id,
                        Price         = price,
                        ProductName   = orderDetailArray[2],
                        ProductId     = productId
                    };



                    _unitOfWork.OrderDetails.Add(orderDetail);
                    _unitOfWork.Product.MinusStockQuantity(productId, quantity);


                    headerId = header.Id;
                }
                _unitOfWork.Save();
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }));
            }



            return(Json(new { success = true, message = headerId }));
        }
예제 #8
0
        //array gelmesini denemem lazim. Specific item adi ile cagirmagla

        public IActionResult SubmitRefund(string postRefundHeaderString, string[] postRefundDetail)
        {
            if (postRefundHeaderString == null)
            {
                return(Json(new { success = false, message = "Refund is empty" }));
            }
            try
            {
                var claimIntetity = (ClaimsIdentity)User.Identity;
                var claim         = claimIntetity.FindFirst(ClaimTypes.NameIdentifier);

                string[] refundHeaderArr = postRefundHeaderString.Split(new char[] { ',' });

                double       totalAmount  = Convert.ToDouble(refundHeaderArr[1]);
                RefundHeader refundHeader = new RefundHeader()
                {
                    OrderHeaderId = Convert.ToInt32(refundHeaderArr[0]),
                    TotalAmount   = totalAmount,
                    Comment       = refundHeaderArr[2],
                    RefundDate    = DateTime.Now
                };

                _unitOfWork.RefundHeader.Add(refundHeader);


                CurrentMovement currentMovement = new CurrentMovement()
                {
                    //AccountingBookId
                    CurrentDate  = DateTime.Now,
                    Description  = Utility.StaticValues.Accounting.Refund,
                    IsInflow     = false,
                    MovementType = (string)CashDeskStaticValues.StaticValues().FirstOrDefault(u => u.Key == "Refund").Key,  //bUnu yeni elave etdim test etmedim
                    Sum          = totalAmount,
                    UserId       = claim.Value,
                    Cleared      = false,
                };

                _unitOfWork.CurrentMovement.Add(currentMovement);

                _unitOfWork.Save();



                foreach (var item in postRefundDetail)
                {
                    string[]     detailArr    = item.Split(new char[] { ',' });
                    int          productId    = Convert.ToInt32(detailArr[0]);
                    int          quantity     = Convert.ToInt32(detailArr[2]);
                    RefundDetail refundDetail = new RefundDetail()
                    {
                        RefundHeaderId = refundHeader.Id,
                        ProductId      = productId,
                        Price          = Convert.ToDouble(detailArr[1]),
                        Count          = quantity
                    };

                    _unitOfWork.RefundDetail.Add(refundDetail);
                    _unitOfWork.Product.AddStockQuantity(productId, quantity);
                }

                _unitOfWork.Save();
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }));
            }

            return(Json(new { success = true, message = "Refunded successfully" }));
        }