コード例 #1
0
        public ActionResult DeleteNotificationInspectionQueue(long id)
        {
            var gVal = new GenericValidator();

            try
            {
                if (id < 1)
                {
                    gVal.Code  = -1;
                    gVal.Error = "Invalid selection";
                    return(Json(gVal, JsonRequestBehavior.AllowGet));
                }
                var delStatus = new NotificationInspectionQueueServices().DeleteNotificationInspectionQueue(id);
                if (delStatus < 1)
                {
                    gVal.Code  = -1;
                    gVal.Error = "NotificationInspectionQueue could not be deleted. Please try again later.";
                    return(Json(gVal, JsonRequestBehavior.AllowGet));
                }

                gVal.Code  = 5;
                gVal.Error = "NotificationInspectionQueue Information was successfully deleted";
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public ActionResult EditNotificationInspectionQueue(NotificationInspectionQueueObject notificationInspectionQueue)
        {
            var gVal = new GenericValidator();

            try
            {
                //if (!ModelState.IsValid)
                //{
                //    gVal.Code = -1;
                //    gVal.Error = "Plese provide all required fields and try again.";
                //    return Json(gVal, JsonRequestBehavior.AllowGet);
                //}

                if (string.IsNullOrEmpty(notificationInspectionQueue.ReferenceCode.Trim()))
                {
                    gVal.Code  = -1;
                    gVal.Error = "Please provide NotificationInspectionQueue.";
                    return(Json(gVal, JsonRequestBehavior.AllowGet));
                }

                if (Session["_NotificationInspectionQueue"] == null)
                {
                    gVal.Code  = -1;
                    gVal.Error = "Session has timed out.";
                    return(Json(gVal, JsonRequestBehavior.AllowGet));
                }

                var oldNotificationInspectionQueue = Session["_NotificationInspectionQueue"] as NotificationInspectionQueueObject;

                if (oldNotificationInspectionQueue == null)
                {
                    gVal.Code  = -1;
                    gVal.Error = "Session has timed out.";
                    return(Json(gVal, JsonRequestBehavior.AllowGet));
                }


                oldNotificationInspectionQueue.ReferenceCode = notificationInspectionQueue.ReferenceCode.Trim();

                var docStatus = new NotificationInspectionQueueServices().UpdateNotificationInspectionQueue(oldNotificationInspectionQueue);
                if (docStatus < 1)
                {
                    gVal.Code  = -1;
                    gVal.Error = "NotificationInspectionQueue information could not be updated. Please try again later";
                    return(Json(gVal, JsonRequestBehavior.AllowGet));
                }

                gVal.Code  = oldNotificationInspectionQueue.Id;
                gVal.Error = "NotificationInspectionQueue information was successfully updated";
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                gVal.Code  = -1;
                gVal.Error = "NotificationInspectionQueue information could not be updated. Please try again later";
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #3
0
        public ActionResult GetNotificationInspectionQueueObjects(JQueryDataTableParamModel param)
        {
            try
            {
                IEnumerable <NotificationInspectionQueueObject> filteredParentMenuObjects;
                var countG = 0;

                var pagedParentMenuObjects = GetNotificationInspectionQueues(param.iDisplayLength, param.iDisplayStart, out countG);

                if (!string.IsNullOrEmpty(param.sSearch))
                {
                    filteredParentMenuObjects = new NotificationInspectionQueueServices().Search(param.sSearch);
                }
                else
                {
                    filteredParentMenuObjects = pagedParentMenuObjects;
                }

                if (!filteredParentMenuObjects.Any())
                {
                    return(Json(new List <NotificationInspectionQueueObject>(), JsonRequestBehavior.AllowGet));
                }

                var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
                Func <NotificationInspectionQueueObject, string> orderingFunction = (c => sortColumnIndex == 1 ? c.ReferenceCode : c.AssignedTimeStr);

                var sortDirection = Request["sSortDir_0"]; // asc or desc
                filteredParentMenuObjects = sortDirection == "desc" ? filteredParentMenuObjects.OrderBy(orderingFunction) : filteredParentMenuObjects.OrderByDescending(orderingFunction);

                var displayedPersonnels = filteredParentMenuObjects;

                var result = from c in displayedPersonnels
                             select new[] { Convert.ToString(c.Id),
                                            c.ReferenceCode, c.EmployeeName, c.AssignedTimeStr,
                                            c.DueTimeStr, c.ActualDeliveryDateTimeStr, c.StepName, c.ProcessName, c.OutComeCodeStr };
                return(Json(new
                {
                    param.sEcho,
                    iTotalRecords = countG,
                    iTotalDisplayRecords = countG,
                    aaData = result
                },
                            JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message);
                return(Json(new List <NotificationInspectionQueueObject>(), JsonRequestBehavior.AllowGet));
            }
        }
コード例 #4
0
        public ActionResult AddNotificationInspectionQueue(NotificationInspectionQueueObject notificationInspectionQueue)
        {
            var gVal = new GenericValidator();

            try
            {
                //if (!ModelState.IsValid)
                //{
                //    gVal.Code = -1;
                //    gVal.Error = "Plese provide all required fields and try again.";
                //    return Json(gVal, JsonRequestBehavior.AllowGet);
                //}

                var importerInfo = GetLoggedOnUserInfo();
                if (importerInfo.Id < 1)
                {
                    gVal.Error = "Your session has timed out";
                    gVal.Code  = -1;
                    return(Json(gVal, JsonRequestBehavior.AllowGet));
                }

                var validationResult = ValidateNotificationInspectionQueue(notificationInspectionQueue);

                if (validationResult.Code == 1)
                {
                    return(Json(validationResult, JsonRequestBehavior.AllowGet));
                }

                var appStatus = new NotificationInspectionQueueServices().AddNotificationInspectionQueue(notificationInspectionQueue);
                if (appStatus < 1)
                {
                    validationResult.Code  = -1;
                    validationResult.Error = appStatus == -2 ? "NotificationInspectionQueue upload failed. Please try again." : "The NotificationInspectionQueue Information already exists";
                    return(Json(validationResult, JsonRequestBehavior.AllowGet));
                }

                gVal.Code  = appStatus;
                gVal.Error = "NotificationInspectionQueue was successfully added.";
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                gVal.Error = "NotificationInspectionQueue notificationInspectionQueueing failed. Please try again later";
                gVal.Code  = -1;
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #5
0
        public ActionResult GetNotificationInspectionQueue(long id)
        {
            try
            {
                var notificationInspectionQueue = new NotificationInspectionQueueServices().GetNotificationInspectionQueue(id);
                if (notificationInspectionQueue == null || notificationInspectionQueue.Id < 1)
                {
                    return(Json(new NotificationInspectionQueueObject(), JsonRequestBehavior.AllowGet));
                }

                Session["_NotificationInspectionQueue"] = notificationInspectionQueue;

                return(Json(notificationInspectionQueue, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(new NotificationInspectionQueueObject(), JsonRequestBehavior.AllowGet));
            }
        }