예제 #1
0
        protected void KnockOffTransaction(object sender, EventArgs e)
        {
            List <Entities.Billing.KnockOff> transactions = new List <Entities.Billing.KnockOff>();
            int voucherId = Convert.ToInt32(ddlKOVoucher.SelectedValue);

            CurrentSession session = CurrentSession.Current;

            foreach (GridViewRow gridRow in this.gridKO.Rows)
            {
                if (gridRow.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chk = gridRow.FindControl("chkBxItem") as CheckBox;
                    if (chk != null && chk.Checked && chk.Enabled)
                    {
                        int   transactionId  = int.Parse(gridKO.DataKeys[gridRow.RowIndex].Values["TransactionId"].ToString());
                        int   paymentTypeId  = int.Parse(gridKO.DataKeys[gridRow.RowIndex].Values["PaymentTypeId"].ToString());
                        Label labelTranTotal = gridRow.FindControl("labeltranTotal") as Label;

                        TextBox        textBox    = gridRow.FindControl("txtKOAmt") as TextBox;
                        RangeValidator rgKOAmount = gridRow.FindControl("rgKOAmount") as RangeValidator;

                        if (textBox != null && textBox.Text != "" && Convert.ToDouble(textBox.Text.Trim()) > 0.0D && rgKOAmount.IsValid)
                        {
                            double   KOAmt    = Convert.ToDouble(textBox.Text.Trim());
                            KnockOff knockOff = new KnockOff()
                            {
                                Id                = 0,
                                TransactionId     = transactionId,
                                UserId            = session.User.Id,
                                PaymentTypeId     = paymentTypeId,
                                KnockOffAmount    = KOAmt,
                                TransactionAmount = Convert.ToDouble(labelTranTotal.Text.Trim()),
                                DeleteFlag        = false,
                                Description       = ""
                            };
                            transactions.Add(knockOff);
                        }
                    }
                }
                ;
            }
            KnockOffServices servicesKO = new KnockOffServices();

            KnockOffServices.ResponseCode responseCode = servicesKO.KnockOffTransaction(session, voucherId, transactions);

            if (responseCode == KnockOffServices.ResponseCode.Ok)
            {
                IQCareMsgBox.NotifyAction("Knock off for the selected* transaction succeeded", "Knock Operation Success", false, this, "");
            }
            else if (responseCode == KnockOffServices.ResponseCode.BadRequest)
            {
                IQCareMsgBox.NotifyAction("Knock off for the selected* transaction failed", "Bad Request", true, this, "");
            }
            this.GetContextTabData(TabContainer1.ActiveTabIndex);
        }
    public void OnImpact(KnockOff impact)
    {
        if (_playerMovementFSM.CurrentState.GetType().Equals(typeof(MovementKnockOffState)))
        {
            return;
        }
        _playerMovementFSM.TransitionTo <MovementKnockOffState>();
        Sequence seq       = DOTween.Sequence();
        Vector3  _finalPos = transform.position + impact.Direction * impact.Force;

        _finalPos.y = transform.position.y;
        seq.Append(transform.DOMove(_finalPos, impact.Duration));
        seq.AppendCallback(() =>
        {
            if (!_playerMovementFSM.CurrentState.GetType().Equals(typeof(TransformMovementState)))
            {
                _playerMovementFSM.TransitionTo <MovementIdleState>();
            }
        });
    }