/// <summary> /// Email Status Button Click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void EmailStatus_Click(object sender, EventArgs e) { ZNode.Libraries.Admin.OrderAdmin _OrderAdmin = new ZNode.Libraries.Admin.OrderAdmin(); ZNode.Libraries.DataAccess.Entities.Order _OrderList = _OrderAdmin.DeepLoadByOrderID(OrderID); SendEmailReceipt(_OrderList); EmailStatus.Enabled = false; }
private void BindData() { ZNode.Libraries.Admin.OrderAdmin _OrderAdminAccess = new ZNode.Libraries.Admin.OrderAdmin(); //Load Order State Item ListOrderStatus.DataSource = _OrderAdminAccess.GetAllOrderStates(); ListOrderStatus.DataTextField = "orderstatename"; ListOrderStatus.DataValueField = "Orderstateid"; ListOrderStatus.DataBind(); ZNode.Libraries.DataAccess.Entities.Order order = _OrderAdminAccess.GetOrderByOrderID(OrderID); int ShippingId = Convert.ToInt32(order.ShippingID); ZNode.Libraries.Admin.ShippingAdmin _shipping = new ZNode.Libraries.Admin.ShippingAdmin(); int ShipId = _shipping.GetShippingtypeid(ShippingId); //Set the Tracking number title based on the ShippingTypeId if (ShipId == 1) { pnlTrack.Visible = true; TrackTitle.Visible = false; TrackingNumber.Visible = false; } else if (ShipId == 2) { pnlTrack.Visible = true; TrackTitle.Text = "UPS Tracking Number"; } else { pnlTrack.Visible = true; TrackTitle.Text = "FedEx Tracking Number"; } if (order != null) { ListOrderStatus.SelectedValue = order.OrderStateID.ToString(); TrackingNumber.Text = order.TrackingNumber; } lblCustomerName.Text = order.BillingFirstName + " " + order.BillingLastName; lblTotal.Text = order.Total.Value.ToString("c"); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void UpdateOrderStatus_Click(object sender, EventArgs e) { ZNode.Libraries.Admin.OrderAdmin orderAdmin = new ZNode.Libraries.Admin.OrderAdmin(); ZNode.Libraries.DataAccess.Entities.Order order = orderAdmin.GetOrderByOrderID(OrderID); if (order != null) { order.OrderStateID = int.Parse(ListOrderStatus.SelectedValue); order.OrderID = OrderID; order.TrackingNumber = TrackingNumber.Text.Trim(); if (order.OrderStateID == 20) { order.ShipDate = DateTime.Now.Date + DateTime.Now.TimeOfDay; } if (order.OrderStateID == 30) { order.ReturnDate = DateTime.Now.Date + DateTime.Now.TimeOfDay; } bool Check = orderAdmin.Update(order); if (Check) { Response.Redirect(ListPage); } else { //Do Nothing } } }
/// <summary> /// Refund button clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Refund_Click(object sender, EventArgs e) { //retrieve order ZNode.Libraries.Admin.OrderAdmin orderAdmin = new ZNode.Libraries.Admin.OrderAdmin(); Order order = orderAdmin.GetOrderByOrderID(OrderID); ZNode.Libraries.Framework.Business.ZNodeEncryption enc = new ZNode.Libraries.Framework.Business.ZNodeEncryption(); //get payment settings int paymentSettingID = (int)order.PaymentSettingID; PaymentSettingService pss = new PaymentSettingService(); PaymentSetting ps = pss.GetByPaymentSettingID(paymentSettingID); //set gateway info GatewayInfo gi = new GatewayInfo(); gi.GatewayLoginID = enc.DecryptData(ps.GatewayUsername); gi.GatewayPassword = enc.DecryptData(ps.GatewayPassword); gi.TransactionKey = enc.DecryptData(ps.TransactionKey); gi.Vendor = ps.Vendor; gi.Partner = ps.Partner; //gi.CurrencyCode = CurrencyCode; gi.TestMode = ps.TestMode; gi.gateway = (GatewayType)ps.GatewayTypeID ; string creditCardExp = Convert.ToString(order.CardExp); if (creditCardExp == null) { creditCardExp = ""; } //set credit card CreditCard cc = new CreditCard(); cc.Amount = Decimal.Parse(txtAmount.Text); cc.CardNumber = txtCardNumber.Text.Trim(); cc.CreditCardExp = creditCardExp; cc.OrderID = order.OrderID; cc.TransactionID = order.CardTransactionID; GatewayResponse resp = new GatewayResponse(); if ((GatewayType)ps.GatewayTypeID == GatewayType.AUTHORIZE) { GatewayAuthorize auth = new GatewayAuthorize(); resp = auth.RefundPayment(gi, cc); } else if ((GatewayType)ps.GatewayTypeID == GatewayType.VERISIGN) { GatewayPayFlowPro pp = new GatewayPayFlowPro(); resp = pp.RefundPayment(gi, cc); } else if ((GatewayType)ps.GatewayTypeID == GatewayType.PAYMENTECH) { GatewayOrbital pmt = new GatewayOrbital(); resp = pmt.ReversePayment(gi, cc); } else if ((GatewayType)ps.GatewayTypeID == GatewayType.IPCOMMERCE) { GatewayIPCommerce ipc = new GatewayIPCommerce(); resp = ipc.RefundPayment(gi, cc); } else if ((GatewayType)ps.GatewayTypeID == GatewayType.NOVA) { GatewayNova nova = new GatewayNova(); cc.CreditCardExp = lstMonth.SelectedValue + "/" + lstYear.SelectedValue; cc.CardSecurityCode = txtSecurityCode.Text.Trim(); gi.TransactionType = "CCCredit"; resp = nova.RefundPayment(gi, cc); } else { lblError.Text = "Error: Credit card refunds and not supported for your gateway."; return; } if (resp.IsSuccess) { //update order status order.OrderStateID = 30; //returned status order.PaymentStatusID = 3; //refund status OrderService os = new OrderService(); os.Update(order); pnlEdit.Visible = false; pnlConfirm.Visible = true; } else { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("Could not complete request. The following response was returned by the gateway: "); sb.Append(resp.ResponseText); lblError.Text = sb.ToString(); } }
/// <summary> /// Bind fields /// </summary> private void BindData() { ZNode.Libraries.Admin.OrderAdmin _OrderAdminAccess = new ZNode.Libraries.Admin.OrderAdmin(); ZNode.Libraries.DataAccess.Entities.Order order = _OrderAdminAccess.DeepLoadByOrderID(OrderID); lblCustomerName.Text = order.BillingFirstName + " " + order.BillingLastName; lblTotal.Text = order.Total.Value.ToString("c"); lblTransactionID.Text = order.CardTransactionID; txtAmount.Text = ((decimal)order.Total.Value).ToString("N"); if ((GatewayType)order.PaymentSettingIDSource.GatewayTypeID == GatewayType.NOVA) { txtCardNumber.Width = 170; lblCardNumber.Text = "Enter Credit Card Number"; BindYearList(); string currentMonth = System.DateTime.Now.Month.ToString(); if(currentMonth.Length == 1) currentMonth = "0" + currentMonth; // pre-select item in the list lstMonth.SelectedValue = currentMonth; pnlCreditCardInfo.Visible = true; } }
/// <summary> /// Refund button clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Capture_Click(object sender, EventArgs e) { //retrieve order ZNode.Libraries.Admin.OrderAdmin orderAdmin = new ZNode.Libraries.Admin.OrderAdmin(); Order order = orderAdmin.GetOrderByOrderID(OrderID); ZNode.Libraries.Framework.Business.ZNodeEncryption enc = new ZNode.Libraries.Framework.Business.ZNodeEncryption(); //get payment settings int paymentSettingID = (int)order.PaymentSettingID; PaymentSettingService pss = new PaymentSettingService(); PaymentSetting ps = pss.GetByPaymentSettingID(paymentSettingID); //set gateway info GatewayInfo gi = new GatewayInfo(); gi.GatewayLoginID = enc.DecryptData(ps.GatewayUsername); gi.GatewayPassword = enc.DecryptData(ps.GatewayPassword); gi.TransactionKey = enc.DecryptData(ps.TransactionKey); gi.Vendor = ps.Vendor; gi.Partner = ps.Partner; gi.TestMode = ps.TestMode; gi.gateway = (GatewayType)ps.GatewayTypeID ; string creditCardExp = Convert.ToString(order.CardExp); if (creditCardExp == null) { creditCardExp = ""; } //set credit card CreditCard cc = new CreditCard(); cc.CreditCardExp = creditCardExp; cc.OrderID = order.OrderID; cc.TransactionID = order.CardTransactionID; GatewayResponse resp = new GatewayResponse(); if ((GatewayType)ps.GatewayTypeID == GatewayType.AUTHORIZE) { GatewayAuthorize auth = new GatewayAuthorize(); resp = auth.CapturePayment(gi, cc); } else if ((GatewayType)ps.GatewayTypeID == GatewayType.VERISIGN) { GatewayPayFlowPro pp = new GatewayPayFlowPro(); resp = pp.CapturePayment(gi, cc); } else if ((GatewayType)ps.GatewayTypeID == GatewayType.PAYMENTECH) { GatewayOrbital pmt = new GatewayOrbital(); resp = pmt.CapturePayment(gi, cc); } else { lblError.Text = "Error: Credit card payment capture is not supported for your gateway."; } if (resp.IsSuccess) { //update order status order.PaymentStatusID = 1; //refund status OrderService os = new OrderService(); os.Update(order); pnlEdit.Visible = false; pnlConfirm.Visible = true; } else { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("Could not complete request. The following response was returned by the gateway: "); sb.Append(resp.ResponseText); lblError.Text = sb.ToString(); } }
/// <summary> /// Bind fields /// </summary> private void BindData() { ZNode.Libraries.Admin.OrderAdmin _OrderAdminAccess = new ZNode.Libraries.Admin.OrderAdmin(); ZNode.Libraries.DataAccess.Entities.Order order = _OrderAdminAccess.GetOrderByOrderID(OrderID); lblCustomerName.Text = order.BillingFirstName + " " + order.BillingLastName; lblTotal.Text = order.Total.Value.ToString("c"); lblTransactionID.Text = order.CardTransactionID; }