Exemple #1
0
        public ActionResult GetDataPacient(BoardPacients data)
        {
            Api API = new Api();
            Dictionary <string, string> arg = new Dictionary <string, string>()
            {
                { "String1", JsonConvert.SerializeObject(data) },
            };

            ViewBag.Pacients = API.Post <BoardPacients>("Pacient/GetAllPacient", arg);
            return(PartialView("_BoardPacientPartial"));
        }
Exemple #2
0
 public BoardPacients GetAllPacient(BoardPacients data)
 {
     return(new PacientDal().GetAllPacient(data));
 }
        public BoardPacients GetAllPacient(BoardPacients data)
        {
            try
            {
                DatabaseContext ctx       = new DatabaseContext();
                var             isDeleted = (int)Enumeratores.SiNo.No;
                //int groupDocTypeId = (int)Enumeratores.DataHierarchy.TypeDoc;
                int skip = (data.Index - 1) * data.Take;

                //filters
                string filterPacient = string.IsNullOrWhiteSpace(data.Pacient) ? "" : data.Pacient;
                //string filterDocNumber = string.IsNullOrWhiteSpace(data.DocNumber) ? "" : data.DocNumber;
                var list = (from per in ctx.Person
                            //join dhy in ctx.DataHierarchy on new { a = per.i_DocTypeId.Value, b = groupDocTypeId } equals new { a = dhy.i_ItemId, b = dhy.i_GroupId }
                            join sys in ctx.SystemParameter on new { a = per.i_BloodGroupId.Value, b = 154 } equals new { a = sys.i_ParameterId, b = sys.i_GroupId } into sys_join from sys in sys_join.DefaultIfEmpty()
                            join sys2 in ctx.SystemParameter on new { a = per.i_BloodFactorId.Value, b = 155 } equals new { a = sys2.i_ParameterId, b = sys2.i_GroupId } into sys2_join from sys2 in sys2_join.DefaultIfEmpty()
                            where per.i_IsDeleted == isDeleted &&
                            (per.v_FirstName.Contains(filterPacient) || per.v_FirstLastName.Contains(filterPacient) || per.v_SecondLastName.Contains(filterPacient) || filterPacient == "" || per.v_DocNumber.Contains(filterPacient))
                            select new PacientCustom
                {
                    v_PersonId = per.v_PersonId,
                    v_FirstName = per.v_FirstName,
                    v_FirstLastName = per.v_FirstLastName,
                    v_SecondLastName = per.v_SecondLastName,
                    //i_DocTypeId = per.i_DocTypeId,
                    v_DocNumber = per.v_DocNumber,
                    d_Birthdate = per.d_Birthdate,
                    //v_BirthPlace = per.v_BirthPlace,
                    //i_SexTypeId = per.i_SexTypeId,
                    //i_MaritalStatusId = per.i_MaritalStatusId,
                    //i_LevelOfId = per.i_LevelOfId,
                    v_TelephoneNumber = per.v_TelephoneNumber,
                    v_AdressLocation = per.v_AdressLocation,
                    // v_GeografyLocationId = per.v_GeografyLocationId,
                    //v_ContactName = per.v_ContactName,
                    //v_EmergencyPhone = per.v_EmergencyPhone,
                    b_PersonImage = per.b_PersonImage,
                    v_Mail = per.v_Mail,
                    //i_BloodGroupId = per.i_BloodGroupId,
                    //i_BloodFactorId = per.i_BloodFactorId,
                    // b_FingerPrintTemplate = per.b_FingerPrintTemplate,
                    //b_RubricImage = per.b_RubricImage,
                    //b_FingerPrintImage = per.b_FingerPrintImage,
                    //t_RubricImageText = per.t_RubricImageText,
                    v_CurrentOccupation = per.v_CurrentOccupation,
                    //i_DepartmentId = per.i_DepartmentId,
                    // i_ProvinceId = per.i_ProvinceId,
                    //i_DistrictId = per.i_DistrictId,
                    // i_ResidenceInWorkplaceId = per.i_ResidenceInWorkplaceId,
                    // v_ResidenceTimeInWorkplace = per.v_ResidenceTimeInWorkplace,
                    // i_TypeOfInsuranceId = per.i_TypeOfInsuranceId,
                    // i_NumberLivingChildren = per.i_NumberLivingChildren,
                    // i_NumberDependentChildren = per.i_NumberDependentChildren,
                    //  i_OccupationTypeId = per.i_OccupationTypeId,
                    //v_OwnerName = per.v_OwnerName,
                    //i_NumberLiveChildren = per.i_NumberLiveChildren,
                    //i_NumberDeadChildren = per.i_NumberDeadChildren,
                    //i_IsDeleted = per.i_IsDeleted,
                    // i_InsertNodeId = per.i_InsertNodeId,
                    //i_UpdateNodeId = per.i_UpdateNodeId,
                    //i_Relationship = per.i_Relationship,
                    //v_ExploitedMineral = per.v_ExploitedMineral,
                    //i_AltitudeWorkId = per.i_AltitudeWorkId,
                    //i_PlaceWorkId = per.i_PlaceWorkId,
                    //v_NroPoliza = per.v_NroPoliza,
                    //v_Deducible = per.v_Deducible,
                    //i_NroHermanos = per.i_NroHermanos,
                    //v_Password = per.v_Password,
                    //v_Procedencia = per.v_Procedencia,
                    //v_CentroEducativo = per.v_CentroEducativo,
                    //v_Religion = per.v_Religion,
                    //v_Nacionalidad = per.v_Nacionalidad,
                    //v_ResidenciaAnterior = per.v_ResidenciaAnterior,
                    //v_Subs = per.v_Subs,
                    //v_ComentaryUpdate = per.v_ComentaryUpdate,
                    v_BloodGroupId = sys.v_Value1,
                    v_BloodFactorId = sys2.v_Value1,
                }).OrderBy(x => x.v_FirstLastName).ToList();

                int totalRecords = list.Count;

                if (data.Take > 0)
                {
                    list = list.Skip(skip).Take(data.Take).ToList();
                }

                data.TotalRecords = totalRecords;
                foreach (var item in list)
                {
                    item.PersonImage = item.b_PersonImage == null ? null : Convert.ToBase64String(item.b_PersonImage);
                }
                data.List = list;

                return(data);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }