private void bindInvoiceServices() { int clientID = Core.SessionHelper.getClientId(); List <InvoiceServiceType> services = null; services = InvoiceServiceManager.GetAll(clientID).ToList(); Core.CollectionManager.FillCollection(ddlServices, "ServiceTypeID", "ServiceDescription", services); }
protected void bindInvoiceServices() { int clientID = Core.SessionHelper.getClientId(); string isBillable = null; string unitDescription = null; GridViewRow footerRow = this.gvInvoiceLines.FooterRow; List <InvoiceServiceType> invoiceServices = InvoiceServiceManager.GetAll(clientID).ToList(); DropDownList cbx = footerRow.FindControl("cbxServiceDescription") as DropDownList; if (cbx != null && invoiceServices != null && invoiceServices.Count > 0) { // clear all items cbx.Items.Clear(); // add select options cbx.Items.Add(new ListItem("Select service", "0")); foreach (InvoiceServiceType invoiceService in invoiceServices) { if (invoiceService.InvoiceServiceUnit != null) { isBillable = ((bool)invoiceService.InvoiceServiceUnit.IsActive) ? "1" : "0"; unitDescription = invoiceService.InvoiceServiceUnit.UnitDescription; } else { isBillable = "0"; unitDescription = invoiceService.ServiceDescription; } ListItem item = new ListItem(invoiceService.ServiceDescription.Trim(), string.Format("{0}|{1}|{2}|{3}|{4}|{5}", invoiceService.ServiceTypeID, invoiceService.ServiceRate ?? 0, unitDescription, isBillable, invoiceService.ServicePercentage ?? 0, invoiceService.DefaultQty ?? 0 )); cbx.Items.Add(item); } } }
private void copyInvoiceServices(int sourceClientID, int targetClientID, int userID) { //List<InvoiceService> services = null; List <InvoiceServiceType> serviceTypes = null; List <InvoiceServiceUnit> serviceUnits = null; // invoice service units serviceUnits = InvoiceServiceManager.GetServiceUnits(sourceClientID); if (serviceUnits != null) { foreach (InvoiceServiceUnit serviceUnit in serviceUnits) { InvoiceServiceUnit newServiceUnit = new InvoiceServiceUnit(); newServiceUnit.ClientID = targetClientID; newServiceUnit.IsActive = serviceUnit.IsActive; newServiceUnit.UnitDescription = serviceUnit.UnitDescription; InvoiceServiceUnitManager.Save(newServiceUnit); } } // invoice service types serviceTypes = InvoiceServiceManager.GetAll(sourceClientID).ToList(); foreach (InvoiceServiceType serviceType in serviceTypes) { InvoiceServiceType newServiceType = new InvoiceServiceType(); newServiceType.ClientID = targetClientID; newServiceType.isActive = serviceType.isActive; newServiceType.ServiceDescription = serviceType.ServiceDescription; newServiceType.ServicePercentage = serviceType.ServicePercentage; newServiceType.ServiceRate = serviceType.ServiceRate; InvoiceServiceManager.Save(newServiceType); } }