Exemplo n.º 1
0
        public ActionResult RunLog(UpdateLog p)
        {
            var jId = p.id;

            var findId = db.mc_scheduled_jobs.Where(r => jId.Equals(r.id) && r.upd_activity_log != true);

            try
            {
                if (findId != null)
                {
                    var l = new mc_schedule_sftp_log();
                    l.job_id    = p.id;
                    l.file_type = p.Value;
                    l.complete  = false;
                    db.mc_schedule_sftp_log.Add(l);
                    db.SaveChanges();
                }
                else
                {
                    throw new Exception("This has alredady been updated@!");
                }

                var u = db.mc_scheduled_jobs.Find(p.id);
                u.upd_activity_log = true;
                db.SaveChanges();

                return(Json(new { success = true, Message = "Updated Activity log", }));
            }
            catch
            {
                //if (findId)
                return(Json(new { success = false, Message = "Failed to update Activity log. " }));
            }
        }
Exemplo n.º 2
0
        public ActionResult RunSFTP(UpdateSftp p)
        {
            //var u = db.mc_scheduled_jobs.Find(p.id);
            ////List<string> errors = new List<string>();
            var jId    = p.id;
            var findId = db.mc_scheduled_jobs.Where(r => jId.Equals(r.id) && r.upd_activity_log == false);

            try
            {
                if (findId != null)
                {
                    var l = new mc_schedule_sftp_log();
                    l.job_id    = p.id;
                    l.file_type = p.Value;
                    l.complete  = false;
                    db.mc_schedule_sftp_log.Add(l);
                    db.SaveChanges();
                }

                var u = db.mc_scheduled_jobs.Find(p.id);
                u.send_sftp = true;
                db.SaveChanges();


                return(Json(new { success = true, Message = "Sent SFTP" + p.Value }));
            }
            catch
            {
                //errors.Add(ex.Message);
                return(Json(new { success = false, Message = "Failed to send SFTP " }));
            }
        }