Ejemplo n.º 1
0
        protected void GetEventDetails(string EventID)
        {
            try
            {
                EventTicketDetailsViewModel _eventTicketDetailsViewModel = new EventTicketDetailsViewModel();
                List<EventTicketDetailsModel> _eventTicketDetailsModel = new List<EventTicketDetailsModel>();
                _eventTicketDetailsModel = _eventTicketDetailsViewModel.GetEventTicketDetailsList(EventID);

                if (_eventTicketDetailsModel != null)
                {
                    lblEventName.Text = _eventTicketDetailsModel[0].EventTitle;
                    imgEvent.Src = _eventTicketDetailsModel[0].ImagePath;
                    lblEvtDate.Text = Convert.ToDateTime(_eventTicketDetailsModel[0].EventDate).ToString("dd MMM,yyyy");
                    lblEvtDate.Text += " " + Convert.ToDateTime(_eventTicketDetailsModel[0].EVENTFROMTIME).ToString("HH:mm");
                    lblEvtDate.Text += " - " + Convert.ToDateTime(_eventTicketDetailsModel[0].EVENTTOTIME).ToString("HH:mm");
                    lblEventDetails.Text = _eventTicketDetailsModel[0].EventDesc;

                    lblLocationName.Text = _eventTicketDetailsModel[0].LocationName;
                    ImgVenue.Src = ".." + _eventTicketDetailsModel[0].VenueImagePath;
                }

                for (int i = 0; i < _eventTicketDetailsModel.Count; i++)
                {

                    ListItem lst = new ListItem();
                    decimal Eventprice = 0;

                    decimal.TryParse(_eventTicketDetailsModel[i].EVENTPRICE.ToString(), out Eventprice);
                    lst.Value = Eventprice.ToString();
                    lst.Text = _eventTicketDetailsModel[i].EVENTPRICEDETAILS.ToString();
                    ddTicketType.Items.Add(lst);

                }

                _eventTicketDetailsModel = null;

                _eventTicketDetailsViewModel = null;
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message);
            }
        }
Ejemplo n.º 2
0
        protected void btnSubmit_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (!String.IsNullOrEmpty(EID) && !String.IsNullOrEmpty(TID))
                {
                    //PAYMENT PROCEDURE

                    //UPDATE TICKET STATUS
                    //***************+kk Authorize.net payment

                    // By default, this sample code is designed to post to our test server for
                    // developer accounts: https://test.authorize.net/gateway/transact.dll
                    // for real accounts (even in test mode), please make sure that you are
                    // posting to: https://secure.authorize.net/gateway/transact.dll

                    //String post_url = "https://test.authorize.net/gateway/transact.dll";
                    String post_url = "https://secure.authorize.net/gateway/transact.dll";  //live

                    Dictionary<string, string> post_values = new Dictionary<string, string>();
                    //the API Login ID and Transaction Key must be replaced with valid values
                    //+kk
                    //post_values.Add("x_login", "5bpPR895DF");
                    //post_values.Add("x_tran_key", "67Rg3v72XqkZk6aL");

                    //Live
                    post_values.Add("x_login", "5S2n9j3uBaR");
                    post_values.Add("x_tran_key", "5g94d9E3wwGUnC6E");

                    post_values.Add("x_delim_data", "TRUE");
                    post_values.Add("x_delim_char", "|");
                    post_values.Add("x_relay_response", "FALSE");

                    post_values.Add("x_type", "AUTH_CAPTURE");
                    post_values.Add("x_method", "CC");
                    post_values.Add("x_card_num", txtCardNumber.Text);//6011000000000012
                    post_values.Add("x_exp_date", ccMonth.Text + ccYear.Value);//"0515");
                    post_values.Add("x_card_code", txtCVV.Text);//+kk CCV

                    post_values.Add("x_amount", totval.Value);//"15.00");
                    post_values.Add("x_description", "SHOWSLINE WEB");

                    //+kk required only id addr verification is doing
                    /*post_values.Add("x_first_name", "John");
                    post_values.Add("x_last_name", "Doe");
                    post_values.Add("x_address", "1234 Street");
                    post_values.Add("x_state", "WA");
                    post_values.Add("x_zip", "98004");*/
                    // Additional fields can be added here as outlined in the AIM integration
                    // guide at: http://developer.authorize.net

                    // This section takes the input fields and converts them to the proper format
                    // for an http post.  For example: "x_login=username&x_tran_key=a1B2c3D4"
                    String post_string = "";

                    foreach (KeyValuePair<string, string> post_value in post_values)
                    {
                        post_string += post_value.Key + "=" + HttpUtility.UrlEncode(post_value.Value) + "&";
                    }
                    post_string = post_string.TrimEnd('&');

                    // The following section provides an example of how to add line item details to
                    // the post string.  Because line items may consist of multiple values with the
                    // same key/name, they cannot be simply added into the above array.
                    //
                    // This section is commented out by default.
                    /*
                    string[] line_items = {
                        "item1<|>golf balls<|><|>2<|>18.95<|>Y",
                        "item2<|>golf bag<|>Wilson golf carry bag, red<|>1<|>39.99<|>Y",
                        "item3<|>book<|>Golf for Dummies<|>1<|>21.99<|>Y"};

                    foreach( string value in line_items )
                    {
                        post_string += "&x_line_item=" + HttpUtility.UrlEncode(value);
                    }
                    */

                    // create an HttpWebRequest object to communicate with Authorize.net
                    HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(post_url);
                    objRequest.Method = "POST";
                    objRequest.ContentLength = post_string.Length;
                    objRequest.ContentType = "application/x-www-form-urlencoded";

                    // post data is sent as a stream
                    StreamWriter myWriter = null;
                    myWriter = new StreamWriter(objRequest.GetRequestStream());
                    myWriter.Write(post_string);
                    myWriter.Close();

                    // returned values are returned as a stream, then read into a string
                    String post_response;
                    HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
                    using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream()))
                    {
                        post_response = responseStream.ReadToEnd();
                        responseStream.Close();
                    }

                    string[] response_array = post_response.Split('|');

                    // the response string is broken into an array
                    // The split character specified here must match the delimiting character specified above

                    // individual elements of the array could be accessed to read certain response
                    // fields.  For example, response_array[0] would return the Response Code,
                    // response_array[2] would return the Response Reason Code.
                    // for a list of response fields, please review the AIM Implementation Guide

                    if (response_array[0] == "1")
                    {//Approved
                        EventTicketDetailsViewModel _eventTicketDetailsViewModel = new EventTicketDetailsViewModel();
                       // _eventTicketDetailsViewModel.UpdateTicketStatus(TID, EID, result.CTR, result.EXact_Resp_Code, result.Bank_Resp_Code + " MSG :  " + result.EXact_Message, result.Bank_Message);//-kk
                        _eventTicketDetailsViewModel.UpdateTicketStatus(TID, EID, response_array[4], response_array[0], response_array[2] + " MSG :  " + response_array[3], response_array[3]);//+kk
                        _eventTicketDetailsViewModel = null;

                        Response.Redirect("~/WebSite/Confirmation.aspx?EID=" + EID + "&TID=" + TID, false);
                        Context.ApplicationInstance.CompleteRequest();
                    }
                    else
                    {
                        System.Text.StringBuilder sb = new System.Text.StringBuilder();
                        sb.Append(@"<script language='javascript'>");
                        sb.Append(@"alert('Transaction Declined : " + response_array[3] + "')");
                        //sb.Append(@"lbl.style.color='red';");
                        sb.Append(@"</script>");

                        //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Error", "javascript:alert('Transaction Decline : '" + result.EXact_Message + "' );", true);
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Transaction Decline", sb.ToString(), false);

                        //Response.Redirect("~/WebSite/Decline.aspx?EID=" + EID + "&TID=" + TID); //for test, To be replaced with Decline page, put "result.EXact_Message" message in the decline page.
                    }

                    //******************************

                    //Response.Redirect("~/WebSite/Confirmation.aspx?EID=" + EID + "&TID=" + TID);
                    //////+kk
                    /*try
                    {
                        E4.ServiceSoapClient ws = new E4.ServiceSoapClient();
                        E4.Transaction txn = new E4.Transaction();
                        // set correct credential values, to be replaced with "live" values
                        txn.ExactID = "AD3533-06";
                        txn.Password = "******";

                        txn.Transaction_Type = "00";
                        txn.Card_Number = txtCardNumber.Text;// "4111111111111111";  //visa 4111111111111111
                        //txn.Card_Number = "5500000000000004"; //master card
                        //txn.Card_Number = "6011000000000004"; //Discover card
                        //txn.Card_Number = "3566002020140006"; //JCB card
                        txn.CardHoldersName = txtCard.Text;// "test name 1";
                        //txn.DollarAmount =  "10.00";
                        //txn.Expiry_Date = "1114"; //mmyy
                        txn.DollarAmount = totval.Value; //"10.00";
                        txn.Expiry_Date = ccMonth.Text + ccYear.Value; //"1114"; //mmyy

                        txn.VerificationStr2 = txtCVV.Text;// "123";  //CVV
                        txn.CVD_Presence_Ind = "1";

                        E4.TransactionResult result = ws.SendAndCommit(txn);

                        Console.WriteLine(result.CTR);
                        Console.WriteLine("e4 resp code: " + result.EXact_Resp_Code);
                        Console.WriteLine("e4 message: " + result.EXact_Message);
                        Console.WriteLine("e4 CVV Result: " + result.CVV2);
                        Console.WriteLine("bank resp code: " + result.Bank_Resp_Code);
                        Console.WriteLine("bank message: " + result.Bank_Message);

                        if (result.EXact_Resp_Code == "00") //Approved
                        {
                            EventTicketDetailsViewModel _eventTicketDetailsViewModel = new EventTicketDetailsViewModel();
                            _eventTicketDetailsViewModel.UpdateTicketStatus(TID, EID, result.CTR, result.EXact_Resp_Code, result.Bank_Resp_Code + " MSG :  " + result.EXact_Message, result.Bank_Message);
                            _eventTicketDetailsViewModel = null;

                            Response.Redirect("~/WebSite/Confirmation.aspx?EID=" + EID + "&TID=" + TID, false);
                            Context.ApplicationInstance.CompleteRequest();
                        }
                        //Response.Redirect("~/WebSite/Confirmation.aspx?EID=" + EID + "&TID=" + TID);
                        else
                        {
                            System.Text.StringBuilder sb = new System.Text.StringBuilder();
                            sb.Append(@"<script language='javascript'>");
                            sb.Append(@"alert('Transaction Declined : " + result.EXact_Message + "')");
                            //sb.Append(@"lbl.style.color='red';");
                            sb.Append(@"</script>");

                            //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Error", "javascript:alert('Transaction Decline : '" + result.EXact_Message + "' );", true);
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Transaction Decline", sb.ToString(), false);

                            //Response.Redirect("~/WebSite/Decline.aspx?EID=" + EID + "&TID=" + TID); //for test, To be replaced with Decline page, put "result.EXact_Message" message in the decline page.
                        }
                    }
                    catch (Exception ex1)
                    {
                        ErrHandler.WriteError(ex1.Message);

                        if (ex1.Message.ToUpper().Contains("TOO BUSY"))
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Error", "javascript:alert('Service Not responding.Please try after sometime.');", true);
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Error", "javascript:alert('Unexpected error occur please try after sometime.');", true);
                        }
                        Response.Redirect("/WebSite/events-List?ID=" + EID + "&EN=" + "");
                    }
                    */
                }
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message);
            }
        }
Ejemplo n.º 3
0
        protected void GetEventDetails(string EventID)
        {
            try
            {
                EventTicketDetailsViewModel _eventTicketDetailsViewModel = new EventTicketDetailsViewModel();
                List<EventTicketDetailsModel> _eventTicketDetailsModel = new List<EventTicketDetailsModel>();
                _eventTicketDetailsModel = _eventTicketDetailsViewModel.GetEventTicketDetailsList(EventID);

                if (_eventTicketDetailsModel.Count > 0)
                {
                    if (_eventTicketDetailsModel != null || _eventTicketDetailsModel.Count > 0)
                    {
                        lblEventName.Text = _eventTicketDetailsModel[0].EventTitle;
                        imgEvent.Src = _eventTicketDetailsModel[0].ImagePath;
                        lblEvtDate.Text = Convert.ToDateTime(_eventTicketDetailsModel[0].EVENTFROMTIME).ToString("dd/MMM/yyyy");
                        lblEvtDate.Text += "  " + Convert.ToDateTime(_eventTicketDetailsModel[0].EVENTFROMTIME).ToString("HH:mm");
                        //lblEvtDate.Text += " To : " + Convert.ToDateTime(_eventTicketDetailsModel[0].EVENTTOTIME).ToString("HH:mm");//-kk

                        //lblEventDetails.Text = _eventTicketDetailsModel[0].EventDesc;
                        lblEventDetails.Value = _eventTicketDetailsModel[0].EventDesc;
                        lblVenueName.Text = _eventTicketDetailsModel[0].VenueName + "<br/> &nbsp&nbsp&nbsp" + _eventTicketDetailsModel[0].StreetAddress + "," + _eventTicketDetailsModel[0].City + "<br/> &nbsp&nbsp&nbsp" + _eventTicketDetailsModel[0].StateProvision + "," + _eventTicketDetailsModel[0].ZipCode;
                        imgVenue.Src = _eventTicketDetailsModel[0].VenueImagePath;
                        rptTicketDetails.DataSource = _eventTicketDetailsModel;
                        rptTicketDetails.DataBind();
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Event Checkout", "<script type='text/javascript'>Msg('Server is busy. Please try again!','Event Checkout','txtEmail');</script>", false);
                }

                //for (int i = 0; i < _eventTicketDetailsModel.Count; i++)
                //{
                //    if (i % 2 == 0)
                //    {
                //        phTicketprice.Controls.Add(new LiteralControl("<li class='even'>"));
                //    }
                //    else
                //    {
                //        phTicketprice.Controls.Add(new LiteralControl("<li class='odd'>"));
                //    }

                //    phTicketprice.Controls.Add(new LiteralControl("<div class='ticket-type column float-l blue-strong'>" + _eventTicketDetailsModel[i].EVENTPRICEDETAILS + "</div>"));

                //    phTicketprice.Controls.Add(new LiteralControl("<div class='ages column float-l'>18+</div>"));
                //    var outvalue = decimal.Parse(_eventTicketDetailsModel[i].EVENTPRICE, NumberStyles.Currency);
                //    phTicketprice.Controls.Add(new LiteralControl("<div class='price column float-l'>$ " + Convert.ToInt32(outvalue) + "</div>"));

                //    phTicketprice.Controls.Add(new LiteralControl("<div id='sfee135127' class='fee column float-l sfee'> $ 2.25</div>"));
                //    phTicketprice.Controls.Add(new LiteralControl(" <div class='quantcheck quantity column float-r'>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<select name='tt_135127' id='tt_135127' class='changeMe qty'>"));
                //    phTicketprice.Controls.Add(new LiteralControl(" <option></option>"));
                //    phTicketprice.Controls.Add(new LiteralControl(" <option value='1'>01</option>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<option value='2'>02</option>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<option value='3'>03</option>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<option value='4'>04</option>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<option value='5'>05</option>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<option value='6'>06</option>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<option value='7'>07</option>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<option value='8'>08</option>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<option value='9'>09</option>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<option value='10'>10</option>"));
                //    phTicketprice.Controls.Add(new LiteralControl(" </select>"));
                //    phTicketprice.Controls.Add(new LiteralControl("</div>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<br/>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<div class='clear-b'></div>"));
                //    phTicketprice.Controls.Add(new LiteralControl("<div class='clear-b'></div>"));
                //    phTicketprice.Controls.Add(new LiteralControl("</li>"));
                //}

                _eventTicketDetailsModel = null;

                _eventTicketDetailsViewModel = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }