int IManagerReviewedRequests.GetRequestCount(decimal managerId, string searchKey, DateTime fromDate, DateTime toDate) { RequestRepository requestRep = new RequestRepository(false); //var ids = from o in quickSearchUnderMnagment // select o.ID; //int result = requestRep.GetAllManagerReviewdCount(fromDate, toDate, RequestState.UnKnown, managerId, ids.ToArray()); //return result; IList <decimal> managerList = new List <decimal>(); BSubstitute subBus = new BSubstitute(); IList <Substitute> substituteList = subBus.GetSubstitute(BUser.CurrentUser.Person.ID); if (substituteList.Count > 0) { managerList = subBus.GetSubstituteManagerList(BUser.CurrentUser.Person.ID); } managerList.Add(managerId); IList <InfoRequest> requests = requestRep.GetAllReviewdKartablItems(fromDate, toDate, RequestState.UnKnown, managerList, KartablOrderBy.RequestDate); requests = this.AppllySubstituteAccess(managerId, requests, substituteList); if (!Utility.IsEmpty(searchKey)) { requests = this.AppllyQuickSearch(searchKey, requests); } return(requests.Count); }
/// <summary> /// جستجو بر اساس /// نام شخص /// شماره پرسنلی /// پیشکارت /// تاریخ ثبت ,شروع ,پایان /// توضیح درخواست /// </summary> /// <param name="managerId"></param> /// <param name="searchKey"></param> /// <param name="fromDate"></param> /// <param name="toDate"></param> /// <returns></returns> int IManagerKartabl.GetRequestCount(decimal managerId, string searchKey, DateTime fromDate, DateTime toDate) { //int result = requestRep.GetAllManagerKartablCount(fromDate, toDate, RequestType.None, managerId, ids.ToArray()); IList <decimal> managerList = new List <decimal>(); BSubstitute subBus = new BSubstitute(); IList <Substitute> substituteList = subBus.GetSubstitute(BUser.CurrentUser.Person.ID); if (substituteList.Count > 0) { managerList = subBus.GetSubstituteManagerList(BUser.CurrentUser.Person.ID); } managerList.Add(managerId); RequestRepository requestRep = new RequestRepository(false); IList <InfoRequest> requests = requestRep.GetAllKartablItems(fromDate, toDate, RequestType.None, managerList, KartablOrderBy.None); requests = this.AppllySubstituteAccess(managerId, requests, substituteList); if (!Utility.IsEmpty(searchKey)) { requests = this.AppllyQuickSearch(searchKey, requests); } return(requests.Count); }
/* * int ISubstituteKartabl.GetRequestCount(decimal managerId, decimal personId, IList<Person> quickSearchUnderMnagment, DateTime fromDate, DateTime toDate) * { * RequestRepository requestRep = new RequestRepository(false); * var ids = from o in quickSearchUnderMnagment * select o.ID; * int result = requestRep.GetAllSubstituteKartablCount(fromDate, toDate, RequestType.None, managerId, personId, ids.ToArray()); * return result; * } * * IList<InfoRequest> ISubstituteKartabl.GetAllRequests(decimal managerId, decimal personId, IList<Person> quickSearchUnderMnagment, DateTime fromDate, DateTime toDate, int pageIndex, int pageSize, KartablOrderBy orderby) * { * RequestRepository requestRep = new RequestRepository(false); * var ids = from o in quickSearchUnderMnagment * select o.ID; * IList<InfoRequest> result = requestRep.GetAllSubstituteKartabl(fromDate, toDate, RequestType.None, managerId, personId, pageIndex, pageSize, ids.ToArray(), orderby); * return result; * } * * IList<InfoRequest> ISubstituteKartabl.GetAllRequests(decimal managerId, decimal personId, RequestType requestType, DateTime fromDate, DateTime toDate, int pageIndex, int pageSize, KartablOrderBy orderby) * { * RequestRepository requestRep = new RequestRepository(false); * IList<InfoRequest> result = requestRep.GetAllSubstituteKartabl(fromDate, toDate, requestType, managerId, personId, pageIndex, pageSize, null, orderby); * return result; * } * * IList<InfoRequest> ISubstituteKartabl.GetAllRequests(decimal managerId, decimal personId) * { * RequestRepository requestRep = new RequestRepository(false); * IList<InfoRequest> result = requestRep.GetAllSubstituteKartabl(managerId, personId, KartablOrderBy.PersonCode); * return result; * } * * int ISubstituteKartabl.GetRequestCountByFilter(decimal managerId, decimal personId, RequestType requestType, DateTime fromDate, DateTime toDate, IList<RequestFliterProxy> fliters) * { * throw new NotImplementedException(); * } * * IList<InfoRequest> ISubstituteKartabl.GetAllRequestsByFilter(decimal managerId, decimal personId, RequestType requestType, DateTime fromDate, DateTime toDate, int pageIndex, int pageSize, IList<RequestFliterProxy> fliters, KartablOrderBy orderby) * { * throw new NotImplementedException(); * }*/ #endregion #region IManagerKartabl Members int IManagerKartabl.GetRequestCount(decimal managerId, RequestType requestType, DateTime fromDate, DateTime toDate) { RequestRepository requestRep = new RequestRepository(false); //int result = requestRep.GetAllManagerKartablCount(fromDate, toDate, requestType, managerId, null); //return result; //int result1 = requestRep.GetAllManagerKartablItemsCount(fromDate, toDate, requestType, managerId); //int result2 = requestRep.GetAllSubstituteKartablItemsCount(fromDate, toDate, requestType, BUser.CurrentUser.Person.ID); //return result1 + result2; IList <decimal> managerList = new List <decimal>(); BSubstitute subBus = new BSubstitute(); IList <Substitute> substituteList = subBus.GetSubstitute(BUser.CurrentUser.Person.ID); if (substituteList.Count > 0) { managerList = subBus.GetSubstituteManagerList(BUser.CurrentUser.Person.ID); } managerList.Add(managerId); IList <InfoRequest> requests = requestRep.GetAllKartablItems(fromDate, toDate, RequestType.None, managerList, KartablOrderBy.None); requests = this.AppllySubstituteAccess(managerId, requests, substituteList); return(requests.Count); }
/// <summary> /// اعمال تاریخ و دسترسی پیشکارت جانشین /// </summary> /// <param name="requests"></param> /// <param name="substituteList"></param> /// <returns></returns> private IList <InfoRequest> AppllySubstituteAccess(decimal managerId, IList <InfoRequest> requests, IList <Substitute> substituteList) { BSubstitute subBus = new BSubstitute(); if (substituteList.Count > 0) { IList <Precard> access = substituteList.First().PrecardList; requests = requests.Where(x => access.Where(y => y.ID == x.PrecardID).Count() > 0).ToList(); requests = requests.Where(x => substituteList.Where(y => (y.Manager.ID == x.ManagerID && y.FromDate <= x.RegisterDate && y.ToDate >= x.RegisterDate) || x.ManagerID == managerId).Count() > 0).ToList(); } return(requests); }
IList <InfoRequest> IManagerKartabl.GetAllRequests(decimal managerId, string searchKey, DateTime fromDate, DateTime toDate, int pageIndex, int pageSize, KartablOrderBy orderby) { RequestRepository requestRep = new RequestRepository(false); //var ids = from o in quickSearchUnderMnagment // select o.ID; //IList<InfoRequest> result = requestRep.GetAllManagerKartabl(fromDate, toDate, RequestType.None, managerId, pageIndex, pageSize, ids.ToArray(), orderby); IList <decimal> managerList = new List <decimal>(); BSubstitute subBus = new BSubstitute(); IList <Substitute> substituteList = subBus.GetSubstitute(BUser.CurrentUser.Person.ID); if (substituteList.Count > 0) { managerList = subBus.GetSubstituteManagerList(BUser.CurrentUser.Person.ID); } managerList.Add(managerId); IList <InfoRequest> requests = requestRep.GetAllKartablItems(fromDate, toDate, RequestType.None, managerList, orderby); requests = this.AppllySubstituteAccess(managerId, requests, substituteList); foreach (InfoRequest req in requests) { if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi) { req.RegistrationDate = Utility.ToPersianDate(req.RegisterDate); req.TheFromDate = Utility.ToPersianDate(req.FromDate) + " " + Utility.GetDayName(req.FromDate, LanguagesName.Parsi); req.TheToDate = Utility.ToPersianDate(req.ToDate) + " " + Utility.GetDayName(req.ToDate, LanguagesName.Parsi); } else { req.RegistrationDate = Utility.ToString(req.RegisterDate); req.TheFromDate = Utility.ToString(req.FromDate) + " " + Utility.GetDayName(req.FromDate, LanguagesName.English); req.TheToDate = Utility.ToString(req.ToDate) + " " + Utility.GetDayName(req.ToDate, LanguagesName.English); } } if (!Utility.IsEmpty(searchKey)) { requests = this.AppllyQuickSearch(searchKey, requests); } return(requests.Skip(pageIndex * pageSize).Take(pageSize).ToList()); }
IList <InfoRequest> IManagerKartabl.GetAllRequests(decimal managerId, RequestType requestType, DateTime fromDate, DateTime toDate, int pageIndex, int pageSize, KartablOrderBy orderby) { //IList<InfoRequest> result = requestRep.GetAllManagerKartabl(fromDate, toDate, requestType, managerId, pageIndex, pageSize, null, orderby); IList <decimal> managerList = new List <decimal>(); BSubstitute subBus = new BSubstitute(); IList <Substitute> substituteList = subBus.GetSubstitute(BUser.CurrentUser.Person.ID); if (substituteList.Count > 0) { managerList = subBus.GetSubstituteManagerList(BUser.CurrentUser.Person.ID); } managerList.Add(managerId); RequestRepository requestRep = new RequestRepository(false); IList <InfoRequest> requests = requestRep.GetAllKartablItems(fromDate, toDate, requestType, managerList, orderby); requests = this.AppllySubstituteAccess(managerId, requests, substituteList); return(requests.Skip(pageIndex * pageSize).Take(pageSize).ToList()); }
private void UpdateSubstitutePrecardAccess(PrecardAccessGroup precardAccessGroup) { try { Flow flowAlias = null; PrecardAccessGroup precardAccessGroupAlias = null; IList <decimal> flowIDsList = this.NHSession.QueryOver <Flow>(() => flowAlias) .JoinAlias(() => flowAlias.AccessGroup, () => precardAccessGroupAlias) .Where(() => precardAccessGroupAlias.ID == precardAccessGroup.ID) .Select(x => x.ID) .List <decimal>(); if (flowIDsList.Count() > 0) { BSubstitute bSubstitute = new BSubstitute(); bSubstitute.UpdateSubstitutePrecardAccessByFlow(flowIDsList); } } catch (Exception ex) { LogException(ex, ExceptionSrc, "UpdateSubstitutePrecardAccess"); } }