コード例 #1
0
        public ActionResult LoadUser(JQueryDataTableParamModel param, string category)
        {
            IEnumerable<LoginUser> users = null;
            var total = 0;
            if (!string.IsNullOrWhiteSpace(category))
            {
                if (category == "SP")
                    users = ObjectBuilder.GetObject<ILoginUserPersistance>("LoginUserPersistance").LoadAllUser(true, true, string.Empty, param.sSearch, param.iDisplayLength, param.iDisplayStart, out total);
                if (category == "AW")
                    users = ObjectBuilder.GetObject<ILoginUserPersistance>("LoginUserPersistance").LoadAllUser(false, true, string.Empty, param.sSearch, param.iDisplayLength, param.iDisplayStart, out total);
            }
            else
                users = ObjectBuilder.GetObject<ILoginUserPersistance>("LoginUserPersistance").LoadAllUser(true, true, string.Empty, param.sSearch, param.iDisplayLength, param.iDisplayStart, out total);

            var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
            Func<LoginUser, string> orderingFunction = (c => sortColumnIndex == 0 ? c.FullName : sortColumnIndex == 1 ? c.FullName : c.LoginId);
            var sortDirection = Request["sSortDir_0"]; // asc or desc
            if (sortDirection == "asc")
            {
                if (users != null) users = users.OrderBy(orderingFunction);
            }
            else if (users != null) users = users.OrderByDescending(orderingFunction);

            var loginUsers = users as IList<LoginUser> ?? users.ToList();
            var aadata = loginUsers.Select(a => new string[]
            {
                a.UserId.ToString(),
                a.FullName,
                a.LoginId,
                string.Format("{0}<br/>{1}", a.Email, a.AlternativeEmail),
                a.ServiceName,
                a.LoginRole.Roles,
                a.IsLocked ? "Tidak Aktif" : "Aktif",
                string.Format("{0:dd/MM/yyyy hh:mm:tt}", a.LastLoginDt),
                a.UserId.ToString()
            }).ToList();

            return Json(new
            {
                OK = true,
                message = "Succeed",
                sEcho = param.sEcho,
                iTotalRecords = total,
                iTotalDisplayRecords = total,
                aaData = aadata,
            }, JsonRequestBehavior.AllowGet);
        }
コード例 #2
0
ファイル: AdminController.cs プロジェクト: ruzzaima/atmintake
        public ActionResult SearchingAtmMember(JQueryDataTableParamModel param, string statuscode, string name, string icno, string armyno)
        {
            var applicants = ObjectBuilder.GetObject<IExistingAtmPersistance>("ExistingAtmPersistance").Search(statuscode, param.sSearch, armyno).ToList();
            if (!string.IsNullOrWhiteSpace(name))
            {
                applicants.Clear();
                applicants.AddRange(ObjectBuilder.GetObject<IExistingAtmPersistance>("ExistingAtmPersistance").Search(statuscode, name, armyno).ToList());
            }
            if (!string.IsNullOrWhiteSpace(icno))
            {
                applicants.Clear();
                applicants.AddRange(ObjectBuilder.GetObject<IExistingAtmPersistance>("ExistingAtmPersistance").Search(statuscode, icno, armyno).ToList());
            }

            var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
            var sortDirection = Request["sSortDir_0"]; // asc or desc
            if (sortDirection == "asc")
                applicants = sortColumnIndex == 0 ? new List<ExistingMember>(applicants.OrderBy(a => a.Name)) : new List<ExistingMember>(applicants.OrderBy(a => a.IdNumber));
            else
                if (sortColumnIndex == 1)
                    applicants = new List<ExistingMember>(applicants.OrderByDescending(a => a.Name));
                else
                    applicants = new List<ExistingMember>(applicants.OrderByDescending(a => a.IdNumber));

            var applicantSubmitteds = applicants as IList<ExistingMember> ?? applicants.ToList();
            var aadata = applicantSubmitteds.Select(a => new string[]
            {
                a.CoId.ToString(),
                a.Name,
                a.IdNumber,
                a.ArmyNo.ToString(),
                a.CoId.ToString(),
                a.Status,
                a.CoId.ToString()
            }).ToList().Skip(param.iDisplayStart).Take(param.iDisplayLength);

            return Json(new
            {
                OK = true,
                message = "Succeed",
                sEcho = param.sEcho,
                iTotalRecords = applicantSubmitteds.Count(),
                iTotalDisplayRecords = applicantSubmitteds.Count(),
                aaData = aadata,
            }, JsonRequestBehavior.AllowGet);
        }
コード例 #3
0
ファイル: AdminController.cs プロジェクト: ruzzaima/atmintake
        public ActionResult SearchingApplicant(JQueryDataTableParamModel param, int acquisitionid, string category, string name, string icno)
        {
            var applicants = new List<ApplicantSubmitted>();
            var total = 0;
            if (!string.IsNullOrWhiteSpace(category))
            {
                if (category == "00")
                    applicants.AddRange(ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence").Search(acquisitionid, category, name, icno, param.sSearch, null, null, null, param.iDisplayLength, param.iDisplayStart, true, out total));
                if (category == "01")
                    applicants.AddRange(ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence").Search(acquisitionid, category, name, icno, param.sSearch, true, null, null, param.iDisplayLength, param.iDisplayStart, null, out total));
                if (category == "02")
                    applicants.AddRange(ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence").Search(acquisitionid, category, name, icno, param.sSearch, null, true, null, param.iDisplayLength, param.iDisplayStart, null, out total));
                if (category == "03")
                    applicants.AddRange(ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence").Search(acquisitionid, category, name, icno, param.sSearch, null, null, true, param.iDisplayLength, param.iDisplayStart, null, out total));
            }

            var applicantSubmitteds = new List<ApplicantSubmitted>();
            var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
            Func<ApplicantSubmitted, string> orderingFunction =
                (c => sortColumnIndex == 0 ? c.FullName : sortColumnIndex == 1 ? c.FullName : c.NewICNo);
            var sortDirection = Request["sSortDir_0"]; // asc or desc
            if (sortDirection == "asc")
                applicantSubmitteds.AddRange(applicants.OrderBy(orderingFunction));
            else
                applicantSubmitteds.AddRange(applicants.OrderByDescending(orderingFunction));

            var aadata = applicantSubmitteds.Select(a => new string[]
            {
                a.ApplicantId.ToString(),
                a.FullName,
                a.NewICNo,
                GenerateStatusApplication(a.Application),
                a.ApplicantId.ToString(),
            }).ToList();

            return Json(new
            {
                OK = true,
                message = "Succeed",
                sEcho = param.sEcho,
                iTotalRecords = total,
                iTotalDisplayRecords = total,
                aaData = aadata,
            }, JsonRequestBehavior.AllowGet);
        }
コード例 #4
0
ファイル: AdminController.cs プロジェクト: ruzzaima/atmintake
        public ActionResult LoadSubmittedApplicant(JQueryDataTableParamModel param, string category, int acquisitionid, string statecode, string citycode, bool? invitationselection, bool? firstselection, bool? finalselection, int? invitationlocid, int? finalselectionlocid, int? reportdutylocid)
        {
            var applicants = new List<ApplicantSubmitted>();
            var total = 0;
            if (string.IsNullOrWhiteSpace(category))
                applicants.AddRange(ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence").Search(acquisitionid, param.sSearch, invitationselection, firstselection, finalselection, param.iDisplayLength, param.iDisplayStart, finalselectionlocid, reportdutylocid, statecode, citycode, null, out total));
            else
            {
                if (category == "11")
                    applicants.AddRange(ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence").Search(acquisitionid, param.sSearch, invitationselection, firstselection, finalselection, param.iDisplayLength, param.iDisplayStart, null, null, statecode, citycode, null, out total));
                if (category == "12")
                    applicants.AddRange(ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence").Search(acquisitionid, param.sSearch, invitationselection, firstselection, finalselection, param.iDisplayLength, param.iDisplayStart, 0, null, statecode, citycode, null, out total));
                if (category == "13")
                    applicants.AddRange(ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence").Search(acquisitionid, param.sSearch, invitationselection, firstselection, finalselection, param.iDisplayLength, param.iDisplayStart, finalselectionlocid, reportdutylocid, statecode, citycode, null, out total));
                if (category == "14")
                    applicants.AddRange(ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence").Search(acquisitionid, param.sSearch, invitationselection, firstselection, finalselection, param.iDisplayLength, param.iDisplayStart, null, 0, statecode, citycode, null, out total));
                if (category == "15")
                {
                    reportdutylocid = reportdutylocid.HasValue ? reportdutylocid : 0;
                    applicants.AddRange(ObjectBuilder.GetObject<IApplicantSubmittedPersistence>("ApplicantSubmittedPersistence").Search(acquisitionid, param.sSearch, invitationselection, firstselection, finalselection, param.iDisplayLength, param.iDisplayStart, null, reportdutylocid, statecode, citycode, null, out total));
                }
            }
            var applicantSubmitteds = new List<ApplicantSubmitted>();
            var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
            Func<ApplicantSubmitted, string> orderingFunction =
                (c => sortColumnIndex == 0 ? c.FullName : sortColumnIndex == 1 ? c.FullName : c.NewICNo);
            var sortDirection = Request["sSortDir_0"]; // asc or desc
            applicantSubmitteds.AddRange(sortDirection == "asc" ? applicants.OrderBy(orderingFunction) : applicants.OrderByDescending(orderingFunction));

            var aadata = applicantSubmitteds.Select(a => new string[]
            {
                a.ApplicantId.ToString(),
                a.FullName,
                a.NewICNo,
                a.CorresponAddrStateNm,
                a.CorresponAddrCityNm,
                firstselection.HasValue ? a.Application.FinalSelActualAcqLocationId.HasValue ? a.Application.FinalSelectionLocation.Location.LocationNm : "Tiada" : finalselection.HasValue ? a.Application.ReportDutyLocId.HasValue ? a.Application.ReportDutyLocation.LocationNm : "Tiada" : "Tiada",
                a.ApplicantId.ToString()
            }).ToList();

            return Json(new
            {
                OK = true,
                message = "Succeed",
                sEcho = param.sEcho,
                iTotalRecords = total,
                iTotalDisplayRecords = total,
                aaData = aadata,
            }, JsonRequestBehavior.AllowGet);
        }
コード例 #5
0
ファイル: AdminController.cs プロジェクト: ruzzaima/atmintake
        public ActionResult LoadIntakes(JQueryDataTableParamModel param)
        {
            var intakes = new List<Acquisition>();

            if (User.Identity.IsAuthenticated)
            {
                var usr = ObjectBuilder.GetObject<ILoginUserPersistance>("LoginUserPersistance").GetByUserName(User.Identity.Name);
                if (null != usr)
                {
                    if (!string.IsNullOrWhiteSpace(usr.ServiceCd))
                        intakes.AddRange(ObjectBuilder.GetObject<IAcquisitionPersistence>("AcquisitionPersistence").GetAllAcquisition(null, usr.ServiceCd).ToList());
                    else
                        intakes.AddRange(ObjectBuilder.GetObject<IAcquisitionPersistence>("AcquisitionPersistence").GetAllAcquisition(null, string.Empty).ToList());
                }
            }

            var aadata = intakes.Select(a => new string[]
            {
                a.AcquisitionId.ToString(),
                a.AcquisitionType.AcquisitionTypeNm,
                a.Siri.HasValue && a.Year.HasValue ? a.Siri.Value.ToString() + "/" + a.Year.Value.ToString() : "NA",
                a.CloseStatus.HasValue ? a.CloseStatus.Value ? "Tutup" : "Buka" : "NA",
                a.AcquisitionId.ToString()
            });

            return Json(new
            {
                OK = true,
                message = "Succeed",
                sEcho = param.sEcho,
                iTotalRecords = intakes.Count(),
                iTotalDisplayRecords = intakes.Count(),
                aaData = aadata,
            }, JsonRequestBehavior.AllowGet);
        }