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); } }
/// <summary> /// Deprecated Method for adding a new object to the InvoiceServiceTypes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToInvoiceServiceTypes(InvoiceServiceType invoiceServiceType) { base.AddObject("InvoiceServiceTypes", invoiceServiceType); }
protected void btnSave_Click(object sender, EventArgs e) { lblMessage.Visible = false; lblMessage.Text = string.Empty; int clientID = Core.SessionHelper.getClientId(); int id = 0; int unitID = 0; InvoiceServiceType service = null; Page.Validate("service"); if (!Page.IsValid) return; try { int.TryParse(hfId.Value, out id); using (InvoiceServiceTypeManager repository = new InvoiceServiceTypeManager()) { if (id == 0) { service = new InvoiceServiceType(); service.ClientID = clientID; service.isActive = true; service.IsTaxable = false; } else { service = repository.Get(id); } service.MinimumFee = txtMinimumFee.Value == null ? 0 : Convert.ToDecimal(txtMinimumFee.Value); service.IsTaxable = cbxIsTaxable.Checked; service.DefaultQty = txtDefaultQty.Value == null ? 0 : Convert.ToDecimal(txtDefaultQty.Value); service.ServiceRate = txtRate.Value == null ? 0 : Convert.ToDecimal(txtRate.Value); service.ServicePercentage = txtPercentage.Value == null ? 0 : Convert.ToDecimal(txtPercentage.Value); service.ServiceDescription = txtServiceDescription.Text.Trim(); service.EarningCode = txtEarningCode.Text.Trim(); //int.TryParse(ddlUnit.SelectedValue, out unitID); //if (ddlUnit.SelectedIndex > 0) // service.UnitID = unitID; //else // service.UnitID = null; repository.Save(service); } lblMessage.Text = "Service type saved successfully."; lblMessage.CssClass = "ok"; pnlEdit.Visible = false; pnlGrid.Visible = true; loadServices(); } catch (Exception ex) { lblMessage.Text = "Unable to save service type information!"; lblMessage.CssClass = "error"; Core.EmailHelper.emailError(ex); } }
/// <summary> /// Create a new InvoiceServiceType object. /// </summary> /// <param name="serviceTypeID">Initial value of the ServiceTypeID property.</param> public static InvoiceServiceType CreateInvoiceServiceType(global::System.Int32 serviceTypeID) { InvoiceServiceType invoiceServiceType = new InvoiceServiceType(); invoiceServiceType.ServiceTypeID = serviceTypeID; return invoiceServiceType; }
public InvoiceServiceType Save(InvoiceServiceType obj) { if (obj.ServiceTypeID == 0) { claimRulerDBContext.InvoiceServiceType.Add(obj); } claimRulerDBContext.SaveChanges(); return obj; }