コード例 #1
0
ファイル: BSubstitute.cs プロジェクト: ImanRezaeipour/atlas
        /// <summary>
        /// مدیران در جستجو
        /// اگر کاربر فعلی اپراتور فقط در بین مدیران زیر دست اپراتور جست و جو میکنیم
        /// ولی اگر مدیر باشد نتایج جست و جو تهی میباشد
        /// اگر هم مدیر باشد و هم اپراتور آنگاه خود شخص به علاوه مدیران تحت مدیریت برمیگردد
        /// </summary>
        /// <param name="searchKey"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IList <Person> GetAllManager(string searchKey, int pageIndex, int pageSize)
        {
            //BUser bUser = new BUser();
            //NHibernate.ISession CurrentNHSession = NHibernateSessionManager.Instance.GetSession();
            //IList<decimal> accessibleFlows = ((IDataAccess)bUser).GetAccessibleFlows();
            //Manager managerAlias = null;
            ////Person personAlias = null;
            ////Person personOrgAlias = null;
            //ManagerFlow managerFlowAlias = null;
            //Flow flowAlias = null;
            ////OrganizationUnit organUnitAlias = null;
            //NHibernate.IQueryOver<Manager> managerQueryExpression = null;

            //managerQueryExpression = CurrentNHSession.QueryOver<Manager>(() => managerAlias)
            //                                         .JoinAlias(() => managerAlias.ManagerFlowList, () => managerFlowAlias)
            //                                         .JoinAlias(() => managerFlowAlias.Flow, () => flowAlias)
            //                                         .Where(() => flowAlias.ID.IsIn(accessibleFlows.ToArray()));
            //                                         //.Skip(pageIndex * pageSize)
            //                                         //.Take(pageSize);

            //IList<Manager> managerList = managerQueryExpression.List<Manager>().Distinct(new ManagerComparer()).ToList();



            IList <Person> result     = new List <Person>();
            ISearchPerson  searchTool = new BPerson();

            result = searchTool.QuickSearchByPage(pageIndex, pageSize, searchKey, PersonCategory.SubstitudeManager);
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// مدیران در جستجو
        /// اگر کاربر فعلی اپراتور فقط در بین مدیران زیر دست اپراتور جست و جو میکنیم
        /// ولی اگر مدیر باشد نتایج جست و جو تهی میباشد
        /// اگر هم مدیر باشد و هم اپراتور آنگاه خود شخص به علاوه مدیران تحت مدیریت برمیگردد
        /// </summary>
        /// <param name="searchKey"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IList <Person> GetAllManager(string searchKey, int pageIndex, int pageSize)
        {
            IList <Person> result     = new List <Person>();
            ISearchPerson  searchTool = new BPerson();

            result = searchTool.QuickSearchByPage(pageIndex, pageSize, searchKey, PersonCategory.Manager);
            return(result);
        }
コード例 #3
0
ファイル: MainPage.aspx.cs プロジェクト: ImanRezaeipour/GTS
 protected void Button23_Click(object sender, EventArgs e)
 {
     ISearchPerson PersonnelSearchBusiness = new BPerson();
     //IList<Person> list = PersonnelSearchBusiness.QuickSearchByPage(0, 20, "62620");
     //IList<Department> departmentsList = PersonnelSearchBusiness.GetAllDepartments();
     //Department rootDep = PersonnelSearchBusiness.GetDepartmentRoot();
     IList <Person> prsList = PersonnelSearchBusiness.QuickSearchByPage(0, 1000, "");
 }
コード例 #4
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);
        }
コード例 #5
0
ファイル: BRemainLeave.cs プロジェクト: ImanRezaeipour/GTS
        /// <summary>
        /// مانده مرخصی را برای سالها و افراد جستجو شده  برمیگرداند
        /// حد اکثر 1000 رکورد بر میگرداند
        /// </summary>
        /// <param name="quickSearchKey"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IList <RemainLeaveProxy> GetRemainLeave(string quickSearchKey, int fromYear, int toYear, int pageIndex, int pageSize)
        {
            try
            {
                if (Utility.IsEmpty(quickSearchKey))
                {
                    return(this.GetRemainLeave(fromYear, toYear, pageIndex, pageSize));
                }

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

                /*
                 * IList<LeaveYearRemain> result = new List<LeaveYearRemain>();
                 * if (underManagmentList != null && underManagmentList.Count > 0)
                 * {
                 *  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);
                 *  }
                 *  result = objectRep.GetByCriteriaByPage(pageIndex, pageSize,
                 *                                                  new CriteriaStruct(Utility.GetPropertyName(() => new LeaveYearRemain().Date), fromDate, CriteriaOperation.GreaterEqThan),
                 *                                                  new CriteriaStruct(Utility.GetPropertyName(() => new LeaveYearRemain().Date), toDate, CriteriaOperation.LessEqThan),
                 *                                                  new CriteriaStruct(Utility.GetPropertyName(() => new LeaveYearRemain().PersonId), underManagmentList.ToArray<decimal>(), CriteriaOperation.IN));
                 * }
                 * if (result != null && result.Count > 0)
                 * {
                 *  result = result.OrderBy(x => x.Person.LastName).ThenBy(x => x.Date.Year).ToList();
                 *
                 * }
                 * return this.ConvertToProxy(result);
                 * */

                return(this.GetRemainLeave(underManagmentList, fromYear, toYear, pageIndex, pageSize));
            }
            catch (Exception ex)
            {
                LogException(ex, "BRemainLeave", "GetRemainLeave");
                throw ex;
            }
        }
コード例 #6
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;
            }
        }
コード例 #7
0
ファイル: BUser.cs プロジェクト: ImanRezaeipour/GTS
 /// <summary>
 /// در بین پرسنلی جستجوی سریع انجام میدهد
 /// </summary>
 /// <param name="searchKey"></param>
 /// <returns></returns>
 public IList <Person> QuickSearchPersonByPage(string searchKey, int pageIndex, int pageSize)
 {
     try
     {
         ISearchPerson  bperson = new BPerson(SysLanguageResource.English, LocalLanguageResource.English);
         IList <Person> list    = bperson.QuickSearchByPage(pageIndex, pageSize, searchKey);
         return(list);
     }
     catch (Exception ex)
     {
         LogException(ex, "BManager", "QuickSearchPersonByPage");
         throw ex;
     }
 }
コード例 #8
0
 /// <summary>
 /// در بین پرسنلی جستجوی سریع انجام میدهد
 /// </summary>
 /// <param name="searchKey"></param>
 /// <returns></returns>
 public IList <Person> QuickSearchPersonByPage(string searchKey, int pageIndex, int pageSize)
 {
     try
     {
         ISearchPerson  searchTool = new BPerson();
         IList <Person> list       = searchTool.QuickSearchByPage(pageIndex, pageSize, searchKey);
         return(list);
     }
     catch (Exception ex)
     {
         LogException(ex, "BManager", "QuickSearchPersonByPage");
         throw ex;
     }
 }
コード例 #9
0
 public void GetByID_Test2()
 {
     try
     {
         PersonAdvanceSearchProxy p = new PersonAdvanceSearchProxy();
         p.Military = MilitaryStatus.GheireMashmool;
         ISearchPerson bus = new BPerson();
         bus.QuickSearchByPage(0, 10, "");
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #10
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));
        }
コード例 #11
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;
            }
        }
コード例 #12
0
ファイル: BRemainLeave.cs プロジェクト: ImanRezaeipour/GTS
        /// <summary>
        /// مانده مرخصی را برای سالها و افراد جستجو شده  برمیگرداند
        /// </summary>
        /// <param name="quickSearchKey"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public int GetRemainLeaveCount(string quickSearchKey, int fromYear, int toYear)
        {
            try
            {
                IList <decimal> underManagmentList = new List <decimal>();
                ISearchPerson   searchTool         = new BPerson();
                int             count = 1000;// searchTool.GetPersonInQuickSearchCount(quickSearchKey);
                IList <Person>  list  = searchTool.QuickSearchByPage(0, count, quickSearchKey);
                var             l     = from p in list
                                        select p.ID;
                underManagmentList = l.ToList <decimal>();

                /*
                 * if (underManagmentList != null && underManagmentList.Count > 0)
                 * {
                 *  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);
                 *  }
                 *  count = objectRep.GetCountByCriteria(new CriteriaStruct(Utility.GetPropertyName(() => new LeaveYearRemain().Date), fromDate, CriteriaOperation.GreaterEqThan),
                 *                                       new CriteriaStruct(Utility.GetPropertyName(() => new LeaveYearRemain().Date), toDate, CriteriaOperation.LessEqThan),
                 *                                        new CriteriaStruct(Utility.GetPropertyName(() => new LeaveYearRemain().PersonId), underManagmentList.ToArray<decimal>(), CriteriaOperation.IN));
                 * }
                 * return count;
                 * */

                return(this.GetRemainLeaveCount(underManagmentList, fromYear, toYear));
            }
            catch (Exception ex)
            {
                LogException(ex, "BRemainLeave", "GetRemainLeaveCount");
                throw ex;
            }
        }
コード例 #13
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);
        }
コード例 #14
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);
        }
コード例 #15
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);
        }
コード例 #16
0
        public StiReport GetReport(decimal reportFileId, PersonAdvanceSearchProxy proxy, IList <ReportUIParameter> parmeters)
        {
            try
            {
                if (parmeters.Where(x => Utility.IsEmpty(x.ActionId)).Count() > 0)
                {
                    exception.Add(new ValidationException(ExceptionResourceKeys.ReportParameterActionIdIsEmpty, "شناسه عملیات مشخص نشده است", ExceptionSrc));
                    throw exception;
                }
                ISearchPerson   searchTool = new BPerson();
                IList <decimal> personIdList;
                IList <Person>  persons;
                if (Utility.IsEmpty(parmeters))
                {
                    //مثلا برای گزارش شیفتها چه نیازی به لیست پرسنل است
                    persons = new List <Person>();// searchTool.QuickSearch("", PersonCategory.Public);
                }
                else
                {
                    if (proxy.PersonIdList == null || proxy.PersonIdList.Count == 0)
                    {
                        persons = searchTool.GetPersonInAdvanceSearch(proxy);
                    }
                    else
                    {
                        persons = searchTool.GetPersonByPersonIdList(proxy.PersonIdList);
                    }
                }
                //کلیه پرسنل مدیر , جانشین و اپراتور
                if (persons.Count == 0 && !Utility.IsEmpty(parmeters))
                {
                    persons = searchTool.QuickSearchByPage(0, 1000, "");
                }

                if (persons.Count == 0 && !Utility.IsEmpty(parmeters))
                {
                    exception.Add(new ValidationException(ExceptionResourceKeys.ReportParameterPersonIsEmpty, "مجموعه انتخابی شامل هیچ پرسنلی نمیباشد", ExceptionSrc));
                    throw exception;
                }
                var ids = from o in persons
                          select o.ID;
                personIdList = ids.ToList <decimal>();

                IDictionary <string, object> ParamValues = new Dictionary <string, object>();
                foreach (ReportUIParameter param in parmeters)
                {
                    if (Utility.IsEmpty(param.Value))
                    {
                        exception.Add(new ValidationException(ExceptionResourceKeys.ReportParametersIsEmpty, "مقدار پارامترها مشخص نشده است", ExceptionSrc));
                        throw exception;
                    }

                    string value = param.Value;
                    IDictionary <string, object> result;
                    if (BusinessFactory.Exists(param.ActionId))
                    {
                        result = BusinessFactory.GetBusiness <IBControlParameter>(param.ActionId).ParsParameter(value, param.ActionId);
                    }
                    else
                    {
                        result = BaseControlParameter.ParsParameter(value);
                    }
                    if (result != null)
                    {
                        foreach (var item in result)
                        {
                            ParamValues.Add(item);
                        }
                    }
                }

                ReportFile   file         = this.GetReportFile(reportFileId);
                ReportHelper reportHelper = ReportHelper.Instance("شرکت طرح و پردازش غدیر", BUser.CurrentUser.ID, BUser.CurrentUser.Person.Name, personIdList);
                StiReport    report       = reportHelper.GetReport(@file.File);
                reportHelper.InitAssemblyReport(report);
                reportHelper.InitReportParameter(report, ParamValues);
                reportHelper.InitReportConnection(report, ReportParamRep.GetConnectionString());


                return(report);
            }
            catch (Exception ex)
            {
                BaseBusiness <Report> .LogException(ex, "BReportParameter", "GetReport");

                throw ex;
            }
        }