コード例 #1
0
        protected void lstPaymentProvider_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            ListView         lv               = sender as ListView;
            ListViewDataItem item             = e.Item as ListViewDataItem;
            SubscriberPaymentProviderInfo spp = item.DataItem as SubscriberPaymentProviderInfo;

            if (spp != null)
            {
                PlaceHolder         ph = e.Item.FindControl("phPaymentProvider") as PlaceHolder;
                PaymentProviderInfo pp = PaymentProvider.Find(p => p.PaymentProviderId == spp.PaymentProviderId);

                if (pp != null)
                {
                    Literal ltrTitle = e.Item.FindControl("ltrTitle") as Literal;
                    ltrTitle.Text = "<h3 class=\"bbstore-cart-payment-header\">" + pp.ProviderName + "</h3>";

                    PaymentProviderBase ctrl = this.LoadControl(@"~\DesktopModules\BBStore\Providers\Payment\" + pp.ProviderControl.Trim() + ".ascx") as PaymentProviderBase;
                    ctrl.DisplayMode       = ViewMode.View;
                    ctrl.Title             = pp.ProviderName;
                    ctrl.EnableViewState   = true;
                    ctrl.Properties        = spp.PaymentProviderProperties;
                    ctrl.Cost              = spp.Cost;
                    ctrl.CostPercent       = spp.CostPercent;
                    ctrl.TaxPercent        = spp.TaxPercent;
                    ctrl.PaymentProviderId = spp.PaymentProviderId;
                    ctrl.ShowNetprice      = MainControl.ShowNetPrice;
                    ctrl.ID = "pp" + spp.SubscriberPaymentProviderId.ToString();

                    CustomerPaymentProviderInfo cusPP = Controller.GetCustomerPaymentProvider(MainControl.CustomerId, spp.PaymentProviderId);
                    if (cusPP != null)
                    {
                        ctrl.Values = cusPP.PaymentProviderValues;
                        if (cusPP.CustomerPaymentProviderId == MainControl.Cart.CustomerPaymentProviderID)
                        {
                            int    index  = item.DataItemIndex;
                            string script = "<script type=\"text/javascript\">var paneIndex = " + index.ToString() + ";" + "</script>";
                            Page.ClientScript.RegisterStartupScript(typeof(Page), "SetActivePane", script);
                        }
                    }
                    ph.Controls.Add(ctrl);
                    ctrl = null;
                }
            }
        }
コード例 #2
0
        private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            #region txtPurchaseID
            if (sender == txtPurchaseID)
            {
                if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3)
                {
                    return;
                }


                if (e.KeyCode.ToString() == "F2")
                {
                    if (oPurchase.View())
                    {
                        oPayment.PurchaseID = oPurchase.ID;
                        txtPurchaseID.Text  = oPurchase.ID;
                        oVendor.Find(oPurchase.VendID);
                        txtName.Text         = oVendor.Name;
                        txtAmountDue.Enabled = false;
                        txtAmountDue.Text    = (oPurchase.Total + oPurchase.GetPayments()).ToString();
                        ctrType.Focus();
                        //txtAmount.Focus();
                    }
                    return;
                }

                if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab)
                {
                    if (txtPurchaseID.Text.Trim().Length == 0)
                    {
                        Clear();
                        txtPurchaseID.Focus();
                    }

                    if (oPurchase.Find(txtPurchaseID.Text))
                    {
                        oPayment.PurchaseID = oPurchase.ID;
                        txtPurchaseID.Text  = oPurchase.ID;
                        oVendor.Find(oPurchase.VendID);
                        txtName.Text         = oVendor.Name;
                        txtAmountDue.Enabled = false;
                        txtAmountDue.Text    = (oPurchase.GetTotal() + oPurchase.GetPayments()).ToString();
                        //txtAmountDue.Text = oPurchase.StatementAmountDue.ToString();
                        //txtAmount.Focus();
                        ctrType.Focus();
                        return;
                    }
                    else
                    {
                        Clear();
                    }
                }
            }
            #endregion
            #region txtChargeID
            if (sender == txtChargeID)
            {
                if (e.KeyCode.ToString() == "F2")
                {
                    if (oPayment.View(txtPurchaseID.Text))
                    {
                        Display();
                        txtChargeID.Text = oPayment.ID;
                    }
                    return;
                }

                if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab)
                {
                    if (oPayment.Find(txtChargeID.Text))
                    {
                        Display();
                        txtChargeID.Text = oPayment.ID;
                    }
                    return;
                }
            }
            #endregion
            #region txtAmount
            if (sender == txtAmount)
            {
                if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab)
                {
                    if (txtAmount.Number != 0.00)
                    {
                        txtComment.Focus();
                    }

                    return;
                }
            }
            #endregion
            #region txtText
            if (sender == txtComment)
            {
                if (e.KeyCode != Keys.PageDown)
                {
                    return;
                }
            }
            #endregion


            #region Default Option
            //Default option
            switch (e.KeyCode)
            {
            case Keys.Tab:
                if (!e.Shift)
                {
                    this.SelectNextControl(this.ActiveControl, true, true, true, true);
                }
                break;

            case Keys.Enter:
                this.SelectNextControl(this.ActiveControl, true, true, true, true);
                break;

            case Keys.Down:
                this.SelectNextControl(this.ActiveControl, true, true, true, true);
                break;

            case Keys.Up:
                this.SelectNextControl(this.ActiveControl, false, true, true, true);
                break;

            case Keys.F8:
                break;

            case Keys.F3:
            {
                if (txtChargeID.Text.Trim() != String.Empty)
                {
                    if (MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                    {
                        MessageBox.Show("Operation Cancelled");
                        return;
                    }
                    else
                    {
                        oPayment.Delete();
                        // oPurchase.GetPayments();
                        // oPurchase.UpdateCurrentTotals();
                        // oPurchase.HasChanged = true;
                        Clear();
                        txtPurchaseID.Focus();
                    }
                }
            }
            break;

            case Keys.F7:
                this.Close();
                break;

            case Keys.PageDown:

                oPayment.ID   = txtChargeID.Text;
                oPayment.Date = (DateTime)txtDate.Value;

                oPayment.Comment = txtComment.Text;
                switch (ctrType.Text)
                {
                case "Payment":
                    oPayment.Type   = "P";
                    oPayment.Amount = txtAmount.Number * -1;
                    break;

                case "Adjustment":
                    oPayment.Type   = "A";
                    oPayment.Amount = txtAmount.Number;
                    break;

                case "Invoice":
                    oPayment.Type = "I";
                    // if (txtAmount.Number < 0)
                    oPayment.Amount = txtAmount.Number;
                    break;

                default:
                    oPayment.Amount = txtAmount.Number;
                    break;
                }


                if (txtChargeID.Text == "")
                {
                    oPayment.Insert();
                    // if (oPayment.Type == "P" && oPurchase.StatementAmountDue != 0)
                    //     oPurchase.PrintStatement(null, PrinterDevice.Printer);
                }
                else
                {
                    oPayment.Save();
                }
                //oPurchase.GetPayments();
                //oPurchase.UpdateCurrentTotals();
                //oPurchase.HasChanged = true;
                Clear();
                //txtCustomerID.Clear();
                txtPurchaseID.Focus();
                break;
            }
            #endregion
        }