protected void WebUserControlEditMaterials_OnSave(object sender, EventArgs e) { // remember selected orders List <string> Selection = new List <string>(); for (int i = 0; i < GridViewOpenOrders.Rows.Count; i++) { if ((GridViewOpenOrders.Rows[i].Cells[0].Controls[1] as CheckBox).Checked) { Selection.Add(GridViewOpenOrders.Rows[i].Cells[2].Text); } } GridViewOpenOrders.DataBind(); // reset the selected orders for (int i = 0; i < GridViewOpenOrders.Rows.Count; i++) { (GridViewOpenOrders.Rows[i].Cells[0].Controls[1] as CheckBox).Checked = false; if (Selection.IndexOf(GridViewOpenOrders.Rows[i].Cells[2].Text) >= 0) { (GridViewOpenOrders.Rows[i].Cells[0].Controls[1] as CheckBox).Checked = true; } } }
protected void EnableCurrentPageElements() { PanelCustomerInformation.Visible = true; PanelOpenOrders.Visible = false; PanelCustomerInformation.Enabled = false; PanelOpenOrders.Enabled = false; PanelTotals.Visible = false; PanelTotals.Enabled = false; PanelPreviewInvoice.Visible = false; PanelPreviewInvoice.Enabled = false; PanelAdvancePayments.Visible = false; PanelAdvancePayments.Enabled = false; ButtonContinue.Visible = false; ButtonDestroyOrderAndBack.Visible = false; ButtonNewOrder.Visible = false; ButtonPrintAndProcess.Visible = false; ButtonRevert.Visible = false; URLPopUpControlInvoice.Visible = false; WebUserControlEditOrderMaterials1.Visible = false; switch (CurrentPage) { case 1: PanelCustomerInformation.Enabled = true; ButtonContinue.Visible = true; TextBoxInvoiceDescription.Text = "Verzamelfactuur dd " + Common.CurrentClientDateTime(Session).ToString(); GridViewOpenOrders.DataBind(); break; case 2: if (DropDownListCustomers.SelectedValue == "") { CurrentPage--; EnableCurrentPageElements(); Common.InformUser(Page, "Selecteer aub een klant op deze lokatie. Als er geen klant is aangegeven zijn er geen open inkooporders die op factuur kunnen worden geplaatst."); } else { PanelOpenOrders.Visible = true; PanelOpenOrders.Enabled = true; ButtonContinue.Visible = true; ButtonRevert.Visible = true; WebUserControlEditAdvancePayments1.CustomerID = new System.Guid(DropDownListCustomers.SelectedValue); } break; case 3: PanelTotals.Visible = true; PanelTotals.Enabled = true; PanelOpenOrders.Visible = true; WebUserControlEditAdvancePayments1.LoadAPLines(); ButtonContinue.Visible = WebUserControlEditAdvancePayments1.CustomerHasOpenAdvancePayments(); ButtonPrintAndProcess.Visible = !WebUserControlEditAdvancePayments1.CustomerHasOpenAdvancePayments(); ButtonRevert.Visible = true; CountOrders(); if (NrOfOrders > 0) { LabelNrOfPurchasesNr.Text = NrOfOrders.ToString(); LabelTotalPriceExVatNr.Text = OrderPriceTotals.ToString(); LabelTotalWeightNr.Text = OrderWeightTotals.ToString(); } else { // no orders are selected, revert to order selection CurrentPage--; EnableCurrentPageElements(); // show message to user to ask for an order selection Common.InformUser(Page, "Selecteer aub minimaal één order."); } break; case 4: PanelTotals.Visible = true; PanelOpenOrders.Visible = true; PanelAdvancePayments.Visible = true; PanelAdvancePayments.Enabled = true; ButtonPrintAndProcess.Visible = true; ButtonRevert.Visible = true; break; case 5: PanelTotals.Visible = true; PanelOpenOrders.Visible = true; PanelAdvancePayments.Visible = true; PanelPreviewInvoice.Visible = true; PanelPreviewInvoice.Enabled = true; ButtonDestroyOrderAndBack.Visible = true; ButtonNewOrder.Visible = true; URLPopUpControlInvoice.Visible = true; FrameShowInvoice.Attributes["src"] = "WebFormPopup.aspx?UC=ShowReport&d=DataSetInvoice&r=ReportInvoiceA4&Id=" + LabelGeneratedInvoiceId.Text; break; } }
protected void DropDownListLocations_SelectedIndexChanged(object sender, EventArgs e) { GridViewOpenOrders.DataBind(); EntityDataSourceCustomers.DataBind(); }