示例#1
0
        private List <BudgetAccountDTO> ConvertDataSetToObjectCollection(DataSet dataSet, int year, string budgetStatus)
        {
            var budgets = new List <BudgetAccountDTO>();

            foreach (DataRow dataRow in dataSet.Tables[GetSheetName(budgetStatus)].Rows)
            {
                var temp = new BudgetAccountDTO();
                if (dataRow[0].ToString() != "")
                {
                    temp.AccountNumber   = Convert.ToInt32(dataRow[0]);
                    temp.Year            = year;
                    temp.BudgetStatus    = GetBudgetStatus(budgetStatus);
                    temp.YearAmount      = Convert.ToDouble(dataRow[2]);
                    temp.JanuaryAmount   = Convert.ToDouble(dataRow[3]);
                    temp.FebruaryAmount  = Convert.ToDouble(dataRow[4]);
                    temp.MarchAmount     = Convert.ToDouble(dataRow[5]);
                    temp.AprilAmount     = Convert.ToDouble(dataRow[6]);
                    temp.MayAmount       = Convert.ToDouble(dataRow[7]);
                    temp.JuneAmount      = Convert.ToDouble(dataRow[8]);
                    temp.JulyAmount      = Convert.ToDouble(dataRow[9]);
                    temp.AugustAmount    = Convert.ToDouble(dataRow[10]);
                    temp.SeptemberAmount = Convert.ToDouble(dataRow[11]);
                    temp.OctoberAmount   = Convert.ToDouble(dataRow[12]);
                    temp.NovemberAmount  = Convert.ToDouble(dataRow[13]);
                    temp.DecemberAmount  = Convert.ToDouble(dataRow[14]);
                    budgets.Add(temp);
                }
            }
            return(budgets);
        }
 public BudgetAccount FromDTO(BudgetAccountDTO dto)
 {
     return(new BudgetAccount
     {
         Id = dto.Id,
         AccountNumber = dto.AccountNumber,
         Year = dto.Year,
         BudgetStatus = dto.BudgetStatus,
         YearAmount = dto.YearAmount,
         JanuaryAmount = dto.JanuaryAmount,
         FebruaryAmount = dto.FebruaryAmount,
         MarchAmount = dto.MarchAmount,
         AprilAmount = dto.AprilAmount,
         MayAmount = dto.MayAmount,
         JuneAmount = dto.JuneAmount,
         JulyAmount = dto.JulyAmount,
         AugustAmount = dto.AugustAmount,
         SeptemberAmount = dto.SeptemberAmount,
         OctoberAmount = dto.OctoberAmount,
         NovemberAmount = dto.NovemberAmount,
         DecemberAmount = dto.DecemberAmount
     });
 }