Пример #1
0
        public JsonResult SaveComment(long?id, string comment)
        {
            object s = new { type = "failed", message = "Saving failed!" };

            if (id == null)
            {
                return(Json(s, JsonRequestBehavior.AllowGet));
            }
            try
            {
                if (ModelState.IsValid)
                {
                    OSC_IndividualScorecard_Current oSC_IndividualScorecard_Current = db.IndividualScorecards.Find(id);
                    oSC_IndividualScorecard_Current.Comments        = comment;
                    db.Entry(oSC_IndividualScorecard_Current).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));
        }
Пример #2
0
        public ActionResult Edit([Bind(Include = "ManagerId,PRDUserId,Name,IsActive")] OSC_Manager oSC_Manager)
        {
            #region "BTSS"
            string role;
            string user_name;
            try
            {
                role      = Session["role"].ToString();
                user_name = Session["logon_user"].ToString();
                string grp_id = Session["grp_id"].ToString();
                ViewBag.CanEdit = af.CanEdit(grp_id, "Manager");
                if (!ViewBag.CanEdit)
                {
                    return(HttpNotFound());
                }
            }
            catch (Exception exception)
            {
                string result = exception.Message.ToString();
                return(HttpNotFound());
            }
            #endregion "BTSS"
            #region "Method
            if (ModelState.IsValid)
            {
                db.Entry(oSC_Manager).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            #endregion "Method"
            #region "Return"
            return(View(oSC_Manager));

            #endregion "Return"
        }
        public ActionResult Edit([Bind(Include = "ActivityId, RepId, Month, Year, DateFrom, DateTo, Activity, NoOfHours, DateModified, ModifiedBy, NoOfDays, TeamId, IsActive")] OSC_ActivityTracker oSC_ActivityTracker)
        {
            #region "BTSS"
            string role;
            string user_name;
            try
            {
                role      = Session["role"].ToString();
                user_name = Session["logon_user"].ToString();
                string grp_id = Session["grp_id"].ToString();
                ViewBag.CanEdit = af.CanEdit(grp_id, "Activity Tracker");
                if (!ViewBag.CanEdit)
                {
                    return(HttpNotFound());
                }
            }
            catch (Exception exception)
            {
                string result = exception.Message.ToString();
                return(HttpNotFound());
            }
            #endregion "BTSS"
            #region "AddValues"
            oSC_ActivityTracker.Month        = Convert.ToDateTime(oSC_ActivityTracker.DateFrom).Month;
            oSC_ActivityTracker.Year         = Convert.ToDateTime(oSC_ActivityTracker.DateFrom).Year;
            oSC_ActivityTracker.DateModified = DateTime.Now;
            oSC_ActivityTracker.ModifiedBy   = user_name;
            if (Session["role"].ToString() != "Admin")
            {
                oSC_ActivityTracker.IsActive = true;
            }
            #endregion "AddValues"
            #region "Method"
            if (ModelState.IsValid)
            {
                db.Entry(oSC_ActivityTracker).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            #endregion "Method"
            #region "Return"
            return(View(oSC_ActivityTracker));

            #endregion "Return"
        }
Пример #4
0
        public ActionResult Edit([Bind(Include = "EntryId,TeamId,RepId,GainLossOccurances,GainLossAmount,CallManagementScore,ProjectResponsibility,ScheduleAdherence,Compliance,ProductAccuracy,Commitment,JHValues,CallEfficiency,Engagement,AdministrativeProcedures,Month,Year,DateUploaded,UploadedBy,IsActive,ActiveProjects,CompletedProjects")] OSC_ManualEntry oSC_ManualEntry)
        {
            #region "BTSS"
            string role;
            string user_name;
            try
            {
                role      = Session["role"].ToString();
                user_name = Session["logon_user"].ToString();
                string grp_id = Session["grp_id"].ToString();
                ViewBag.CanEdit = af.CanEdit(grp_id, "Manual Entries");
                if (!ViewBag.CanEdit)
                {
                    return(HttpNotFound());
                }
            }
            catch (Exception exception)
            {
                string result = exception.Message.ToString();
                return(HttpNotFound());
            }
            #endregion "BTSS"
            #region "AddValues"
            oSC_ManualEntry.Month        = Convert.ToDateTime(oSC_ManualEntry.PeriodCoverage).Month;
            oSC_ManualEntry.Year         = Convert.ToDateTime(oSC_ManualEntry.PeriodCoverage).Year;
            oSC_ManualEntry.DateUploaded = DateTime.Now;
            oSC_ManualEntry.UploadedBy   = user_name;
            if (Session["role"].ToString() != "Admin")
            {
                oSC_ManualEntry.IsActive = true;
            }
            #endregion "AddValues"
            #region "Method"
            if (ModelState.IsValid)
            {
                db.Entry(oSC_ManualEntry).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            #endregion "Method"
            #region "Return"
            return(View(oSC_ManualEntry));

            #endregion "Return"
        }
Пример #5
0
        public ActionResult Edit([Bind(Include = "DepartmentId,DepartmentName,IsActive")] OSC_Department oSC_Department)
        {
            #region "BTSS"
            string role;
            string user_name;
            try
            {
                role      = Session["role"].ToString();
                user_name = Session["logon_user"].ToString();
                string grp_id = Session["grp_id"].ToString();
                ViewBag.CanEdit = af.CanEdit(grp_id, "Department");
                if (!ViewBag.CanEdit)
                {
                    return(HttpNotFound());
                }
            }
            catch (Exception exception)
            {
                string result = exception.Message.ToString();
                return(HttpNotFound());
            }
            #endregion "BTSS"
            #region "AddValues"
            if (Session["role"].ToString() != "Admin")
            {
                oSC_Department.IsActive = true;
            }
            #endregion "AddValues"
            #region "Method"
            if (ModelState.IsValid)
            {
                db.Entry(oSC_Department).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            #endregion "Method"
            #region "Return"
            return(View(oSC_Department));

            #endregion "Return"
        }
Пример #6
0
        //Edit
        public bool Edit(OSC_ImportNPT paramObj)
        {
            bool result = false;

            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(paramObj).State = EntityState.Modified;
                    db.SaveChanges();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                _err.MessageType        = "Server Error";
                _err.MessageDescription = ex.Message.ToString();
                return(result);
            }
            return(result);
        }