예제 #1
0
        public async Task WriteKbk(List <ExpandoObject> lst)
        {
            _dohodDbContext.TruncateDbTable(typeof(s_kbkdop).Name);
            _dohodDbContext.TruncateDbTable(typeof(s_kbk).Name);

            foreach (dynamic obj in lst)
            {
                var kbk = new s_kbk();

                kbk.Sysid      = (int)obj.SYSID;
                kbk.Kbk        = obj.KBK;
                kbk.OktmoId    = (obj.ID_OKATO ?? 0) > 0 ? obj.ID_OKATO : null;
                kbk.DateBeg    = obj.DATE1;
                kbk.DateEnd    = obj.DATE2;
                kbk.ProcFed    = (double)(obj.PR_FED ?? 0.0);
                kbk.ProcObl    = (double)(obj.PR_OBL ?? 0.0);
                kbk.ProcMest   = (double)(obj.PR_MESTN ?? 0.0);
                kbk.ProcPos1   = (double)(obj.PR_DOP1 ?? 0.0);
                kbk.ProcPos2   = (double)(obj.PR_DOP2 ?? 0.0);
                kbk.ProcFond   = (double)(obj.PR_FOND ?? 0.0);
                kbk.ProcSmol   = (double)(obj.PR_SMLN ?? 0.0);
                kbk.NumBudgKop = (int)(obj.NUMBUDGKOP ?? 0);
                kbk.IsPriznak  = !string.IsNullOrWhiteSpace(obj.PRIZNAK);
                kbk.IsItog     = !string.IsNullOrWhiteSpace(obj.ITOG);
                kbk.IsGr       = obj.GR ?? false;
                kbk.DateRad    = obj.DATE_RA;
                kbk.Name       = obj.NAMESMALL;
                kbk.FullName   = obj.NAME;

                FillAppEditFields(obj, kbk);
                await _dohodDbContext.s_kbk.AddAsync(kbk);
            }
            await _dohodDbContext.SaveChangesAsync();
        }
예제 #2
0
파일: Fn.cs 프로젝트: paxan89/Monica
        public static async Task <s_kbk> AddKbk(this DohodDbContext dbContext, string kbkcode)
        {
            var kbk = new s_kbk()
            {
                Kbk       = kbkcode,
                OktmoId   = null,
                DateBeg   = null,
                DateEnd   = null,
                ProcFed   = 100.0,
                Name      = $"Добавлено при импорте {DateTime.Now:dd.MM.yyyy}",
                FullName  = $"Добавлено при импорте {DateTime.Now}",
                IsPriznak = false
            };
            var res = await dbContext.s_kbk.AddAsync(kbk);

            await dbContext.SaveChangesAsync();

            kbk.Sysid = res.Entity.Sysid;

            return(kbk);
        }