Esempio n. 1
0
        private void LastBtn_Click(object sender, RoutedEventArgs e)
        {
            int step = StepServices.GetCompletedStepCount(ViewModel.Steps);

            switch (step)
            {
            case 2:
                Workspace1.Content  = classificationPage;
                StepControl.Content = new StepUserControl(ViewModel.MoveSteps(false));
                break;

            case 3:
                Workspace1.Content  = propertyPage;
                StepControl.Content = new StepUserControl(ViewModel.MoveSteps(false));
                break;

            case 4:
                Workspace1.Content  = inputFilePage;
                StepControl.Content = new StepUserControl(ViewModel.MoveSteps(false));
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
        public ActionResult DeleteStep(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 StepServices().DeleteStep(id);
                if (delStatus < 1)
                {
                    gVal.Code  = -1;
                    gVal.Error = "Step could not be deleted. Please try again later.";
                    return(Json(gVal, JsonRequestBehavior.AllowGet));
                }

                gVal.Code  = 5;
                gVal.Error = "Step Information was successfully deleted";
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 3
0
        public ActionResult EditStep(StepObject step)
        {
            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(step.Name.Trim()))
                {
                    gVal.Code  = -1;
                    gVal.Error = "Please provide Step.";
                    return(Json(gVal, JsonRequestBehavior.AllowGet));
                }

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

                var oldStep = Session["_Step"] as StepObject;

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


                oldStep.Name = step.Name.Trim();

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

                gVal.Code  = oldStep.Id;
                gVal.Error = "Step information was successfully updated";
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                gVal.Code  = -1;
                gVal.Error = "Step information could not be updated. Please try again later";
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 4
0
        private void NextBtn_Click(object sender, RoutedEventArgs e)
        {
            int step = StepServices.GetCompletedStepCount(ViewModel.Steps);

            switch (step)
            {
            case 1:
                if (classificationPage.ViewModel.HasSelection)
                {
                    propertyPage.ViewModel.GetAllProperties(classificationPage.ViewModel.SelectedClasses);
                    propertyPage.UpdateSelection();
                    Workspace1.Content  = propertyPage;
                    StepControl.Content = new StepUserControl(ViewModel.MoveSteps());
                }
                else
                {
                    NoticeShow(ResourceExtensions.GetLocalized("ValidatorPage_Notice_NoClasses"));
                }
                break;

            case 2:
                if (propertyPage.ViewModel.HasSelection)
                {
                    LocalConfig.SaveConfigFile(propertyPage.ViewModel.SelectedClasses);
                    Workspace1.Content  = inputFilePage;
                    StepControl.Content = new StepUserControl(ViewModel.MoveSteps());
                }
                else
                {
                    NoticeShow(ResourceExtensions.GetLocalized("ValidatorPage_Notice_NoProps"));
                }
                break;

            case 3:
                if (inputFilePage.ViewModel.InputFiles.Count > 0)
                {
                    reportPage.ViewModel.LoadReport(inputFilePage.ViewModel.InputFiles, propertyPage.ViewModel.SelectedClasses);
                    StepControl.Content = new StepUserControl(ViewModel.MoveSteps());
                    Workspace1.Content  = reportPage;
                }
                else
                {
                    NoticeShow(ResourceExtensions.GetLocalized("ValidatorPage_Notice_NoFile"));
                }
                break;

            default:
                break;
            }
        }
Esempio n. 5
0
        public ActionResult GetStepObjects(JQueryDataTableParamModel param)
        {
            try
            {
                IEnumerable <StepObject> filteredParentMenuObjects;
                var countG = 0;

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

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

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

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

                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.Name, c.SequenceNumber.ToString(), c.ProcessName, c.ImportStageName };
                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 <StepObject>(), JsonRequestBehavior.AllowGet));
            }
        }
 private void CheckEnable()
 {
     if (StepServices.IsReacheLimit(_steps, true))
     {
         IsLastButtonEnable = true;
         IsNextButtonEnable = false;
     }
     else if (StepServices.IsReacheLimit(_steps, false))
     {
         IsLastButtonEnable = false;
         IsNextButtonEnable = true;
     }
     else
     {
         IsLastButtonEnable = true;
         IsNextButtonEnable = true;
     }
 }
Esempio n. 7
0
        public ActionResult GetStep(long id)
        {
            try
            {
                var step = new StepServices().GetStep(id);
                if (step == null || step.Id < 1)
                {
                    return(Json(new StepObject(), JsonRequestBehavior.AllowGet));
                }

                Session["_Step"] = step;

                return(Json(step, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(new StepObject(), JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 8
0
        public ActionResult AddStep(StepObject step)
        {
            var gVal = new GenericValidator();

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

                var validationResult = ValidateStep(step);

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

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

                gVal.Code  = appStatus;
                gVal.Error = "Step was successfully added.";
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                gVal.Error = "Step steping failed. Please try again later";
                gVal.Code  = -1;
                return(Json(gVal, JsonRequestBehavior.AllowGet));
            }
        }
 public List <Step> MoveSteps(bool isNext = true)
 {
     _steps = StepServices.MoveStep(_steps, isNext);
     CheckEnable();
     return(Steps);
 }
 private void LoadSteps()
 {
     _steps = StepServices.GenerateIfcValidatorSteps();
     CheckEnable();
 }