コード例 #1
0
        /// <summary>
        /// تعداد مدیران در جستجو
        /// اگر کاربر فعلی اپراتور فقط در بین مدیران زیر دست اپراتور جست و جو میکنیم
        /// ولی اگر مدیر باشد نتایج جست و جو تهی میباشد
        /// اگر هم مدیر باشد و هم اپراتور آنگاه خود شخص به علاوه مدیران تحت مدیریت برمیگردد
        /// </summary>
        /// <param name="searchKey"></param>
        /// <returns></returns>
        public int GetAllManagerCount(string searchKey)
        {
            ISearchPerson searchTools = new BPerson();
            int           count       = searchTools.GetPersonInQuickSearchCount(searchKey, PersonCategory.Manager);

            return(count);
        }
コード例 #2
0
        public void QuickSearchOnFirstNameByPageTest()
        {
            ISearchPerson  searchTool = new BPerson();
            string         key        = ADOPerson1.BarCode.Remove(0, 2);
            int            count      = searchTool.GetPersonInQuickSearchCount(key);
            IList <Person> list       = searchTool.QuickSearchByPage(0, count, key);

            Assert.IsTrue(list.Where(x => x.ID == ADOPerson1.ID).Count() == 1);
        }
コード例 #3
0
ファイル: BPersonParams.cs プロジェクト: ImanRezaeipour/atlas
        public IList <PersonParamValue> GetAll(decimal paramFieldId, string searchTerm)
        {
            try
            {
                ISearchPerson            searchTool   = new BPerson();
                int                      count        = searchTool.GetPersonInQuickSearchCount(searchTerm);
                IList <Person>           personList   = searchTool.QuickSearchByPage(0, count, searchTerm);
                List <decimal>           personIDList = personList.Select(r => r.ID).ToList <decimal>();
                IList <PersonParamValue> list         = paramValueRepository.Find(x => personIDList.Contains(x.Person.ID) && x.ParamField.ID == paramFieldId).ToList();
                List <PersonParamValue>  listParams   = new List <PersonParamValue>();

                foreach (PersonParamValue item in list)
                {
                    bool result = true;
                    foreach (decimal personID in personIDList)
                    {
                        if (list.Count(p => p.Person.ID == personID && p.FromDate == item.FromDate && p.ToDate == item.ToDate && p.Value == item.Value) == 0)
                        {
                            result = false;
                        }
                    }
                    if (result == true)
                    {
                        if (listParams.Count(c => c.FromDate == item.FromDate && c.ToDate == item.ToDate && c.Value == item.Value) == 0)
                        {
                            listParams.Add(item);
                        }
                    }
                }

                foreach (PersonParamValue value in listParams)
                {
                    if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                    {
                        value.TheFromDate = Utility.ToPersianDate(value.FromDate);
                        value.TheToDate   = Utility.ToPersianDate(value.ToDate);
                    }
                    else
                    {
                        value.TheFromDate = Utility.ToString(value.FromDate);
                        value.TheToDate   = Utility.ToString(value.ToDate);
                    }
                }
                return(listParams);
            }
            catch (Exception ex)
            {
                LogException(ex);
                throw ex;
            }
        }
コード例 #4
0
ファイル: BUser.cs プロジェクト: ImanRezaeipour/GTS
 /// <summary>
 /// تعداد پرسنل را باتوجه به کلمه جستجو برمیگرداند
 /// </summary>
 /// <param name="searchKey"></param>
 /// <returns></returns>
 public int QuickSearchPersonCount(string searchKey)
 {
     try
     {
         ISearchPerson bperson = new BPerson();
         int           count   = bperson.GetPersonInQuickSearchCount(searchKey);
         return(count);
     }
     catch (Exception ex)
     {
         LogException(ex, "BUser", "QuickSearchPersonCount");
         throw ex;
     }
 }
コード例 #5
0
        public IList <ImperativeUndermanagementInfoProxy> GetQuickSearchPersonByImperativeRequest(string searchValue, ImperativeRequestLoadState IRLS, ImperativeRequest imperativeRequest, PersonCategory searchInCategory, int pageIndex, int pageSize)
        {
            try
            {
                UIValidationExceptions exception = new UIValidationExceptions();
                if (imperativeRequest.Precard == null || imperativeRequest.Precard.ID == 0)
                {
                    exception.Add(new ValidationException(ExceptionResourceKeys.RequestPrecardIsEmpty, "پیشکارت نباید خالی باشد", ExceptionSrc));
                }
                if (imperativeRequest.Year == null || imperativeRequest.Year == 0)
                {
                    exception.Add(new ValidationException(ExceptionResourceKeys.RequestYearIsEmpty, "سال نباید خالی باشد", ExceptionSrc));
                }
                if (imperativeRequest.Month == null || imperativeRequest.Month == 0)
                {
                    exception.Add(new ValidationException(ExceptionResourceKeys.RequestMonthIsEmpty, "ماه نباید خالی باشد", ExceptionSrc));
                }

                if (exception.Count == 0)
                {
                    BApplicationSettings.CheckGTSLicense();

                    IList <Person> personList = new List <Person>();
                    ISearchPerson  searchTool = new BPerson();
                    searchValue = searchValue == null ? String.Empty : searchValue;
                    searchValue = searchValue.Trim();
                    int count = searchTool.GetPersonInQuickSearchCount(searchValue, searchInCategory);
                    if (pageSize * pageIndex == 0 || pageSize * pageIndex < count)
                    {
                        decimal        managerId = this.personBusiness.GetCurentManagerId(ref searchInCategory);
                        IList <Person> result    = this.imperativeRequestRepository.GetQuickSearchPersonByImperativeRequest(searchValue, IRLS, imperativeRequest, BUser.CurrentUser.ID, managerId, searchInCategory, pageSize, pageIndex);
                        return(this.ConvertToImperativeUndermanagementInfoProxy(result, imperativeRequest, pageSize, pageIndex));
                    }
                    else
                    {
                        throw new OutOfExpectedRangeException("0", Convert.ToString(count - 1), Convert.ToString(pageSize * (pageIndex + 1)), ExceptionSrc + "GetQuickSearchPersonByImperativeRequest");
                    }
                }
                else
                {
                    throw exception;
                }
            }
            catch (Exception ex)
            {
                LogException(ex, "BImperativeRequest", "GetQuickSearchPersonByImperativeRequest");
                throw ex;
            }
        }
コード例 #6
0
        public IList <ArchiveCalcValuesProxy> GetArchiveValues(int year, int month, string searchKey, int pageIndex, int pageSize)
        {
            int            rangeOrder = month;
            ISearchPerson  searchTool = new BPerson();
            int            totalCount = searchTool.GetPersonInQuickSearchCount(searchKey);
            IList <Person> personList = searchTool.QuickSearchByPage(0, totalCount, searchKey);
            var            ids        = from o in personList
                                        select o.ID;
            IList <decimal> existsPersonArchiveList = archiveRep.GetExsitsArchivePersons(ids.ToList(), year, rangeOrder);

            personList = personList.Where(x => existsPersonArchiveList.Any(y => y == x.ID))
                         .Skip(pageIndex * pageSize)
                         .Take(pageSize)
                         .ToList();

            return(this.GetArchiveValues(year, month, personList));
        }
コード例 #7
0
        public int GetSearchCount(string searchKey, int year, int month)
        {
            try
            {
                int            rangeOrder = month;
                ISearchPerson  searchTool = new BPerson();
                int            totalCount = searchTool.GetPersonInQuickSearchCount(searchKey);
                IList <Person> personList = searchTool.QuickSearchByPage(0, totalCount, searchKey);
                var            ids        = from o in personList
                                            select o.ID;
                IList <decimal> personIds = archiveRep.GetExsitsArchivePersons(ids.ToList(), year, rangeOrder);
                return(personIds.Count);
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex);

                throw ex;
            }
        }
コード例 #8
0
ファイル: BRemainLeave.cs プロジェクト: ImanRezaeipour/GTS
        /// <summary>
        ///  اتقال مرخصی به سال بعد
        /// </summary>
        /// <param name="searchKey"></param>
        /// <param name="fromYear"></param>
        /// <param name="toYear"></param>
        public int TransferToNextYear(string searchKey, int fromYear, int toYear)
        {
            DateTime fromDate, toDate;

            if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
            {
                fromDate = Utility.ToMildiDate(String.Format("{0}/01/01", fromYear));
                toDate   = Utility.ToMildiDate(String.Format("{0}/01/01", toYear));
            }
            else
            {
                fromDate = new DateTime(fromYear, 1, 1);
                toDate   = new DateTime(toYear, 1, 1);
            }

            IList <decimal> underManagmentList = new List <decimal>();
            ISearchPerson   searchTool         = new BPerson();
            int             count = searchTool.GetPersonInQuickSearchCount(searchKey);
            IList <Person>  list  = searchTool.QuickSearchByPage(0, count, searchKey);
            var             l     = from p in list
                                    select p.ID;

            underManagmentList = l.ToList <decimal>();
            int counter = 0;

            foreach (decimal personId in underManagmentList)
            {
                try
                {
                    this.TransferToNextYear(personId, fromDate, toDate, fromYear, toYear);
                    counter++;
                }
                catch (UIValidationExceptions ex)
                {
                    LogException(ex);
                }
            }
            return(counter);
        }
コード例 #9
0
ファイル: BPersonParams.cs プロジェクト: ImanRezaeipour/atlas
        public decimal DeletePersonsParamValue_onPersonnelUpdate(PersonParamValue filedValue, UIActionType UAT, string searchTerm)
        {
            ISearchPerson    searchTool     = new BPerson();
            int              count          = searchTool.GetPersonInQuickSearchCount(searchTerm);
            IList <Person>   list           = searchTool.QuickSearchByPage(0, count, searchTerm);
            PersonParamValue personParamOld = GetAll().SingleOrDefault(p => p.ID == filedValue.ID);

            string   value    = personParamOld.Value;
            DateTime fromDate = personParamOld.FromDate;
            DateTime toDate   = personParamOld.ToDate;

            foreach (Person prs in list)
            {
                PersonParamValue personParamObj = new PersonParamValue();
                personParamObj = GetAll().SingleOrDefault(f => f.Person.ID == prs.ID && f.FromDate == fromDate && f.ToDate == toDate && f.Value == value);


                this.SaveChanges(personParamObj, UAT);
            }

            return(list.Count);
        }
コード例 #10
0
ファイル: BPersonParams.cs プロジェクト: ImanRezaeipour/atlas
        public decimal InsertPersonsParamValue_onPersonnelUpdate(PersonParamValue filedValue, UIActionType UAT, string searchTerm)
        {
            ISearchPerson    searchTool     = new BPerson();
            int              count          = searchTool.GetPersonInQuickSearchCount(searchTerm);
            IList <Person>   list           = searchTool.QuickSearchByPage(0, count, searchTerm);
            PersonParamValue personParamObj = new PersonParamValue();

            foreach (Person prs in list)
            {
                personParamObj             = new PersonParamValue();
                personParamObj.ID          = filedValue.ID;
                personParamObj.FromDate    = filedValue.FromDate;
                personParamObj.ParamField  = filedValue.ParamField;
                personParamObj.Person      = prs;
                personParamObj.TheFromDate = filedValue.TheFromDate;
                personParamObj.TheToDate   = filedValue.TheToDate;
                personParamObj.ToDate      = filedValue.ToDate;
                personParamObj.Value       = filedValue.Value;

                this.SaveChanges(personParamObj, UAT);
            }

            return(list.Count);
        }