Exemplo n.º 1
0
        public int Create()
        {
            asset assetToCreate = new asset();

            assetToCreate = UpdateFields(assetToCreate);

            db.assets.Add(assetToCreate);
            db.SaveChanges();

            return(assetToCreate.assetId);
        }
Exemplo n.º 2
0
        public int Create()
        {
            record recordToCreate = new record();

            recordToCreate = UpdateFields(recordToCreate);

            db.records.Add(recordToCreate);
            db.SaveChanges();


            return(recordToCreate.recordId);
        }
        public ActionResult Edit(dossier dossier)
        {
            if (ModelState.IsValid)
            {
                db.Entry(dossier).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            //       ViewBag.userId = new SelectList(db.users, "userId", "name", dossier.userId);
            return(View(dossier));
        }
Exemplo n.º 4
0
        public int ImportEntity(string sessionID)
        {
            ObjectCache cache = MemoryCache.Default;

            cache.Remove("totalRecordsProcessed_" + sessionID);
            cache.Add("totalRecordsProcessed_" + sessionID, _Report.totalRecordsProcessed, DateTimeOffset.MaxValue);

            int recCount = 0;

            //if (cache["RecCount_" + sessionID] != null)
            //    recCount=(int)cache["RecCount_" + sessionID];


            cache.Remove("RecCount_" + sessionID);
            foreach (var Record in _importRecordTmp)
            {
                recCount++;
                _context.importRecordTmps.Add(Record);
                //      _context.SaveChanges();
                cache.Remove("RecCount_" + sessionID);
                cache.Add("RecCount_" + sessionID, recCount, DateTimeOffset.MaxValue);
            }

            return(_context.SaveChanges());
        }
        //[HttpPost]
        public ActionResult Delete(int recordId, int dossierId)
        {
            record Record = db.records.Find(recordId);

            db.records.Remove(Record);
            db.SaveChanges();
            return(RedirectToAction("Index", new { dossierId = dossierId }));
        }
Exemplo n.º 6
0
        public static void DeleteAsset(int dossierId, int assetId)
        {
            PersonalFinancesDBEntities db = new PersonalFinancesDBEntities();
            var asset = db.assets.Where(a => a.dossierId == dossierId && a.assetId == assetId).Single();

            db.assets.Remove(asset);
            db.SaveChanges();
        }
        public static void Delete(int dossierId, int importRecordTmpId)
        {
            PersonalFinancesDBEntities db = new PersonalFinancesDBEntities();

            importRecordTmp irt = db.importRecordTmps.Where(i => i.dossierId == dossierId && i.importRecordTmpId == importRecordTmpId).Single();

            db.importRecordTmps.Remove(irt);
            db.SaveChanges();
        }
        public static void UpdateSubcategory(POCO.assetSubcategory assetSubcategory)
        {
            PersonalFinancesDBEntities db = new PersonalFinancesDBEntities();

            var aC = db.assetSubcategories.Find(assetSubcategory.assetSubcategoryId);

            aC.description     = assetSubcategory.description;
            aC.assetCategoryId = assetSubcategory.assetCategoryId;

            db.Entry(aC).State = EntityState.Modified;
            db.SaveChanges();
        }
        public static void DeleteCategory(int dossierId, int assetCategoryId)
        {
            PersonalFinancesDBEntities db = new PersonalFinancesDBEntities();

            var aC = (from c in db.assetCategories
                      where c.assetCategoryId == assetCategoryId &&
                      c.dossierId == dossierId
                      select c).Single();


            db.assetCategories.Remove(aC);
            db.SaveChanges();
        }
        public static void AddSubCategory(assetSubcategory subcat)
        {
            PersonalFinancesDBEntities db = new PersonalFinancesDBEntities();

            var catEntity = new PersonalFinances.DATA.DataModel.assetSubcategory
            {
                assetCategoryId = subcat.assetCategoryId,
                description     = subcat.description
            };

            db.assetSubcategories.Add(catEntity);
            db.SaveChanges();
        }
Exemplo n.º 11
0
        public static void AddCategory(assetCategory cat)
        {
            PersonalFinancesDBEntities db = new PersonalFinancesDBEntities();

            var catEntity = new PersonalFinances.DATA.DataModel.assetCategory {
                dossierId   = cat.dossierId,
                isAsset     = cat.isAsset,
                description = cat.description
            };



            db.assetCategories.Add(catEntity);
            db.SaveChanges();
        }
        public static void DeleteSubcategory(int dossierId, int assetSubcategoryId)
        {
            PersonalFinancesDBEntities db = new PersonalFinancesDBEntities();

            // var aSC = db.assetSubcategories.Find(assetSubcategoryId);

            var aSC = (from sc in db.assetSubcategories
                       join c in db.assetCategories on sc.assetCategoryId equals c.assetCategoryId
                       where sc.assetSubcategoryId == assetSubcategoryId &&
                       c.dossierId == dossierId
                       select sc).Single();

            db.assetSubcategories.Remove(aSC);
            db.SaveChanges();
        }
        public static void MoveSubcategory(MergeCategoriesModel model)
        {
            recordSubcategory subCat = db.recordSubcategories.Find(model.recordSubcategoryId_FROM);

            int dossierId = (from c in db.recordCategories
                             join s in db.recordSubcategories on c.recordCategoryId equals s.recordCategoryId
                             where s.recordSubcategoryId == model.recordSubcategoryId_FROM
                             select c.dossierId).Single();

            if (model.dossierId == dossierId)
            {
                subCat.recordCategoryId = model.recordCategoryId_TO;
                db.Entry(subCat).State  = EntityState.Modified;
                db.SaveChanges();
            }
        }
Exemplo n.º 14
0
        public static void CreateDossier(DossierModel dossier, string UserName)
        {
            PersonalFinancesDBEntities db = new PersonalFinancesDBEntities();
            dossier dos = new dossier();

            string userId = (from u in db.AspNetUsers
                             where u.UserName == UserName
                             select u.Id).Single();

            ////TODO: give real value
            dos.userId = userId;

            dos.dossierName  = dossier.dossierName;
            dos.creationDate = DateTime.Now;
            db.dossiers.Add(dos);
            db.SaveChanges();
        }