コード例 #1
0
ファイル: PaymentDOP.cs プロジェクト: irijon/win
        public PaymentDOP CopyFromPerson(Payment person)
        {
            PaymentDOP       perDPO = new PaymentDOP();
            ServiceViewModel vmSer  = new ServiceViewModel();
            ClientViewModel  vmCl   = new ClientViewModel();
            string           ser    = string.Empty;
            string           cl     = string.Empty;

            foreach (var r in vmSer.ServiceList)
            {
                if (r.Id == person.ServiceId)
                {
                    ser = r.Name;
                    break;
                }
            }
            foreach (var r in vmCl.ClientPerson)
            {
                if (r.Id == person.ClientId)
                {
                    cl = r.FirstName + " " + r.LastName;
                    break;
                }
            }
            if (ser != string.Empty && cl != string.Empty)
            {
                perDPO.Id       = person.Id;
                perDPO.Quantity = person.Quantity;
                perDPO.Service  = ser;
                perDPO.Client   = cl;
                perDPO.Amount   = person.Amount;
                perDPO.Date     = person.Date;
            }
            return(perDPO);
        }
コード例 #2
0
        public Payment CopyFromPaymentDPO(PaymentDOP p)
        {
            ServiceViewModel vmSer = new ServiceViewModel();
            ClientViewModel  vmCl  = new ClientViewModel();
            int SERId = 0;
            int CLId  = 0;

            foreach (var r in vmSer.ServiceList)
            {
                if (r.Name == p.Service)
                {
                    SERId = r.Id;
                    break;
                }
            }
            foreach (var r in vmCl.ClientPerson)
            {
                if (r.FirstName + " " + r.LastName == p.Client)
                {
                    CLId = r.Id;
                    break;
                }
            }
            if (SERId != 0 && CLId != 0)
            {
                this.Id        = p.Id;
                this.ServiceId = SERId;
                this.ClientId  = CLId;
                this.Date      = p.Date;
                this.Quantity  = p.Quantity;
                this.Amount    = p.Amount;
            }
            return(this);
        }