コード例 #1
0
        public static Details MapToDetails(ZbaBotService.Details opaDetails)
        {
            var details = new Details
                {
                    AssessedImprovementExempt = opaDetails.AssessedImprovementExempt,
                    AssessedImprovementTaxable = opaDetails.AssessedImprovementTaxable,
                    AssessedLandExempt = opaDetails.AssessedLandExempt,
                    AssessedLandTaxable = opaDetails.AssessedLandTaxable,
                    BeginPoint = opaDetails.BeginPoint,
                    Condition = opaDetails.Condition,
                    CouncilDistrict = opaDetails.CouncilDistrict,
                    Description = opaDetails.Description,
                    ImprovementArea = opaDetails.ImprovementArea,
                    LandArea = opaDetails.LandArea,
                    MarketValue = opaDetails.MarketValue,
                    RealEstateTax = opaDetails.RealEstateTax,
                    SaleDate = opaDetails.SaleDate,
                    SalePrice = opaDetails.SalePrice,
                    TotalAssessment = opaDetails.TotalAssessment,
                    Zoning = opaDetails.Zoning,
                    ZoningDescription = opaDetails.ZoningDescription
                };

            return details;
        }
コード例 #2
0
ファイル: UiController.cs プロジェクト: tekconf/tekconf
        public async Task<ActionResult> Details(Details.Query query)
        {
            var model = await _mediator.SendAsync(query);

            return Json(model, JsonRequestBehavior.AllowGet);

        }
コード例 #3
0
ファイル: TypeIndex.cs プロジェクト: CecleCW/ProductMan
        public void AddAssembly( System.Reflection.Assembly assembly )
        {
            Details details = new Details();

            details.Assembly = assembly;

            foreach( Type type in assembly.GetTypes() )
            {
                List<Type> types;

                if( details.TypeMap.ContainsKey( type.Name ) )
                {
                    types = details.TypeMap[type.Name];
                }
                else
                {
                    types = new List<Type>();
                    details.TypeMap[type.Name] = types;
                }

                types.Add( type );
            }

            _details.Add( details );
        }
コード例 #4
0
ファイル: Profile.xaml.cs プロジェクト: BharathMG/Palm
        private void choose_clicked(object sender, RoutedEventArgs e)
        {
            String age_text = age_box.Text;
            String name_text = name_box.Text;
            String gender_text = (bool)male_button.IsChecked ? "Male" : "Female";
            String personality_text = (personality_list.SelectedItem as Personality).Name;
            Personality personality = new Personality() { Name = personality_text };
            Details profile = new Details() { Age = age_text, Name = name_text, Gender = gender_text, personality = personality };
            
            //System.Diagnostics.Debug.WriteLine(age_text + " , " + name_text + " , " + gender_text + " , " + personality_text);
            if (age_text.Length < 1 || name_text.Length < 1)
            {
                Dispatcher.BeginInvoke(() =>
                {
                        MessageBox.Show("Please enter Age AND Name ");
                });
                return;
            }

            //Stores profile if everything is in place.
            storeProfile(profile);
            NavigationService.Navigate(new Uri("/Gifts.xaml?personality="+personality_text, UriKind.Relative));



        }
コード例 #5
0
ファイル: DetailsTests.cs プロジェクト: nivertech/Olive
        public void RendersWithoutExceptions()
        {
            var view = new Details();
            var viewModel = new DetailsViewModel();

            view.RenderAsHtml(viewModel);
        }
コード例 #6
0
ファイル: ShipController.cs プロジェクト: ardliath/BigSpace
        public ActionResult Details(int id)
        {
            using (_sessionManager.CreateUnitOfWork())
            {
                var ship = _fleetManager.GetShipFromMyFleet(id);
                var allCommands = _ships.ListAllCommands();
                var commandsForThisShip = _ships.ListCommandsForShip(ship.ShipID);
                var model = new Details
                {
                    ShipID = ship.ShipID,
                    Name =  ship.Name,
                    CurrentLocationID = ship.SolarSystemID,
                    LocationName = ship.SolarSystemName,
                    CurrentTask = ship.JobDescription,
                    ShipCommands = allCommands.Select(c => new ShipCommandSummary
                    {
                        Value = c.CommandID,
                        Description = c.Description,
                        IsApplied = commandsForThisShip.Any(tsc => tsc.CommandID == c.CommandID)
                    }).ToArray()
                };

                return View(model);
            }
        }
コード例 #7
0
ファイル: Table.cs プロジェクト: saveenr/saveenr
 public Table()
 {
     this.Header = new Header();
     this.Details = new Details();
     this.TableColumns = new NodeCollection<TableColumn>();
     this.TableGroups = new NodeCollection<TableGroup>(); 
     this.Style = new Style();
 }
コード例 #8
0
ファイル: Cars.cs プロジェクト: bttalic/BitcampStudentTest
 public Cars(string itemDesc, string itemName,double itemPrice, string type, string manufacturer,int year,Details details): base
     (itemDesc, itemName, itemPrice)
 {
     this.type = type;
     this.manufacturer = manufacturer;
     this.year = year;
     this.details = details;
 }
コード例 #9
0
 // GET: /Student/Details/5
 public async Task<ActionResult> Details(Details.Query query)
 {
     var student = await _mediator.SendAsync(query);
     if (student == null)
     {
         return HttpNotFound();
     }
     return View(student);
 }
コード例 #10
0
ファイル: Log.cs プロジェクト: Faham/emophiz
 public void CSV(Details detail, Priority priority, params String[] csv_values)
 {
     String csv_record_str = "";
     String delim = ",";
     for (int i = 0; i < csv_values.Length; ++i)
     {
         if (csv_record_str != "")
             csv_record_str += delim;
         csv_record_str += csv_values[i].ToString();
     }
     String sig = getLogSignature(detail, priority, delim);
     if (sig != "")
         csv_record_str = sig + delim + csv_record_str;
     m_messages.Enqueue(csv_record_str);
 }
コード例 #11
0
 protected void UpdateProfile()
 {
     var d = new Details
                 {
                     FirstName = txtFirstName.Text,
                     LastName = txtLastName.Text,
                     Phone = txtPhone.Text,
                     Address = txtAddress.Text,
                     City = txtCity.Text,
                     State = txtState.Text,
                     ZipCode = txtZipCode.Text
                 };
     user.Email = txtEmail.Text;
     System.Web.Security.Membership.UpdateUser(user);
     Profile.Details = d;
 }
コード例 #12
0
ファイル: ResultInspector.cs プロジェクト: dfr0/moon
 /// <summary>
 /// Prepare the initial visual contents of the web control.
 /// </summary>
 private void InitializeComponent()
 {
     _details = Result.Exception != null && Result.Result != TestOutcome.Passed ? new ExceptionDetails(this) : new Details(this);
     bool hasDecorators = false;
     foreach (HtmlControlBase decoration in _details.DecorateContainer())
     {
         Controls.Add(decoration);
         hasDecorators = true;
     }
     Controls.Add(_details);
     if (hasDecorators)
     {
         BackgroundColor = Color.Manila;
         SetStyleAttribute(CssAttribute.Border, "1px solid " + Color.ManilaBorder);
         ForegroundColor = Color.DarkGray;
         Padding.Bottom = 2;
         Margin.Bottom = 2;
         Padding.Top = 6;
         SetStyleAttribute(CssAttribute.Position, "relative");
     }
     SetStyleAttribute(CssAttribute.Position, "relative");
 }
コード例 #13
0
        public ViewResult Details(Guid Id)
        {
            var tree = new TreeSource().GetTree(Id, Url);

            var mapId = Id;
            var buildingId = FacilitiesSingleton.Facilities.GetParent(mapId);
            var campusId = FacilitiesSingleton.Facilities.GetParent(buildingId);

            var campus = tree.RootItems.Single(item => item.Id == campusId);
            var campusName = campus.Text;

            var building = campus.Children.Single(item => item.Id == buildingId);
            var buildingName = building.Text;

            var map = building.Children.Single(item => item.Id == mapId);
            var mapName = map.Text;

            var mapImageUrl = Url.Action("Image", new {Id = mapId});

            var model = new Details(tree, mapId, mapName, buildingId, buildingName, campusId, campusName, mapImageUrl);
            return View(model);
        }
コード例 #14
0
        public override void AppendAnswer(Details.AnswerContext context, string postedValue)
        {
            var file = context.HttpContext.Request.Files[ElementID];
            if (file == null || file.ContentLength == 0 || string.IsNullOrEmpty(file.FileName))
            {
                return;
            }

            if (MaxFileSize != 0 && file.ContentLength > MaxFileSize * 1024)
            {
                context.ValidationErrors.Add(ElementID, QuestionText + " is too big");
                return;
            }

            string fileName = System.IO.Path.GetFileName(file.FileName);
            if (!AllowedFileExtensions.Split(',').Any(ext => fileName.EndsWith(ext.Trim(), StringComparison.InvariantCultureIgnoreCase)))
            {
                context.ValidationErrors.Add(ElementID, QuestionText + " is not an allowed file type");
                return;
            }

            context.Attachments.Add(new System.Net.Mail.Attachment(file.InputStream, fileName));
        }
コード例 #15
0
ファイル: Details_DLL.cs プロジェクト: yinchangxin/lztztb
        /// <summary>
        /// 查找详细信息
        /// </summary>
        /// <param name="invoice_no"></param>
        /// <returns></returns>
        public static Details Find(int id)
        {
            Details details = new Details();
               string sql = string.Format("select * from tb_details where id={0}", id);
               DataRow dr = DataControl.GetDataRow(sql);
               try
               {

               details.Invoice_no = dr["invoice_no"].ToString();
               details.Ser_number = dr["ser_number"].ToString();
               details.Title= dr["title"].ToString();
               details.Charge_unit= dr["charge_unit"].ToString();
               details.Charge_no = dr["charge_no"].ToString();
               details.Freight_Basis1= dr["Freight_Basis"].ToString();
               details.Total_price= Convert.ToDouble(dr["total_price"].ToString());

               return details;
               }
               catch
               {
               return null;
               }
        }
コード例 #16
0
 public LoadContentBytesException(Details reason)
 {
     Reason = reason;
 }
コード例 #17
0
    private SearchResults DetailsToSearchResults(string category, Details details)
    {
        SearchResults results = null;

        switch (category) {
            case "films":
                SearchResultsFilm film_results = new SearchResultsFilm ();
                film_results.Name = details.ProductName;
                film_results.OriginalTitle = "";
                film_results.Rating = 1;
                film_results.Image = details.ImageUrlMedium;
                film_results.Directors = details.Directors;
                film_results.Starring = details.Starring;
                film_results.Date = details.TheatricalReleaseDate;
                film_results.Genre = "";
                film_results.RunningTime = details.RunningTime;
                film_results.Country = "";
                film_results.Language = "";
                film_results.Manufacturer = details.Manufacturer;
                film_results.Medium = "DVD";
                film_results.Comments = details.ProductDescription;

                results = film_results;
                break;
            case "albums":
                SearchResultsAlbum album_results = new SearchResultsAlbum ();
                album_results.Name = details.ProductName;
                album_results.Rating = 1;
                album_results.Image = details.ImageUrlMedium;
                album_results.Artists = details.Artists;
                album_results.Label = details.Manufacturer;
                album_results.Date = details.ReleaseDate;
                album_results.Style = "";
                album_results.ASIN = details.Asin;
                if (details.Tracks != null) {
                    for (int i = 0; i < details.Tracks.Length; i++) {
                        album_results.Tracks[i] = details.Tracks[i].TrackName;
                    }
                }
                album_results.Medium = "CDRom";
                album_results.Runtime = details.RunningTime;
                album_results.Comments = details.ProductDescription;

                results = album_results;
                break;
            case "books":
                SearchResultsBook books_results = new SearchResultsBook ();
                books_results.Name = details.ProductName;
                books_results.Rating = 1;
                books_results.Image = details.ImageUrlMedium;
                books_results.Authors = details.Authors;
                books_results.Date = details.ReleaseDate;
                books_results.OriginalTitle = "";
                books_results.Genre = "";
                books_results.Pages = details.NumberOfPages;
                books_results.Publisher = details.Manufacturer;
                books_results.ISBN = details.Isbn;
                books_results.Country = "";
                books_results.Language = "";
                books_results.Comments = details.ProductDescription;

                results = books_results;
                break;
        }

        return results;
    }
コード例 #18
0
        private void Add(string name, Details details)
        {
            if (!Knowledge.ContainsKey(name)) Knowledge[name] = new List<Details>();
            Knowledge[name].Add(details);

            if (!KnowledgeByType.ContainsKey(new Tuple<Types, string>(details.Type, name))) KnowledgeByType[new Tuple<Types, string>(details.Type, name)] = new List<Details>();
            KnowledgeByType[new Tuple<Types, string>(details.Type, name)].Add(details);
        }
コード例 #19
0
ファイル: VersionManager.cs プロジェクト: brianmatic/n2cms
 private static void Relink(Details.ContentDetail detail)
 {
     if (detail.LinkedItem.ID.HasValue && detail.LinkedItem.Value != null && detail.LinkedItem.Value.VersionOf.HasValue)
     {
         detail.LinkedItem = detail.LinkedItem.Value.VersionOf;
     }
 }
コード例 #20
0
ファイル: UI.cs プロジェクト: wcatykid/GeoShader
 public ExceptionMessageDialog(Page page, Exception ex, string message)
 {
     parent = page;
     details = new Details(ex.ToString());
     errorCode = ex.ToString().GetHashCode().ToString();
     MessageText = message;
 }
コード例 #21
0
ファイル: ThreeButtonDialog.cs プロジェクト: huizh/xenadmin
        /// <summary>
        /// Gives you a dialog with the specified buttons.
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="buttons">>Must be between 1 and 3 buttons</param>
        public ThreeButtonDialog(Details properties, params TBDButton[] buttons)
        {
            System.Diagnostics.Trace.Assert(buttons.Length > 0 && buttons.Length < 4, "Three button dialog can only have between 1 and 3 buttons.");
            InitializeComponent();

            if (properties.Icon == null)
                pictureBoxIcon.Visible = false;
            else
                pictureBoxIcon.Image = properties.Icon.ToBitmap();

            labelMessage.Text = properties.MainMessage;

            if (properties.WindowTitle != null)
                this.Text = properties.WindowTitle;

            button1.Visible = true;
            button1.Text = buttons[0].label;
            button1.DialogResult = buttons[0].result;
            if (buttons[0].defaultAction == ButtonType.ACCEPT)
            {
                AcceptButton = button1;
                if (buttons.Length == 1)
                    CancelButton = button1;
            }
            else if (buttons[0].defaultAction == ButtonType.CANCEL)
                CancelButton = button1;

            if (buttons[0].selected)
                button1.Select();

            if (buttons.Length > 1)
            {
                button2.Visible = true;
                button2.Text = buttons[1].label;
                button2.DialogResult = buttons[1].result;
                if (buttons[1].defaultAction == ButtonType.ACCEPT)
                    AcceptButton = button2;
                else if (buttons[1].defaultAction == ButtonType.CANCEL)
                    CancelButton = button2;

                if (buttons[1].selected)
                    button2.Select();
            }
            else
            {
                button2.Visible = false;
            }

            if (buttons.Length > 2)
            {
                button3.Visible = true;
                button3.Text = buttons[2].label;
                button3.DialogResult = buttons[2].result;
                if (buttons[2].defaultAction == ButtonType.ACCEPT)
                    AcceptButton = button3;
                else if (buttons[2].defaultAction == ButtonType.CANCEL)
                    CancelButton = button3;

                if (buttons[2].selected)
                    button3.Select();
            }
            else
            {
                button3.Visible = false;
            }
        }
コード例 #22
0
 public OnsiteCourse()
 {
     Details = new Details();
 }
コード例 #23
0
        private Payment CreatePayment(APIContext apicontext, string redirectUrl)
        {
            var ItemList = new ItemList()
            {
                items = new List <Item>()
            };

            if (Session["cart"] != null)
            {
                List <CartItem> cart = (List <CartItem>)Session["cart"];
                foreach (var item in cart)
                {
                    ItemList.items.Add(new Item()
                    {
                        name     = item.Product.ProductName.ToString(),
                        currency = "USD",
                        price    = item.Product.UnitPrice.ToString(),
                        quantity = item.Quantity.ToString(),
                        sku      = "sku"
                    });
                }
                //ItemList.items.Add(new Item()
                //{
                //    name = "Item Name comes here",
                //    currency = "USD",
                //    price = "1",
                //    quantity = "1",
                //    sku = "sku"
                //});

                var payer = new Payer()
                {
                    payment_method = "paypal"
                };
                var redirUrl = new RedirectUrls()
                {
                    cancel_url = redirectUrl + "&Cancel=true",
                    return_url = redirectUrl
                };
                var details = new Details()
                {
                    tax      = "1",
                    shipping = "1",
                    subtotal = Session["SesTotal"].ToString()
                };
                int total  = Convert.ToInt32(details.tax) + Convert.ToInt32(details.shipping) + Convert.ToInt32(details.subtotal);
                var amount = new Amount()
                {
                    currency = "USD",
                    total    = total.ToString(),
                    details  = details
                };
                //var amount = new Amount()
                //{
                //    currency = "USD",
                //    total = "3", // Total must be equal to sum of tax, shipping and subtotal.
                //    details = details
                //};
                var transactionList = new List <Transaction>();
                transactionList.Add(new Transaction()
                {
                    description    = "Transaction Description",
                    invoice_number = "#100000",
                    amount         = amount,
                    item_list      = ItemList
                });

                this.payment = new Payment()
                {
                    intent        = "sale",
                    payer         = payer,
                    transactions  = transactionList,
                    redirect_urls = redirUrl
                };
            }


            return(this.payment.Create(apicontext));
        }
コード例 #24
0
        private Payment CreatePayment(APIContext apiContext, string redirectUrl)
        {
            //similar to credit card create itemlist and add item objects to it
            var itemList = new ItemList()
            {
                items = new List <Item>()
            };

            itemList.items.Add(new Item()
            {
                name     = "Item Name",
                currency = "USD",
                price    = "5",
                quantity = "1",
                sku      = "sku"
            });

            var payer = new Payer()
            {
                payment_method = "paypal"
            };

            // Configure Redirect Urls here with RedirectUrls object
            var redirUrls = new RedirectUrls()
            {
                cancel_url = redirectUrl,
                return_url = redirectUrl
            };

            // similar as we did for credit card, do here and create details object
            var details = new Details()
            {
                tax      = "1",
                shipping = "1",
                subtotal = "5"
            };

            // similar as we did for credit card, do here and create amount object
            var amount = new Amount()
            {
                currency = "USD",
                total    = "7", // Total must be equal to sum of shipping, tax and subtotal.
                details  = details
            };

            var transactionList = new List <Transaction>();

            transactionList.Add(new Transaction()
            {
                description    = "Transaction description.",
                invoice_number = "your invoice number",
                amount         = amount,
                item_list      = itemList
            });

            this.payment = new Payment()
            {
                intent        = "sale",
                payer         = payer,
                transactions  = transactionList,
                redirect_urls = redirUrls
            };

            // Create a payment using a APIContext
            return(this.payment.Create(apiContext));
        }
コード例 #25
0
        public ActionResult PaymentWithCreditCard()
        {
            //create and item for which you are taking payment
            //if you need to add more items in the list
            //Then you will need to create multiple item objects or use some loop to instantiate object
            Item item = new Item();

            item.name     = "Demo Item";
            item.currency = "USD";
            item.price    = "5";
            item.quantity = "1";
            item.sku      = "sku";

            //Now make a List of Item and add the above item to it
            //you can create as many items as you want and add to this list
            List <Item> itms = new List <Item>();

            itms.Add(item);
            ItemList itemList = new ItemList();

            itemList.items = itms;

            //Address for the payment
            Address billingAddress = new Address();

            billingAddress.city         = "NewYork";
            billingAddress.country_code = "US";
            billingAddress.line1        = "23rd street kew gardens";
            billingAddress.postal_code  = "43210";
            billingAddress.state        = "NY";


            //Now Create an object of credit card and add above details to it
            CreditCard crdtCard = new CreditCard();

            crdtCard.billing_address = billingAddress;
            crdtCard.cvv2            = "874";
            crdtCard.expire_month    = 1;
            crdtCard.expire_year     = 2020;
            crdtCard.first_name      = "Aman";
            crdtCard.last_name       = "Thakur";
            crdtCard.number          = "1234567890123456";
            crdtCard.type            = "discover";

            // Specify details of your payment amount.
            Details details = new Details();

            details.shipping = "1";
            details.subtotal = "5";
            details.tax      = "1";

            // Specify your total payment amount and assign the details object
            Amount amnt = new Amount();

            amnt.currency = "USD";
            // Total = shipping tax + subtotal.
            amnt.total   = "7";
            amnt.details = details;

            // Now make a trasaction object and assign the Amount object
            Transaction tran = new Transaction();

            tran.amount         = amnt;
            tran.description    = "Description about the payment amount.";
            tran.item_list      = itemList;
            tran.invoice_number = "your invoice number which you are generating";

            // Now, we have to make a list of trasaction and add the trasactions object
            // to this list. You can create one or more object as per your requirements

            List <Transaction> transactions = new List <Transaction>();

            transactions.Add(tran);

            // Now we need to specify the FundingInstrument of the Payer
            // for credit card payments, set the CreditCard which we made above

            FundingInstrument fundInstrument = new FundingInstrument();

            fundInstrument.credit_card = crdtCard;

            // The Payment creation API requires a list of FundingIntrument

            List <FundingInstrument> fundingInstrumentList = new List <FundingInstrument>();

            fundingInstrumentList.Add(fundInstrument);

            // Now create Payer object and assign the fundinginstrument list to the object
            Payer payr = new Payer();

            payr.funding_instruments = fundingInstrumentList;
            payr.payment_method      = "credit_card";

            // finally create the payment object and assign the payer object & transaction list to it
            Payment pymnt = new Payment();

            pymnt.intent       = "sale";
            pymnt.payer        = payr;
            pymnt.transactions = transactions;

            try
            {
                //getting context from the paypal, basically we are sending the clientID and clientSecret key in this function
                //to the get the context from the paypal API to make the payment for which we have created the object above.

                //Code for the configuration class is provided next

                // Basically, apiContext has a accesstoken which is sent by the paypal to authenticate the payment to facilitator account. An access token could be an alphanumeric string

                APIContext apiContext = Configuration.GetAPIContext();

                // Create is a Payment class function which actually sends the payment details to the paypal API for the payment. The function is passed with the ApiContext which we received above.

                Payment createdPayment = pymnt.Create(apiContext);

                //if the createdPayment.State is "approved" it means the payment was successfull else not

                if (createdPayment.state.ToLower() != "approved")
                {
                    return(View("FailureView"));
                }
            }
            catch (PayPal.PayPalException ex)
            {
                Logger.Log("Error: " + ex.Message);
                return(View("FailureView"));
            }

            return(View("SuccessView"));
        }
コード例 #26
0
        protected override void RunSample()
        {
            // ### Api Context
            // Pass in a `APIContext` object to authenticate
            // the call and to send a unique request id
            // (that ensures idempotency). The SDK generates
            // a request id if you do not pass one explicitly.
            // See [Configuration.cs](/Source/Configuration.html) to know more about APIContext.
            var apiContext = Configuration.GetAPIContext();

            string payerId = Request.Params["PayerID"];

            if (string.IsNullOrEmpty(payerId))
            {
                // ###Items
                // Items within a transaction.
                var itemList = new ItemList()
                {
                    items = new List <Item>()
                    {
                        new Item()
                        {
                            name     = "Item Name",
                            currency = "USD",
                            price    = "15",
                            quantity = "5",
                            sku      = "sku"
                        }
                    }
                };

                // ###Payer
                // A resource representing a Payer that funds a payment
                // Payment Method
                // as `paypal`
                var payer = new Payer()
                {
                    payment_method = "paypal"
                };

                // ###Redirect URLS
                // These URLs will determine how the user is redirected from PayPal once they have either approved or canceled the payment.
                var baseURI     = Request.Url.Scheme + "://" + Request.Url.Authority + "/PaymentWithPayPal.aspx?";
                var guid        = Convert.ToString((new Random()).Next(100000));
                var redirectUrl = baseURI + "guid=" + guid;
                var redirUrls   = new RedirectUrls()
                {
                    cancel_url = redirectUrl + "&cancel=true",
                    return_url = redirectUrl
                };

                // ###Details
                // Let's you specify details of a payment amount.
                var details = new Details()
                {
                    tax      = "15",
                    shipping = "10",
                    subtotal = "75"
                };

                // ###Amount
                // Let's you specify a payment amount.
                var amount = new Amount()
                {
                    currency = "USD",
                    total    = "100.00", // Total must be equal to sum of shipping, tax and subtotal.
                    details  = details
                };

                // ###Transaction
                // A transaction defines the contract of a
                // payment - what is the payment for and who
                // is fulfilling it.
                var transactionList = new List <Transaction>();

                // ### Payee
                // Specify a payee with that user's email or merchant id
                // Merchant Id can be found at https://www.paypal.com/businessprofile/settings/
                Payee payee = new Payee()
                {
                    email = "*****@*****.**"
                };

                // The Payment creation API requires a list of
                // Transaction; add the created `Transaction`
                // to a List
                transactionList.Add(new Transaction()
                {
                    description    = "Transaction description.",
                    invoice_number = Common.GetRandomInvoiceNumber(),
                    amount         = amount,
                    item_list      = itemList,
                    payee          = payee
                });

                // ###Payment
                // A Payment Resource; create one using
                // the above types and intent as `sale` or `authorize`
                var payment = new Payment()
                {
                    intent        = "sale",
                    payer         = payer,
                    transactions  = transactionList,
                    redirect_urls = redirUrls
                };

                // ^ Ignore workflow code segment
                #region Track Workflow
                this.flow.AddNewRequest("Create PayPal payment", payment);
                #endregion

                // Create a payment using a valid APIContext
                var createdPayment = payment.Create(apiContext);

                // ^ Ignore workflow code segment
                #region Track Workflow
                this.flow.RecordResponse(createdPayment);
                #endregion

                // Using the `links` provided by the `createdPayment` object, we can give the user the option to redirect to PayPal to approve the payment.
                var links = createdPayment.links.GetEnumerator();
                while (links.MoveNext())
                {
                    var link = links.Current;
                    if (link.rel.ToLower().Trim().Equals("approval_url"))
                    {
                        this.flow.RecordRedirectUrl("Redirect to PayPal to approve the payment...", link.href);
                    }
                }
                Session.Add(guid, createdPayment.id);
                Session.Add("flow-" + guid, this.flow);
            }
            else
            {
                var guid = Request.Params["guid"];

                // ^ Ignore workflow code segment
                #region Track Workflow
                this.flow = Session["flow-" + guid] as RequestFlow;
                this.RegisterSampleRequestFlow();
                this.flow.RecordApproval("PayPal payment approved successfully.");
                #endregion

                // Using the information from the redirect, setup the payment to execute.
                var paymentId        = Session[guid] as string;
                var paymentExecution = new PaymentExecution()
                {
                    payer_id = payerId
                };
                var payment = new Payment()
                {
                    id = paymentId
                };

                // ^ Ignore workflow code segment
                #region Track Workflow
                this.flow.AddNewRequest("Execute PayPal payment", payment);
                #endregion

                // Execute the payment.
                var executedPayment = payment.Execute(apiContext, paymentExecution);
                // ^ Ignore workflow code segment
                #region Track Workflow
                this.flow.RecordResponse(executedPayment);
                #endregion

                // For more information, please visit [PayPal Developer REST API Reference](https://developer.paypal.com/docs/api/).
            }
        }
コード例 #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpContext CurrContext = HttpContext.Current;

            // ###Items
            // Items within a transaction.
            Item item = new Item();

            item.name     = "Item Name";
            item.currency = "USD";
            item.price    = "1";
            item.quantity = "5";
            item.sku      = "sku";

            List <Item> itms = new List <Item>();

            itms.Add(item);
            ItemList itemList = new ItemList();

            itemList.items = itms;

            // ###CreditCard
            // A resource representing a credit card that can be
            // used to fund a payment.
            CreditCardToken credCardToken = new CreditCardToken();

            credCardToken.credit_card_id = "CARD-5MY32504F4899612AKIHAQHY";

            // ###Details
            // Let's you specify details of a payment amount.
            Details details = new Details();

            details.shipping = "1";
            details.subtotal = "5";
            details.tax      = "1";

            // ###Amount
            // Let's you specify a payment amount.
            Amount amnt = new Amount();

            amnt.currency = "USD";
            // Total must be equal to the sum of shipping, tax and subtotal.
            amnt.total   = "7";
            amnt.details = details;

            // ###Transaction
            // A transaction defines the contract of a
            // payment - what is the payment for and who
            // is fulfilling it.
            Transaction tran = new Transaction();

            tran.amount      = amnt;
            tran.description = "This is the payment transaction description.";
            tran.item_list   = itemList;

            // The Payment creation API requires a list of
            // Transaction; add the created `Transaction`
            // to a List
            List <Transaction> transactions = new List <Transaction>();

            transactions.Add(tran);

            // ###FundingInstrument
            // A resource representing a Payer's funding instrument.
            // For stored credit card payments, set the CreditCardToken
            // field on this object.
            FundingInstrument fundInstrument = new FundingInstrument();

            fundInstrument.credit_card_token = credCardToken;

            // The Payment creation API requires a list of
            // FundingInstrument; add the created `FundingInstrument`
            // to a List
            List <FundingInstrument> fundingInstrumentList = new List <FundingInstrument>();

            fundingInstrumentList.Add(fundInstrument);

            // ###Payer
            // A resource representing a Payer that funds a payment
            // Use the List of `FundingInstrument` and the Payment Method
            // as 'credit_card'
            Payer payr = new Payer();

            payr.funding_instruments = fundingInstrumentList;
            payr.payment_method      = "credit_card";

            // ###Payment
            // A Payment Resource; create one using
            // the above types and intent as 'sale'
            Payment pymnt = new Payment();

            pymnt.intent       = "sale";
            pymnt.payer        = payr;
            pymnt.transactions = transactions;

            try
            {
                // ### Api Context
                // Pass in a `APIContext` object to authenticate
                // the call and to send a unique request id
                // (that ensures idempotency). The SDK generates
                // a request id if you do not pass one explicitly.
                // See [Configuration.cs](/Source/Configuration.html) to know more about APIContext..
                APIContext apiContext = Configuration.GetAPIContext();

                // Create a payment using a valid APIContext
                Payment createdPayment = pymnt.Create(apiContext);
                CurrContext.Items.Add("ResponseJson", Common.FormatJsonString(createdPayment.ConvertToJson()));
            }
            catch (PayPal.Exception.PayPalException ex)
            {
                CurrContext.Items.Add("Error", ex.Message);
            }
            CurrContext.Items.Add("RequestJson", Common.FormatJsonString(pymnt.ConvertToJson()));
            Server.Transfer("~/Response.aspx");
        }
コード例 #28
0
 public decimal ComputeAccount()
 {
     return(Details.Sum(config => config.ReturnCount * config.OrderItem.ItemPrice));
 }
コード例 #29
0
ファイル: RuleBase.cs プロジェクト: vletoux/pingcastle
 public void AddDetail(string detail)
 {
     Details.Add(detail);
 }
コード例 #30
0
ファイル: Program.cs プロジェクト: nassan/fireShare
            public Interaction(string username)
            {
                //Set the username member
                this.username = username;

                //Instantiate the default config
                config = new FirebaseConfig
                {
                    AuthSecret = "h2X1OAqY2EOs0vIsyhomap4PKS4vMjnQyv57tEJd",
                    BasePath = "https://firesharing.firebaseio.com/"
                };

                //Instantiate the Firebase client using the above config
                client = new FirebaseClient(config);

                //Define the base url for the user
                user_url = basename + username;

                //Prepare details for delivery
                details = new Details();
            }
コード例 #31
0
ファイル: VariableItem.cs プロジェクト: andyhebear/Continuum
        private void DoAdjustDetails(Details details, ThreadMirror thread, VariableItem parent, object key, object value)
        {
            // If the value is decorated with DebuggerTypeProxyAttribute then we need to
            // use a proxy value instead of the original value.
            object replacement = DoGetProxyValue(value, thread);

            // If a property or field of the value is decorated with DebuggerBrowsableAttribute
            // and RootHidden then we need to display just the value of that property or field.
            replacement = DoGetRootValue(replacement ?? value, thread);

            // If we found a replacement for the original value then,
            if (replacement != null)
            {
                // we need to use that value,
                details.Value = replacement;

                // the children will be those of the replacement,
                Item item = GetItem.Invoke(thread, parent != null ? parent.Value : null, key, replacement);
                details.NumberOfChildren = item.Count;

                // and if the replacement has a ToString or value attribute then use that.
                if (!string.IsNullOrEmpty(item.Text))
                    details.DisplayValue = item.Text;
            }

            // Special case for types or fields or properties that use DebuggerDisplayAttribute.
            // TODO: We don't support DebuggerDisplayAttribute used at the assembly level.
            string displayName, displayValue, displayType;
            DoGetDisplayDetails(key, details.Value, thread, out displayName, out displayValue, out displayType);
            if (displayName != null)
            {
                details.DisplayName = displayName;

                NumberOfChildren = 0;
            }

            if (displayValue != null)
                details.DisplayValue = displayValue;

            if (displayType != null)
                details.DisplayType = displayType;

            if (details.DisplayValue.Length == 0 && value is ArrayMirror)
            {
                var aa = (ArrayMirror) value;

                details.DisplayValue = string.Format("Length = {0}", aa.Length);
            }
        }
コード例 #32
0
        public override string ToString()
        {
            // Based on implementation of Exception.ToString in reference source.
            // Just inserts our Details into the output.
            var s = GetType().ToString();

            if (Message?.Length > 0)
            {
                s += ": " + Message;
            }
            if (Details?.Length > 0)
            {
                s += (Message?.Length > 0 ? Environment.NewLine + "Additional Details: " : ": ") + Details.Trim();
            }
            if (InnerException != null)
            {
                s += " ---> " + InnerException + Environment.NewLine + "   --- End of inner exception stack trace ---";
            }
            if (StackTrace != null)
            {
                s += Environment.NewLine + StackTrace;
            }
            return(s);
        }
コード例 #33
0
ファイル: ParserObject.cs プロジェクト: dlebansais/Wrist
        private IObjectProperty ParseProperty(IParsingSourceStream sourceStream)
        {
            IDeclarationSource NameSource;
            string             Details;

            ParserDomain.ParseStringPair(sourceStream, ':', out NameSource, out Details);

            string[] SplittedDetails  = Details.Split(',');
            string   PropertyTypeName = SplittedDetails[0].Trim();

            int MaximumLength = int.MaxValue;
            IDeclarationSource ObjectSource = null;

            for (int i = 1; i < SplittedDetails.Length; i++)
            {
                string   Detail         = SplittedDetails[i].Trim();
                string[] SplittedDetail = Detail.Split('=');
                int      ParsedLength;

                if (SplittedDetail.Length == 2 && SplittedDetail[0].Trim() == "maximum length" && int.TryParse(SplittedDetail[1].Trim(), out ParsedLength) && ParsedLength >= 0)
                {
                    if (MaximumLength == int.MaxValue)
                    {
                        MaximumLength = ParsedLength;
                    }
                    else
                    {
                        throw new ParsingException(97, sourceStream, "Maximum length specified more than once.");
                    }
                }

                else if (SplittedDetail.Length == 2 && SplittedDetail[0].Trim() == "object")
                {
                    if (ObjectSource == null)
                    {
                        ObjectSource = new DeclarationSource(SplittedDetail[1].Trim(), sourceStream);
                        if (string.IsNullOrEmpty(ObjectSource.Name))
                        {
                            throw new ParsingException(98, sourceStream, "Invalid empty object name.");
                        }
                    }
                    else
                    {
                        throw new ParsingException(99, sourceStream, "Object name specified more than once.");
                    }
                }

                else
                {
                    throw new ParsingException(100, sourceStream, $"Unknown specifier '{Detail}'.");
                }
            }

            string CSharpName = ParserDomain.ToCSharpName(NameSource.Source, NameSource.Name);

            if (PropertyTypeName == "string")
            {
                return(new ObjectPropertyString(NameSource, CSharpName, MaximumLength));
            }
            else if (PropertyTypeName == "readonly string")
            {
                return(new ObjectPropertyReadonlyString(NameSource, CSharpName));
            }
            else if (PropertyTypeName == "string dictionary")
            {
                return(new ObjectPropertyStringDictionary(NameSource, CSharpName));
            }
            else if (PropertyTypeName == "string list")
            {
                return(new ObjectPropertyStringList(NameSource, CSharpName));
            }
            else if (MaximumLength != int.MaxValue)
            {
                throw new ParsingException(101, sourceStream, "Specifiers 'maximum length' not valid for this property type.");
            }
            else if (PropertyTypeName == "integer")
            {
                return(new ObjectPropertyInteger(NameSource, CSharpName));
            }
            else if (PropertyTypeName == "enum")
            {
                return(new ObjectPropertyEnum(NameSource, CSharpName));
            }
            else if (PropertyTypeName == "boolean")
            {
                return(new ObjectPropertyBoolean(NameSource, CSharpName));
            }
            else if (PropertyTypeName == "item")
            {
                if (ObjectSource != null)
                {
                    return(new ObjectPropertyItem(NameSource, CSharpName, ObjectSource));
                }
                else
                {
                    throw new ParsingException(102, sourceStream, "Object name not specified for 'item'.");
                }
            }
            else if (PropertyTypeName == "items")
            {
                if (ObjectSource != null)
                {
                    return(new ObjectPropertyItemList(NameSource, CSharpName, ObjectSource));
                }
                else
                {
                    throw new ParsingException(103, sourceStream, "Object name not specified for 'items'.");
                }
            }
            else
            {
                throw new ParsingException(104, sourceStream, $"Unknown property type '{PropertyTypeName}'.");
            }
        }
コード例 #34
0
 public SalesOrderDetail Default0RemoveDetail()
 {
     return(Details.FirstOrDefault());
 }
コード例 #35
0
ファイル: AccountImpl.cs プロジェクト: cyyt/Lesktop
 public AccountInfo(DataRow data)
 {
     _detailsJson = new Details(this);
     m_ListNode = new LinkedListNode<AccountInfo>(this);
     Reset(data);
 }
コード例 #36
0
 public void Recalculate()
 {
     SubTotal = Details.Sum(d => d.LineTotal);
     TotalDue = SubTotal;
 }
コード例 #37
0
        public override OPResult Save()
        {
            if (!OrganizationListVM.IsSelfRunShop(VMGlobal.CurrentUser.OrganizationID))
            {
#if UniqueCode
                List <string> uniqueCodes = new List <string>();
                TraverseGridDataItems(
                    item =>
                {
                    if (item.UniqueCodes.Count > 0)
                    {
                        uniqueCodes.AddRange(item.UniqueCodes);
                    }
                }
                    );
                var ucarray = uniqueCodes.ToArray();
                var result  = this.CheckDataAvaliable(ucarray);
                if (!result.IsSucceed)
                {
                    return(result);
                }
                result =
#else
                var result =
#endif
                    this.CheckGoodReturnRate(VMGlobal.CurrentUser.OrganizationID);
                if (!result.IsSucceed)
                {
                    return(result);
                }
            }
            this.Master.TotalPrice = this.GridDataItems.Sum(o => o.Quantity * o.Price * o.Discount) / 100;//本单退货金额
            this.Master.Quantity   = this.GridDataItems.Sum(o => o.Quantity);
            var details = this.Details = new List <BillGoodReturnDetails>();
            TraverseGridDataItems(p =>
            {
                details.Add(new BillGoodReturnDetails {
                    ProductID = p.ProductID, Quantity = p.Quantity, Discount = p.Discount, Price = p.Price
                });
            });
            if (details.Count == 0)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "没有需要保存的数据"
                });
            }
            var opresult = BillWebApiInvoker.Instance.SaveBill <BillGoodReturn, BillGoodReturnDetails>(new BillBO <BillGoodReturn, BillGoodReturnDetails>()
            {
                Bill    = this.Master,
                Details = this.Details
            });
            if (opresult.IsSucceed)
            {
                var users = IMHelper.OnlineUsers.Where(o => o.OrganizationID == OrganizationListVM.CurrentOrganization.ParentID).ToArray();
                IMHelper.AsyncSendMessageTo(users, new IMessage
                {
                    Message = string.Format("{2}退货{0}件,单号{1},请注意查收.", Details.Sum(o => o.Quantity), Master.Code, OrganizationListVM.CurrentOrganization.Name)
                }, IMReceiveAccessEnum.退货单);
                this.Init();
            }
            return(opresult);
        }
コード例 #38
0
        public ActionResult PaymentWithCreditCard()
        {
            //create and item for which you are taking payment
            //if you need to add more items in the list
            //Then you will need to create multiple item objects or use some loop to instantiate object

            Item item = new Item
            {
                name     = "Demo Item1",
                currency = "USD",
                price    = "6",
                quantity = "2",
                sku      = "dhghftghjn"
            };

            //Now make a List of Item and add the above item to it
            //you can create as many items as you want and add to this list
            List <Item> itms = new List <Item> {
                item
            };
            ItemList itemList = new ItemList {
                items = itms
            };

            //Address for the payment
            Address billingAddress = new Address
            {
                city         = "NewYork",
                country_code = "US",
                line1        = "23rd street kew gardens",
                postal_code  = "43210",
                state        = "NY"
            };


            //Now Create an object of credit card and add above details to it
            //Please replace your credit card details over here which you got from paypal
            CreditCard crdtCard = new CreditCard
            {
                billing_address = billingAddress,
                cvv2            = "874",
                expire_month    = 1,
                expire_year     = 2020,
                first_name      = "Aman",
                last_name       = "Thakur",
                number          = "1234567890123456",
                type            = "visa"
            };
            //card cvv2 number
            //card expire date
            //card expire year
            //enter your credit card number here
            //credit card type here paypal allows 4 types

            // Specify details of your payment amount.
            Details details = new Details
            {
                shipping = "1",
                subtotal = "5",
                tax      = "1"
            };

            // Specify your total payment amount and assign the details object
            Amount amnt = new Amount
            {
                currency = "USD",
                total    = "7",
                details  = details
            };
            // Total = shipping tax + subtotal.

            // Now make a transaction object and assign the Amount object

            var guid = Guid.NewGuid().ToString();

            Transaction tran = new Transaction
            {
                amount         = amnt,
                description    = "Description about the payment amount.",
                item_list      = itemList,
                invoice_number = guid
            };

            // Now, we have to make a list of transaction and add the transactions object
            // to this list. You can create one or more object as per your requirements

            List <Transaction> transactions = new List <Transaction>
            {
                tran
            };

            // Now we need to specify the FundingInstrument of the Payer
            // for credit card payments, set the CreditCard which we made above

            FundingInstrument fundInstrument = new FundingInstrument
            {
                credit_card = crdtCard
            };

            // The Payment creation API requires a list of FundingIntrument

            List <FundingInstrument> fundingInstrumentList = new List <FundingInstrument>
            {
                fundInstrument
            };

            // Now create Payer object and assign the fundinginstrument list to the object
            Payer payr = new Payer
            {
                funding_instruments = fundingInstrumentList,
                payment_method      = "credit_card"
            };

            // finally create the payment object and assign the payer object & transaction list to it
            Payment pymnt = new Payment
            {
                intent       = "sale",
                payer        = payr,
                transactions = transactions
            };

            try
            {
                //getting context from the paypal
                //basically we are sending the clientID and clientSecret key in this function
                //to the get the context from the paypal API to make the payment
                //for which we have created the object above.

                //Basically, apiContext object has a accesstoken which is sent by the paypal
                //to authenticate the payment to facilitator account.
                //An access token could be an alphanumeric string

                APIContext apiContext = Configuration.GetAPIContext();

                //Create is a Payment class function which actually sends the payment details
                //to the paypal API for the payment. The function is passed with the ApiContext
                //which we received above.

                Payment createdPayment = pymnt.Create(apiContext);

                //if the createdPayment.state is "approved" it means the payment was successful else not

                if (createdPayment.state.ToLower() != "approved")
                {
                    return(View("FailureView"));
                }
            }
            catch (PayPal.PayPalException ex)
            {
                // Logger.Log("Error: " + ex.Message);
                return(View("FailureView"));
            }

            return(View("SuccessView"));
        }
コード例 #39
0
        /// <summary>
        /// Parse the KDB data
        /// </summary>
        /// <returns>A KDB object based on the parsed data</returns>
        public KDB Parse()
        {
            Stack<string> Recursion = new Stack<string>();
            string expectedRecursion = "", parentName = "";

            string[] lines = Code.Split(new string[] { GlobalData.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            for (int lineNum = 0; lineNum < lines.Length; lineNum++)
            {
                //Skip comments
                while (lines[lineNum].StartsWith("//") || string.IsNullOrWhiteSpace(lines[lineNum])) lineNum++;
                string line = lines[lineNum];

                //If it's an import statement
                if (line.StartsWith("import"))
                {
                    string codeBackup = Code;
                    Code = File.ReadAllText(line.Remove("import").Remove("\"").Trim()); //Get the file path specified
                    this.Parse();   //Parse the other file, doing it like this immediately adds all the other's information into our db
                    Code = codeBackup;  //Restore our backup
                }
                else if (line.StartsWith("component"))
                {
                    string info = line.Remove("component").Remove(":").Trim();
                    expectedRecursion = "\t";
                    string[] parts = info.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    Components.Add(parts[0].ToLower());   //Add the component name to the database
                    Add(parts[0].ToLower(), new Details() { Name = parts[0].ToLower(), Type = Types.Undefined });
                    parentName = parts[0].ToLower();
                    //Start extracting info
                    //if(parts[1] == "
                }
                else if (line.StartsWith("object"))
                {
                    string info = line.Remove("object").Remove(":").Trim();
                    expectedRecursion = "\t";
                    string[] parts = info.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    Objects.Add(parts[0].ToLower());   //Add the component name to the database
                    Add(parts[0].ToLower(), new Details() { Name = parts[0].ToLower(), Type = Types.Undefined });
                    parentName = parts[0].ToLower();
                    //Start extracting info
                    if (parts.Length >= 3 && parts[1] == "of")
                    {
                        string[] sections = parts[2].Remove("[").Remove("]").Trim().Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        foreach (string s in sections)
                        {
                            Add(parts[0].ToLower(), new Details() { Name = s.ToLower(), Type = Types.Child });
                        }
                    }
                    else if (parts.Length >= 3 && (parts[1] == "is" || parts[3] == "is"))
                    {
                        string[] sections = parts[(parts[1] == "is")?2:4].Remove("[").Remove("]").Trim().Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                        foreach (string s in sections)
                        {
                            Add(parts[0].ToLower(), new Details() { Name = s.ToLower(), Type = Types.Base });
                        }
                    }
                }
                else if (line.StartsWith(expectedRecursion + "var"))
                {
                    string[] parts = line.Remove(expectedRecursion + "var").Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    Details d = new Details();

                    Types t = Types.Undefined;

                         if (parts[0].Trim().ToLower() == "(property)") t = Types.Property;
                    else if (parts[0].Trim().ToLower() == "(int)") t = Types.Int;
                    else if (parts[0].Trim().ToLower() == "(string)") t = Types.String;
                    else if (parts[0].Trim().ToLower() == "(float)") t = Types.Float;
                    else if (parts[0].Trim().ToLower() == "(double)") t = Types.Double;

                    d.Type = t;
                    d.Name = parts[1].Trim().ToLower();

                    if (parts.Length >= 4)
                    {
                        string val = "";
                        for (int c = 3; c < parts.Length; c++)
                        {
                            val += " " + parts[c];
                        }
                        d.Value = val.Remove("\"").Trim();
                    }

                    Add(parentName, d);
                }

            }

            return GetKDB();
        }
コード例 #40
0
        private Payment CreatePayment(APIContext apiContext, string redirectUrl)
        {
            var shoppingCard = _orderProxy.GetShoppingCartForPaypal(User.Identity.GetUserId());
            //create itemlist and add item objects to it

            var itemList = new ItemList()
            {
                items = new List <Item>()
            };
            var lista = shoppingCard.PayPalList;

            //Adding Item Details like name, currency, price etc
            foreach (var i in lista)
            {
                itemList.items.Add(new Item()
                {
                    name     = i.Title,
                    currency = "DKK",
                    price    = decimal.Round(i.RatePerHour, 0, MidpointRounding.AwayFromZero).ToString(),
                    quantity = decimal.Round((i.HoursTo - i.HoursFrom).Hours, 0, MidpointRounding.AwayFromZero).ToString(),
                    sku      = "sku"
                });
            }

            var payer = new Payer()
            {
                payment_method = "paypal"
            };
            // Configure Redirect Urls here with RedirectUrls object
            var redirUrls = new RedirectUrls()
            {
                cancel_url = redirectUrl + "&Cancel=true",
                return_url = redirectUrl
            };
            // Adding Tax, shipping and Subtotal details
            var details = new Details()
            {
                tax      = "0",
                shipping = "0",
                subtotal = decimal.Round(shoppingCard.GetTotalPricePayPal(), 0, MidpointRounding.AwayFromZero).ToString()
            };
            //Final amount with details
            var amount = new Amount()
            {
                currency = "DKK",
                total    = decimal.Round(shoppingCard.GetTotalPricePayPal(), 0, MidpointRounding.AwayFromZero).ToString(), // Total must be equal to sum of tax, shipping and subtotal.
                details  = details
            };
            var transactionList = new List <PayPal.Api.Transaction>();

            // Adding description about the transaction
            transactionList.Add(new PayPal.Api.Transaction()
            {
                description    = "Transaction description",
                invoice_number = shoppingCard.RandomString(),
                amount         = amount,
                item_list      = itemList
            });
            this.payment = new Payment()
            {
                intent        = "sale",
                payer         = payer,
                transactions  = transactionList,
                redirect_urls = redirUrls
            };
            // Create a payment using a APIContext
            return(this.payment.Create(apiContext));
        }
コード例 #41
0
    private void PrintDetails(Details details)
    {
        System.Console.WriteLine("url: "+details.Url);
        System.Console.WriteLine("Asin; "+details.Asin);
        System.Console.WriteLine("ProductName; "+details.ProductName);
        System.Console.WriteLine("Catalog; "+details.Catalog);
        System.Console.WriteLine("image: "+details.ImageUrlLarge);

        System.Console.WriteLine("BrowseList: ");
        if (details.BrowseList != null) {
            foreach (BrowseNode bn in details.BrowseList) {
                System.Console.WriteLine("\t"+bn.BrowseId+" | "+bn.BrowseName);
            }
        }

        System.Console.WriteLine("KeyPhrases: ");
        if (details.KeyPhrases != null) {
            foreach (KeyPhrase k in details.KeyPhrases) {
                System.Console.WriteLine("\t"+k.KeyPhrase1+" | "+k.Type);
            }
        }

        System.Console.Write ("Artists: ");
        if (details.Artists != null) {
            foreach (string s in details.Artists) {
                System.Console.Write(s+",");
            }
        }
        System.Console.WriteLine();

        System.Console.Write("Authors: ");
        if (details.Authors != null) {
            foreach (string s in details.Authors) {
                System.Console.Write(s+", ");
            }
        }
        System.Console.WriteLine();

        System.Console.WriteLine("Mpn; "+details.Mpn);

        System.Console.Write("Starring: ");
        if (details.Starring != null) {
            foreach (string s in details.Starring) {
                System.Console.Write(s+", ");
            }
        }
        System.Console.WriteLine();

        System.Console.Write("Directors: ");
        if (details.Directors != null) {
            foreach (string s in details.Directors) {
                System.Console.Write(s+", ");
            }
        }
        System.Console.WriteLine();

        System.Console.WriteLine("TheatricalReleaseDate; "+details.TheatricalReleaseDate);
        System.Console.WriteLine("ReleaseDate; "+details.ReleaseDate);
        System.Console.WriteLine("Manufacturer; "+details.Manufacturer);
        System.Console.WriteLine("Distributor; "+details.Distributor);
        System.Console.WriteLine("MerchantId; "+details.MerchantId);
        System.Console.WriteLine("MultiMerchant; "+details.MultiMerchant);
        System.Console.WriteLine("MerchantSku; "+details.MerchantSku);
        System.Console.WriteLine("NumberOfOfferings; "+details.NumberOfOfferings);
        System.Console.WriteLine("ThirdPartyNewCount; "+details.ThirdPartyNewCount);
        System.Console.WriteLine("UsedCount; "+details.UsedCount);
        System.Console.WriteLine("CollectibleCount; "+details.CollectibleCount);
        System.Console.WriteLine("RefurbishedCount; "+details.RefurbishedCount);
        //              ThirdPartyProductInfo ThirdPartyProductInfo;
        System.Console.WriteLine("SalesRank; "+details.SalesRank);
        System.Console.WriteLine("Media; "+details.Media);
        System.Console.WriteLine("ReadingLevel; "+details.ReadingLevel);
        System.Console.WriteLine("NumberOfPages; "+details.NumberOfPages);
        System.Console.WriteLine("NumberOfIssues; "+details.NumberOfIssues);
        System.Console.WriteLine("IssuesPerYear; "+details.IssuesPerYear);
        System.Console.WriteLine("SubscriptionLength; "+details.SubscriptionLength);
        System.Console.WriteLine("DeweyNumber; "+details.DeweyNumber);
        System.Console.WriteLine("RunningTime; "+details.RunningTime);
        System.Console.WriteLine("Publisher; "+details.Publisher);
        System.Console.WriteLine("NumMedia; "+details.NumMedia);
        System.Console.WriteLine("Isbn; "+details.Isbn);

        System.Console.Write("Features: ");
        if (details.Features != null) {
            foreach (string s in details.Features) {
                System.Console.Write(s+", ");
            }
        }
        System.Console.WriteLine();

        System.Console.WriteLine("MpaaRating; "+details.MpaaRating);
        System.Console.WriteLine("EsrbRating; "+details.EsrbRating);
        System.Console.WriteLine("AgeGroup; "+details.AgeGroup);
        System.Console.WriteLine("Availability; "+details.Availability);
        System.Console.WriteLine("Upc; "+details.Upc);

        System.Console.Write("Accessories: ");
        if (details.Accessories != null) {
            foreach (string s in details.Accessories) {
                System.Console.Write(s+", ");
            }
        }
        System.Console.WriteLine();

        System.Console.Write("Platforms: ");
        if (details.Platforms != null) {
            foreach (string s in details.Platforms) {
                System.Console.Write(s+", ");
            }
        }
        System.Console.WriteLine();

        System.Console.WriteLine("Encoding; "+details.Encoding);
        System.Console.WriteLine("ProductDescription; "+details.ProductDescription);
        //              Reviews Reviews;

        System.Console.Write("Lists: ");
        if (details.Lists != null) {
            foreach (string s in details.Lists) {
                System.Console.Write(s+", ");
            }
        }
        System.Console.WriteLine();

        System.Console.WriteLine("Status; "+details.Status);
    }
コード例 #42
0
        // POST: api/Payment
        public PaymentResponse Post(PaymentDetails paymentDetails)
        {
            var creditCard = new CreditCard
            {
                cvv2         = paymentDetails.Cvv,
                expire_month = int.Parse(paymentDetails.ExpirationMonth),
                expire_year  = int.Parse(paymentDetails.ExpirationYear),
                number       = paymentDetails.CardNumber,
                type         = "visa"
            };

            var details = new Details
            {
                shipping = "0",
                subtotal = paymentDetails.Amount,
                tax      = "0",
            };

            var amount = new Amount
            {
                currency = "USD",
                total    = paymentDetails.Amount,
                details  = details,
            };

            var transaction = new Transaction
            {
                amount         = amount,
                invoice_number = Common.GetRandomInvoiceNumber()
            };

            var transactions = new List <Transaction> {
                transaction
            };

            var fundingInstrument = new FundingInstrument {
                credit_card = creditCard
            };

            var fundingInstruments = new List <FundingInstrument> {
                fundingInstrument
            };

            var payer = new Payer
            {
                funding_instruments = fundingInstruments,
                payment_method      = "credit_card"
            };

            var paymet = new Payment
            {
                intent       = "sale",
                payer        = payer,
                transactions = transactions
            };

            try
            {
                var apiContext    = Models.Configuration.GetApiContext();
                var createPayment = paymet.Create(apiContext);

                if (createPayment.state.ToLower() != "approved")
                {
                    return(new PaymentResponse
                    {
                        TransactionSuccessful = false,
                        Message = null
                    });
                }
            }
            catch (PayPal.PayPalException ex)
            {
                return(new PaymentResponse
                {
                    TransactionSuccessful = false,
                    Message = ex.InnerException?.Message
                });
            }
            return(new PaymentResponse
            {
                TransactionSuccessful = true,
                Message = null
            });
        }
コード例 #43
0
 public LoadContentBytesException(Details reason, string message, Exception innerException)
     : base(message, innerException)
 {
     Reason = reason;
 }
コード例 #44
0
ファイル: StringTest.cs プロジェクト: emilefraser/PyroSQL
        public void GetEscapedCharFailedTest()
        {
            var ch = Details.GetEscapedChar('F');

            Assert.True(ch.IsFailure);
        }
        /// <summary>
        /// Returns true if OrgApacheSlingDistributionAgentImplQueueDistributionAgentFactoryProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheSlingDistributionAgentImplQueueDistributionAgentFactoryProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheSlingDistributionAgentImplQueueDistributionAgentFactoryProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Details == other.Details ||
                     Details != null &&
                     Details.Equals(other.Details)
                 ) &&
                 (
                     Enabled == other.Enabled ||
                     Enabled != null &&
                     Enabled.Equals(other.Enabled)
                 ) &&
                 (
                     ServiceName == other.ServiceName ||
                     ServiceName != null &&
                     ServiceName.Equals(other.ServiceName)
                 ) &&
                 (
                     LogLevel == other.LogLevel ||
                     LogLevel != null &&
                     LogLevel.Equals(other.LogLevel)
                 ) &&
                 (
                     AllowedRoots == other.AllowedRoots ||
                     AllowedRoots != null &&
                     AllowedRoots.Equals(other.AllowedRoots)
                 ) &&
                 (
                     RequestAuthorizationStrategyTarget == other.RequestAuthorizationStrategyTarget ||
                     RequestAuthorizationStrategyTarget != null &&
                     RequestAuthorizationStrategyTarget.Equals(other.RequestAuthorizationStrategyTarget)
                 ) &&
                 (
                     QueueProviderFactoryTarget == other.QueueProviderFactoryTarget ||
                     QueueProviderFactoryTarget != null &&
                     QueueProviderFactoryTarget.Equals(other.QueueProviderFactoryTarget)
                 ) &&
                 (
                     PackageBuilderTarget == other.PackageBuilderTarget ||
                     PackageBuilderTarget != null &&
                     PackageBuilderTarget.Equals(other.PackageBuilderTarget)
                 ) &&
                 (
                     TriggersTarget == other.TriggersTarget ||
                     TriggersTarget != null &&
                     TriggersTarget.Equals(other.TriggersTarget)
                 ) &&
                 (
                     PriorityQueues == other.PriorityQueues ||
                     PriorityQueues != null &&
                     PriorityQueues.Equals(other.PriorityQueues)
                 ));
        }
コード例 #46
0
ファイル: StringTest.cs プロジェクト: emilefraser/PyroSQL
        public void GetEscapedCharTest(char input, char expected)
        {
            var ch = Details.GetEscapedChar(input);

            Assert.Equal(expected, ch.Value);
        }
コード例 #47
0
        public async Task<ActionResult> Details(Details.Query query)
        {
            var model = await _mediator.SendAsync(query);

            return View(model);
        }
コード例 #48
0
 public void AddDetail(productionDetail detail)
 {
     Details.Add(detail);
     RecalculatePercentage();
 }
コード例 #49
0
ファイル: VariableItem.cs プロジェクト: andyhebear/Continuum
        private Details DoGetDetails(ThreadMirror thread, string name, VariableItem parent, object key, object value)
        {
            Item item = GetItem.Invoke(thread, parent != null ? parent.Value : null, key, value);

            var details = new Details();
            details.Value = value;
            details.NumberOfChildren = item.Count;
            details.DisplayName = name;
            details.DisplayValue = item.Text;
            details.DisplayType = item.Type;

            DoAdjustDetails(details, thread, parent, key, value);

            return details;
        }
コード例 #50
0
        public async Task testBuildAndTransferPartingTransaction()
        {
            var publicKeyObj  = BlockchainAccount.publicKeyFromHex(publicKey);
            var privateKeyObj = BlockchainAccount.privateKeyFromHex(privateKey);

            Vehicle car = new Vehicle();

            car.id          = "92832938203903" + DateTime.Now.ToLongDateString();
            car.consumption = "20.9";

            // Set up, sign, and send your transaction
            var transaction = BigchainDbTransactionBuilder <Vehicle, object>
                              .init()
                              .addAssets(car)
                              .operation(Operations.CREATE)
                              .buildAndSignOnly(publicKeyObj, privateKeyObj);

            //.buildAndSign(account.PublicKey, account.PrivateKey);

            //var info = transaction.toHashInput();
            var createTransaction = await TransactionsApi <Vehicle, object> .sendTransactionAsync(transaction);

            createTransaction.Data.ShouldNotBe(null);
            // the asset's ID is equal to the ID of the transaction that created it
            if (createTransaction != null)
            {
                string testId2   = createTransaction.Data.Id;
                var    testTran2 = await TransactionsApi <object, object> .getTransactionByIdAsync(testId2);

                testTran2.ShouldNotBe(null);
            }

            // Describe the output you are fulfilling on the previous transaction
            FulFill spendFrom = new FulFill();

            // the asset's ID is equal to the ID of the transaction that created it
            spendFrom.TransactionId = createTransaction.Data.Id;
            spendFrom.OutputIndex   = 0;

            Mileage m = new Mileage();

            m.Amount = "2000";

            // By default, the 'amount' of a created digital asset == "1". So we spend "1" in our TRANSFER.
            string  amount  = "1";
            Details details = null;
            // Use the previous transaction's asset and TRANSFER it
            var build2 = BigchainDbTransactionBuilder <Mileage, object> .
                         init().
                         addInput(details, spendFrom, publicKeyObj).
                         addOutput(amount, publicKeyObj).
                         addAssets(createTransaction.Data.Id).
                         operation(Operations.TRANSFER).
                         buildAndSignOnly(publicKeyObj, privateKeyObj);

            var transferTransaction = await TransactionsApi <Mileage, object> .sendTransactionAsync(build2);

            transferTransaction.Data.ShouldNotBe(null);

            if (transferTransaction != null)
            {
                string tran2     = transferTransaction.Data.Id;
                var    testTran2 = await TransactionsApi <object, object> .getTransactionByIdAsync(tran2);

                testTran2.ShouldNotBe(null);
            }
        }
コード例 #51
0
        private Payment CreatePayment(APIContext apiContext, string redirectURL)
        {
            var itemList = new ItemList()
            {
                items = new List <Item>()
            };

            if (Session["cart"] != null)
            {
                List <Models.Home.Item> cart = (List <Models.Home.Item>)(Session["cart"]);

                foreach (var item in cart)
                {
                    itemList.items.Add(new Item()
                    {
                        name     = Convert.ToString(item.Product.ProductName),
                        currency = "USD",
                        price    = Convert.ToString(Convert.ToDecimal(item.Product.Price)),
                        // price = "1",
                        quantity = Convert.ToString(item.Quantity),
                        // quantity = "1",
                        sku = "sku"
                    }
                                       );
                    Console.WriteLine(Convert.ToString(item.Quantity));
                }

                var payer = new Payer()
                {
                    payment_method = "paypal"
                };

                var redirectURLs = new RedirectUrls()
                {
                    cancel_url = redirectURL + "&Cancel=true",
                    return_url = redirectURL
                };

                var details = new Details()
                {
                    tax      = "0.00",
                    shipping = "0.00",
                    subtotal = Convert.ToString(Convert.ToDecimal(Session["SessionTotal"]))
                               // subtotal = "1"
                };

                var amount = new Amount()
                {
                    currency = "USD",
                    total    = Convert.ToString(Convert.ToDecimal(Session["SessionTotal"])),
                    // total = "1",
                    details = details
                };

                var transactionList = new List <Transaction>();
                transactionList.Add(new Transaction()
                {
                    description    = "Transaction Description",
                    invoice_number = Convert.ToString((new Random()).Next(100000)),
                    amount         = amount,
                    item_list      = itemList
                });

                this.payment = new Payment()
                {
                    intent        = "sale",
                    payer         = payer,
                    redirect_urls = redirectURLs,
                    transactions  = transactionList
                };
            }

            return(this.payment.Create(apiContext));
        }
コード例 #52
0
        /// <summary>
        /// Processes the login verification.
        /// </summary>
        /// <param name="request">The request to process and verify.</param>
        /// <param name="type">The login connection type.</param>
        public static void Process(LoginRequest request, LoginConnectionType type)
        {
            short packetSize = -1;

            if (request.Buffer.RemainingAmount >= 2)
            {
                packetSize = request.Buffer.ReadShort(); // The size will vary depending on user's inputted username and password.
            }
            else
            {
                return;
            }

            if (request.Buffer.RemainingAmount >= packetSize)
            {
                Packet p = new Packet(request.Buffer.GetRemainingData());
                int    encryptedPacketSize = packetSize - packetSize - (36 + 1 + 1 + 2); // Shouldn't be under 0.

                int clientVersion = p.ReadInt();
                if (clientVersion != 508) // Check to make sure the client is 508.
                {
                    request.LoginStage = -3;
                    return;
                }

                // Client preferences.
                bool  lowMemory = p.ReadByte() == 1 ? true : false;
                bool  hd        = p.ReadByte() == 1 ? true : false;
                bool  resized   = p.ReadByte() == 1 ? true : false;
                short width     = p.ReadShort();
                short height    = p.ReadShort();

                p.Skip(141);

                int tmpEncryptPacketSize = p.ReadByte();
                if (tmpEncryptPacketSize != 10)
                {
                    int encryptPacketId = p.ReadByte();
                }

                // Session data.
                long clientKey = p.ReadLong(); // The client's session key.
                long serverKey = p.ReadLong(); // The client's server session key.

                // Hash verification.
                long longName = p.ReadLong();
                int  hash     = (int)(31 & longName >> 16); // Verify client session hash.
                if (hash != request.NameHash)               // Possibly a bot attack.
                {
                    request.LoginStage = -3;
                    return;
                }

                // User data.
                string username = longName.LongToString();
                string password = Hash.GetHash(username + Hash.GetHash(
                                                   p.ReadString(), HashType.SHA1), HashType.SHA1);

                // Try to load the account with the given details.
                Details details = new Details(request.Connection, username, password, hd, resized, clientKey, serverKey);
                Program.Logger.WriteDebug("Login request: " + details.ToString());
                GameEngine.World.CharacterManager.LoadAccount(details, type);
                request.Finished = true;
            }
            return;
        }