Esempio n. 1
0
        /// <summary>
        /// بخشهایی که اجازه دسترسی به آنها دارد به همراه پدران و بچه ها را برمیگرداند
        /// </summary>
        /// <returns></returns>
        IList <decimal> IDataAccess.GetAccessibleDeparments()
        {
            BApplicationSettings.CheckGTSLicense();

            if (userRepository.HasAllDepartmentAccess(this.CurrentUserId))
            {
                IList <Department> list = new DepartmentRepository(false).GetAll();
                var ids = from obj in list
                          select obj.ID;
                return(ids.ToList <decimal>());
            }
            else
            {
                BDepartment    bDepartment         = new BDepartment();
                List <decimal> depList             = new List <decimal>();
                List <decimal> childAndParentsList = new List <decimal>();
                depList.AddRange(userRepository.GetUserDepartmentList(this.CurrentUserId));
                foreach (decimal depId in depList)//اضافه کردن بچه ها و والد ها
                {
                    IList <Department> childs = new List <Department>();
                    childs = bDepartment.GetDepartmentChildsByParentPath(depId);
                    childAndParentsList.AddRange(bDepartment.GetByID(depId).ParentPathList);
                    var ids = from child in childs
                              select child.ID;
                    childAndParentsList.AddRange(ids.ToList <decimal>());
                }
                depList.AddRange(childAndParentsList);
                return(depList);
            }
        }
Esempio n. 2
0
 protected void Button36_Click(object sender, EventArgs e)
 {
     try
     {
         BApplicationSettings.CheckGTSLicense();
         resultTB.Text = "OK";
     }
     catch
     {
         resultTB.Text = "Error!";
     }
 }
Esempio n. 3
0
        public int GetAdvancedSearchPersonCountByImperativeRequest(PersonAdvanceSearchProxy proxy, ImperativeRequestLoadState IRLS, ImperativeRequest imperativeRequest, PersonCategory searchInCategory)
        {
            try
            {
                BApplicationSettings.CheckGTSLicense();

                #region Date Convert
                if (!Utility.IsEmpty(proxy.FromBirthDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    proxy.FromBirthDate = Utility.ToMildiDateString(proxy.FromBirthDate);
                }
                if (!Utility.IsEmpty(proxy.ToBirthDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    proxy.ToBirthDate = Utility.ToMildiDateString(proxy.ToBirthDate);
                }
                if (!Utility.IsEmpty(proxy.FromEmploymentDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    proxy.FromEmploymentDate = Utility.ToMildiDateString(proxy.FromEmploymentDate);
                }
                if (!Utility.IsEmpty(proxy.ToEmploymentDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    proxy.ToEmploymentDate = Utility.ToMildiDateString(proxy.ToEmploymentDate);
                }
                if (!Utility.IsEmpty(proxy.WorkGroupFromDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    proxy.WorkGroupFromDate = Utility.ToMildiDateString(proxy.WorkGroupFromDate);
                }
                if (!Utility.IsEmpty(proxy.RuleGroupFromDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    proxy.RuleGroupFromDate = Utility.ToMildiDateString(proxy.RuleGroupFromDate);
                }
                if (!Utility.IsEmpty(proxy.RuleGroupToDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    proxy.RuleGroupToDate = Utility.ToMildiDateString(proxy.RuleGroupToDate);
                }
                if (!Utility.IsEmpty(proxy.CalculationFromDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    proxy.CalculationFromDate = Utility.ToMildiDateString(proxy.CalculationFromDate);
                }
                #endregion

                decimal managerId = this.personBusiness.GetCurentManagerId(ref searchInCategory);
                int     count     = this.imperativeRequestRepository.GetAdvancedSearchPersonCountByImperativeRequest(proxy, IRLS, imperativeRequest, BUser.CurrentUser.ID, managerId, searchInCategory);
                return(count);
            }
            catch (Exception ex)
            {
                LogException(ex, "BImperativeRequest", "GetAdvancedSearchPersonCountByImperativeRequest");
                throw ex;
            }
        }
Esempio n. 4
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;
            }
        }
Esempio n. 5
0
        public int GetQuickSearchPersonCountByImperativeRequest(string key, ImperativeRequestLoadState IRLS, ImperativeRequest imperativeRequest, PersonCategory searchCat)
        {
            try
            {
                BApplicationSettings.CheckGTSLicense();

                IList <Person> personList = new List <Person>();

                key = key == null ? String.Empty : key;
                key = key.Trim();
                decimal managerId = this.personBusiness.GetCurentManagerId(ref searchCat);
                int     count     = this.imperativeRequestRepository.GetQuickSearchPersonCountByImperativeRequest(key, IRLS, imperativeRequest, BUser.CurrentUser.ID, managerId, searchCat);
                return(count);
            }
            catch (Exception ex)
            {
                LogException(ex, "BImperativeRequest", "GetQuickSearchPersonCountByImperativeRequest");
                throw ex;
            }
        }
Esempio n. 6
0
        public IList <ImperativeUndermanagementInfoProxy> GetAdvancedSearchPersonByImperativeRequest(PersonAdvanceSearchProxy proxy, 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();

                    #region Date Convert
                    if (!Utility.IsEmpty(proxy.FromBirthDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                    {
                        proxy.FromBirthDate = Utility.ToMildiDateString(proxy.FromBirthDate);
                    }
                    if (!Utility.IsEmpty(proxy.ToBirthDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                    {
                        proxy.ToBirthDate = Utility.ToMildiDateString(proxy.ToBirthDate);
                    }
                    if (!Utility.IsEmpty(proxy.FromEmploymentDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                    {
                        proxy.FromEmploymentDate = Utility.ToMildiDateString(proxy.FromEmploymentDate);
                    }
                    if (!Utility.IsEmpty(proxy.ToEmploymentDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                    {
                        proxy.ToEmploymentDate = Utility.ToMildiDateString(proxy.ToEmploymentDate);
                    }
                    if (!Utility.IsEmpty(proxy.WorkGroupFromDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                    {
                        proxy.WorkGroupFromDate = Utility.ToMildiDateString(proxy.WorkGroupFromDate);
                    }
                    if (!Utility.IsEmpty(proxy.RuleGroupFromDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                    {
                        proxy.RuleGroupFromDate = Utility.ToMildiDateString(proxy.RuleGroupFromDate);
                    }
                    if (!Utility.IsEmpty(proxy.RuleGroupToDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                    {
                        proxy.RuleGroupToDate = Utility.ToMildiDateString(proxy.RuleGroupToDate);
                    }
                    if (!Utility.IsEmpty(proxy.CalculationFromDate) && BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                    {
                        proxy.CalculationFromDate = Utility.ToMildiDateString(proxy.CalculationFromDate);
                    }
                    #endregion

                    IList <Person> list;
                    if (!Utility.IsEmpty(proxy.PersonId))
                    {
                        list = new List <Person>();
                        Person prs = this.personBusiness.GetByID((decimal)proxy.PersonId);
                        list.Add(prs);
                    }
                    else
                    {
                        decimal managerId = personBusiness.GetCurentManagerId(ref searchInCategory);
                        list = this.imperativeRequestRepository.GetAdvancedSearchPersonByImperativeRequest(proxy, IRLS, imperativeRequest, BUser.CurrentUser.ID, managerId, searchInCategory, pageIndex, pageSize);
                    }
                    return(this.ConvertToImperativeUndermanagementInfoProxy(list, imperativeRequest, pageSize, pageIndex));
                }
                else
                {
                    throw exception;
                }
            }
            catch (Exception ex)
            {
                LogException(ex, "BImperativeRequest", "GetAdvancedSearchPersonByImperativeRequest");
                throw ex;
            }
        }