Exemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = AddressId.GetHashCode();
         hashCode = (hashCode * 397) ^ (AnalyticsData != null ? AnalyticsData.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BillingAddress != null ? BillingAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ClientDetails != null ? ClientDetails.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (CustomerHash != null ? CustomerHash.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomerId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ HasUncommitedChanges.GetHashCode();
         hashCode = (hashCode * 397) ^ Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (LastName != null ? LastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Note != null ? Note.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ProcessedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (ProcessorName != null ? ProcessorName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ScheduledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ ShipmentsCount.GetHashCode();
         hashCode = (hashCode * 397) ^ (ShippingAddress != null ? ShippingAddress.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ShopifyOrderId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubTotal != null ? SubTotal.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ SubtotalPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ (Tags != null ? Tags.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TaxLines.GetHashCode();
         hashCode = (hashCode * 397) ^ (TotalDiscounts != null ? TotalDiscounts.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TotalLineItemsPrice != null ? TotalLineItemsPrice.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TotalPrice != null ? TotalPrice.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TotalRefunds != null ? TotalRefunds.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TotalTax.GetHashCode();
         hashCode = (hashCode * 397) ^ TotalWeight.GetHashCode();
         hashCode = (hashCode * 397) ^ (TransactionId != null ? TransactionId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         return(hashCode);
     }
 }
Exemplo n.º 2
0
        private void dgvGRN_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvGRN.Columns[e.ColumnIndex] == clmbtnDelete)
            {
                int index = dgvGRN.Rows.Count - 1;

                if (index == 0)
                {
                    int id = Convert.ToInt32(dgvGRN.Rows[dgvGRN.CurrentCell.RowIndex].Cells[clmItemID1.Name].Value);

                    GlobalSelectedItemList.RemoveAll(x => x.intItemID == id);

                    dgvGRN.DataSource = GlobalSelectedItemList.ToList();


                    decimal DiscountedVal = 0;;
                    decimal TotalPrice    = 0;
                    TotalPrice    = TotalPrice - DiscountedVal;
                    lblTotal.Text = TotalPrice.ToString("#,##0.00");

                    CalculateDiscountedPrice();
                }
                else
                {
                    int id = Convert.ToInt32(dgvGRN.Rows[dgvGRN.CurrentCell.RowIndex].Cells[clmItemID1.Name].Value);

                    decimal DiscountedVal = Convert.ToDecimal(dgvGRN.Rows[dgvGRN.CurrentCell.RowIndex].Cells[clmDiscountedValue.Name].Value);
                    TotalPrice    = TotalPrice - DiscountedVal;
                    lblTotal.Text = TotalPrice.ToString("#,##0.00");

                    GlobalSelectedItemList.RemoveAll(x => x.intItemID == id);

                    dgvGRN.DataSource = GlobalSelectedItemList.ToList();

                    CalculateDiscountedPrice();
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Overide the ToString() method;
        /// To generate the details(Receipt) of this order;
        /// </summary>
        /// <returns>A string description for this order</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            // Order Number
            sb.AppendLine("订单编号: " + OrderNumber);
            sb.AppendLine();

            // Order items
            foreach (OrderItem item in CartItemList)
            {
                sb.AppendLine(item.ToString());
            }
            sb.AppendLine();

            // Price, tax and discount for the order
            sb.AppendLine("价格: " + NetPrice.ToString("C2", CultureInfo.CreateSpecificCulture("en-NZ")));
            sb.AppendLine("邮费: " + TaxPrice.ToString("C2", CultureInfo.CreateSpecificCulture("en-NZ")));
            sb.AppendLine("折扣: -" + DiscountedTotalPrice.ToString("C2", CultureInfo.CreateSpecificCulture("en-NZ")));
            sb.AppendLine("总计价格: " + TotalPrice.ToString("C2", CultureInfo.CreateSpecificCulture("en-NZ")));

            return(sb.ToString());
        }
Exemplo n.º 4
0
        public override int GetHashCode()
        {
            int hashCode = -521319978;

            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <Accommodation> .Default.GetHashCode(Accommodation);

            hashCode = hashCode * -1521134295 + AccommodationId.GetHashCode();
            hashCode = hashCode * -1521134295 + _checkIn.GetHashCode();
            hashCode = hashCode * -1521134295 + CheckIn.GetHashCode();
            hashCode = hashCode * -1521134295 + _checkOut.GetHashCode();
            hashCode = hashCode * -1521134295 + CheckOut.GetHashCode();
            hashCode = hashCode * -1521134295 + TotalPrice.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <List <Guest> > .Default.GetHashCode(Guests);

            hashCode = hashCode * -1521134295 + EqualityComparer <Tourist> .Default.GetHashCode(HeadGuest);

            hashCode = hashCode * -1521134295 + GuestId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <Review> .Default.GetHashCode(Rating);

            hashCode = hashCode * -1521134295 + EqualityComparer <List <BookingStage> > .Default.GetHashCode(BookingHistory);

            return(hashCode);
        }
        public override string ToString()
        {
            string orderResults = "";

            orderResults += CustomerName + ": " + items.Count;
            if (items.Count > 1)
            {
                orderResults += " items.";
            }
            else
            {
                orderResults += " item.";
            }
            orderResults += "\nTotal Price: " + TotalPrice.ToString("C");
            if (Address != null)
            {
                orderResults += "\nShip to:\n" + Address;
            }
            else
            {
                orderResults += "\nLocal Pickup";
            }
            return(orderResults);
        }
Exemplo n.º 6
0
        private void Show()
        {
            string sql = " 1=1 ";

            if (txtFrom.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtFrom.Text.Trim()) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('申请日期 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and AppTime>='{0} 00:00:00'", txtFrom.Text);
            }

            if (txtTo.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtTo.Text.Trim()) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('申请日期 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and AppTime<='{0} 23:59:59'", txtTo.Text);
            }


            if (txtUseFromTime.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtUseFromTime.Text.Trim()) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('使用日期 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and useDate>='{0} 00:00:00'", txtUseFromTime.Text);
            }

            if (txtUseToTime.Text != "")
            {
                if (CommHelp.VerifesToDateTime(txtUseToTime.Text.Trim()) == false)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('使用日期 格式错误!');</script>");
                    return;
                }
                sql += string.Format(" and useDate<='{0} 23:59:59'", txtUseToTime.Text);
            }


            if (txtGuestName.Text.Trim() != "")
            {
                sql += string.Format(" and TB_UseCarDetail.GuestName like '%{0}%'", txtGuestName.Text.Trim());
            }


            if (txtDriver.Text != "")
            {
                sql += string.Format(" and Driver like '%{0}%'", txtDriver.Text);
            }

            if (txtAppName.Text != "")
            {
                sql += string.Format(" and LoginName like '%{0}%'", txtAppName.Text);
            }

            if (txtPONo.Text.Trim() != "")
            {
                if (CheckPoNO(txtPONo.Text.Trim()) == false)
                {
                    return;
                }
                sql += string.Format(" and TB_UseCarDetail.PONo like '%{0}%'", txtPONo.Text.Trim());
            }
            if (ddlCompany.Text != "-1")
            {
                string where = string.Format(" CompanyCode='{0}'", ddlCompany.Text.Split(',')[2]);
                sql         += string.Format(" and exists(select id from CG_POOrder where  IFZhui=0 and CG_POOrder.PONo=TB_UseCarDetail.PONo and AE IN(select LOGINNAME from tb_User where {0}))", where);
            }

            if (ddlCarNo.Text != "")
            {
                sql += string.Format(" and CarNo like '%{0}%'", ddlCarNo.Text);
            }
            if (txtProNo.Text.Trim() != "")
            {
                if (CheckProNo(txtProNo.Text) == false)
                {
                    return;
                }
                sql += string.Format(" and TB_UseCarDetail.ProNo like '%{0}%'", txtProNo.Text.Trim());
            }



            if (ddlIsSpecial.Text != "-1")
            {
                sql += " and IsSpecial=" + ddlIsSpecial.Text;
            }

            if (ddlClose.Text != "-1")
            {
                sql += " and IsClose=" + ddlClose.Text;
            }

            if (ddlIsSelect.Text != "-1")
            {
                sql += " and IsSelected=" + ddlIsSelect.Text;
            }
            if (ddlGuestTypeList.Text != "全部")
            {
                sql += string.Format(" and CG_POOrder.GuestType='{0}'", ddlGuestTypeList.Text);
            }
            if (ddlGuestProList.Text != "-2")
            {
                sql += " and CG_POOrder.GuestPro=" + ddlGuestProList.Text;
            }
            if (ddlModel.Text != "全部")
            {
                sql += string.Format(" and Model='{0}'", ddlModel.Text);
            }
            if (ddlJieIsSelected.Text != "-1")
            {
                sql += " and JieIsSelected=" + ddlJieIsSelected.Text;
            }


            if (ddlUser.Text == "-1")//显示所有用户
            {
            }
            else if (ddlUser.Text == "0")//显示部门信息
            {
                var model = Session["userInfo"] as User;
                sql += string.Format(" and CG_POOrder.AE in (select loginName from tb_User where 1=1 and loginName<>'admin' and loginStatus<>'离职' and loginIPosition<>'' and loginIPosition='{0}')", model.LoginIPosition);
            }
            else
            {
                sql += string.Format(" and CG_POOrder.AE='{0}'", ddlUser.SelectedItem.Text);
            }

            sql += string.Format(@" and TB_UseCarDetail.id in (select allE_id from tb_EForm where proId in (
select pro_Id from A_ProInfo where pro_Type='用车明细表') and state='通过')");
            decimal Total = 0;
            decimal TotalPrice;
            List <TB_UseCarDetail> UseCarServices = this.useCarSer.GetListArrayReps_1(sql, out Total, out TotalPrice);

            lblTotal.Text            = Total.ToString();
            lblTotalPrice.Text       = TotalPrice.ToString();
            AspNetPager1.RecordCount = UseCarServices.Count;
            this.gvList.PageIndex    = AspNetPager1.CurrentPageIndex - 1;
            this.gvList.DataSource   = UseCarServices;
            this.gvList.DataBind();
        }
Exemplo n.º 7
0
        private void add_Click(object sender, EventArgs e)
        {
            int a = 0;
            //count rows
            //int rows =  Orderdgv.Rows.Count;
            //rows = rows - 1;
            int insertid = 0;
            //Count number of products from grid view
            int sum = 0;

            for (int i = 0; i < Orderdgv.Rows.Count; ++i)
            {
                sum += Convert.ToInt32(Orderdgv.Rows[i].Cells[3].Value);
            }
            // MessageBox.Show(sum.ToString()) ;



            //Remaining amount checks
            if (ReceivedAmount.Text == "")
            {
                if (Convert.ToInt32(TotalPrice.Text) < 0)
                {
                    ReceivedAmount.Text = TotalPrice.Text;
                    ReceivedAmount.Text = "-" + ReceivedAmount.Text;
                }
                ReceivedAmount.Text = TotalPrice.Text;
            }
            //inseted bill id

            int remaining = Convert.ToInt32(ReceivedAmount.Text) - Convert.ToInt32(TotalPrice.Text);

            if (remaining < 0)
            {
                MessageBox.Show("INVALID AMOUNT RECEIVED");
            }
            else
            {
                try
                {
                    //Add BIll details into billdb
                    // only add billid,qty,amount , seller name
                    MessageBox.Show(a.ToString());
                    a++;
                    DateTime dateTime = DateTime.Now;
                    Con.Open();
                    String query = "insert into billdb (items, amount, seller,date) values('" + sum.ToString() + "','" + TotalPrice.Text + "','"
                                   + Form1.SetValueForText1 + "','" + dateTime.ToShortDateString() + "'); select @@identity;";
                    SqlCommand cmd = new SqlCommand(query, Con);
                    //cmd.ExecuteNonQuery();
                    insertid = int.Parse(cmd.ExecuteScalar().ToString());
                    MessageBox.Show(insertid.ToString());

                    Con.Close();
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }

                int check = Convert.ToInt32(TotalPrice.Text);

                if (check < 0)
                {
                    MessageBox.Show("Total Products = " + sum.ToString() + "\n" + "Total Bill = " + TotalPrice.Text + "\n" + "Customer Remaining Change = " + remaining);
                }
                if (check > 0)
                {
                    //Show the change
                    MessageBox.Show("Total Products = " + sum.ToString() + "\n" + "Total Bill = " + TotalPrice.Text + "\n" + "Amount Recieved= " + ReceivedAmount.Text + "\n" + "Change = " + remaining);
                }

                int i = 0;
                //MessageBox.Show("Yahan se");

                //

                //Insert items into table

                //
                for (i = 0; i < Orderdgv.Rows.Count - 1; i++)
                {
                    try
                    {
                        Con.Open();
                        // MessageBox.Show("Yahse");
                        string StrQuery = "INSERT INTO solditems (pid,billid, pname, pprice,pqty,total) VALUES ('" + Orderdgv.Rows[i].Cells[0].Value + "', '" + insertid + "', '"
                                          + Orderdgv.Rows[i].Cells[1].Value + "', '" + Orderdgv.Rows[i].Cells[2].Value + "', '" + Orderdgv.Rows[i].Cells[3].Value + "', '" + Orderdgv.Rows[i].Cells[4].Value + "')";
                        SqlCommand cmd = new SqlCommand(StrQuery, Con);
                        cmd.ExecuteNonQuery();
                        Con.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        Con.Close();
                    }
                }



                Orderdgv.Rows.Clear();
                ProQty.Clear();
                ProName.Clear();
                ProPrice.Clear();
                TotalPrice.Clear();
                ReceivedAmount.Clear();
            }
        }
Exemplo n.º 8
0
        /*
         * Event Handler for Display Button
         * It will Calculate Fees based on User provided Term input
         * Also It will validate Term provided
         */
        private void DisplayButton_Click(object sender, EventArgs e)
        {
            decimal PerMonthPrice, TotalPrice;
            int     TermInput;

            if (TermTextBox.Text == "")
            {
                MessageBox.Show("Term can not be blank. Please enter input in months", "Blank Entry Not allowed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TermTextBox.Focus();
                TermTextBox.SelectAll();
            }
            else
            {
                try
                {
                    TermInput = int.Parse(TermTextBox.Text);
                    if (TermInput < 0)
                    {
                        MessageBox.Show("Please Enter Positive Number", "Negative Number not Allowed in Terms", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        TermTextBox.Focus();
                        TermTextBox.SelectAll();
                    }
                    else if (TermInput == 0)
                    {
                        MessageBox.Show("Term can not be Zero. Please enter valid input", "Zero Terms not allowed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        TermTextBox.Focus();
                        TermTextBox.SelectAll();
                    }
                    else
                    {
                        //Fetching Per Month price
                        PerMonthPrice = CalculatePerMonth(TermInput);
                        //Fetching Total Fees
                        TotalPrice = CalculateTotalFees(TermInput);

                        //Assigning Details of fees
                        PricePerMonthLabel.Text = "€ " + PerMonthPrice.ToString("N2");
                        PriceFullTermLabel.Text = "€ " + TotalPrice.ToString("N2");
                        EnquiredPrice           = TotalPrice;

                        //Fetching Next Term based on current Term
                        NextMonth = NextTermMonth(TermInput);
                        //If Next month is more than limit
                        if (TermInput > MONTH12)
                        {
                            NextTermLabel.Text      = NEXTTERMTEXT;
                            PriceNextTermLabel.Text = "N.A.";
                            PitchLabel.Text         = "Kudos! You are about to avail maximum Discount of 66.66%! Confirm Soon!!";
                        }
                        else
                        {
                            TotalPrice              = CalculateTotalFees(NextMonth);
                            SuggestedPrice          = TotalPrice;
                            NextTermLabel.Text      = NEXTTERMTEXT + " for " + NextMonth.ToString() + " Month(s)";
                            PriceNextTermLabel.Text = "€ " + TotalPrice.ToString("N2");
                            if (GetDiscount(NextMonth) == DISCOUNT7)
                            {
                                PitchLabel.Text = "Pay €" + (SuggestedPrice).ToString() + " to get  " + (NextMonth - TermInput).ToString() + " Month(s) at whooping " + GetDiscount(NextMonth).ToString() + "% Discount";
                            }
                            else
                            {
                                PitchLabel.Text = "Pay additional €" + (SuggestedPrice - EnquiredPrice).ToString() + " to get extra " + (NextMonth - TermInput).ToString() + " Month(s) at whooping " + GetDiscount(NextMonth).ToString() + "% Discount";
                            }
                        }



                        ClientConfirmedTextBox.Focus();
                    }
                }
                catch
                {
                    MessageBox.Show("Invalid input provided for Terms. Please provide number", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    TermTextBox.Focus();
                    TermTextBox.SelectAll();
                }
            }
        }
Exemplo n.º 9
0
        private void button1A2C_Click(object sender, EventArgs e)
        {
            if (dataGridViewItems.SelectedRows.Count == 1)
            {
                if (string.IsNullOrWhiteSpace(textBox1Qnt.Text) || textBox1Qnt.Text == "0")
                {
                    MessageBox.Show("Please enter a quantity");
                }
                else
                {
                    int price; int quantity; int TotalPrice; int stock;
                    price      = Convert.ToInt32(textBox_Price.Text);
                    quantity   = Convert.ToInt32(textBox1Qnt.Text);
                    stock      = Convert.ToInt32(textBox_Stock.Text);
                    TotalPrice = Convert.ToInt32(textBox_TP.Text);
                    //

                    price      *= quantity;
                    TotalPrice += price;
                    //stockLeft = stockLeft - quantity;

                    if (quantity > stock)
                    {
                        MessageBox.Show("Not available");
                    }
                    else
                    {
                        stock -= quantity;
                        textBox_Stock.Text = (stock.ToString());
                        textBox_Price.Text = (price.ToString());
                        textBox_TP.Text    = (TotalPrice.ToString());
                        // textBox_Leftstock.Text = (stockLeft.ToString());

                        int row;
                        dataGridViewCart.Rows.Add();
                        row = dataGridViewCart.Rows.Count - 2;
                        dataGridViewCart["Item", row].Value      = label_item.Text;
                        dataGridViewCart["Quantity", row].Value  = textBox1Qnt.Text;
                        dataGridViewCart["Price", row].Value     = textBox_Price.Text;
                        dataGridViewCart["ID", row].Value        = label_ID.Text;
                        dataGridViewCart["StockLeft", row].Value = textBox_Stock.Text;


                        int selectedRowCount = dataGridViewItems.Rows.GetRowCount(DataGridViewElementStates.Selected);
                        //int selectedRowIndex = dataGridViewItems.CurrentCell.RowIndex;

                        if (selectedRowCount > 1)
                        {
                            MessageBox.Show("Please select a single row");
                        }
                        else
                        {
                            string        cn_string     = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\LENOVO\source\repos\SemesterDemo\SemesterDemo\DB_SAF.mdf;Integrated Security=True;Connect Timeout=30";
                            SqlConnection cn_connection = new SqlConnection(cn_string);
                            if (cn_connection.State != ConnectionState.Open)
                            {
                                cn_connection.Open();
                            }

                            string     sql = "UPDATE Catalogue SET [Stock]='" + textBox_Stock.Text + "' WHERE Id = " + label_ID.Text;
                            SqlCommand cmd = new SqlCommand(sql, cn_connection);
                            cmd.ExecuteNonQuery();
                            loadtbl_data();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select one row to add");
            }
        }
Exemplo n.º 10
0
 private bool Equals(OutputDtoQueryOrder other)
 {
     return(Id == other.Id && IsPaid == other.IsPaid && TotalPrice.Equals(other.TotalPrice) &&
            Ordered.Equals(other.Ordered) && ListEquals(OrderedItems, other.OrderedItems));
 }
Exemplo n.º 11
0
        public async Task <IActionResult> OnGet()
        {
            //ApplicationUser = await userManager.GetUserAsync(User);
            //if (ApplicationUser != null)
            //{
            //    if (ApplicationUser.IsMember)
            //    {
            //        var membership = membershipData.GetMembershipById(ApplicationUser.MembershipId.Value);
            //        ApplicationUser.Membership = membership;
            //    }


            //    if (HttpContext.Session.GetObjectFromJson<List<ShoppingCart>>("CartItems") != null)
            //    {
            //        CartItems = HttpContext.Session.GetObjectFromJson<List<ShoppingCart>>("CartItems").ToList();


            //        if (ApplicationUser.IsMember)
            //        {

            //            TotalPrice = cartBL.TotalPrice(CartItems, ApplicationUser.Membership.Discount);
            //        }
            //        else
            //        {
            //            TotalPrice = cartBL.TotalPrice(CartItems, 0);
            //        }
            //    }

            //    HttpContext.Session.SetString("TotalPrice", TotalPrice.ToString());
            //}
            //CartItems = HttpContext.Session.GetObjectFromJson<List<ShoppingCart>>("CartItems").ToList();

            //return Page();


            if (HttpContext.Session.GetObjectFromJson <List <ShoppingCart> >("CartItems") != null)
            {
                CartItems       = HttpContext.Session.GetObjectFromJson <List <ShoppingCart> >("CartItems").ToList();
                ApplicationUser = await userManager.GetUserAsync(User);

                if (ApplicationUser != null)
                {
                    if (ApplicationUser.IsMember)
                    {
                        var membership = membershipData.GetMembershipById(ApplicationUser.MembershipId.Value);
                        ApplicationUser.Membership = membership;
                        TotalPrice = cartBL.TotalPrice(CartItems, ApplicationUser.Membership.Discount);
                    }
                    else
                    {
                        TotalPrice = cartBL.TotalPrice(CartItems, 0);
                    }
                }
                else
                {
                    TotalPrice = cartBL.TotalPrice(CartItems, 0);
                }
                HttpContext.Session.SetString("TotalPrice", TotalPrice.ToString());
            }
            return(Page());
        }
Exemplo n.º 12
0
        public decimal PromptForPayment()
        {
            _prompt.Message = "\n" +
                              "Please pay for your order using " + PaymentType.ToLower() + ". Enter the amount to pay:";

            //Get input and trim any $ symbol, the user might have specified.
            string userResponse = Prompt.CleanCurrencyInput(_prompt.GetUserInput());


            while (!decimal.TryParse(userResponse, out decimal num) || Convert.ToDecimal(userResponse) < TotalPrice) // while not a decimal value that is at least the amount requested
            {
                // Validate Payment (did they give enough money?)
                if (decimal.TryParse(userResponse, out num) && (Convert.ToDecimal(userResponse) < TotalPrice))
                {
                    _prompt.Message = "Inadequate amount received. You are " + (TotalPrice - Convert.ToDecimal(userResponse)).ToString("C") + " short. Please pay the full amount: " + TotalPrice.ToString("C");
                }
                else
                {
                    _prompt.Message = "That is not a valid numeric response. Please enter a number:";
                }

                //Get input and trim any $ symbol, the user might have specified.
                userResponse = Prompt.CleanCurrencyInput(_prompt.GetUserInput());
            }
            return(Convert.ToDecimal(userResponse));
        }
Exemplo n.º 13
0
 public void UpdateTotalPrice()
 {
     TotalPrice       = ShoppingCart.TotalPrice;
     TotalPriceString = $"{TotalPrice.ToString()} kr.";
 }
Exemplo n.º 14
0
 Sale()
 {
    Line line = new Line()
    TotalPrice();
     Console.WriteLine("Your Shopping Bag is " + Sale.lines.ToString() + "With a Total of " + TotalPrice.ToStirng());
 }
Exemplo n.º 15
0
Arquivo: Order.cs Projeto: p8b/OSnack
        internal async Task <PayPalCheckoutSdk.Orders.Order> ConvertToPayPalOrder()
        {
            OrderRequest orderRequest = new OrderRequest();

            orderRequest.CheckoutPaymentIntent = "CAPTURE";
            orderRequest.ApplicationContext    = new ApplicationContext()
            {
                BrandName          = AppConst.Settings.BrandName,
                UserAction         = "CONTINUE",
                ShippingPreference = "SET_PROVIDED_ADDRESS",
            };

            orderRequest.PurchaseUnits = new List <PurchaseUnitRequest>()
            {
                new PurchaseUnitRequest()
                {
                    ReferenceId         = "PUHF",
                    Description         = "Snacks and food products",
                    CustomId            = "CUST-HighFashions",
                    SoftDescriptor      = "Snacks",
                    AmountWithBreakdown = new AmountWithBreakdown()
                    {
                        CurrencyCode    = AppConst.Settings.PayPal.CurrencyCode,
                        Value           = TotalPrice.ToString("0.00"),
                        AmountBreakdown = new AmountBreakdown()
                        {
                            ItemTotal = new Money()
                            {
                                CurrencyCode = AppConst.Settings.PayPal.CurrencyCode,
                                Value        = TotalItemPrice.ToString("0.00")
                            },
                            Shipping = new Money()
                            {
                                CurrencyCode = AppConst.Settings.PayPal.CurrencyCode,
                                Value        = ShippingPrice.ToString("0.00")
                            },
                            Discount = new Money()
                            {
                                CurrencyCode = AppConst.Settings.PayPal.CurrencyCode,
                                Value        = TotalDiscount.ToString("0.00")
                            }
                        }
                    },
                    Items = ConvertItem(),
                }
            };
            if (User != null)
            {
                orderRequest.PurchaseUnits.FirstOrDefault().ShippingDetail = new ShippingDetail()
                {
                    Name = new Name()
                    {
                        FullName = $"{User.FirstName} {User.Surname}"
                    },
                    AddressPortable = new AddressPortable()
                    {
                        AddressLine1 = FirstLine,
                        AddressLine2 = SecondLine,
                        PostalCode   = Postcode,
                        CountryCode  = "GB",
                        AdminArea1   = "UK",
                        AdminArea2   = City
                    },
                };
                orderRequest.Payer = new Payer()
                {
                    Email = User.Email,
                    Name  = new Name()
                    {
                        GivenName = User.FirstName,
                        Surname   = User.Surname
                    },
                    AddressPortable = new AddressPortable()
                    {
                        AddressLine1 = FirstLine,
                        AddressLine2 = SecondLine,
                        PostalCode   = Postcode,
                        CountryCode  = "GB",
                        AdminArea2   = City
                    }
                };
            }
            else
            {
                orderRequest.ApplicationContext.ShippingPreference = "GET_FROM_FILE";
            }
            OrdersCreateRequest request = new OrdersCreateRequest();

            request.Prefer("return=representation");

            request.RequestBody(orderRequest);
            var response = await PayPalClient.client().Execute(request).ConfigureAwait(false);

            PayPalCheckoutSdk.Orders.Order paypalOrder = response.Result <PayPalCheckoutSdk.Orders.Order>();

            return(paypalOrder);
        }
Exemplo n.º 16
0
        protected override void Bottom(Section section)
        {
            var textFrame = section.AddTextFrame();

            textFrame.RelativeVertical = RelativeVertical.Page;
            textFrame.Top = ShapePosition.Bottom;
            //textFrame.Width = section.PageSetup.PageWidth;
            //textFrame.Height = "5.5cm";

            Table table = textFrame.AddTable();

            table.Borders.Visible = false;

            table.AddColumn(GetWidth(section) * 0.2);
            table.AddColumn(GetWidth(section) * 0.3);
            table.AddColumn(GetWidth(section) * 0.24);
            table.AddColumn(GetWidth(section) * 0.1);
            table.AddColumn(GetWidth(section) * 0.16);

            Row row = table.AddRow();

            row.Height              = "0.5cm";
            row.Format.Alignment    = ParagraphAlignment.Right;
            row.Style               = "BottomTaxes";
            row.Cells[0].MergeRight = 3;
            row.Cells[0].AddParagraph("Arvonlisäveroton hinta");
            row.Cells[4].AddParagraph(TotalTaxless.ToString("C", System.Globalization.CultureInfo.CurrentCulture));

            row                     = table.AddRow();
            row.Height              = "0.5cm";
            row.Format.Alignment    = ParagraphAlignment.Right;
            row.Style               = "BottomTaxes";
            row.Cells[0].MergeRight = 3;
            row.Cells[0].AddParagraph("Arvonlisävero yhteensä");
            row.Cells[4].AddParagraph(TotalTax.ToString("C", System.Globalization.CultureInfo.CurrentCulture));

            row.Borders.Bottom.Style = BorderStyle.Single;;

            row       = table.AddRow();
            row.Style = "BottomHeader";
            row.Cells[0].AddParagraph("Eräpäivä");
            row.Cells[1].AddParagraph("Viitenumero");
            row.Height = "0.6cm";

            row.Cells[2].AddParagraph("Maksettava yhteensä");
            row.Cells[2].Format.Alignment = ParagraphAlignment.Right;
            row.Cells[2].MergeRight       = 1;
            row.Cells[2].Style            = "BottomTotal";

            row.Cells[4].AddParagraph(TotalPrice.ToString("C", System.Globalization.CultureInfo.CurrentCulture));
            row.Cells[4].Format.Alignment = ParagraphAlignment.Right;
            row.Cells[4].Style            = "BottomValue";

            row       = table.AddRow();
            row.Style = "Heading3";
            row.Cells[0].AddParagraph(DueDate.ToShortDateString());
            row.Cells[1].AddParagraph(Invoice.Reference);

            row.Borders.Bottom.Style = BorderStyle.Single;

            Row row1 = table.AddRow();

            row1.Style = "BottomHeader";
            row1.Cells[0].AddParagraph("BIC");
            row1.Cells[1].AddParagraph("IBAN");
            row1.Height = "0.6cm";

            row       = table.AddRow();
            row.Style = "BottomValue";
            row.Cells[0].AddParagraph(Company.BIC);
            row.Cells[1].AddParagraph(Company.IBAN);
            row.Cells[1].MergeRight = 1;

            table.AddRow();

            row1.Cells[2].MergeDown = 2;
            row1.Cells[2].Style     = "BottomInfo";
            row1.Cells[2].AddParagraph(Company.Name);
            if (Company.ContactPerson != null)
            {
                row1.Cells[2].AddParagraph(Company.ContactPerson);
            }
            row1.Cells[2].AddParagraph(Company.Address);
            row1.Cells[2].AddParagraph($"{Company.PostalCode} {Company.City}" + (Company.Country != null ? " / " + Company.Country : ""));

            row1.Cells[3].MergeDown  = 2;
            row1.Cells[3].MergeRight = 1;
            row1.Cells[3].Style      = "BottomInfo";
            if (Company.Phone != null)
            {
                row1.Cells[3].AddParagraph(Company.Phone);
            }
            if (Company.Email != null)
            {
                row1.Cells[3].AddParagraph(Company.Email);
            }
            if (Company.WebPage != null)
            {
                row1.Cells[3].AddParagraph(Company.WebPage);
            }
            row1.Cells[3].AddParagraph("Y-tunnus " + Company.CompanyID);

            table.AddRow().Height = "0.5cm";

            Unit tableHeight = 0;

            foreach (Row r in table.Rows)
            {
                tableHeight += r.Height;
            }

            textFrame.Height = tableHeight + section.PageSetup.BottomMargin;
        }
Exemplo n.º 17
0
 private bool Equals(OutputDtoQueryUserBaggedItem other)
 {
     return(BagOwner.Equals(other.BagOwner) && TotalPrice.Equals(other.TotalPrice) && ListEquals(Items, other.Items));
 }
Exemplo n.º 18
0
 public string GetFormattedTotalPrice()
 => TotalPrice.ToString("0.00");
 private void BillingConfirmationWindow_Loaded(object sender, RoutedEventArgs e)
 {
     tblTotalAmount.Text = TotalPrice.ToString("C0");
 }
Exemplo n.º 20
0
        private static byte[] GetReceiptBytes(ReceiptData receiptData)
        {
            Assure.ArgumentNotNull(receiptData, nameof(receiptData));

            var kioskAppSettings = ComponentManager.Current.GetComponent <IKioskAppSettingsContract>().State;
            var now                = DateTime.Now;
            var kioskAddress       = kioskAppSettings.KioskAddress;
            var kioskAddressParts  = new[] { kioskAddress?.AddressLine2, kioskAddress?.City, kioskAddress?.AddressLine1 };
            var kioskAddressString = string.Join(", ", kioskAddressParts.Where(x => !string.IsNullOrEmpty(x)));

            string deliveryTypeString;

            string[] deliveryAddressParts;
            switch (receiptData.DeliveryInfo?.Type)
            {
            case EkDeliveryTypeEnum.DeliveryServiceStore:
                deliveryTypeString   = "Самовывоз из Новой Почты";
                deliveryAddressParts = new[]
                {
                    receiptData.DeliveryInfo?.Address?.City,
                    // address line contains branch number
                    receiptData.DeliveryInfo?.Address?.AddressLine1
                };
                break;

            default:
            case EkDeliveryTypeEnum.Courier:
                deliveryTypeString   = "Курьер";
                deliveryAddressParts = new[]
                {
                    receiptData.DeliveryInfo?.Address?.City,
                    receiptData.DeliveryInfo?.Address?.AddressLine1
                };
                break;
            }

            var deliveryAddressString = string.Join(", ", deliveryAddressParts.Where(x => !string.IsNullOrEmpty(x)));

            var productsStringBuilder = new StringBuilder();

            if (receiptData.Products?.Length > 0)
            {
                for (var i = 0; i < receiptData.Products.Length; i++)
                {
                    var product           = receiptData.Products[i];
                    var totalProductPrice = product.Price * product.Quantity;
                    productsStringBuilder.AppendLine(
                        $@"{EscP.ALIGN_LEFT}{i + 1}. {product.Name.FirstNSymbols(100)}
   {product.Quantity} x {product.Price.ToAmountString(false)} = {totalProductPrice.ToAmountString(false)} {product.PriceCurrencyCode}");
                }
            }

            var message = $@"{EscP.INIT}{EscP.SET_LEFT_MARGIN}{EscP.ALIGN_LEFT}{EscP.SET_B_MODE}{EscP.SET_BOLD}Номер терминала: {EscP.CLEAR_BOLD}{kioskAppSettings.KioskId}
{EscP.SET_BOLD}Адрес терминала: {EscP.CLEAR_BOLD}{kioskAddressString}
{EscP.SET_BOLD}Дата: {EscP.CLEAR_BOLD}{now:dd.MM.yyyy} {EscP.SET_BOLD}Время: {EscP.CLEAR_BOLD}{now:HH:mm:ss}
{EscP.SET_BOLD}Номер операции: {EscP.CLEAR_BOLD}{receiptData.ReceiptNumber}

{EscP.SET_A_MODE}{EscP.ALIGN_CENTER}{EscP.SET_BOLD}ЗАКАЗ ТОВАРОВ/УСЛУГ{EscP.CLEAR_BOLD}{EscP.SET_B_MODE}
{productsStringBuilder}{EscP.ALIGN_LEFT}{EscP.SET_BOLD}ИТОГО: {EscP.CLEAR_BOLD}{EscP.ALIGN_RIGHT}{receiptData.TotalPrice.ToAmountString(false)} {receiptData.TotalPriceCurrencyCode}

{EscP.ALIGN_LEFT}{EscP.SET_BOLD}Заказчик: {EscP.CLEAR_BOLD}{receiptData.CustomerInfo?.FullName}
{EscP.SET_BOLD}Телефон: {EscP.CLEAR_BOLD}{receiptData.CustomerInfo?.Phone}
{EscP.SET_BOLD}Доставка: {EscP.CLEAR_BOLD}{deliveryTypeString}
{EscP.SET_BOLD}Адрес: {EscP.CLEAR_BOLD}{deliveryAddressString}

{EscP.SET_A_MODE}{EscP.ALIGN_CENTER}{EscP.SET_BOLD}ИНСТРУКЦИЯ{EscP.CLEAR_BOLD}{EscP.SET_B_MODE}
{EscP.ALIGN_LEFT}1. В течении 1 минуты Вы получите СМС с инструкциями по оплате.
2. Выберите и оплатите заказ удобным способом оплаты.
3. Следите за статусом заказа и доставки с помощью СМС.

{EscP.SET_A_MODE}{EscP.ALIGN_CENTER}{EscP.SET_BOLD}ИЛИ ОПЛАТИТЕ В БАНКЕ ПО РЕКВИЗИТАМ{EscP.CLEAR_BOLD}{EscP.SET_B_MODE}
{EscP.ALIGN_LEFT}ФОП ""Дубина Л. В.""
14000, Чернігівська обл., м. Чернігів,
вул. Проспект Перемоги, 90/78
UA383052990000026009016303944
в АТ КБ ""ПРИВАТБАНК""
МФО 353586
ЄДРПОУ 2092012427
Платник єдиного податку на 
спрощеній системі оподаткування.
Сума {receiptData.TotalPrice.ToAmountString(false)} {receiptData.TotalPriceCurrencyCode}


{EscP.SET_A_MODE}{EscP.ALIGN_CENTER}{EscP.SET_BOLD}ДЯКУЄМО!{EscP.CLEAR_BOLD}{EscP.SET_B_MODE}

{EscP.SET_BOLD}Телефон контакт-центра:
{kioskAppSettings.SupportPhone}

{EscP.FORM_FEED}";

            message = message.Replace("\r", "");

            // todo: REMOVE AND FIX UKR LANGUAGE
            message = message
                      .Replace('І', 'I')
                      .Replace('і', 'i')
                      .Replace('Ї', 'I')
                      .Replace('ї', 'i')
                      .Replace('Є', 'E')
                      .Replace('є', 'e');

            // todo: should we make this only once?
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            var cyrillicEncoding = Encoding.GetEncoding(866);
            var messageBytes     = cyrillicEncoding.GetBytes(message);

            return(messageBytes);
        }
Exemplo n.º 21
0
        private void CalculateDiscountedPrice()
        {
            decimal Discount      = 0;
            decimal unitPrice     = 0;
            decimal totDiscout    = 0;
            decimal IndexDiscount = 0;
            decimal Qty           = 0;
            decimal Val           = 0;
            decimal x             = 0;
            int     id            = 0;

            decimal Value           = 0;
            decimal ValueDiscounted = 0;

            foreach (DataGridViewRow row in dgvGRN.Rows)
            {
                if (Convert.ToBoolean(row.Cells[dgvGRN.Columns[clmDiscount.Name].Index].Value == null))
                {
                    row.Cells[dgvGRN.Columns[clmDiscount.Name].Index].Value = 0;
                }
                else
                {
                    Discount = (Convert.ToDecimal(row.Cells[dgvGRN.Columns[clmDiscount.Name].Index].Value));
                }


                Qty           = (Convert.ToDecimal(row.Cells[dgvGRN.Columns[clmGRNQty.Name].Index].Value));
                unitPrice     = (Convert.ToDecimal(row.Cells[dgvGRN.Columns[clmUnitPrice.Name].Index].Value));
                id            = (Convert.ToInt32(row.Cells[dgvGRN.Columns[clmItemID1.Name].Index].Value));
                IndexDiscount = (Convert.ToDecimal(row.Cells[dgvGRN.Columns[clmDiscount.Name].Index].Value));

                Value           = (Convert.ToDecimal(row.Cells[dgvGRN.Columns[clmValue.Name].Index].Value));
                ValueDiscounted = (Convert.ToDecimal(row.Cells[dgvGRN.Columns[clmDiscountedValue.Name].Index].Value));


                ItemEntity obj   = GlobalSelectedItemList.Find(xx => xx.intItemID == id);
                int        index = GlobalSelectedItemList.IndexOf(obj);


                GlobalSelectedItemList[index].decUnitPrice = unitPrice;
                GlobalSelectedItemList[index].GRNqty       = Qty;
                GlobalSelectedItemList[index].Discount     = IndexDiscount;

                GlobalSelectedItemList[index].value      = Value;
                GlobalSelectedItemList[index].Discounted = ValueDiscounted;

                Val = Qty * unitPrice;

                row.Cells[dgvGRN.Columns[clmValue.Name].Index].Value = Val;

                x          = (Val * Discount) / 100;
                totDiscout = totDiscout + (Val - x);
                row.Cells[dgvGRN.Columns[clmDiscountedValue.Name].Index].Value = (Val - x);
            }

            lblTotal.Text = totDiscout.ToString("#,##0.00");

            TotalPrice = totDiscout;

            lblTotal.Text = TotalPrice.ToString("#,##0.00");
        }
Exemplo n.º 22
0
        public ViewResult makePayment(PaymentInformation cardInfo)
        {
            try
            {
                Stripe.StripeConfiguration.SetApiKey("sk_test_51HqI05B1UsJ4lZg1agboQSE7i0fWn98619xc2FP5NhREH4igqo1AlKTQO8VWMfsQBUs1OlXNBzBkOqORRQP6ZlPf00E2l0QVhL");



                Stripe.CreditCardOptions card = new Stripe.CreditCardOptions();
                card.Name     = cardInfo.CardOwnerFirstName + " " + cardInfo.CardOwnerLastName;
                card.Number   = cardInfo.CardNumber;
                card.ExpYear  = cardInfo.ExpirationYear;
                card.ExpMonth = cardInfo.ExpirationMonth;
                card.Cvc      = cardInfo.CVV2;

                Console.WriteLine(TotalPrice.ToString());


                Stripe.TokenCreateOptions token = new Stripe.TokenCreateOptions();
                token.Card = card;
                Stripe.TokenService serviceToken = new Stripe.TokenService();
                Stripe.Token        newToken     = serviceToken.Create(token);

                Stripe.CustomerCreateOptions myCustomer = new Stripe.CustomerCreateOptions();
                myCustomer.Email       = cardInfo.Buyer_Email;
                myCustomer.SourceToken = newToken.Id;
                var             customerService = new Stripe.CustomerService();
                Stripe.Customer stripeCustomer  = customerService.Create(myCustomer);

                var t = TempData["totalCost"];


                int    t1 = (int)Math.Round(Convert.ToDouble(t)) - 1;
                string total;
                string input_decimal_number = t.ToString();

                var regex = new System.Text.RegularExpressions.Regex("(?<=[\\.])[0-9]+");
                if (regex.IsMatch(input_decimal_number))
                {
                    string decimal_places = regex.Match(input_decimal_number).Value;
                    total = t1.ToString() + decimal_places;
                }
                else
                {
                    total = t1 + "00";
                }


                System.Diagnostics.Trace.WriteLine(t1.ToString());


                var options = new Stripe.ChargeCreateOptions
                {
                    Amount       = Convert.ToInt32(total),
                    Currency     = "USD",
                    ReceiptEmail = cardInfo.Buyer_Email,
                    CustomerId   = stripeCustomer.Id,
                };



                var           service = new Stripe.ChargeService();
                Stripe.Charge charge  = service.Create(options);


                return(View("Thanks"));
            }
            catch (StripeException e)
            {
                switch (e.StripeError.ErrorType)
                {
                case "card_error":

                    error = (" Error Message: " + e.StripeError.Message);
                    break;

                case "api_connection_error":
                    break;

                case "api_error":
                    break;

                case "authentication_error":
                    break;

                case "invalid_request_error":
                    break;

                case "rate_limit_error":
                    break;

                case "validation_error":
                    break;

                default:
                    // Unknown Error Type
                    break;
                }
                ViewBag.Greeting = error;
                return(View("Error"));
            }
        }
Exemplo n.º 23
0
 protected bool Equals(NewOrderInfoModel other)
 {
     return(ClientId == other.ClientId && OrderDate == other.OrderDate && StatusesId == other.StatusesId &&
            OrderReview == other.OrderReview && TotalPrice.Equals(other.TotalPrice) &&
            Equals(ProductsInOrder, other.ProductsInOrder));
 }
Exemplo n.º 24
0
 public override string ToString() => $"Offer with total price: {TotalPrice.ToString()}";
Exemplo n.º 25
0
        /// <summary>
        ///     Validates the objects fields content
        /// </summary>
        /// <param name="validationType"></param>
        /// <exception cref="OrderFieldBadFormatException">
        ///     throws an exception if one of the parameters doesn't match the expected
        ///     format
        /// </exception>
        public override void Validate(Validations validationType = Validations.Weak)
        {
            base.Validate(validationType);
            InputValidators.ValidateObjectNotNull(LineItems, "Line Items");
            LineItems.ToList().ForEach(item => item.Validate(validationType));
            InputValidators.ValidateObjectNotNull(ShippingLines, "Shipping Lines");
            ShippingLines.ToList().ForEach(item => item.Validate(validationType));
            if (PaymentDetails == null && NoChargeAmount == null)
            {
                throw new OrderFieldBadFormatException("Both PaymentDetails and NoChargeDetails are missing - at least one should be specified");
            }
            if (PaymentDetails != null && PaymentDetails.Length > 0)
            {
                PaymentDetails.ToList().ForEach(item => item.Validate(validationType));
            }
            else
            {
                NoChargeAmount.Validate(validationType);
            }

            if (validationType == Validations.Weak)
            {
                if (BillingAddress == null && ShippingAddress == null)
                {
                    throw new OrderFieldBadFormatException("Both shipping and billing addresses are missing - at least one should be specified");
                }

                if (BillingAddress != null)
                {
                    BillingAddress.Validate(validationType);
                }
                else
                {
                    ShippingAddress.Validate(validationType);
                }

                if (CustomerBrowserIp != null)
                {
                    InputValidators.ValidateIp(CustomerBrowserIp);
                }
            }
            else
            {
                InputValidators.ValidateObjectNotNull(BillingAddress, "Billing Address");
                BillingAddress.Validate(validationType);
                InputValidators.ValidateObjectNotNull(ShippingAddress, "Shipping Address");
                ShippingAddress.Validate(validationType);
                InputValidators.ValidateIp(CustomerBrowserIp);
            }

            InputValidators.ValidateObjectNotNull(Customer, "Customer");
            Customer.Validate(validationType);
            InputValidators.ValidateEmail(Email);
            InputValidators.ValidateCurrency(Currency);
            InputValidators.ValidateZeroOrPositiveValue(TotalPrice.GetValueOrDefault(), "Total Price");
            InputValidators.ValidateValuedString(Gateway, "Gateway");
            InputValidators.ValidateDateNotDefault(CreatedAt.GetValueOrDefault(), "Created At");
            InputValidators.ValidateDateNotDefault(UpdatedAt.GetValueOrDefault(), "Updated At");

            // optional fields validations
            if (DiscountCodes != null && DiscountCodes.Length > 0)
            {
                DiscountCodes.ToList().ForEach(item => item.Validate(validationType));
            }
            if (TotalPriceUsd.HasValue)
            {
                InputValidators.ValidateZeroOrPositiveValue(TotalPriceUsd.Value, "Total Price USD");
            }
            if (TotalDiscounts.HasValue)
            {
                InputValidators.ValidateZeroOrPositiveValue(TotalDiscounts.Value, "Total Discounts");
            }
            if (ClosedAt.HasValue)
            {
                InputValidators.ValidateDateNotDefault(ClosedAt.Value, "Closed At");
            }
        }