public virtual async Task <ActionResult> Manage(RelativeSearchFilter filter)
        {
            filter.UserId = User.GetUserId();
            //ViewBag.HasExtraButton = true;
            //ViewBag.ExtraButtonUrl = Url.Action("InsuranceInfo", "User");
            //ViewBag.ExtraButtonText = Strings.PreFactor;
            //ViewBag.ExtraButtonIcon = "zmdi-eye";

            var getUser = await _userSrv.FindAsync(User.GetUserId());

            var startDate = PersianDateTime.Parse(_configuration["CustomSettings:StartLockDate"]).ToDateTime();
            var endDate   = PersianDateTime.Parse(_configuration["CustomSettings:EndLockDate"]).ToDateTime();

            ViewBag.CanEdit          = !(getUser.Result.InsertDateMi >= startDate && getUser.Result.InsertDateMi <= endDate);
            ViewBag.WithoutAddButton = !ViewBag.CanEdit;

            if (!Request.IsAjaxRequest())
            {
                return(View(_MemberRelativeSrv.Get(filter)));
            }
            else
            {
                return(PartialView("Partials/_List", _MemberRelativeSrv.Get(filter)));
            }
        }
Esempio n. 2
0
        public string Export(RelativeSearchFilter filter)
        {
            Expression <Func <Relative, bool> > conditions = x => true;

            if (filter != null)
            {
                if (filter.UserId != null)
                {
                    conditions = conditions.And(x => x.UserId == filter.UserId);
                }
                if (!string.IsNullOrWhiteSpace(filter.NationalCode))
                {
                    conditions = conditions.And(x => x.NationalCode == filter.NationalCode);
                }
                if (!string.IsNullOrWhiteSpace(filter.Name))
                {
                    conditions = conditions.And(x => (x.Name + " " + x.Family).Contains(filter.Name));
                }
            }

            var items = _RelativeRepo.Get(conditions, x => x.OrderByDescending(u => u.RelativeId));;
            var sb    = new StringBuilder(",Fullname,Relation,Gender,Takafol,National Code,Identity Number,FatherName,BirthDay,Register Date" + Environment.NewLine);
            int idx   = 1;

            foreach (var item in items)
            {
                sb.Append($"{idx},{item.Fullname},{item.RelativeType.GetDescription()},{item.Gender.GetDescription()},{item.TakafolKind.GetDescription()},{item.NationalCode},{item.IdentityNumber},{item.FatherName},{item.BirthDay},{item.InsertDateSh}" + Environment.NewLine);
                idx++;
            }
            return(sb.ToString());
        }
Esempio n. 3
0
 public virtual ActionResult Manage(RelativeSearchFilter filter)
 {
     ViewBag.ExcelExport = true;
     if (!Request.IsAjaxRequest())
     {
         return(View(_relativeSrv.Get(filter)));
     }
     else
     {
         return(PartialView("Partials/_List", _relativeSrv.Get(filter)));
     }
 }
Esempio n. 4
0
        public PagingListDetails <Relative> Get(RelativeSearchFilter filter)
        {
            Expression <Func <Relative, bool> > conditions = x => true;

            if (filter != null)
            {
                if (filter.UserId != null)
                {
                    conditions = conditions.And(x => x.UserId == filter.UserId);
                }
                if (!string.IsNullOrWhiteSpace(filter.NationalCode))
                {
                    conditions = conditions.And(x => x.NationalCode == filter.NationalCode);
                }
                if (!string.IsNullOrWhiteSpace(filter.Name))
                {
                    conditions = conditions.And(x => (x.Name + " " + x.Family).Contains(filter.Name));
                }
            }

            return(_RelativeRepo.Get(conditions, filter, x => x.OrderByDescending(u => u.RelativeId)));;
        }
Esempio n. 5
0
 public virtual JsonResult Excel(RelativeSearchFilter filter)
 => Json(_relativeSrv.Export(filter));