Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string CartItemId   = string.Empty;
            string ImportItemId = string.Empty;

            if (Request.QueryString.AllKeys.Contains("CartId"))
            {
                CartItemId = Request.QueryString["CartId"].ToString();
            }
            if (!string.IsNullOrEmpty(CartItemId))
            {
                CurrentCartItemId.Value = CartItemId;
                pnlSearch.Visible       = false;
                divEdit.Visible         = true;
                pnlGrids.Visible        = false;
                GiftCertificateEdit1.CurrentCartItemID = Convert.ToInt32(CartItemId);
                GiftCertificateEdit1.Bind();
            }
            else if (Request.QueryString.AllKeys.Contains("ImportCartId"))
            {
                ImportItemId = Request.QueryString["ImportCartId"].ToString();
                if (!string.IsNullOrEmpty(ImportItemId))
                {
                    int certId            = Convert.ToInt32(ImportItemId);
                    ImportedGiftCert cert = ImportedGiftCert.GetById(certId);

                    if (cert != null)
                    {
                        CurrentCartItemId.Value = Convert.ToString(certId);
                        lblCode.Text            = cert.code.ToString();
                        txtAmount.Text          = cert.amount.Value.ToString();
                        txtDateUsed.Text        = cert.date_used;
                        chkRedeemed.Checked     = cert.is_used == "Y" ? true : false;
                        //txtUsedBy.Text = cert.used_by.ToString();

                        pnlImpCertEdit.Visible = true;
                    }
                    else
                    {
                        lblFBImpCert.Text = "Gift certificate not found.";
                    }
                }
            }

            else if (!IsPostBack)
            {
                //BindgvwIssuedCerts();
                //BindgvwRedeemedCerts();
                //BindgvwImportedGiftCerts();
            }
        }
Example #2
0
        void gvwImportedGiftCerts_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridView gvw = (GridView)sender;

            int certId            = int.Parse(gvw.SelectedDataKey.Value.ToString());
            ImportedGiftCert cert = ImportedGiftCert.GetById(certId);

            if (cert != null)
            {
                lblCode.Text        = cert.code.ToString();
                txtAmount.Text      = cert.amount.Value.ToString();
                txtDateUsed.Text    = cert.date_used;
                chkRedeemed.Checked = cert.is_used == "Y" ? true : false;
                //txtUsedBy.Text = cert.used_by.ToString();

                pnlImpCertEdit.Visible = true;
            }
            else
            {
                lblFBImpCert.Text = "Gift certificate not found.";
            }
        }