예제 #1
0
        public static ExtraOrderLogoff Create(Visit visit, ILoggedPart part, ExtraOrder extraOrder, string login)
        {
            if (visit == null)
            {
                return(null);
            }
            if (part == null)
            {
                return(null);
            }
            if (extraOrder == null)
            {
                return(null);
            }

            var unitPrice     = part.PriceExtra;
            var vat           = part.VatExtra;
            var valueMaterial = part as ValueMaterial;

            if (valueMaterial != null)
            {
                if (valueMaterial.GroupId != null && valueMaterial.Group != null)
                {
                    //When a part belongs to a group => the price and vat of the group is used on the ExtraOrder
                    unitPrice = valueMaterial.Group.PriceExtra;
                    vat       = valueMaterial.Group.VatExtra;
                }
            }

            var logOff = new ExtraOrderLogoff
            {
                VisitId      = visit.Id,
                Visit        = visit,
                PartId       = part.Id,
                Part         = (Part)part,
                ExtraOrderId = extraOrder.VisitId,
                ExtraOrder   = extraOrder,
                UnitPrice    = unitPrice,
                Vat          = vat
            };

            logOff.SetAuditInfo(login);
            return(logOff);
        }
예제 #2
0
        public static LogOff Create(Visit visit, ILoggedPart part, string login)
        {
            if (visit == null)
            {
                return(null);
            }
            if (part == null)
            {
                return(null);
            }

            var logOff = new LogOff
            {
                VisitId = visit.Id,
                Visit   = visit,
                PartId  = part.Id,
                Part    = (Part)part
            };

            logOff.SetAuditInfo(login);
            return(logOff);
        }