예제 #1
0
        public int SaveCharge(Charge charge)
        {
            Charge dbCharge;

            if (charge.ChargeId == 0)
            {
                dbCharge = new Charge()
                {
                    ChargeId = Charges.Count
                }
            }
            ;
            else
            {
                dbCharge = Charges.Single(item => item.ChargeId == charge.ChargeId);
            }
            dbCharge.AccountNumber     = charge.AccountNumber;
            dbCharge.BilledAmount      = charge.BilledAmount;
            dbCharge.Category          = charge.Category;
            dbCharge.Description       = charge.Description;
            dbCharge.EmployeeId        = charge.EmployeeId;
            dbCharge.ExpenseDate       = charge.ExpenseDate;
            dbCharge.ExpenseReportId   = charge.ExpenseReportId;
            dbCharge.ExpenseType       = charge.ExpenseType;
            dbCharge.Location          = charge.Location;
            dbCharge.Merchant          = charge.Merchant;
            dbCharge.Notes             = charge.Notes;
            dbCharge.ReceiptRequired   = charge.ReceiptRequired;
            dbCharge.TransactionAmount = charge.TransactionAmount;
            if (charge.ChargeId == 0)
            {
                Charges.Add(dbCharge);
            }
            return(dbCharge.ChargeId);
        }
예제 #2
0
        private void UpdateCharges(UMCLight feature)
        {
            Charges.Clear();
            m_scanMaps = feature.CreateChargeMap();

            foreach (var charge in m_scanMaps.Keys)
            {
                double mz           = 0;
                var    minScan      = int.MaxValue;
                var    maxScan      = int.MinValue;
                double maxIntensity = 0;

                foreach (var msFeature in m_scanMaps[charge])
                {
                    minScan = Math.Min(minScan, msFeature.Scan);
                    maxScan = Math.Max(maxScan, msFeature.Scan);

                    if (maxIntensity >= msFeature.Abundance)
                    {
                        continue;
                    }

                    maxIntensity = msFeature.Abundance;
                    mz           = msFeature.Mz;
                }

                Charges.Add(new ChargeStateViewModel(charge, mz, minScan, maxScan));
            }
            if (Charges.Count <= 0)
            {
                return;
            }

            SelectedCharge = Charges[0];
        }
예제 #3
0
 public void AddCharge(decimal charge)
 {
     if (charge < 0.0m)
     {
         throw new ArgumentException("Invalid value.");
     }
     Charges.Add(charge);
 }
예제 #4
0
        /// <summary>
        /// Add an array of OrderCharge.
        /// <param name="charges">List<OrderCharge></param>
        /// <returns>OrderCreateRequest</returns>
        /// </summary>
        public OrderCreateRequest AddCharges(List <OrderCharge> charges)
        {
            foreach (OrderCharge e in charges)
            {
                Charges.Add(e);
            }

            return(this);
        }
예제 #5
0
        void AddFreeCharges(Employee employee)
        {
            for (int month = 0; month < 9; ++month)
            {
                int chargesCount = (int)(13 - 1.3 * month) - 2;
                for (int chargeIndex = 0; chargeIndex < chargesCount; ++chargeIndex)
                {
                    int          descRef  = random.Next() % 100000000;
                    CategoryType category = (CategoryType)random.Next(10);
                    if (category == CategoryType.Other)
                    {
                        category = CategoryType.AirFare;
                    }
                    int amountBase;
                    switch (category)
                    {
                    case CategoryType.AirFare: amountBase = 300; break;

                    case CategoryType.CarRental: amountBase = 400; break;

                    case CategoryType.ConferenceSeminar: amountBase = 200; break;

                    case CategoryType.Entertainment: amountBase = 120; break;

                    case CategoryType.Gifts: amountBase = 300; break;

                    case CategoryType.Hotel: amountBase = 500; break;

                    case CategoryType.Mileage: amountBase = 300; break;

                    case CategoryType.OtherTravelAndLodging: amountBase = 300; break;

                    case CategoryType.TEMeals: amountBase = 300; break;

                    default: amountBase = 80; break;
                    }
                    int amount = amountBase + random.Next(30);
                    Charges.Add(new Charge()
                    {
                        ChargeId          = Charges.Count + 1,
                        AccountNumber     = 723000,
                        BilledAmount      = amount,
                        Category          = category,
                        Description       = "REF# " + descRef.ToString(),
                        EmployeeId        = employee.EmployeeId,
                        ExpenseDate       = DateTime.Today.AddDays(-30 * month - random.Next(30)),
                        ExpenseType       = ChargeType.Business,
                        Location          = random.Next(2) == 1 ? "San Francisco, CA" : random.Next(2) == 1 ? "Seattle, WA" : "Chicago, IL",
                        Merchant          = random.Next(5) != 4 ? "Northwind Inn" : "Contoso Taxi",
                        Notes             = string.Empty,
                        ReceiptRequired   = true,
                        TransactionAmount = (decimal)(0.75 * amount),
                    });
                }
            }
        }
예제 #6
0
        }         // ShiftPayments

        public virtual bool TryAddCharge(LoanCharge charge)
        {
            if (charge.Date < Date)
            {
                throw new ArgumentException("Charge date is before loan start date");
            }

            var charges = Charges.Where(c => {
                var name1 = c.ChargesType.Name;
                var name2 = charge.ChargesType.Name;
                if (name1 == name2)
                {
                    return(true);
                }
                if (name1 == "PartialPaymentCharge" && name2 == "AdministrationCharge")
                {
                    return(true);
                }
                if (name2 == "PartialPaymentCharge" && name1 == "AdministrationCharge")
                {
                    return(true);
                }
                return(false);
            }).ToList();

            if (charge.Date > Schedule.First().Date)
            {
                var dateFrom = Schedule.Last(s => s.Date < charge.Date).Date;
                charges = charges.Where(c => c.Date >= dateFrom).ToList();
            }

            if (charge.Date < Schedule.Last().Date)
            {
                var dateUpTo = Schedule.First(s => s.Date >= charge.Date).Date;
                charges = charges.Where(c => c.Date < dateUpTo).ToList();
            }

            if (charges.Any())
            {
                return(false);
            }

            Charges.Add(charge);

            return(true);
        }         // TryAddCharge
예제 #7
0
        public void AddCharge(Charge charge)
        {
            if (charge.Amount == null || charge.Amount.Amount == 0)
            {
                throw new InvalidChargeException("Cannot add charge to invoice, invalid amount");
            }
            if (charge.Amount.Currency == null || charge.Amount.Currency != this.Currency)
            {
                throw new InvalidChargeException("Cannot add charge to invoice, invalid currency");
            }
            if (charge.Event.Date.Year != this.Year || charge.Event.Date.Month != this.Month)
            {
                throw new InvalidChargeException("Cannot add charge to invoice, invalid charge date");
            }

            Charges.Add(charge);
        }
예제 #8
0
        public void AddCharge(DateTime date, HSP hsp, int planNum, Service service, int enrolleeId, String enrolleeEmail, double totalBillAmount, double enrolleeBillAmount)
        {
            this.planCtrl = new PlanController((int)PrimaryEnrollee, enrolleeEmail, true);
            var bill = new Bill(date, hsp.Id, planNum, service.Id, enrolleeId, enrolleeEmail, totalBillAmount, enrolleeBillAmount);

            Charges.Add(bill);
            APDRemainder -= enrolleeBillAmount;
            if (APDRemainder < 0)
            {
                APDRemainder = 0;
            }
            PYMBRemainder -= (totalBillAmount - enrolleeBillAmount);

            if (OPMIRemainder != 0 && OPMFRemainder != 0)
            {
                if (OPMIRemainder < enrolleeBillAmount)
                {
                    TotalCost += OPMIRemainder;
                }
                else if (OPMFRemainder < enrolleeBillAmount)
                {
                    TotalCost += OPMFRemainder;
                }
                else
                {
                    TotalCost += (enrolleeBillAmount);
                }
            }

            OPMIRemainder -= (totalBillAmount - enrolleeBillAmount);
            if (OPMIRemainder < 0)
            {
                OPMIRemainder = 0;
            }

            OPMFRemainder -= (totalBillAmount - enrolleeBillAmount);
            if (OPMFRemainder < 0)
            {
                OPMFRemainder = 0;
            }


            planCtrl.addBill(bill);
        }
예제 #9
0
        /// <summary>
        /// Method to get sale line charges
        /// </summary>
        /// <param name="saleNumber">Sale number</param>
        /// <param name="lineNumber">Line number</param>
        /// <param name="dataSource">Data source</param>
        /// <returns>Charges</returns>
        public Charges GetSaleLineCharges(int saleNumber, int lineNumber, DataSource dataSource)
        {
            var rsLineChg = GetRecords("Select *  FROM   SaleChg  WHERE  SaleChg.Sale_No = " + Convert.ToString(saleNumber) + " AND " + "       SaleChg.Line_No = " + Convert.ToString(lineNumber) + " " + "Order By SaleChg.As_Code ", dataSource);
            var charges   = new Charges();

            foreach (DataRow charge in rsLineChg.Rows)
            {
                var rsLcTax = GetRecords("Select *  FROM   ChargeTax  WHERE  ChargeTax.Sale_No = " + Convert.ToString(saleNumber) + " AND " + "       ChargeTax.Line_No = " + Convert.ToString(lineNumber) + " AND " + "       ChargeTax.As_Code = \'" + CommonUtility.GetStringValue(charge["As_Code"]) + "\' ", dataSource);
                // Find any taxes that applied to those charges.
                var lct = new Charge_Taxes();
                foreach (DataRow tax in rsLcTax.Rows)
                {
                    lct.Add(Convert.ToString(tax["Tax_Name"]), Convert.ToString(tax["Tax_Code"]),
                            Convert.ToSingle(tax["Tax_Rate"]), Convert.ToBoolean(tax["Tax_Included"]), "");
                }

                charges.Add(Convert.ToString(charge["As_Code"]), Convert.ToString(charge["Description"]),
                            Convert.ToSingle(charge["price"]), lct, "");
            }

            return(charges);
        }
예제 #10
0
        /// <summary>
        /// Method to make charges
        /// </summary>
        /// <param name="stockCode">Stock code</param>
        /// <param name="stockType">Stock type</param>
        /// <returns>Charges</returns>
        private Charges GetCharges(string stockCode, char stockType)
        {
            var dateStart = DateTime.Now;

            Performancelog.Debug($"Start,StockManager,GetCharges,{string.Empty},{DateTime.Now:hh.mm.ss.ffffff}");
            var cg = new Charges();

            if (stockType == 'G')
            {
                return(null);
            }
            var allTaxes = _taxService.GetAllTaxes();
            // Load Charges
            var charges = _stockService.GetAssociateCharges(stockCode);

            foreach (var charge in charges)
            {
                var taxes = _stockService.GetTax(charge.AsCode);
                var cs    = new Charge_Taxes();
                foreach (var tax in taxes)
                {
                    var taxMast = allTaxes.FirstOrDefault(t => t.TaxName == tax.Tax_Name && t.Active.HasValue && t.Active.Value);
                    if (taxMast != null)
                    {
                        cs.Add(Convert.ToString(tax.Tax_Name), Convert.ToString(tax.Tax_Code),
                               Convert.ToSingle(tax.Tax_Rate), Convert.ToBoolean(tax.Tax_Included), "");
                    }
                }

                cg.Add(Convert.ToString(charge.AsCode), Convert.ToString(charge.Description),
                       Convert.ToSingle(charge.Price), cs, "");
            }

            var returnValue = cg;

            Performancelog.Debug($"End,StockManager,GetCharges,{DateTime.Now.Subtract(dateStart).TotalMilliseconds},{DateTime.Now:hh.mm.ss.ffffff}");

            return(returnValue);
        }
예제 #11
0
        public void Load(Stream stream)
        {
            using (BinaryReader bw = new BinaryReader(stream)) {
                int count = bw.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Employee employee = new Employee();
                    employee.Alias      = bw.ReadString();
                    employee.EmployeeId = bw.ReadInt32();
                    employee.Manager    = bw.ReadString();
                    employee.Name       = bw.ReadString();
                    Employees.Add(employee);
                }

                count = bw.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    ExpenseReport er = new ExpenseReport();
                    er.Amount     = bw.ReadInt64();
                    er.Approver   = bw.ReadString();
                    er.CostCenter = bw.ReadInt32();
                    long tickCount = bw.ReadInt64();
                    if (tickCount != 0)
                    {
                        er.DateResolved = new DateTime(tickCount);
                    }
                    tickCount = bw.ReadInt64();
                    if (tickCount != 0)
                    {
                        er.DateSaved = new DateTime(tickCount);
                    }
                    tickCount = bw.ReadInt64();
                    if (tickCount != 0)
                    {
                        er.DateSubmitted = new DateTime(tickCount);
                    }
                    er.EmployeeId       = bw.ReadInt32();
                    er.ExpenseReportId  = bw.ReadInt32();
                    er.Notes            = bw.ReadString();
                    er.OwedToCreditCard = bw.ReadInt64();
                    er.OwedToEmployee   = bw.ReadInt64();
                    er.Purpose          = bw.ReadString();
                    er.Status           = (ExpenseReportStatus)bw.ReadInt32();
                    ExpenseReports.Add(er);
                }
                count = bw.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    Charge charge = new Charge();
                    charge.AccountNumber = bw.ReadInt32();
                    charge.BilledAmount  = bw.ReadInt64();
                    charge.Category      = (CategoryType)bw.ReadInt32();
                    charge.ChargeId      = bw.ReadInt32();
                    charge.Description   = bw.ReadString();
                    charge.EmployeeId    = bw.ReadInt32();
                    charge.ExpenseDate   = new DateTime(bw.ReadInt64());
                    int value = bw.ReadInt32();
                    if (value != 0)
                    {
                        charge.ExpenseReportId = value;
                    }
                    charge.ExpenseType       = (ChargeType)bw.ReadInt32();
                    charge.Location          = bw.ReadString();
                    charge.Merchant          = bw.ReadString();
                    charge.Notes             = bw.ReadString();
                    charge.ReceiptRequired   = bw.ReadBoolean();
                    charge.TransactionAmount = bw.ReadInt64();
                    Charges.Add(charge);
                }
            }
        }
예제 #12
0
 public void AddCharge(Charge depense)
 {
     Charges.Add(depense);
     SaveChanges();
 }
예제 #13
0
        void AddCharges(int month, ExpenseReport expenseReport, Employee employee)
        {
            int amount1 = month == 1 ? 0 : month == 2 ? 40 : month == 3 ? 20 : month == 4 ? 40 : 80;
            int amount2 = month == 1 ? 10 : month == 2 ? 120 : month == 3 ? 40 : month == 4 ? 80 : 30;
            int amount3 = month == 1 ? 20 : month == 2 ? 40 : month == 3 ? 50 : month == 4 ? 22 : 90;
            int amount4 = month == 1 ? 120 : month == 2 ? 30 : month == 3 ? 40 : month == 4 ? 28 : 50;
            int amount5 = month == 1 ? 80 : month == 2 ? 20 : month == 3 ? 30 : month == 4 ? 14 : 13;
            int amount6 = month == 1 ? 40 : month == 2 ? 120 : month == 3 ? 200 : month == 4 ? 56 : 88;

            Charges.Add(new Charge()
            {
                ChargeId          = Charges.Count + 1,
                AccountNumber     = 723000,
                BilledAmount      = amount1 + random.Next(10),
                Category          = (int)CategoryType.AirFare,
                Description       = "Airfare to San Francisco",
                EmployeeId        = employee.EmployeeId,
                ExpenseReportId   = expenseReport.ExpenseReportId,
                ExpenseDate       = DateTime.Today.AddDays(-60),
                ExpenseType       = ChargeType.Business,
                Location          = "Chicago, IL",
                Merchant          = "Blue Yonder Airlines",
                Notes             = string.Empty,
                ReceiptRequired   = true,
                TransactionAmount = 350M,
            });
            Charges.Add(new Charge()
            {
                ChargeId          = Charges.Count + 1,
                AccountNumber     = 723000,
                BilledAmount      = amount2 + random.Next(10),
                Category          = CategoryType.OtherTravelAndLodging,
                Description       = "Cab from airport",
                EmployeeId        = employee.EmployeeId,
                ExpenseReportId   = expenseReport.ExpenseReportId,
                ExpenseDate       = DateTime.Today.AddDays(-45),
                ExpenseType       = ChargeType.Business,
                Location          = "San Francisco, CA",
                Merchant          = "Contoso Taxi",
                Notes             = string.Empty,
                ReceiptRequired   = false,
                TransactionAmount = 50,
            });
            Charges.Add(new Charge()
            {
                ChargeId          = Charges.Count + 1,
                AccountNumber     = 723000,
                BilledAmount      = amount3 + random.Next(10),
                Category          = CategoryType.Mileage,
                Description       = "Cab to airport",
                EmployeeId        = employee.EmployeeId,
                ExpenseReportId   = expenseReport.ExpenseReportId,
                ExpenseDate       = DateTime.Today.AddDays(-45),
                ExpenseType       = ChargeType.Business,
                Location          = "San Francisco, CA",
                Merchant          = "Contoso Taxi",
                Notes             = string.Empty,
                ReceiptRequired   = false,
                TransactionAmount = 50,
            });
            Charges.Add(new Charge()
            {
                ChargeId          = Charges.Count + 1,
                AccountNumber     = 723000,
                BilledAmount      = amount4 + random.Next(10),
                Category          = CategoryType.Hotel,
                Description       = "Cab to airport",
                EmployeeId        = employee.EmployeeId,
                ExpenseReportId   = expenseReport.ExpenseReportId,
                ExpenseDate       = DateTime.Today.AddDays(-45),
                ExpenseType       = ChargeType.Business,
                Location          = "San Francisco, CA",
                Merchant          = "Contoso Taxi",
                Notes             = string.Empty,
                ReceiptRequired   = false,
                TransactionAmount = 50,
            });
            Charges.Add(new Charge()
            {
                ChargeId          = Charges.Count + 1,
                AccountNumber     = 723000,
                BilledAmount      = amount5 + random.Next(10),
                Category          = CategoryType.CarRental,
                Description       = "Cab to airport",
                EmployeeId        = employee.EmployeeId,
                ExpenseReportId   = expenseReport.ExpenseReportId,
                ExpenseDate       = DateTime.Today.AddDays(-45),
                ExpenseType       = ChargeType.Business,
                Location          = "San Francisco, CA",
                Merchant          = "Contoso Taxi",
                Notes             = string.Empty,
                ReceiptRequired   = false,
                TransactionAmount = 50,
            });
            Charges.Add(new Charge()
            {
                ChargeId          = Charges.Count + 1,
                AccountNumber     = 723000,
                BilledAmount      = amount5 + random.Next(10),
                Category          = CategoryType.ConferenceSeminar,
                Description       = "Cab to airport",
                EmployeeId        = employee.EmployeeId,
                ExpenseReportId   = expenseReport.ExpenseReportId,
                ExpenseDate       = DateTime.Today.AddDays(-45),
                ExpenseType       = ChargeType.Business,
                Location          = "San Francisco, CA",
                Merchant          = "Contoso Taxi",
                Notes             = string.Empty,
                ReceiptRequired   = false,
                TransactionAmount = 50,
            });
            Charges.Add(new Charge()
            {
                ChargeId          = Charges.Count + 1,
                AccountNumber     = 723000,
                BilledAmount      = amount6 + random.Next(10),
                Category          = CategoryType.Entertainment,
                Description       = "Cab to airport",
                EmployeeId        = employee.EmployeeId,
                ExpenseReportId   = expenseReport.ExpenseReportId,
                ExpenseDate       = DateTime.Today.AddDays(-45),
                ExpenseType       = ChargeType.Business,
                Location          = "San Francisco, CA",
                Merchant          = "Contoso Taxi",
                Notes             = string.Empty,
                ReceiptRequired   = false,
                TransactionAmount = 50,
            });
            Charges.Add(new Charge()
            {
                ChargeId          = Charges.Count + 1,
                AccountNumber     = 723000,
                BilledAmount      = amount6 + random.Next(10),
                Category          = CategoryType.Gifts,
                Description       = "Cab to airport",
                EmployeeId        = employee.EmployeeId,
                ExpenseReportId   = expenseReport.ExpenseReportId,
                ExpenseDate       = DateTime.Today.AddDays(-45),
                ExpenseType       = ChargeType.Business,
                Location          = "San Francisco, CA",
                Merchant          = "Contoso Taxi",
                Notes             = string.Empty,
                ReceiptRequired   = false,
                TransactionAmount = 50,
            });
        }
예제 #14
0
 /// <summary>
 /// Add a OrderCharge.
 /// - charge: OrderCharge
 /// - Returns: Self
 /// </summary>
 public OrderCreateRequest AddCharge(OrderCharge charge)
 {
     Charges.Add(charge);
     return(this);
 }
예제 #15
0
        void AddApprovedReports(string managerAlias, Employee employee)
        {
            DateTime today             = DateTime.Today;
            DateTime currentMonthStart = new DateTime(today.Year, today.Month, 1);

            for (DateTime monthStart = currentMonthStart.AddMonths(-2); monthStart > today.AddYears(-3); monthStart = monthStart.AddMonths(-1))
            {
                int           daysInMonth   = (int)(monthStart.AddMonths(1) - monthStart).TotalDays;
                int           b1            = 250 + random.Next(100);
                int           b2            = 100 + random.Next(20);
                int           b3            = 100 + random.Next(10);
                int           b4            = 310 + random.Next(90);
                ExpenseReport expenseReport = new ExpenseReport()
                {
                    ExpenseReportId  = ExpenseReports.Count + 1,
                    EmployeeId       = employee.EmployeeId,
                    Amount           = b1 + b2 + b3 + b4,
                    Approver         = managerAlias,
                    CostCenter       = 50992,
                    DateSubmitted    = monthStart.AddDays((today.Day - 5 + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    DateResolved     = monthStart.AddDays((today.Day + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    Notes            = "Visit to Tailspin Toys",
                    OwedToCreditCard = 850M,
                    OwedToEmployee   = 0M,
                    Purpose          = "Customer visit",
                    Status           = ExpenseReportStatus.Approved
                };
                ExpenseReports.Add(expenseReport);
                Charges.Add(new Charge()
                {
                    ChargeId          = Charges.Count + 1,
                    AccountNumber     = 723000,
                    BilledAmount      = b1,
                    Category          = (int)CategoryType.AirFare,
                    Description       = "Airfare to Chicago",
                    EmployeeId        = employee.EmployeeId,
                    ExpenseReportId   = expenseReport.ExpenseReportId,
                    ExpenseDate       = monthStart.AddDays((today.Day - 15 + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    ExpenseType       = ChargeType.Business,
                    Location          = "Chicago, IL",
                    Merchant          = "Blue Yonder Airlines",
                    Notes             = string.Empty,
                    ReceiptRequired   = true,
                    TransactionAmount = 350M,
                });
                Charges.Add(new Charge()
                {
                    ChargeId          = Charges.Count + 1,
                    AccountNumber     = 723000,
                    BilledAmount      = b2,
                    Category          = CategoryType.OtherTravelAndLodging,
                    Description       = "Cab from airport",
                    EmployeeId        = employee.EmployeeId,
                    ExpenseReportId   = expenseReport.ExpenseReportId,
                    ExpenseDate       = monthStart.AddDays((today.Day - 5 + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    ExpenseType       = ChargeType.Business,
                    Location          = "Chicago, IL",
                    Merchant          = "Contoso Taxi",
                    Notes             = string.Empty,
                    ReceiptRequired   = false,
                    TransactionAmount = 50M,
                });
                Charges.Add(new Charge()
                {
                    ChargeId          = Charges.Count + 1,
                    AccountNumber     = 723000,
                    BilledAmount      = b3,
                    Category          = CategoryType.TEMeals,
                    Description       = "Cab to airport",
                    EmployeeId        = employee.EmployeeId,
                    ExpenseReportId   = expenseReport.ExpenseReportId,
                    ExpenseDate       = monthStart.AddDays((today.Day - 3 + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    ExpenseType       = ChargeType.Business,
                    Location          = "Chicago, IL",
                    Merchant          = "Contoso Taxi",
                    Notes             = string.Empty,
                    ReceiptRequired   = false,
                    TransactionAmount = 50M,
                });
                Charges.Add(new Charge()
                {
                    ChargeId          = Charges.Count + 1,
                    AccountNumber     = 723000,
                    BilledAmount      = b4,
                    Category          = CategoryType.Hotel,
                    Description       = "2 nights hotel",
                    EmployeeId        = employee.EmployeeId,
                    ExpenseReportId   = expenseReport.ExpenseReportId,
                    ExpenseDate       = monthStart.AddDays((today.Day - 3 + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    ExpenseType       = ChargeType.Business,
                    Location          = "Chicago, IL",
                    Merchant          = "Northwind Inn",
                    Notes             = string.Empty,
                    ReceiptRequired   = true,
                    TransactionAmount = 400M,
                });
                int c1 = 330 + random.Next(120);
                int c2 = 120 + random.Next(10);
                expenseReport = new ExpenseReport()
                {
                    ExpenseReportId  = ExpenseReports.Count + 1,
                    Amount           = c1,
                    Approver         = managerAlias,
                    CostCenter       = 50992,
                    DateSubmitted    = monthStart.AddDays((today.Day - 5 + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    DateResolved     = monthStart.AddDays((today.Day + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    Notes            = "",
                    OwedToCreditCard = 0,
                    OwedToEmployee   = 50M,
                    Purpose          = "Last month's cell phone",
                    Status           = ExpenseReportStatus.Approved,
                };
                ExpenseReports.Add(expenseReport);
                Charges.Add(new Charge()
                {
                    ChargeId          = Charges.Count + 1,
                    AccountNumber     = 742000,
                    BilledAmount      = b3,
                    Category          = CategoryType.Entertainment,
                    Description       = "Cell phone bill",
                    EmployeeId        = employee.EmployeeId,
                    ExpenseReportId   = expenseReport.ExpenseReportId,
                    ExpenseDate       = monthStart.AddDays((today.Day - 10 + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    ExpenseType       = ChargeType.Personal,
                    Location          = "Seattle, WA",
                    Merchant          = "The Phone Company",
                    Notes             = string.Empty,
                    ReceiptRequired   = true,
                    TransactionAmount = 50M,
                });
                Charges.Add(new Charge()
                {
                    ChargeId          = Charges.Count + 1,
                    AccountNumber     = 742000,
                    BilledAmount      = c2,
                    Category          = CategoryType.Mileage,
                    Description       = "Cell phone bill",
                    EmployeeId        = employee.EmployeeId,
                    ExpenseReportId   = expenseReport.ExpenseReportId,
                    ExpenseDate       = monthStart.AddDays((today.Day - 10 + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    ExpenseType       = ChargeType.Personal,
                    Location          = "Seattle, WA",
                    Merchant          = "The Phone Company",
                    Notes             = string.Empty,
                    ReceiptRequired   = true,
                    TransactionAmount = 50M,
                });
                Charges.Add(new Charge()
                {
                    ChargeId          = Charges.Count + 1,
                    AccountNumber     = 742000,
                    BilledAmount      = b4,
                    Category          = CategoryType.Hotel,
                    Description       = "Cell phone bill",
                    EmployeeId        = employee.EmployeeId,
                    ExpenseReportId   = expenseReport.ExpenseReportId,
                    ExpenseDate       = monthStart.AddDays((today.Day - 10 + daysInMonth - 1) % (daysInMonth - 1) + 1),
                    ExpenseType       = ChargeType.Personal,
                    Location          = "Seattle, WA",
                    Merchant          = "The Phone Company",
                    Notes             = string.Empty,
                    ReceiptRequired   = true,
                    TransactionAmount = 50M,
                });
            }
        }
예제 #16
0
        /// <summary>
        /// Add another evidence of the ConsensusTarget
        /// </summary>
        /// <param name="evidence"></param>
        public void AddEvidence(Evidence evidence)
        {
            Evidences.Add(evidence);
            if (Sequence == null)
            {
                Sequence = evidence.Sequence;
            }
            evidence.Sequence = Sequence;
            if (Math.Abs(PredictedNet) < double.Epsilon)
            {
                PredictedNet = evidence.PredictedNet;
            }
            // For rebuilding and getting the predicted NET into Evidence
            // when reloading back into the data objects
            evidence.PredictedNet = PredictedNet;

            if (MultiProteinCount == 0)
            {
                MultiProteinCount = evidence.MultiProteinCount;
            }
            evidence.MultiProteinCount = MultiProteinCount;

            if (string.IsNullOrWhiteSpace(ModificationDescription))
            {
                ModificationDescription = evidence.ModificationDescription;
            }
            evidence.ModificationDescription = ModificationDescription;

            if (ModificationCount == 0)
            {
                ModificationCount = evidence.ModificationCount;
            }
            evidence.ModificationCount = ModificationCount;

            if (evidence.Ptms.Count != 0 && Ptms.Count == 0)
            {
                foreach (var ptm in evidence.Ptms)
                {
                    Ptms.Add(ptm);
                    ptm.Parent = this;
                }
            }
            var tempList = Ptms.ToList();

            tempList.Sort((x, y) => x.Location.CompareTo(y.Location));

            // Copy sequence as is up until you hit a modification
            //For numeric, add a bracket add +/- and copy the mass
            //For non numeric, add a bracket add +/- and copy the formula
            var numeric    = "";
            var nonNumeric = "";
            var cleanSeq   = "";

            var sequencePos    = 0;
            var symbolsRemoved = 0;

            string partialSeq;

            foreach (var ptm in tempList)
            {
                partialSeq  = Sequence.Substring(sequencePos, (ptm.Location + PreCharCount + symbolsRemoved) - sequencePos);
                cleanSeq   += partialSeq;
                numeric    += partialSeq + string.Format("[{0}{1}]", ((ptm.Mass > 0) ? "+" : "-"), ptm.Mass);
                nonNumeric += partialSeq + string.Format("[{0}{1}]", ((ptm.Mass > 0) ? "+" : "-"), ptm.Formula);
                sequencePos = ptm.Location + PreCharCount;
                // To skip over non-alphanumeric characters in the sequence such as "*" or "&"
                // which can be used to denote ptms in .txt files, but not skip over "." or "-"
                // which are standard characters in peptide sequences to separate peptide from
                // pre/post residues and to denote the lack of a pre/post residue respectively
                int indexCheck = sequencePos + symbolsRemoved;
                if ((Sequence[indexCheck] != 46 && Sequence[indexCheck] != 45) &&
                    (Sequence[indexCheck] < 65 || Sequence[indexCheck] > 90))
                {
                    sequencePos += ++symbolsRemoved;
                }
            }
            partialSeq       = Sequence.Substring(sequencePos);
            cleanSeq        += partialSeq;
            numeric         += partialSeq;
            nonNumeric      += partialSeq;
            StrippedSequence = cleanSeq;
            var pieces = cleanSeq.Split('.');

            if (pieces.Count() != 1)
            {
                PrefixResidue    = pieces[0].First();
                StrippedSequence = pieces[1];
                SuffixResidue    = pieces[2].First();
            }

            if (string.IsNullOrWhiteSpace(evidence.CleanPeptide))
            {
                //evidence.CleanPeptide = cleanSeq;
                evidence.CleanPeptide = StrippedSequence;
            }
            CleanSequence = cleanSeq;

            if (string.IsNullOrWhiteSpace(evidence.EncodedNonNumericSequence))
            {
                evidence.EncodedNonNumericSequence = nonNumeric;
            }
            EncodedNonNumericSequence = nonNumeric;

            if (string.IsNullOrWhiteSpace((evidence.SeqWithNumericMods)))
            {
                evidence.SeqWithNumericMods = numeric;
            }
            EncodedNumericSequence = numeric;

            if (!Charges.Contains(evidence.Charge))
            {
                Charges.Add(evidence.Charge);
            }

            evidence.Parent = this;
        }
예제 #17
0
 public void AddCharge(Charge g)
 {
     ValidateCharge(g);
     Charges.Add(g);
     ProcessDebtsFromCharge(g);
 }