Esempio n. 1
0
        private MinutesOfSessionCreateViewModel PrepareViewModel(MinutesOfSessionViewModel MinutesOfSession = null)
        {
            if (MinutesOfSession == null)
            {
                MinutesOfSession = new MinutesOfSessionViewModel();
            }
            //   var attendanctype = LookupService.GetLookupsByCategory(Base.LookupsCategories.PresenceStatuses);
            var defendents = DefectsService.GetDefectsByCaseID(MinutesOfSession.CaseID, MinutesOfSession.SessionID);
            var result     = new MinutesOfSessionCreateViewModel()
            {
                AutoCompleteText = GetTextPrediction(MinutesOfSession.CircuitID),
                MinutesOfSession = MinutesOfSession,
                SessionData      = SessionService.GetSessionData(MinutesOfSession.SessionID),
                CaseBasicData    = CaseService.GetCaseBasicData(MinutesOfSession.CaseID),
                vw_CircuitsGrid  = CircuitMembersService.GetCircuitMembersByCircuitID(MinutesOfSession.CircuitID),
                CaseDefectsData  = defendents
                                   .Select(def => new CaseDefectsDataViewModel
                {
                    ID                     = def.ID,
                    Address                = def.Address,
                    Age                    = CalculateAge(def.Birthdate.Value),
                    Birthdate              = def.Birthdate,
                    CaseID                 = def.CaseID,
                    DefectID               = def.ID,
                    DefectType             = def.DefectType,
                    IsCivilRightProsecutor = def.IsCivilRightProsecutor,
                    JobName                = def.JobName,
                    Name                   = def.Name,
                    NationalID             = def.NationalID,
                    NationalityType        = def.NationalityType,
                    Nationality            = def.Nationality,
                    Order                  = def.Order,
                    PassportNumber         = def.PassportNumber,
                    PersonID               = def.PersonID,
                    Presence               = def.Presence,
                    Status                 = def.Status,
                }).Where(e => e.DefectType == PartyTypes.Defendant).OrderBy(defect => defect.Order).ToList(),
            };

            foreach (var defent in result.CaseDefectsData)
            {
                string[] li = Regex.Split(defent.Address, "/");
                if (li[0] != null)
                {
                    defent.Address = li[0];
                }
            }

            result.MinutesOfSession.Text         = SessionService.GetMinutesOfSession(MinutesOfSession.SessionID);
            result.MinutesOfSession.CourtID      = CurrentUser.CourtID;
            result.MinutesOfSession.CurentUserID = CurrentUser.ID;
            return(result);
        }
Esempio n. 2
0
        public ActionResult Edit(int id)
        {
            if (CurrentUser != null)
            {
                try
                {
                    CaseBasicDataViewModel caseBasicDataViewModel = new CaseBasicDataViewModel();
                    caseBasicDataViewModel = GetCaseBasicData();
                    vw_CrimeCaseBasicData vw_CaseData = CaseService.GetCaseBasicData(id);
                    if (CurrentUser.UserTypeID != (int)SystemUserTypes.ElementaryCourtAdministrator && vw_CaseData.OverAllId != null)
                    {
                        return(CPartialView("UnAuthorizedEdit"));
                    }
                    else
                    {
                        caseBasicDataViewModel.CaseID                   = vw_CaseData.CaseID;
                        caseBasicDataViewModel.CaseName                 = vw_CaseData.CaseName;
                        caseBasicDataViewModel.CaseNationalID           = vw_CaseData.NationalID;
                        caseBasicDataViewModel.CourtID                  = vw_CaseData.CourtID;
                        caseBasicDataViewModel.CourtName                = vw_CaseData.CourtName;
                        caseBasicDataViewModel.SecondLevelProcID        = vw_CaseData.SecondProsecutionID;
                        caseBasicDataViewModel.SecondLevelProsecutions  = GetElementaryProsecutions(CurrentUser.CourtID.Value);
                        caseBasicDataViewModel.FirstLevelProsecutionID  = vw_CaseData.FirstProsecutionID;
                        caseBasicDataViewModel.FirstLevelProsecutions   = lookupService.GetIntialProsecutions(caseBasicDataViewModel.SecondLevelProcID.Value);
                        caseBasicDataViewModel.PoliceStations           = lookupService.GetPoliceStations(caseBasicDataViewModel.FirstLevelProsecutionID.Value);
                        caseBasicDataViewModel.PoliceStationID          = vw_CaseData.FirstPoliceStationID;
                        caseBasicDataViewModel.CrimeID                  = vw_CaseData.CrimeTypeID;
                        caseBasicDataViewModel.MainCrimeID              = vw_CaseData.MainCrimeID;
                        caseBasicDataViewModel.FirstNumber              = vw_CaseData.FirstNumberInt;
                        caseBasicDataViewModel.FirstYear                = vw_CaseData.FirstYearInt;
                        caseBasicDataViewModel.HasObtainment            = vw_CaseData.HasObtainment;
                        caseBasicDataViewModel.OverAllNumber            = vw_CaseData.OverAllNumber;
                        caseBasicDataViewModel.OverAllNumberProsecution = vw_CaseData.OverAllNumberProsecution;
                        caseBasicDataViewModel.OverAllNumberYear        = vw_CaseData.OverAllNumberYear;
                        caseBasicDataViewModel.MainCrimeID              = vw_CaseData.MainCrimeID;
                        caseBasicDataViewModel.SecondNumber             = vw_CaseData.SecondNumberInt;
                        caseBasicDataViewModel.SecondYear               = vw_CaseData.SecondYearInt;
                        caseBasicDataViewModel.UserType                 = CurrentUser.UserTypeID;
                        caseBasicDataViewModel.OrderOfAssignment        = vw_CaseData.OrderOfAssignment;
                        caseBasicDataViewModel.OverAllId                = vw_CaseData.OverAllId;
                        caseBasicDataViewModel.IsComplete               = vw_CaseData.IsComplete;
                        return(View(caseBasicDataViewModel));
                    }
                }
                catch (Exception ex)
                {
                    return(ErrorPage(ex));
                }
            }

            else
            {
                return(RedirectTo(Url.Action("login", "User", new { returnUrl = "/" })).WithErrorMessages("تم الخروج بشكل تلقائى لعدم التفاعل اكثر من 15 دقيقة"));
            }
        }
        public ActionResult Index(int id, int SessionID, int CircuitID /*, bool SaveAttendance = false, bool SavedBefore = false*/)
        {
            MinutesOfSessionViewModel MinutesOfSession = new MinutesOfSessionViewModel();

            //  MinutesOfSession.SaveAttendance = SaveAttendance;
            //  MinutesOfSession.SavedBefore = SavedBefore;
            MinutesOfSession.CaseID      = id;
            MinutesOfSession.SessionID   = SessionID;
            MinutesOfSession.CircuitID   = CircuitID;
            MinutesOfSession.CrimeTypeID = CaseService.GetCaseBasicData(id).CrimeTypeID;
            MinutesOfSessionCreateViewModel CreateViewModel = PrepareViewModel(MinutesOfSession);

            foreach (var defent in CreateViewModel.CaseDefectsData)
            {
                string[] li = Regex.Split(defent.Address, "/");
                if (li[0] != null)
                {
                    defent.Address = li[0];
                }
            }
            foreach (var defent in CreateViewModel.CaseVictims)
            {
                string[] li = Regex.Split(defent.Address, "/");
                if (li[0] != null)
                {
                    defent.Address = li[0];
                }
            }

            foreach (var defent in CreateViewModel.CaseWitnesses)
            {
                string[] li = Regex.Split(defent.Address, "/");
                if (li[0] != null)
                {
                    defent.Address = li[0];
                }
            }
            CreateViewModel = DayNameChange(CreateViewModel);

            return(CPartialView(CreateViewModel));
        }
Esempio n. 4
0
 public ActionResult Delete(int id)
 {
     try
     {
         var unCompletCase = CaseService.GetCaseBasicData(id);
         NotCompleteCaseViewModels NotCompleteCaseView = new NotCompleteCaseViewModels()
         {
             CaseId       = unCompletCase.CaseID,
             CaseTitle    = unCompletCase.CaseName,
             CrimName     = unCompletCase.CrimeTypeName,
             FirstNumber  = unCompletCase.FirstNumberInt + " / " + unCompletCase.FirstYearInt + " / " + unCompletCase.FirstprosecutionName,
             SecondNumber = unCompletCase.SecondNumberInt + " / " + unCompletCase.SecondYearInt + " / " + unCompletCase.SecoundProsecutionName,
         };
         return(PartialView(NotCompleteCaseView));
     }
     catch (Exception ex)
     {
         return(ErrorPage(ex));
     }
 }
Esempio n. 5
0
        public ActionResult Delete(int CaseID, Guid DeleteFolderID, long?SessionID = null)
        {
            if (sessionService.IsSessionSentToJudge(Convert.ToInt32(SessionID)))
            {
                return(JavaScript("$(document).trigger('FolderAttachmentDelete:SentToJudge');"));
            }
            var documents        = AttachmentService.GetDocuments(CaseID, null).ToList();
            var documentInFolder = AttachmentService.GetFolderDocumentsData(DeleteFolderID).ToList();
            int countfile;
            var CaseData = CrimeCaseService.GetCaseBasicData(CaseID);

            if (CaseData.HasObtainment)
            {
                foreach (var documentType in documentInFolder)
                {
                    if (documentType.TypeID == 80)
                    {
                        countfile = documents.Where(e => e.TypeID == 80).ToList().Count();

                        if (countfile == 1)
                        {
                            return(JavaScript("$(document).trigger('FolderHasFileCritical:NoDelete');"));
                        }
                    }
                }
            }

            foreach (var documentType in documentInFolder)
            {
                if (documentType.TypeID == 82)
                {
                    countfile = documents.Where(e => e.TypeID == 80).ToList().Count();

                    if (countfile == 1)
                    {
                        return(JavaScript("$(document).trigger('FolderHasFileCritical:NoDelete');"));
                    }
                }
            }

            string UserName = CurrentUser.UserName;

            if (CurrentUser.UserTypeID == 1)
            {
                UserName = "******";
            }
            var DeleteFolder = AttachmentService.DeleteFolder(DeleteFolderID, UserName);

            switch (DeleteFolder)
            {
            case AttachmentsSaveStatus.Saved:
                return(JavaScript("$(document).trigger('CreateFolder:Saved');"));

            case AttachmentsSaveStatus.Failed:
                return(JavaScript("$(document).trigger('CreateFolder:Failed');"));

            //return CPartialView("CaseFolders", GetFullFolderViewModel(CaseID, SessionID)).WithErrorMessages(JIC.Base.Resources.Messages.OperationNotCompleted);
            case AttachmentsSaveStatus.Folder_Has_Documents:
                return(JavaScript("$(document).trigger('CreateFolder:Folder_Has_Documents');"));

            //  return CPartialView("CaseFolders", GetFullFolderViewModel(CaseID, SessionID)).WithErrorMessages("تحتوى الحافظة على ملفات");
            case AttachmentsSaveStatus.UserNotCreate:
                return(JavaScript("$(document).trigger('UserNotDelete:Folder');"));
            }

            return(CPartialView("CaseFolders", GetFullFolderViewModel(CaseID, SessionID)));
        }
        public ActionResult Delete(FileAttachment fileAttachment)
        {
            if (CurrentUser != null)
            {
                if (sessionService.IsSessionSentToJudge(Convert.ToInt32(fileAttachment.SessionID)))
                {
                    return(JavaScript("$(document).trigger('FileAttachment:SentToJudge');"));
                }

                var documents = AttachmentService.GetDocuments(fileAttachment.CaseID.Value, null).ToList();
                int countfile;
                int caseid = 0;
                if (fileAttachment.CaseID.HasValue)
                {
                    caseid = fileAttachment.CaseID.Value;
                }
                vw_CrimeCaseBasicData CaseData = CrimeCaseService.GetCaseBasicData(caseid);

                if (CaseData.HasObtainment)
                {
                    if (fileAttachment.AttachmentType == "80")
                    {
                        countfile = documents.Where(e => e.TypeID == int.Parse(fileAttachment.AttachmentType)).ToList().Count();

                        if (countfile == 1)
                        {
                            return(JavaScript("$(document).trigger('FileCritical:NoDelete');"));
                        }
                    }
                }

                if (fileAttachment.AttachmentType == "82")
                {
                    countfile = documents.Where(e => e.TypeID == int.Parse(fileAttachment.AttachmentType)).ToList().Count();

                    if (countfile == 1)
                    {
                        return(JavaScript("$(document).trigger('FileCritical:NoDelete');"));
                    }
                }
                string UserName = CurrentUser.UserName;
                if (CurrentUser.UserTypeID == 1)
                {
                    UserName = "******";
                }
                switch (AttachmentService.DeleteDocument(fileAttachment.AttachmentID, UserName))
                {
                case AttachmentsSaveStatus.Saved:
                    return(JavaScript("$(document).trigger('FileAttachment:Delete');"));

                case AttachmentsSaveStatus.Failed:
                    return(CPartialView(fileAttachment).WithErrorMessages(JIC.Base.Resources.Messages.OperationNotCompleted));

                case AttachmentsSaveStatus.UserNotCreate:
                    return(JavaScript("$(document).trigger('UserNotDelete:Delete');"));
                }
                ViewData["SessionEnded"] = false;
                return(CPartialView(fileAttachment));
            }
            else
            {
                ViewData["SessionEnded"] = true;
                return(CPartialView());
            }
        }