Example #1
0
        public static void DeleteAppDocByStId(int stid)
        {
            StormDBEntities db = new StormDBEntities();

            // delete application Documents and corresponding files
            var app = (from a in db.Applications
                       from d in db.Application_Document
                       where a.Application_Id == d.Application_Id && a.Student_Id == stid
                       select d).ToList();

            foreach (var application in app)
            {
                string completFileName = HttpContext.Current.Server.MapPath(application.Path + '/' + application.FileName);
                System.IO.File.Delete(completFileName);
                db.Application_Document.DeleteObject(application);
            }

            db.SaveChanges();
        }
Example #2
0
        public static void DeleteCaseDocByAppId(int appId)
        {
            StormDBEntities db = new StormDBEntities();

            // delete application Documents and corresponding files
            var app = (from a in db.Applications
                       from c in db.CaseDocuments
                       where a.Case_Id == c.Case_Id && a.Application_Id == appId
                       select c).ToList();

            foreach (var application in app)
            {
                string completFileName = HttpContext.Current.Server.MapPath(application.Path + '/' + application.FileName);
                System.IO.File.Delete(completFileName);
                application.Path = null;
                application.UploadedOn = null;
                application.FileName = null;
                application.Comment = null;
            }

            db.SaveChanges();
        }
        public static void statusDown(int applicationID)
        {
            StormDBEntities db = new StormDBEntities();
            Application app = db.Applications.SingleOrDefault(x => x.Application_Id == applicationID);
            if (app == null)
                return;

            bool found = false;

            string[] names = Enum.GetNames(typeof(ApplicationStatusType));
            ApplicationStatusType[] values = (ApplicationStatusType[])Enum.GetValues(typeof(ApplicationStatusType));

            for (int i = names.Length-1; i >= 0; i--)
            {
                if (found)
                {
                    app.Status = names[i];
                    break;
                }
                if (getProgressValue(app.Status) == (int)values[i])
                {
                    found = true;
                }
            }

            db.SaveChanges();
        }
        public static void statusUp(int applicationID)
        {
            StormDBEntities db = new StormDBEntities();
            Application app = db.Applications.SingleOrDefault(x => x.Application_Id == applicationID);
            if (app == null)
                return;

            bool found = false;
            foreach(var statusType in Enum.GetValues(typeof(ApplicationStatusType)))
            {
                if (found)
                {
                    app.Status = statusType.ToString();
                    break;
                }
                if (getProgressValue(app.Status) == (int)statusType)
                {
                    found = true;
                }
            }

            db.SaveChanges();
        }
        public static void setStatus(int applicat, int status)
        {
            StormDBEntities db = new StormDBEntities();

            Application application = db.Applications.Single(x => x.Application_Id == applicat);

            string newStatus = Enum.GetName(typeof(ApplicationStatusType), status);
            application.Status = newStatus;

            db.SaveChanges();

            return;
        }