Exemplo n.º 1
0
        private async Task <bool> CreateMonthSalaryForm(string monthid, List <HumanInfo> humaninfolist, CancellationToken cle = default(CancellationToken))
        {
            try
            {
                List <SalaryFormInfo> lst = new List <SalaryFormInfo>();
                foreach (var item in humaninfolist)
                {
                    SalaryFormInfo salary = new SalaryFormInfo();
                    salary.ID                 = Guid.NewGuid().ToString();
                    salary.MonthID            = monthid;
                    salary.HumanID            = item.Id;
                    salary.ClothesBack        = item.ClothesBack;
                    salary.AdministrativeBack = item.AdministrativeBack;
                    salary.PortBack           = item.PortBack;
                    salary.OtherBack          = item.OtherBack;

                    lst.Add(salary);
                }

                await _Store.CreateMonthSalaryListAsync(lst, cle);

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }

            return(false);
        }
        public async Task CreateMonthSalaryAsync(SalaryFormInfo forminfo, CancellationToken cle = default(CancellationToken))
        {
            if (forminfo == null)
            {
                throw new ArgumentNullException(nameof(forminfo));
            }

            Context.Add(forminfo);
            await Context.SaveChangesAsync(cle);
        }