Example #1
0
        public JsonResult CancelSignOff(long?id)
        {
            object s = new { type = "failed", message = "Saving failed!" };

            if (id == null)
            {
                return(Json(s, JsonRequestBehavior.AllowGet));
            }
            try
            {
                OSC_TeamScorecard_Current ts = db.TeamScorecards.Find(id);
                if (ModelState.IsValid)
                {
                    ts.ManagerSignOff  = "";
                    ts.SignOffDate     = null;
                    ts.SignOffBy       = null;
                    ts.IsSignedOff     = false;
                    db.Entry(ts).State = EntityState.Modified;
                    db.SaveChanges();
                }
                s = new { type = "success", message = "Sign-off cancelled!" };
            }
            catch (Exception ex)
            {
                s = new { type = "failed", message = "Saving failed!\nError occured:\n" + ex.Message.ToString() };
            }
            return(Json(s, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public JsonResult SignOff(long?id, string comment)
        {
            object s = new { type = "failed", message = "Saving failed!" };

            if (id == null)
            {
                return(Json(s, JsonRequestBehavior.AllowGet));
            }
            try
            {
                OSC_TeamScorecard_Current ts = db.TeamScorecards.Find(id);
                if (ModelState.IsValid)
                {
                    ts.ManagerSignOff  = comment;
                    ts.SignOffDate     = DateTime.Now;
                    ts.SignOffBy       = (string)Session["logon_user"];
                    ts.IsSignedOff     = true;
                    db.Entry(ts).State = EntityState.Modified;
                    db.SaveChanges();
                }
                s = new { type = "success", message = "Successfully signed-off!" };
            }
            catch (Exception ex)
            {
                s = new { type = "failed", message = "Saving failed!\nError occured:\n" + ex.Message.ToString() };
            }
            return(Json(s, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public PartialViewResult ManagerSignoff()
        {
            long teamId;
            int  month, year;

            teamId        = (long)Session["TS_Team"];
            month         = (int)Session["TS_Month"];
            year          = (int)Session["TS_Year"];
            ViewBag.Month = db.months.Where(m => m.Value == Convert.ToString(month)).First().Text;
            ViewBag.Year  = year;
            OSC_TeamScorecard_Current obj = db.TeamScorecards.Where(t => t.TeamId == teamId && t.Month == month && t.Year == year).FirstOrDefault();

            ViewBag.Id = obj.TeamScorecardId;

            if (obj.IsSignedOff)
            {
                ViewBag.ManagerSignOff = obj.ManagerSignOff;
                ViewBag.SignOffDate    = obj.SignOffDate;
                ViewBag.SignOffBy      = obj.SignOffBy;
                ViewBag.IsSignedOff    = obj.IsSignedOff;
            }
            else
            {
                ViewBag.ManagerSignOff = "";
                ViewBag.SignOffDate    = DateTime.Now;
                ViewBag.SignOffBy      = (string)Session["logon_user"];
                ViewBag.IsSignedOff    = obj.IsSignedOff;
            }
            return(PartialView());
        }
Example #4
0
        public JsonResult SaveStatusSummaryComment(long?id, string comment)
        {
            object s = new { type = "failed", message = "Saving failed!" };

            if (id == null)
            {
                return(Json(s, JsonRequestBehavior.AllowGet));
            }
            try
            {
                OSC_TeamScorecard_Current ts = db.TeamScorecards.Find(id);
                if (ModelState.IsValid)
                {
                    ts.StatusSummaryComments = comment;
                    db.Entry(ts).State       = EntityState.Modified;
                    db.SaveChanges();
                }
                s = new { type = "success", message = "Successfully saved!" };
            }
            catch (Exception ex)
            {
                s = new { type = "failed", message = "Saving failed!\nError occured:\n" + ex.Message.ToString() };
            }
            return(Json(s, JsonRequestBehavior.AllowGet));
        }
Example #5
0
        public JsonResult SaveTeamGoals(long?id, List <OSC_TeamScorecard_Current> objects)
        {
            object s = new { type = "failed", message = "Saving failed!" };

            if (id == null)
            {
                return(Json(s, JsonRequestBehavior.AllowGet));
            }
            try
            {
                foreach (OSC_TeamScorecard_Current obj in objects)
                {
                    if (ModelState.IsValid)
                    {
                        OSC_TeamScorecard_Current ts = db.TeamScorecards.Find(obj.TeamScorecardId);
                        ts.ProductivityGoal = obj.ProductivityGoal;
                        ts.QualityGoal      = obj.QualityGoal;
                        ts.EfficiencyGoal   = obj.EfficiencyGoal;
                        ts.UtilizationGoal  = obj.UtilizationGoal;
                        db.Entry(ts).State  = EntityState.Modified;
                        db.SaveChanges();
                    }
                }
                s = new { type = "success", message = "Successfully saved!" };
            }
            catch (Exception ex)
            {
                s = new { type = "failed", message = "Saving failed!\nError occured:\n" + ex.Message.ToString() };
            }
            return(Json(s, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public JsonResult GetAppendixList()
        {
            long teamId;
            int  month, year;

            teamId = (long)Session["TS_Team"];
            month  = (int)Session["TS_Month"];
            year   = (int)Session["TS_Year"];
            OSC_TeamScorecard_Current obj = db.TeamScorecards.Where(t => t.TeamId == teamId && t.Month == month && t.Year == year).FirstOrDefault();
            var result = db.Appendix.Where(t => t.TeamScorecardId == obj.TeamScorecardId).ToList();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public PartialViewResult Appendix()
        {
            long teamId;
            int  month, year;

            teamId        = (long)Session["TS_Team"];
            month         = (int)Session["TS_Month"];
            year          = (int)Session["TS_Year"];
            ViewBag.Month = db.months.Where(m => m.Value == Convert.ToString(month)).First().Text;
            ViewBag.Year  = year;
            OSC_TeamScorecard_Current obj = db.TeamScorecards.Where(t => t.TeamId == teamId && t.Month == month && t.Year == year).FirstOrDefault();

            ViewBag.Id = obj.TeamScorecardId;

            return(PartialView());
        }