Esempio n. 1
0
        public virtual ActionResult FixApprovalProblems()
        {
            List <SymbolDrawing> problems = getApprovalProblems();

            foreach (var sd in problems)
            {
                sd.Approved = true;
            }

            db.SaveChangesNotValidated();

            return(RedirectToAction(Actions.ApprovalProblems()));
        }
Esempio n. 2
0
        public virtual ActionResult ApproveSymbolDrawingsPost(IDictionary <string, string> approvals)
        {
            int savedRows   = 0;
            int skippedRows = 0;

            foreach (var kvp in approvals)
            {
                int symbolDrawingId;
                if (int.TryParse(kvp.Key, out symbolDrawingId) == false)
                {
                    skippedRows += 1;
                    continue;
                }

                bool approved;
                if (bool.TryParse(kvp.Value, out approved) == false)
                {
                    skippedRows += 1;
                    continue;
                }

                var symbol = db.SymbolDrawings
                             //.Include(x => x.Symbol)
                             .Where(x => x.Approved == null && x.SymbolDrawingId == symbolDrawingId)
                             .FirstOrDefault();

                if (symbol == null)
                {
                    skippedRows += 1;
                    continue;
                }

                symbol.Approved = approved;
                savedRows      += 1;
            }

            db.SaveChangesNotValidated();
            return(RedirectToAction(Actions.ApproveSymbolDrawings(savedRows, skippedRows)));
        }