using System; using System.ComponentModel; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Web.Services; using OakLeaf.MM.Main.Business; using OakLeaf.MM.Main.Web.UI; using OakLeaf.MM.Main.Web.UI.WebControls; using OakLeaf.MM.Main.Collections; using Wala.Membership.Business; /// <summary> /// Summary description for MMWebBusinessForm /// </summary> public partial class MMWebBusinessForm : mmBusinessWebPage { protected Reg_Golf oOrder; protected Fee oFee; protected int iOrderId; protected int iContactId; /// <summary> /// Page Load handler /// </summary> /// <param name="sender">Event source</param> /// <param name="e">Event args</param> protected void Page_Load(object sender, EventArgs e) { // EventGolf oEvent = new Wala.Membership.Business.EventGolf(); // mmBindingList<EventGolfEntity> oGolfEvents = oEvent.GetAllEntities(); this.oOrder = (Reg_Golf)this.RegisterBizObj(new Reg_Golf()); this.oFee = (Fee)this.RegisterBizObj(new Fee()); this.iContactId = int.Parse(String.IsNullOrEmpty(Request.QueryString["ContactId"]) ? "0" : Request.QueryString["ContactId"]); this.iOrderId = int.Parse(String.IsNullOrEmpty(Request.QueryString["OrderId"]) ? "0" : Request.QueryString["OrderId"]); // Retrieve the specified order and detail if (! this.oOrder.getOrderById(this.iOrderId)) { // Set default contact ID to the value sent in this.oOrder.NewEntity(); this.oOrder.Entity.numIndID = this.iContactId; } if (IsPostBack) { this.oOrder.DataSet = (DataSet)Session["dsOrder"]; } else { Session["dsOrder"] = this.oOrder.DataSet; } } /// <summary> /// Save the Order header data /// </summary> protected void btnSave_Click(object sender, System.EventArgs e) { DataSet dsOrder = (DataSet)Session["dsOrder"]; // Convert the date string to a datetime for sql // this.oOrder.Entity.dtRegDate = Convert.ToDateTime(this.oOrder.Entity.dtRegDate); if (this.Save(this.oOrder, dsOrder, this.oOrder.TableName) == mmSaveDataResult.RulesPassed) { Response.Redirect("Contact.aspx?Id=" + this.iContactId); } } public class Reg_GolfDefaultValues { public DateTime dtReg = DateTime.Now; public int iCustomerId = 0; public Reg_GolfDefaultValues(int iCustomerId) { this.iCustomerId = iCustomerId; } } [WebMethod(CacheDuration = 360, Description = "Returns Fees for an Event")] public static String getFeesForEvent(int eventId) { //Uncomment the following line if using designed components //InitializeComponent(); var i = 1; String cReturn = "{\"results\": {\"fees\" : ["; Fee oFee = new Fee(); mmBindingList<FeeEntity> oFees = oFee.getFeesForEvent(eventId); // return in JSON format foreach (FeeEntity e in oFees) { cReturn += "{\"id\":" + e.numEvGolfFeeID + " , \"description\":\"" + e.txtFeeDescription.Replace("\"", """) + " (" + String.Format("{0:C}", e.curFee) + ")\"" + ", \"fee\":" + e.curFee + "}"; if (i < oFees.Count) cReturn += ", "; i++; } cReturn += "] }}"; return cReturn; } [WebMethod(CacheDuration = 360, Description = "Returns Registration Fee for an Event")] public static String getFeeForFeeId(int feeId) { //Uncomment the following line if using designed components //InitializeComponent(); // var i = 1; // String cReturn = "{\"results\": {\"options\" : ["; Fee oFee = new Fee(); oFee.LoadRow(feeId); String cReturn = oFee.ToString(); return cReturn; } }