Ejemplo n.º 1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (Txtcardno.Text == "")
     {
         lblmsg.Visible = true;
         lblmsg.Text    = "Please Enter Six Digits of Your World Card-Master Card.";
         Txtcardno.Focus();
         return;
     }
     if (Txtcardno.Text.Length < 6)
     {
         lblmsg.Visible = true;
         lblmsg.Text    = "Please Enter Six Digits of Your World Card-Master Card.";
         Txtcardno.Focus();
         return;
     }
     if (ddlbankname.SelectedItem.ToString() == "Select Bank Name")
     {
         lblmsg.Visible = true;
         lblmsg.Text    = "Please select Bank Name";
         ddlbankname.Focus();
         return;
     }
     else
     {
         DataTable dtvalidation = TransactionBOL.Validation(int.Parse(Txtcardno.Text));
         if (dtvalidation != null && dtvalidation.Rows.Count > 0)
         {
             foreach (DataRow dr in dtvalidation.Rows)
             {
                 if (dr[0].ToString() == ddlbankname.SelectedItem.ToString())
                 {
                     Session["cardno"]   = Txtcardno.Text;
                     Session["BankName"] = ddlbankname.SelectedItem;
                     Session["CardType"] = "Platinum";
                     Response.Redirect("Details.aspx");
                 }
                 else
                 {
                     lblmsg.Visible = true;
                     lblmsg.Text    = "Either Card Number or Bank name is incorrect.";
                     Txtcardno.Focus();
                     return;
                 }
             }
         }
         else
         {
             grayBG.Visible        = true;
             showcontainer.Visible = true;
             Container.Visible     = true;
         }
     }
 }
    public bool validation()
    {
        if (Txtcardno.Text == "" || (Txtcardno.Text.Length < 6))
        {
            ClientScript.RegisterStartupScript(typeof(Page), "test", "alert('Please Enter Six Digits of Your Master Card.');", true);
            Txtcardno.Focus();
            return(false);
        }
        if (ddlbankname.SelectedValue.ToString() == "Select Bank Name")
        {
            ClientScript.RegisterStartupScript(typeof(Page), "test", "alert('Please select Bank Name');", true);
            ddl_type.Focus();
            return(false);
        }
        DataTable dtvalidation = TransactionBOL.Validationnonwc(int.Parse(Txtcardno.Text));

        if (dtvalidation != null && dtvalidation.Rows.Count > 0)
        {
            bool istrue = false;
            foreach (DataRow dr in dtvalidation.Rows)
            {
                if (dr[0].ToString() == ddlbankname.SelectedItem.ToString())
                {
                    istrue = true;
                }
            }
            if (istrue == false)
            {
                ClientScript.RegisterStartupScript(typeof(Page), "test", "alert('Either Card Number or Bank name is incorrect.');", true);
                ddlbankname.Focus();
                return(false);
            }
        }
        if (dtvalidation == null || dtvalidation.Rows.Count == 0)
        {
            ClientScript.RegisterStartupScript(typeof(Page), "test", "alert('Sorry, your card is not eligible for this Offer.');", true);
            ddlbankname.Focus();
            return(false);
        }
        if (ddl_type.SelectedValue.ToString() == "Select")
        {
            ClientScript.RegisterStartupScript(typeof(Page), "test", "alert('Please Select Promotion Type');", true);
            ddl_type.Focus();
            return(false);
        }
        if (divshow.Visible)
        {
            if (ddlnoofpackage.SelectedValue.ToString() == "Select")
            {
                ClientScript.RegisterStartupScript(typeof(Page), "test", "alert('Please Select No of Package');", true);
                ddlnoofpackage.Focus();
                return(false);
            }
        }
        if (chkterms.Checked == false)
        {
            ClientScript.RegisterStartupScript(typeof(Page), "test", "alert('Please Accept Terms and Condition');", true);
            chkterms.Focus();
            return(false);
        }
        else
        {
            return(true);
        }
    }
Ejemplo n.º 3
0
 protected void btnMCPromotionCode_Click(object sender, EventArgs e)
 {
     if (Txtcardno.Text == "" || (Txtcardno.Text.Length < 6))
     {
         lblMsgPromotionCode.Visible = true;
         lblMsgPromotionCode.Text    = "Please Enter Six Digits of Your Master Card.";
         Txtcardno.Focus();
         return;
     }
     if (ddlbankname.SelectedValue.ToString() == "Select Bank Name")
     {
         lblMsgPromotionCode.Visible = true;
         lblMsgPromotionCode.Text    = "Please select Bank Name";
         ddlbankname.Focus();
         return;
     }
     if (txtMCPromotionCode.Text.Length == 0)
     {
         lblMsgPromotionCode.Visible = true;
         lblMsgPromotionCode.Text    = "Please Enter Promotion Code";
         txtMCPromotionCode.Focus();
         return;
     }
     if (chkterms.Checked == false)
     {
         lblMsgPromotionCode.Visible = true;
         lblMsgPromotionCode.Text    = "Please Accept Terms and Condition.";
         chkterms.Focus();
         return;
     }
     else
     {
         List <KoDTicketingLibrary.DTO.Promotion> listPromo = VistaBOL.GetPromostionCode();
         String    PromotionCode = txtMCPromotionCode.Text;
         int       list          = listPromo.Count;
         bool      istrue        = false;
         DataTable dtvalidation  = TransactionBOL.Validationnonwc(int.Parse(Txtcardno.Text));
         for (int i = 0; i < list; i++)
         {
             bool isMatchPromo = Regex.IsMatch(PromotionCode, listPromo[i].RegexValidator);
             if (isMatchPromo)
             {
                 if (listPromo[i].PromotionCode.ToString().ToUpper() == "MCOTHERS")
                 {
                     //Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Promotion code:" + txtMCPromotionCode.Text.ToString());
                     //Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Redirect to MasterCard-NwcDetail page.");
                     //Session["MCPROMOCODE"] = txtMCPromotionCode.Text.ToString();
                     Session["PromotionCode"]                  = listPromo[i];
                     Session[listPromo[i].PromotionCode]       = listPromo[i];
                     Session["a" + listPromo[i].PromotionCode] = listPromo[i];
                     Session["Hotel"] = listPromo[i].PromotionCode.ToString();
                     istrue           = true;
                     //   Response.Redirect("MasterCard-NwcDetails.aspx");
                 }
                 if (istrue == false)
                 {
                     lblMsgPromotionCode.Visible = true;
                     lblMsgPromotionCode.Text    = "Promotion Code is not Valid.";
                     txtMCPromotionCode.Focus();
                     return;
                 }
                 if (dtvalidation != null && dtvalidation.Rows.Count > 0)
                 {
                     foreach (DataRow dr in dtvalidation.Rows)
                     {
                         if (dr[0].ToString() == ddlbankname.SelectedItem.ToString())
                         {
                             Session["MCPROMOCODE"]   = txtMCPromotionCode.Text.ToString();
                             Session["NWTMCBANKNAME"] = ddlbankname.SelectedItem.ToString();
                             Session["NWTMCCARDNO"]   = Txtcardno.Text.ToString();
                             Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Card no:" + Txtcardno.ToString());
                             Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("bank name:" + ddlbankname.SelectedItem.ToString());
                             Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("redirect to default page.");
                             Response.Redirect("Default.aspx?NWMCT=S&promo=" + Encrypt("MCOTHERS"), false);
                         }
                         else
                         {
                             lblMsgPromotionCode.Visible = true;
                             lblMsgPromotionCode.Text    = "Either Card Number or Bank name is incorrect.";
                             Txtcardno.Focus();
                             return;
                         }
                     }
                 }
                 else
                 {
                     lblMsgPromotionCode.Visible = true;
                     lblMsgPromotionCode.Text    = "Sorry, your card is not eligible for this Offer.";
                     Txtcardno.Focus();
                     return;
                 }
             }
         }
     }
 }