private void Page_Load(object sender, System.EventArgs e) { // this.warpGrid.AddLinkedRequestTrigger("butAddItem"); if (Session["CustomerID"] == null) { Response.Redirect("Default.aspx"); } else { this.AddKeepAlive(); oMySql = new MySQL(ConnectionType.NonUnique); oCustomer = new Customer(Session["CompanyID"].ToString()); oCustomer.oMySql = oMySql; oCustomer.Find(Session["CustomerID"].ToString()); oCustomerCS = new Customer.CustomerCS(oCustomer.CompanyID, oMySql); oCustomerCS.oMySql = oMySql; oCustomerCS.Find(oCustomer.ID); oBrochure = new Brochure(oCustomer.CompanyID); oBrochure.oMySql = oMySql; txtEarlyBirdDate.Value = DateTime.Today.ToString("MM/dd/yyyy"); txtName.Text = oCustomer.Name; oMySql.Dispose(); } }
protected override void OnInit(EventArgs e) { // base.OnInit(e); if (Session["CustomerID"] == null) { Response.Redirect("Default.aspx"); } else { using (MySQL oMySql = new MySQL(ConnectionType.NonUnique)) { oCustomer = new Customer(Session["CompanyID"].ToString()); oCustomer.oMySql = oMySql; oCustomer.Find(Session["CustomerID"].ToString()); txtName.Text = oCustomer.Name; oCustomerCS = new Customer.CustomerCS(oCustomer.CompanyID); oCustomerCS.oMySql = oMySql; oCustomerCS.Find(oCustomer.ID); //ReportViewer.Width = 700; ReportViewer.DisplayGroupTree = false; ReportViewer.HasCrystalLogo = false; ReportViewer.HasToggleGroupTreeButton = false; // ReportViewer.Width = 700; ReportViewer.Height = 400; ReportViewer.BestFitPage = true; oCustomer.PrintEarlyBird(ReportViewer, oCustomerCS.EarlyBirdDate); } } }
private void Page_Load(object sender, System.EventArgs e) { // this.warpGrid.AddLinkedRequestTrigger("butAddItem"); if (Session["CustomerID"] == null) { Response.Redirect("Default.aspx"); } else { this.AddKeepAlive(); Global.oMySql.Close(ConnectionType.Unique); oMySql = new MySQL(ConnectionType.NonUnique); oCustomer = new Customer(Session["CompanyID"].ToString()); oCustomer.oMySql = oMySql; oCustomer.Find(Session["CustomerID"].ToString()); oCustomerCS = new Customer.CustomerCS(oCustomer.CompanyID); oCustomerCS.oMySql = oMySql; oCustomerCS.Find(oCustomer.ID); oBrochure = new Brochure(oCustomer.CompanyID); oBrochure.oMySql = oMySql; if (!this.IsPostBack) { if (oCustomerCS.Goal == 0) { txtGoal.Text = "10"; } else { txtGoal.Text = oCustomerCS.Goal.ToString(); } if (oCustomerCS.EarlyBirdDate == Global.DNull) { txtEarlyBirdDate.Value = oCustomer.StartDate.AddDays(7); } else { txtEarlyBirdDate.Value = oCustomerCS.EarlyBirdDate.ToString("MM/dd/yyyy"); } } txtName.Text = oCustomer.Name; txtAddress.Text = oCustomer.Address + " " + oCustomer.City + " " + oCustomer.State + ", " + oCustomer.ZipCode; txtChairperson.Text = oCustomer.Chairperson; txteMail.Text = oCustomer.eMail; txtFax.Text = oCustomer.FaxNumber != ""? string.Format("{0:(###)-###-####}", double.Parse(oCustomer.FaxNumber)):""; txtPhone.Text = oCustomer.PhoneNumber != ""?string.Format("{0:(###)-###-####}", double.Parse(oCustomer.PhoneNumber)):""; oBrochure.Find(oCustomer.BrochureID); txtBrochure.Text = oCustomer.BrochureID + " - " + oBrochure.Description; txtProfit.Text = oCustomer.ProfitPercent.ToString(); txtStartDate.Text = (oCustomer.StartDate == Global.DNull)?"":oCustomer.StartDate.ToString("MM/dd/yyyy"); txtEndDate.Text = (oCustomer.EndDate == Global.DNull) ? "" : oCustomer.EndDate.ToString("MM/dd/yyyy"); txtPickUpDate.Text = (oCustomer.PickUpDate == Global.DNull) ? "" : oCustomer.PickUpDate.ToString("MM/dd/yyyy"); txtDeliveryDate.Text = (oCustomer.DeliveryDate == Global.DNull) ? "" : oCustomer.DeliveryDate.ToString("MM/dd/yyyy"); txtParentPickUpDate.Text = (oCustomer.ParentPickUpDate == Global.DNull) ? "" : oCustomer.ParentPickUpDate.ToString("MM/dd/yyyy"); // txtItemsDelivery.Text = oCustomer.NoItems.ToString(); oMySql.Dispose(); } }