Skip to content

Commit

Permalink
12.09.2008 Bugs fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
vsenih committed Sep 12, 2008
1 parent 710fd9f commit d002553
Show file tree
Hide file tree
Showing 20 changed files with 158 additions and 62 deletions.
Binary file modified Bin/Orders.dll
Binary file not shown.
Binary file modified Bin/Orders.pdb
Binary file not shown.
14 changes: 14 additions & 0 deletions Orders/Callback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ public Callback(string id)
orderId = id;
}

/// <summary>
/// Gets the shipping result.
/// </summary>
/// <param name="ShipMethodName">Name of the ship method.</param>
/// <param name="ThisOrder">The this order.</param>
/// <param name="Address">The address.</param>
/// <returns>ShippingResult object</returns>
public override ShippingResult GetShippingResult(string ShipMethodName, Order ThisOrder, AnonymousAddress Address)
{
StoreDataClassesDataContext db = new StoreDataClassesDataContext("Data Source=mssql401.ixwebhosting.com;Initial Catalog=karolin_ecommerce;uid=karolin_ecomm;password=ke6grty");
Expand All @@ -32,6 +39,13 @@ public override ShippingResult GetShippingResult(string ShipMethodName, Order Th
return result;
}

/// <summary>
/// Gets the tax result.
/// </summary>
/// <param name="ThisOrder">The this order.</param>
/// <param name="Address">The address.</param>
/// <param name="ShippingRate">The shipping rate.</param>
/// <returns>Tax result as decimal value</returns>
public override decimal GetTaxResult(Order ThisOrder, AnonymousAddress Address, decimal ShippingRate)
{
StoreDataClassesDataContext db = new StoreDataClassesDataContext("Data Source=mssql401.ixwebhosting.com;Initial Catalog=karolin_ecommerce;uid=karolin_ecomm;password=ke6grty");
Expand Down
31 changes: 28 additions & 3 deletions Orders/Orders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static string GetItemDescription(int item_id)
}

#region Notification methods

/// <summary>
/// Processes the notification.
/// </summary>
Expand Down Expand Up @@ -60,8 +61,9 @@ public static string ProcessNotification(string xmlFile)
newOrder.google_order_number = OrderNumber1;
newOrder.order_date = N1.timestamp;
newOrder.order_by = UserName;
newOrder.sub_total = 0;
newOrder.sub_total = N1.ordertotal.Value;
newOrder.total = N1.ordertotal.Value;
newOrder.charged_amount = 0;
newOrder.status = "NEW";
newOrder.root_id = 1;
//newOrder.shipping_first_name = ShipToFirstName;
Expand Down Expand Up @@ -176,7 +178,8 @@ public static string ProcessNotification(string xmlFile)
decimal chargedAmount = N4.latestchargeamount.Value;

order thisOrder2 = (from or in db.orders where or.google_order_number == googleOrderNumber2 select or).Single<order>();
thisOrder2.charged_amount = chargedAmount;
thisOrder2.charged_amount += chargedAmount;
thisOrder2.sub_total -= chargedAmount;
db.SubmitChanges();

break;
Expand Down Expand Up @@ -230,7 +233,7 @@ public static List<order> GetAllOrders()
{
StoreDataClassesDataContext db = new StoreDataClassesDataContext("Data Source=mssql401.ixwebhosting.com;Initial Catalog=karolin_ecommerce;uid=karolin_ecomm;password=ke6grty");
List<order> listOfAllOrderes = (from or in db.orders
where or.root_id != 999
where or.root_id != 999 && or.status != "TEMP"
select or).ToList<order>();
return listOfAllOrderes;
}
Expand Down Expand Up @@ -375,6 +378,28 @@ public static void DeleteOrder(int orderId)
db.SubmitChanges();
}

/// <summary>
/// Gets all customers.
/// </summary>
/// <returns>List of all customers</returns>
public static List<customer> GetAllCustomers()
{
StoreDataClassesDataContext db = new StoreDataClassesDataContext("Data Source=mssql401.ixwebhosting.com;Initial Catalog=karolin_ecommerce;uid=karolin_ecomm;password=ke6grty");
List<customer> list = db.customers.ToList<customer>();
return list;
}

/// <summary>
/// Gets all order items.
/// </summary>
/// <returns>List of all ordered items</returns>
public static List<order_item> GetAllOrderItems()
{
StoreDataClassesDataContext db = new StoreDataClassesDataContext("Data Source=mssql401.ixwebhosting.com;Initial Catalog=karolin_ecommerce;uid=karolin_ecomm;password=ke6grty");
List<order_item> list = db.order_items.ToList<order_item>();
return list;
}

#endregion


Expand Down
Binary file modified Orders/bin/Debug/Orders.dll
Binary file not shown.
Binary file modified Orders/bin/Debug/Orders.pdb
Binary file not shown.
Binary file modified Orders/obj/Debug/Orders.dll
Binary file not shown.
Binary file modified Orders/obj/Debug/Orders.pdb
Binary file not shown.
34 changes: 34 additions & 0 deletions OrdersProcessing/callback.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="GCheckout.MerchantCalculation" %>
<%@ Import Namespace="GCheckout.Util" %>
<%@ Import Namespace="Orders" %>
<script runat="server" language="c#">
void Page_Load(Object sender, EventArgs e)
{
try
{
// Extract the XML from the request.
Stream RequestStream = Request.InputStream;
StreamReader RequestStreamReader = new StreamReader(RequestStream);
string RequestXml = RequestStreamReader.ReadToEnd();
RequestStream.Close();
Log.Debug("Request XML: " + RequestXml);
// Process the incoming XML.
string orderId = EncodeHelper.GetElementValue(RequestXml, "MERCHANT_DATA_HIDDEN");
CallbackProcessor P = new CallbackProcessor(new Callback(orderId));
byte[] ResponseXML = P.Process(RequestXml);
Log.Debug("Response XML: " + EncodeHelper.Utf8BytesToString(ResponseXML));
Response.BinaryWrite(ResponseXML);
}
catch (Exception ex)
{
Log.Debug(ex.ToString());
}
}
</script>
16 changes: 0 additions & 16 deletions OrdersProcessing/test.aspx

This file was deleted.

21 changes: 0 additions & 21 deletions OrdersProcessing/test.aspx.cs

This file was deleted.

14 changes: 0 additions & 14 deletions OrdersProcessing/web.config

This file was deleted.

6 changes: 3 additions & 3 deletions TestStore.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "TestStore", ".", "{BD484C12
ProjectSection(WebsiteProperties) = preProject
TargetFramework = "3.5"
Debug.AspNetCompiler.VirtualPath = "/TestStore"
Debug.AspNetCompiler.PhysicalPath = "..\..\..\Webs\TestStore\"
Debug.AspNetCompiler.PhysicalPath = "..\TestStore\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\TestStore\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/TestStore"
Release.AspNetCompiler.PhysicalPath = "..\..\..\Webs\TestStore\"
Release.AspNetCompiler.PhysicalPath = "..\TestStore\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\TestStore\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "4636"
VWDPort = "2773"
VWDDynamicPort = "true"
EndProjectSection
EndProject
Expand Down
Binary file modified TestStore.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion setup/RunSQL.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// **************************************************************************
// Url of the T-SQL file you want to run
string fileUrl = @"http://98.130.133.37/setup/archive.txt";
string fileUrl = @"http://98.130.133.37/setup/script.txt";
// Connection string to the server you want to execute against
string connectionString = @"Data Source=mssql401.ixwebhosting.com;Initial Catalog=karolin_ecommerce;uid=karolin_ecomm;password=ke6grty";
Expand Down
21 changes: 21 additions & 0 deletions setup/orders.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="orders.aspx.cs" Inherits="setup_orders" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
<asp:GridView ID="GridView2" runat="server">
</asp:GridView>
<asp:GridView ID="GridView3" runat="server">
</asp:GridView>
</div>
</form>
</body>
</html>
25 changes: 25 additions & 0 deletions setup/orders.aspx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Orders;

public partial class setup_orders : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<order> source = Orders.Orders.GetAllOrders();
GridView1.DataSource = source;
GridView1.DataBind();

List<customer> source1 = Orders.Orders.GetAllCustomers();
GridView2.DataSource = source1;
GridView2.DataBind();

List<order_item> source2 = Orders.Orders.GetAllOrderItems();
GridView3.DataSource = source2;
GridView3.DataBind();
}
}
20 changes: 19 additions & 1 deletion systems/shop_orders.ascx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@
onclick="PartialChargingButton_Click">Partial charging</asp:LinkButton>
</asp:Panel>
<asp:Panel ID="PartialChargingPanel" runat="server">
<asp:RangeValidator ID="PartialAmountRangeValidator" runat="server"
ControlToValidate="PartialAmountTextBox" ErrorMessage="*" Type="Double"></asp:RangeValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="PartialAmountTextBox" ErrorMessage="*"></asp:RequiredFieldValidator>
<asp:TextBox ID="PartialAmountTextBox" runat="server"></asp:TextBox>
<asp:Button ID="ChargePartialButton" runat="server"
onclick="ChargePartialButton_Click" Text="Charge" />
Expand Down Expand Up @@ -272,7 +276,7 @@
</tr>
<tr>
<td colspan="2">
<asp:GridView ID="OrderItemsGridView" runat="server"
<asp:GridView Width="100%" ID="OrderItemsGridView" runat="server"
AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="item_name" HeaderText="Item name" />
Expand All @@ -283,6 +287,12 @@
</asp:GridView>
</td>
</tr>
<tr>
<td align="right" bgcolor="Silver" colspan="2">
Shipping:
<asp:Label ID="ShippingLabel" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right" bgcolor="Silver" colspan="2">
Tax:
Expand All @@ -295,6 +305,14 @@
<asp:Label ID="TotalAmountLabel" runat="server" Font-Bold="True"></asp:Label>
</td>
</tr>
<tr>
<td align="right" bgcolor="Silver" colspan="2">
<span class="Apple-style-span"
style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-right; text-indent: 0px; text-transform: none; white-space: nowrap; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; ">
Refunds: </span>
<asp:Label ID="RefundLabel" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="right" bgcolor="Silver" colspan="2">
Charged amount:
Expand Down
14 changes: 12 additions & 2 deletions systems/shop_orders.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ protected void OrdersGridView_SelectedIndexChanged(object sender, EventArgs e)
Label fulfillmentLbl = (Label)LoginView.FindControl("FulfillmentLabel");
Label financialLbl = (Label)LoginView.FindControl("FinancialLabel");
Label totalAmountLbl = (Label)LoginView.FindControl("TotalAmountLabel");
Label shippingLbl = (Label)LoginView.FindControl("ShippingLabel");
Label taxLbl = (Label)LoginView.FindControl("TaxLabel");
Label refundLbl = (Label)LoginView.FindControl("RefundLabel");
Label chargedAmountLbl = (Label)LoginView.FindControl("ChargedAmountLabel");
Label dateLbl = (Label)LoginView.FindControl("DateLabel");
GridView orderItemsGrid = (GridView)LoginView.FindControl("OrderItemsGridView");
Expand Down Expand Up @@ -132,13 +134,14 @@ protected void OrdersGridView_SelectedIndexChanged(object sender, EventArgs e)
cancelBtn.Enabled = false;
else
cancelBtn.Enabled = true;
if (source[0].status != "CHARGEABLE")
if ((source[0].status != "CHARGEABLE" || source[0].status !="CHARGED") && source[0].sub_total == 0)
chargingPanel.Visible = false;
else
chargingPanel.Visible = true;
orderNumberLbl.Text = dataKey.ToString();
financialLbl.Text = source[0].status;
fulfillmentLbl.Text = source[0].shipping_status;
shippingLbl.Text = source[0].shipping.ToString();
taxLbl.Text = source[0].tax.ToString();
totalAmountLbl.Text = source[0].total.ToString();
chargedAmountLbl.Text = source[0].charged_amount.ToString();
Expand All @@ -153,6 +156,11 @@ protected void OrdersGridView_SelectedIndexChanged(object sender, EventArgs e)
shipBtn.Enabled = false;
if (financialLbl.Text != "CHARGED")
refundBtn.Enabled = false;
if (source[0].sub_total + source[0].charged_amount != source[0].total)
{
decimal temp = source[0].total - Math.Abs(source[0].sub_total - source[0].charged_amount.Value);
refundLbl.Text = temp.ToString();
}
}
else
statusLbl.Text = "No details available!";
Expand Down Expand Up @@ -226,8 +234,10 @@ protected void ChargePartialButton_Click(object sender, EventArgs e)
Label totalAmountLbl = (Label)LoginView.FindControl("TotalAmountLabel");
Label statusLabel = (Label)LoginView.FindControl("StatusLabel");
Panel partialChargingPanel = (Panel)LoginView.FindControl("PartialChargingPanel");
RangeValidator validator = (RangeValidator)LoginView.FindControl("PartialAmountRangeValidator");
decimal total = decimal.Parse(totalAmountLbl.Text);
decimal amount = 0;
validator.MaximumValue = total.ToString();
if (decimal.TryParse(partialAmountTB.Text, out amount) && amount != 0 && amount <= total)
{
GCheckout.OrderProcessing.ChargeOrderRequest chargeReq = new GCheckout.OrderProcessing.ChargeOrderRequest(orderNumberLbl.Text, "USD", amount);
Expand Down Expand Up @@ -276,7 +286,7 @@ protected void RefundButton_Click(object sender, EventArgs e)
decimal amount = 0;
if (decimal.TryParse(refundAmountTB.Text, out amount) && amount != 0 && amount <= total)
{
GCheckout.OrderProcessing.RefundOrderRequest refundReq = new GCheckout.OrderProcessing.RefundOrderRequest(orderNumberLbl.Text, refundCommentTB.Text, "USD", amount);
GCheckout.OrderProcessing.RefundOrderRequest refundReq = new GCheckout.OrderProcessing.RefundOrderRequest(orderNumberLbl.Text, refundCommentTB.Text, "USD", amount, refundCommentTB.Text);
refundReq.Send();
refundStatusLbl.Text = "";
refundPanel.Visible = false;
Expand Down
2 changes: 1 addition & 1 deletion web.config
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>-->
<system.web>
<sessionState timeout="45"/>
<sessionState timeout="30"/>
<httpModules>
<add type="URLRewrite, App_code" name="URLRewrite"/>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Expand Down

0 comments on commit d002553

Please sign in to comment.