Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6963477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:47:48+00:00 2026-05-27T15:47:48+00:00

i am using nopcommerce 1.9 and in creating discount i have the following code

  • 0

i am using nopcommerce 1.9 and in creating discount i have the following code

discount = new Discount()
            {
                DiscountTypeId = (int)discountType,
                DiscountRequirementId = (int)discountRequirement,
                RequirementSpentAmount = requirementSpentAmount,
                RequirementBillingCountryIs = requirementBillingCountryIs,
                RequirementShippingCountryIs = requirementShippingCountryIs,
                DiscountLimitationId = (int)discountLimitation,
                LimitationTimes = limitationTimes,
                Name = name,
                UsePercentage = usePercentage,
                DiscountPercentage = discountPercentage,
                DiscountAmount = discountAmount,
                StartDate = discountStartDate,
                EndDate = discountEndDate,
                RequiresCouponCode = requiresCouponCode,
                CouponCode = couponCode
            };
            this.DiscountService.InsertDiscount(discount);

now my task is that in 'CouponCode = couponCode' i have to replace this coupon code from excel sheet column which is uploaded by client when he save the discount.

and this excel sheet can have 50000 coupon codes so each coupon have the same info of discount .

in this solution we have entity framework. and we have to store the data in this format

D1   10%    C1(coupon code from excel sheet)
D1   10%    C2(coupon code from excel sheet)
D1   10%    C3(coupon code from excel sheet)
D1   10%    C4(coupon code from excel sheet)
D1   10%    C5(coupon code from excel sheet)
D1   10%    C6(coupon code from excel sheet)
D1   10%    C7(coupon code from excel sheet)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:47:49+00:00Added an answer on May 27, 2026 at 3:47 pm
    if (fuXlsFile.PostedFile != null && !String.IsNullOrEmpty(fuXlsFile.FileName))
                {
                    DataTable dt = GetDataFromExcel(filePath, "Sheet1");
                    foreach (DataRow dr in dt.Rows)
                    {
                        discount = new Discount()
                    {
                        DiscountTypeId = (int)discountType,
                        DiscountRequirementId = (int)discountRequirement,
                        RequirementSpentAmount = requirementSpentAmount,
                        RequirementBillingCountryIs = requirementBillingCountryIs,
                        RequirementShippingCountryIs = requirementShippingCountryIs,
                        DiscountLimitationId = (int)discountLimitation,
                        LimitationTimes = limitationTimes,
                        Name = name,
                        UsePercentage = usePercentage,
                        DiscountPercentage = discountPercentage,
                        DiscountAmount = discountAmount,
                        StartDate = discountStartDate,
                        EndDate = discountEndDate,
                        RequiresCouponCode = requiresCouponCode,
                        CouponCode = dr[0].ToString()
                    };
    
    
                        this.DiscountService.InsertDiscount(discount);
                    }
                }
    

    i found the way to deal with this situation in this way.still i have to loop each record but i think this is the necessity of my work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
I have built a test website using nopCommerce open source , Everything is working
Using the following code, I'm able to successfully open a raw disk on my
Using online interfaces to a version control system is a nice way to have
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using MVC2 I have an AJAX form which is posting to a bound model.
using a binary search tree I need to add to a vector all int
Using report builder 3.0, I have a report that queries a cube. How do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.