private void EnableDisableActions() { IStock.BLL.Invoices invoice = new IStock.BLL.Invoices(); invoice.GetDeliveryOrderInvoice(CurrentDeliveryOrder.DeliveryOrderID); if (invoice.RowCount == 0) uiPanelActions.Visible = true; else uiPanelActions.Visible = false; }
protected void uiLinkButtonCreateInvoice_Click(object sender, EventArgs e) { IStock.BLL.Invoices invoice = new IStock.BLL.Invoices(); string code = invoice.getNewSerial(); invoice.AddNew(); invoice.InvoiceNo = code; invoice.ClientID = CurrentDeliveryOrder.ClientID; invoice.InvoiceDate = CurrentDeliveryOrder.DeliveryOrderDate; invoice.EmployeeID = CurrentDeliveryOrder.EmployeeID; invoice.DeliveryOrderID = CurrentDeliveryOrder.DeliveryOrderID; if (!CurrentDeliveryOrder.IsColumnNull("Discount")) invoice.Discount = CurrentDeliveryOrder.Discount; else invoice.Discount = 0; invoice.Save(); IStock.BLL.DeliveryOrderDetails details = new IStock.BLL.DeliveryOrderDetails(); IStock.BLL.InvoiceDetails invoicedetails = new IStock.BLL.InvoiceDetails(); details.GetDeliveryOrderDetails(CurrentDeliveryOrder.DeliveryOrderID); for (int i = 0; i < details.RowCount; i++) { invoicedetails.AddNew(); invoicedetails.InvoiceID = invoice.InvoiceID; invoicedetails.ItemID = details.ItemID; invoicedetails.ItemPrice = details.ItemPrice; invoicedetails.Quantity = details.Quantity; details.MoveNext(); } invoicedetails.Save(); //EnableDisableActions(); }