protected void Page_Load(object sender, EventArgs e) { ctlORSVEvent.btnSave_Click += new EventSaveEventHandler(CalculateLetterCount); ctlORSVPlace.btnSave_Click += new PlaceSaveEventHandler(CalculateLetterCount); ctlORSVEvent.btnAdd_Click += new EventAddEventHandler(SaveForEvent); ctlDocument.btnBack_Click += new DocumentBackEventHandler(Document_btnBack); StorageTotal.Attributes.Add("readonly", "readonly"); Total.Attributes.Add("readonly", "readonly"); if (!(IsPostBack)) { FillDropDowns(); if ((!(Request.QueryString["ID"] == null)) || (!(Request.QueryString["QCID"] == null))) { if (Request.QueryString["ID"] == null) { FillDetails(Request.QueryString["QCID"].ToString()); } else { FillDetails(Request.QueryString["ID"].ToString()); } ctlORSVEvent.FillList(); ORSVTypeID_SelectedIndexChanged(null, null); ctlORSVPlace.FillList(); PostageFee p = new PostageFee(); PerLetterFee.Text = p.TotalFormatted; CalculateLetterCount(null, null); CalculateStorageTotal(null, null); CalculateAdminFee(null, null); AdjStorageDate_TextChanged(null, null); //CalculateTotal(null, null); SwitchFormMode(Util.FormMode.Edit); VIN.Focus(); } else { FillList(); SwitchFormMode(Util.FormMode.List); } } }
protected void gvList_RowCommand(Object sender, GridViewCommandEventArgs e) { int index; string ID; switch (e.CommandName) { case "Select": index = Convert.ToInt32(e.CommandArgument); ID = gvList.DataKeys[index].Values["ORSVID"].ToString(); FillDetails(ID); ctlORSVEvent.FillList(); ORSVTypeID_SelectedIndexChanged(null, null); ctlORSVPlace.FillList(); PostageFee p = new PostageFee(); PerLetterFee.Text = p.TotalFormatted; CalculateLetterCount(null, null); CalculateStorageTotal(null, null); CalculateAdminFee(null, null); AdjStorageDate_TextChanged(null, null); //CalculateTotal(null, null); IsCustomerLetter(); IsMember(); SwitchFormMode(Util.FormMode.Edit); VIN.Focus(); break; case "DeleteRestore": index = Convert.ToInt32(e.CommandArgument); ID = gvList.DataKeys[index].Values["ORSVID"].ToString(); bool Deleted = Convert.ToBoolean(gvList.DataKeys[index].Values["Deleted"].ToString()); DeleteRestore(ID, Deleted); FillList(); lblError.Text = ""; break; } }
protected void ORSVTypeID_SelectedIndexChanged(object sender, EventArgs e) { if (ORSVTypeID.SelectedIndex > 0) { if (ORSVTypeID.SelectedValue == "1") { //Vehicle lblVIN.Text = "VIN"; pnlVehicle.Visible = true; pnlVessel.Visible = false; } else if (ORSVTypeID.SelectedValue == "2") { //Vessel lblVIN.Text = "HIN"; pnlVehicle.Visible = false; pnlVessel.Visible = true; } } VIN.Focus(); }
protected void Buttons(object sender, EventArgs e) { Control ctl = sender as Control; PostageFee p = new PostageFee(); switch (ctl.ID) { case "btnSave": if (Validation()) { SaveRecord(); if (!(Request.QueryString["ID"] == null)) { Response.Redirect("Letters.aspx"); } else if (!(Request.QueryString["QCID"] == null)) { Response.Redirect("QualityControl.aspx"); } else { FillList(); SwitchFormMode(Util.FormMode.List); } } break; case "btnSaveAndContinue": if (Validation()) { SaveRecord(); Clear(); SwitchFormMode(Util.FormMode.Add); lblError.Text = ""; lblCustomerID.Text = "Customer"; PerLetterFee.Text = p.TotalFormatted; StateCode.SelectedIndex = -1; StateCode.Items.FindByText("LA").Selected = true; CalculateAdminFee(null, null); //fees o.ORSVID = "-1"; rpFees.DataSource = o.ORSVFees(); rpFees.DataBind(); o.ORSVID = ""; VIN.Focus(); } break; case "btnCancel": if (!(Request.QueryString["ID"] == null)) { Response.Redirect("Letters.aspx"); } else if (!(Request.QueryString["QCID"] == null)) { Response.Redirect("QualityControl.aspx"); } else { SwitchFormMode(Util.FormMode.List); } break; case "btnAddNew": SwitchFormMode(Util.FormMode.Add); lblError.Text = ""; lblCustomerID.Text = "Customer"; PerLetterFee.Text = p.TotalFormatted; StateCode.SelectedIndex = -1; StateCode.Items.FindByText("LA").Selected = true; //StateCode.SelectedValue = "LA"; CalculateAdminFee(null, null); //fees o.ORSVID = "-1"; rpFees.DataSource = o.ORSVFees(); rpFees.DataBind(); o.ORSVID = ""; VIN.Focus(); break; case "btnDelete": DeleteRestore(ORSVID.Text, true); FillList(); SwitchFormMode(Util.FormMode.List); break; case "btnAddress": if (ORSVID.Text.Length > 0) { ctlORSVPlace.FillDropDowns(); ctlORSVPlace.FillList(); AddressPopup.Show(); } else { if (SaveForEvent() == true) { ctlORSVPlace.FillDropDowns(); ctlORSVPlace.FillList(); AddressPopup.Show(); } } break; case "btnDocument": if (ORSVID.Text.Length > 0) { ctlDocument.FillDropDowns(); ctlDocument.FillList(); ctlDocument.SwitchFormMode(Util.FormMode.List); SwitchFormMode(Util.FormMode.DocumentUpload); } else { if (SaveForEvent() == true) { SwitchFormMode(Util.FormMode.DocumentUpload); } } break; case "btnSearch": FillList(); break; case "btnReset": Util.ResetPanelControls(pnlFilters); FillList(); break; case "btnPrint": if (ORSVTypeID.SelectedValue == "1") { PrintORSV(); } else if (ORSVTypeID.SelectedValue == "2") { PrintVessel(); } break; } }