private static Cases_MasterCase InitializeMasterCase(vw_CaseBasicData BasicData)
        {
            var caseBasicData      = (vw_CrimeCaseBasicData)BasicData;
            Cases_MasterCase cases = new Cases_MasterCase()
            {
                Title             = caseBasicData.CaseName,
                FirstLevelYear    = caseBasicData.FirstYearInt.ToString(),
                FirstLevelNumber  = caseBasicData.FirstNumberInt.ToString(),
                ProsecutionID     = caseBasicData.SecondProsecutionID,
                SecondLevelNumber = caseBasicData.SecondNumberInt.ToString(),
                SecondLevelYear   = caseBasicData.SecondYearInt.ToString(),
                CrimeID           = caseBasicData.MainCrimeID,
                CrimeType         = caseBasicData.CrimeTypeID,

                HasObtainments    = caseBasicData.HasObtainment,
                NationalID        = caseBasicData.NationalID,
                PoliceStationID   = caseBasicData.FirstPoliceStationID,
                OrderOfAssignment = caseBasicData.OrderOfAssignment,
                OverallID         = caseBasicData.OverAllId,
                IsComplete        = caseBasicData.IsComplete,
            };

            if (caseBasicData.OverAllId.HasValue)
            {
                cases.OverallID = caseBasicData.OverAllId.Value;
            }

            return(cases);
        }
        public CaseSaveStatus AddCaseBasicDate(vw_CaseBasicData _caseBasicData, out int MasterCaseID)
        {
            try
            {
                bool found = (DataContext.Cases_MasterCase.Where(x => x.SecondLevelNumber == _caseBasicData.SecondNumber.ToString() &&
                                                                 x.SecondLevelYear == _caseBasicData.SecondYear.ToString() && x.ProsecutionID == _caseBasicData.SecondProsecutionID).Count() > 0);

                if (found)
                {
                    MasterCaseID = 0;
                    return(CaseSaveStatus.SecondNumberExistBefore);
                }
                else
                {
                    Cases_MasterCase cases = InitializeMasterCase(_caseBasicData);
                    this.Add(cases);
                    this.Save();
                    MasterCaseID = cases.ID;
                    return(CaseSaveStatus.Saved);
                }
            }
            catch (Exception)
            {
                MasterCaseID = 0;
                return(CaseSaveStatus.Failed);
            }
        }
        public void UpdateCaseBasicData(int MasterCaseID, vw_CaseBasicData caseBasicData)
        {
            Cases_MasterCase cases = InitializeMasterCase(caseBasicData);

            cases.ID = MasterCaseID;
            Update(cases);
            Save();
        }
Ejemplo n.º 4
0
        public CaseSaveStatus AddCaseBasicData(vw_CaseBasicData caseBasicData, out int MasterCaseID)
        {
            //int ID = JIC.Repositories.DBInteractions.Utitlities.DBTranse(JIC.Crime.Repositories.DBInteractions.DBFactory.Get(), () =>
            //{

            //    if (caseBasicData.OverAllNumberProsecution > 0 && caseBasicData.OverAllNumberYear > 0)
            //    {
            //        OverallNumberComponent caseComponent = new OverallNumberComponent(caseType);

            //        caseBasicData.OverAllId = caseComponent.AddOverAll(caseBasicData);
            //    }

            //});
            //return ID;

            return(CaseRepository.AddCaseBasicDate(caseBasicData, out MasterCaseID));
        }
Ejemplo n.º 5
0
        public CaseSaveStatus AddCaseBasicDate(vw_CaseBasicData caseBasicData, out int MasterCaseID)
        {
            var FaultBasicData = (vw_FaultCaseBasicData)caseBasicData;
            var MasterCase     = new Cases_MasterCase
            {
                Title             = FaultBasicData.CaseName,
                FirstLevelYear    = FaultBasicData.FirstYear,
                FirstLevelNumber  = FaultBasicData.FirstNumber,
                ProsecutionID     = FaultBasicData.SecondProsecutionID,
                SecondLevelNumber = FaultBasicData.SecondNumber,
                SecondLevelYear   = FaultBasicData.SecondYear,
                CrimeID           = FaultBasicData.MainCrimeID,
                NationalID        = FaultBasicData.NationalID,
                PoliceStationID   = FaultBasicData.FirstPoliceStationID,
                CaseTypeID        = FaultBasicData.CaseTypeID
            };

            Add(MasterCase);
            Save();
            MasterCaseID = MasterCase.ID;
            return(CaseSaveStatus.Saved);
        }
Ejemplo n.º 6
0
        public string GetNationalID(vw_CaseBasicData BasicData)
        {
            var caseBasicData = (vw_FaultCaseBasicData)BasicData;

            return(String.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}", SystemConfigurations.Defaults_CurrentCourtType, CaseLevels.Initial.Code(), caseBasicData.SecondProsecutionID, caseBasicData.FirstProsecutionID, GetCaseTypeCode(caseBasicData.CaseTypeID), caseBasicData.FirstYear, caseBasicData.FirstNumber));
        }
Ejemplo n.º 7
0
        public string CreateNationalID(vw_CaseBasicData BasicData)
        {
            var caseBasicData = (vw_FaultCaseBasicData)BasicData;

            return(String.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}", "01", (int)CaseLevels.Initial, caseBasicData.SecondProsecutionID, caseBasicData.FirstProsecutionID, caseBasicData.CaseTypeID, caseBasicData.FirstYear, caseBasicData.FirstNumber));
        }
Ejemplo n.º 8
0
 public void UpdateCaseBasicData(int caseID, vw_CaseBasicData caseBasicData)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 9
0
        public string GetNationalID(vw_CaseBasicData BasicData)
        {
            var caseBasicData = (vw_CrimeCaseBasicData)BasicData;

            return(String.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}", "02", (int)CaseLevels.Elementary, caseBasicData.SecondProsecutionID, caseBasicData.FirstProsecutionID, caseBasicData.CrimeTypeID, caseBasicData.FirstYearInt, caseBasicData.FirstNumberInt));
        }
Ejemplo n.º 10
0
 public CaseSaveStatus AddFaultCaseBasicData(vw_CaseBasicData caseBasicData, out int CaseID)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 11
0
 public string CreateNationalID(vw_CaseBasicData caseBasicData)
 {
     return(LookupRepository.GetNationalID(caseBasicData));
 }