Пример #1
0
        public void SaveSMSSetting(SMSSettings setting, PersonAdvanceSearchProxy proxy)
        {
            try
            {
                ISearchPerson  searchTool = new BPerson();
                IList <Person> list;

                //don't select count
                if (proxy.PersonId > 0)
                {
                    list = searchTool.GetPersonInAdvanceSearch(proxy, 0, 1, PersonCategory.Public);
                }
                else
                {
                    list = searchTool.GetPersonInAdvanceSearch(proxy);
                }
                var l = from o in list
                        select o;
                list = l.ToList <Person>();

                foreach (Person prs in list)
                {
                    this.SaveSMSSetting(setting, prs.User);
                }
            }
            catch (Exception ex)
            {
                LogException(ex, "BUserSettings", "SaveSMSSettingsAdvanceSearch");
                throw ex;
            }
        }
Пример #2
0
        /// <summary>
        /// آیا داده های اشخاص مشخص شده قبلا نتایج محاسبات شده اند
        /// </summary>
        /// <param name="year">سال</param>
        /// <param name="month">ماه</param>
        /// <param name="proxy"></param>
        /// <returns>وضعیت نتایج محاسبات</returns>
        public ArchiveExistsConditions IsArchiveExsits(int year, int month, PersonAdvanceSearchProxy proxy)
        {
            int            count = searchTool.GetPersonInAdvanceSearchCount(proxy);
            IList <Person> list  = searchTool.GetPersonInAdvanceSearch(proxy, 0, count);

            return(this.IsArchiveExsits(year, month, list));
        }
Пример #3
0
        public void SaveSMSSettings_ByAdvanceSearchSearch()
        {
            SMSSettings smsSet = new SMSSettings();

            smsSet.Active     = true;
            smsSet.SendByDay  = true;
            smsSet.TheDayHour = "13:10";
            smsSet.TheHour    = "10:10";
            smsSet.DayCount   = 5;
            ClearSession();
            PersonAdvanceSearchProxy proxy = new PersonAdvanceSearchProxy();

            proxy.DepartmentId          = ADORoot.ID;
            proxy.IncludeSubDepartments = true;
            busUserSettings.SaveSMSSetting(smsSet, proxy);
            ClearSession();
            smsSet = busUserSettings.GetSMSSetting(ADOPerson1.ID);
            Assert.IsTrue(smsSet.SendByDay);
            Assert.IsTrue(smsSet.Active);
            Assert.AreEqual(790, smsSet.DayHour);
            Assert.AreEqual(5, smsSet.DayCount);

            smsSet = busUserSettings.GetSMSSetting(ADOPerson2.ID);
            Assert.IsTrue(smsSet.SendByDay);
            Assert.IsTrue(smsSet.Active);
            Assert.AreEqual(790, smsSet.DayHour);
            Assert.AreEqual(5, smsSet.DayCount);

            smsSet = busUserSettings.GetSMSSetting(ADOPerson3.ID);
            Assert.IsTrue(smsSet.SendByDay);
            Assert.IsTrue(smsSet.Active);
            Assert.AreEqual(790, smsSet.DayHour);
            Assert.AreEqual(5, smsSet.DayCount);
        }
Пример #4
0
        /// <summary>
        /// پس از حذف نتایج محاسبات قبلی , دادههای جدید را کپی میکند
        /// </summary>
        /// <param name="year">سال</param>
        /// <param name="month">ماه</param>
        /// <param name="proxy"></param>
        ///<param name="overwrite">بازنویسی</param>
        /// <returns>انجام شد/انجام نشد</returns>
        public bool ArchiveData(int year, int month, PersonAdvanceSearchProxy proxy, bool overwrite)
        {
            int            count  = searchTool.GetPersonInAdvanceSearchCount(proxy);
            IList <Person> list   = searchTool.GetPersonInAdvanceSearch(proxy, 0, count);
            bool           result = this.ArchiveData(year, month, list, overwrite);

            return(result);
        }
Пример #5
0
        /// <summary>
        /// تعداد مدیران جستجو شده
        /// اگر کاربر فعلی اپراتور فقط در بین مدیران زیر دست اپراتور جست و جو میکنیم
        /// ولی اگر مدیر باشد نتایج جست و جو تهی میباشد
        /// اگر هم مدیر باشد و هم اپراتور آنگاه خود شخص به علاوه مدیران تحت مدیریت برمیگردد
        /// </summary>
        /// <param name="proxy"></param>
        /// <returns></returns>
        public int GetAllManagerCount(PersonAdvanceSearchProxy proxy)
        {
            //if (!IsOperator()) { return 0; }
            ISearchPerson searchTools = new BPerson();
            int           count       = searchTools.GetPersonInAdvanceSearchCount(proxy, PersonCategory.Manager);

            return(count);
        }
Пример #6
0
        public void PersonCalculateAllTest()
        {
            dataAccessDepTA.Insert(BUser.CurrentUser.ID, null, true);
            PersonAdvanceSearchProxy p = new PersonAdvanceSearchProxy();

            p.DepartmentId = 221;
            BEngineCalc.Calculate(p, Utility.ToPersianDate(DateTime.Now));
            Assert.True(true);
        }
Пример #7
0
        protected void Button34_Click(object sender, EventArgs e)
        {
            ISearchPerson            search = new BPerson();
            PersonAdvanceSearchProxy proxy  = new PersonAdvanceSearchProxy();

            proxy.RuleGroupId       = 41467;
            proxy.RuleGroupFromDate = "2012/12/15";
            proxy.RuleGroupToDate   = "2012/12/20";
            int            count = search.GetPersonInAdvanceSearchCount(proxy);
            IList <Person> list  = search.GetPersonInAdvanceSearch(proxy, 0, 10);
        }
Пример #8
0
 protected void button1_Click(object sender, EventArgs e)
 {
     BArchiveCalculator       bus   = new BArchiveCalculator();
     PersonAdvanceSearchProxy proxy = new PersonAdvanceSearchProxy()
     {
         PersonIdList = new List <decimal>()
         {
             1, 870, 527
         }
     };
     ArchiveExsitsConditions result = bus.IsArchiveExsits(1392, 4, proxy);
 }
Пример #9
0
        protected void button3_Click(object sender, EventArgs e)
        {
            BArchiveCalculator       bus   = new BArchiveCalculator();
            PersonAdvanceSearchProxy proxy = new PersonAdvanceSearchProxy()
            {
                PersonIdList = new List <decimal>()
                {
                    1, 870, 527, 554
                }
            };

            bus.GetArchiveValues(1392, 4, proxy, 0, 10);
        }
Пример #10
0
        public IList <PersonParamValue> GetAll(decimal paramFieldId, PersonAdvanceSearchProxy proxy)
        {
            try
            {
                ISearchPerson            searchTool   = new BPerson();
                int                      count        = searchTool.GetPersonInAdvanceSearchCount(proxy);
                IList <Person>           personList   = searchTool.GetPersonInAdvanceSearch(proxy, 0, count);
                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;
            }
        }
Пример #11
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;
            }
        }
Пример #12
0
    public string[] GetReport_ReportsPage(string ReportFileID)
    {
        this.InitializeCulture();
        string[] retMessage = new string[4];
        try
        {
            decimal reportID     = 0;
            decimal reportFileID = decimal.Parse(this.StringBuilder.CreateString(ReportFileID), CultureInfo.InvariantCulture);
            PersonAdvanceSearchProxy  PersonFilterProxy    = new PersonAdvanceSearchProxy();
            IList <ReportUIParameter> ReportParametersList = new List <ReportUIParameter>();
            decimal   groupingTypeId = -1;
            StiReport stiReport      = this.ReportParameterBusiness.GetReport(reportFileID, PersonFilterProxy, ReportParametersList, false, reportID, groupingTypeId, false, false, false, GTS.Clock.Infrastructure.ReportOutPutType.Report);

            Dictionary <string, StiReport> SysReportsDic = new Dictionary <string, StiReport>();
            string stiReportGUID = Guid.NewGuid().ToString();
            if (Session["SysReports"] == null)
            {
                Session.Add("SysReports", SysReportsDic);
            }
            SysReportsDic = (Dictionary <string, StiReport>)Session["SysReports"];
            if (!SysReportsDic.Keys.Contains(stiReportGUID))
            {
                SysReportsDic.Add(stiReportGUID, stiReport);
            }
            Session["SysReports"] = SysReportsDic;

            //DNN Note
            string currentPage = "~/DesktopModules/Atlas/" + HttpContext.Current.Request.UrlReferrer.Segments[HttpContext.Current.Request.UrlReferrer.Segments.Length - 1];
            retMessage[0] = HttpContext.GetLocalResourceObject(currentPage, "RetSuccessType").ToString();
            retMessage[1] = HttpContext.GetLocalResourceObject(currentPage, "EditComplete").ToString();
            retMessage[2] = "success";
            retMessage[3] = stiReportGUID;

            return(retMessage);
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            return(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            return(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            return(retMessage);
        }
    }
Пример #13
0
        public void ShowReport_Test()
        {
            IList <ReportUIParameter> parmeters = new List <ReportUIParameter>();

            parmeters.Add(new ReportUIParameter()
            {
                Value = "@Order=1;@ToDate=2010/05/01", ActionId = "PersonDateRange"
            });
            PersonAdvanceSearchProxy proxy = new PersonAdvanceSearchProxy();

            proxy.PersonId = 32682;

            Stimulsoft.Report.StiReport report = busReportParameter.GetReport(1, proxy, parmeters);
        }
Пример #14
0
        public void ShowReport_BControlParameter_ToDate_Explicit_StartOfYear_EndOfYear_Test()
        {
            IList <ReportUIParameter> parmeters = new List <ReportUIParameter>();

            parmeters.Add(new ReportUIParameter()
            {
                Value = "@FromDate=2012/03/20;@ToDate=2012/09/04", ActionId = "ToDate_Implicit_StartOfYear_EndOfYear"
            });
            PersonAdvanceSearchProxy proxy = new PersonAdvanceSearchProxy();

            proxy.PersonId = 32682;

            Stimulsoft.Report.StiReport report = busReportParameter.GetReport(70, proxy, parmeters);
        }
Пример #15
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;
     }
 }
Пример #16
0
        protected void Button49_Click(object sender, EventArgs e)
        {
            PersonAdvanceSearchProxy pas = new PersonAdvanceSearchProxy()
            {
                RuleGroupId = 26, PersonActivateState = true
            };
            IList <ChangeInfoErrorProxy> msg  = new List <ChangeInfoErrorProxy>();
            OrganicInfoProxy             info = new OrganicInfoProxy()
            {
                RuleGroupID = 27, RuleGroupFromDate = "1392/07/01"                                             /*, RuleGroupToDate = "1392/08/01"*/
            };
            BChangeOrganicInfo bus = new BChangeOrganicInfo();

            bus.ChangeInfo(pas, info, out msg);
        }
Пример #17
0
        /// <summary>
        /// مانده مرخصی را برای سالها و افراد جستجو شده  برمیگرداند
        /// حد اکثر 1000 رکورد بر میگرداند
        /// </summary>
        /// <param name="proxy"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <returns></returns>
        public IList <RemainLeaveProxy> GetRemainLeave(PersonAdvanceSearchProxy proxy, int fromYear, int toYear, int pageIndex, int pageSize)
        {
            try
            {
                IList <decimal> underManagmentList = new List <decimal>();
                ISearchPerson   searchTool         = new BPerson();
                int             count = 1000;//searchTool.GetPersonInAdvanceSearchCount(proxy);
                IList <Person>  list  = searchTool.GetPersonInAdvanceSearch(proxy, 0, count);
                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;
            }
        }
Пример #18
0
        /// <summary>
        /// لیست مدیران جستجو شده
        /// اگر کاربر فعلی اپراتور فقط در بین مدیران زیر دست اپراتور جست و جو میکنیم
        /// ولی اگر مدیر باشد نتایج جست و جو تهی میباشد
        /// اگر هم مدیر باشد و هم اپراتور آنگاه خود شخص به علاوه مدیران تحت مدیریت برمیگردد
        /// </summary>
        /// <param name="proxy"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IList <Person> GetAllManager(PersonAdvanceSearchProxy proxy, int pageIndex, int pageSize)
        {
            IList <Person> result = new List <Person>();
            //if (!IsOperator()) { return result; }
            //PersonRepository prsRep = new PersonRepository();
            //var ids = from mng in this.GetAllManager(0, this.GetAllManagerCount())
            //          select mng.ID;
            //IList<decimal> list = ids.ToList<decimal>();
            //proxy.SearchInCategory = PersonCategory.Manager;
            //result = prsRep.GetPersonInAdvanceSearch(proxy, list, pageIndex, pageSize);

            ISearchPerson searchTool = new BPerson();

            result = searchTool.GetPersonInAdvanceSearch(proxy, pageIndex, pageSize, PersonCategory.Manager);
            return(result);
        }
Пример #19
0
        /// <summary>
        /// تغییر مشخصات سازمانی
        /// </summary>
        /// <param name="proxy"></param>
        ///
        public bool ChangeInfo(PersonAdvanceSearchProxy proxy, OrganicInfoProxy infoProxy, out IList <ChangeInfoErrorProxy> errorList)
        {
            int            count = searchTool.GetPersonInAdvanceSearchCount(proxy);
            IList <Person> list  = searchTool.GetPersonInAdvanceSearch(proxy, 0, count);

            bool result = this.ChangeInfo(list, infoProxy, out errorList);

            if (!result)
            {
                foreach (ChangeInfoErrorProxy error in errorList)
                {
                    BaseBusiness <Entity> .LogException(new Exception(error.ToString()));
                }
            }
            return(result);
        }
Пример #20
0
 public void SaveSMSSetting(SMSSettings setting, decimal personId)
 {
     try
     {
         ISearchPerson            searchTool = new BPerson();
         PersonAdvanceSearchProxy proxy      = new PersonAdvanceSearchProxy()
         {
             PersonId = personId
         };
         this.SaveSMSSetting(setting, proxy);
     }
     catch (Exception ex)
     {
         LogException(ex, "BUserSettings", "SaveSMSSettings");
         throw ex;
     }
 }
Пример #21
0
        public IList <ArchiveCalcValuesProxy> GetArchiveValues(int year, int month, PersonAdvanceSearchProxy proxy, int pageIndex, int pageSize)
        {
            //int count = searchTool.GetPersonInAdvanceSearchCount(proxy);
            //IList<Person> list = searchTool.GetPersonInAdvanceSearch(proxy, 0, count);
            int            rangeOrder = month;
            ISearchPerson  searchTool = new BPerson();
            IList <Person> personList = searchTool.GetPersonInAdvanceSearch(proxy);
            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));
        }
Пример #22
0
        /// <summary>
        ///  اتقال مرخصی به سال بعد
        /// </summary>
        /// <param name="proxy"></param>
        /// <param name="fromYear"></param>
        /// <param name="toYear"></param>
        public int TransferToNextYear(PersonAdvanceSearchProxy proxy, int fromYear, int toYear)
        {
            try
            {
                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.GetPersonInAdvanceSearchCount(proxy);
                IList <Person>  list  = searchTool.GetPersonInAdvanceSearch(proxy, 0, count);
                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);
            }
            catch (Exception ex)
            {
                LogException(ex, "BRemainLeave", "TransferToNextYear");
                throw ex;
            }
        }
Пример #23
0
        /// <summary>
        /// تغییر مشخصات سازمانی
        /// </summary>
        /// <param name="personId">کلید پرسنل</param>
        /// <param name="infoProxy">پروکسی مشخصات سازمانی</param>
        /// <param name="errorList">خروجی لیست خطاها</param>
        /// <returns>وضعیت انجام عملیات</returns>
        public bool ChangeInfo(decimal personId, OrganicInfoProxy infoProxy, out IList <ChangeInfoErrorProxy> errorList)
        {
            //Person prs = new BPerson().GetByID(personId);
            //NHibernateSessionManager.Instance.ClearSession();
            //Person prs = new Person() { ID = personId, PersonTASpec = (new BPerson()).GetPersonTASpecByID(personId)};
            PersonAdvanceSearchProxy proxy = new PersonAdvanceSearchProxy();

            proxy.PersonId = personId;
            //IList<Person> list = new List<Person>();
            //list.Add(prs);
            bool result = this.ChangeInfo(proxy, infoProxy, out errorList);

            //if (!result)
            //    foreach (ChangeInfoErrorProxy error in errorList)
            //    {
            //        BaseBusiness<Entity>.LogException(new Exception(error.ToString()));
            //    }
            return(result);
        }
Пример #24
0
        public int GetSearchCount(PersonAdvanceSearchProxy proxy, int year, int month)
        {
            try
            {
                int            rangeOrder = month;
                ISearchPerson  searchTool = new BPerson();
                IList <Person> personList = searchTool.GetPersonInAdvanceSearch(proxy);
                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;
            }
        }
Пример #25
0
        /// <summary>
        /// مانده مرخصی را برای سالها و افراد جستجو شده  برمیگرداند
        /// حد اکثر 1000 برمیگردد
        /// </summary>
        /// <param name="proxy"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <returns></returns>
        public int GetRemainLeaveCount(PersonAdvanceSearchProxy proxy, int fromYear, int toYear)
        {
            try
            {
                IList <decimal> underManagmentList = new List <decimal>();
                ISearchPerson   searchTool         = new BPerson();
                int             count = 1000;//searchTool.GetPersonInAdvanceSearchCount(proxy);
                IList <Person>  list  = searchTool.GetPersonInAdvanceSearch(proxy, 0, count);
                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;
            }
        }
Пример #26
0
        public bool Calculate(PersonAdvanceSearchProxy proxy, string fromDate, string toDate, bool forceCalculate)
        {
            try
            {
                ISearchPerson  searchTool = new BPerson();
                int            count      = searchTool.GetPersonInAdvanceSearchCount(proxy);
                IList <Person> personList = searchTool.GetPersonInAdvanceSearch(proxy, 0, count)
                                            .Where(x => x.Active).ToList();
                var ids = from o in personList
                          select o.ID;

                DateTime from, to;
                if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    from = Utility.ToMildiDate(fromDate);
                    to   = Utility.ToMildiDate(toDate);
                }
                else
                {
                    from = Utility.ToMildiDateTime(fromDate);
                    to   = Utility.ToMildiDateTime(toDate);
                }
                if (forceCalculate)
                {
                    BusinessEntity entity = new BusinessEntity();
                    entity.UpdateCFP(personList, from, true);
                }
                gtsEngineWS.GTS_ExecutePersonsByToDate(BUser.CurrentUser.UserName, ids.ToArray <decimal>(), to);
                BaseBusiness <Entity> .LogUserAction(String.Format("CalculateAll -> Count: {0} -->Calculate(AdvanceSearch,toDate)", personList.Count));

                return(true);
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BEngineCalculator", "Calculate(AdvanceSearch,toDate)");

                throw ex;
            }
        }
Пример #27
0
    public PersonAdvanceSearchProxy CreateAdvancedPersonnelSearchProxy(string StrObjPersonnelAdvancedSearch)
    {
        PersonAdvanceSearchProxy personAdvanceSearchProxy = new PersonAdvanceSearchProxy();
        JavaScriptSerializer     JsSerializer             = new JavaScriptSerializer();

        if (StrObjPersonnelAdvancedSearch != string.Empty)
        {
            Dictionary <string, object> ParamDic = (Dictionary <string, object>)JsSerializer.DeserializeObject(StrObjPersonnelAdvancedSearch);
            if (ParamDic.ContainsKey("IsDeleted") && ParamDic["IsDeleted"].ToString() == "true")
            {
                personAdvanceSearchProxy.PersonIsDeleted = bool.Parse(ParamDic["IsDeleted"].ToString());
            }
            // else
            // {
            if (ParamDic.ContainsKey("Active") && ParamDic["Active"].ToString() == string.Empty)
            {
                personAdvanceSearchProxy.PersonActivateState = null;
            }
            else
            {
                personAdvanceSearchProxy.PersonActivateState = bool.Parse(ParamDic["Active"].ToString());
            }
            // }
            if (ParamDic.ContainsKey("FirstName") && ParamDic["FirstName"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.FirstName = ParamDic["FirstName"].ToString();
            }
            if (ParamDic.ContainsKey("LastName") && ParamDic["LastName"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.LastName = ParamDic["LastName"].ToString();
            }
            if (ParamDic.ContainsKey("NationalCode") && ParamDic["NationalCode"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.MelliCode = ParamDic["NationalCode"].ToString();
            }
            if (ParamDic.ContainsKey("PersonnelNumber") && ParamDic["PersonnelNumber"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.PersonCode = ParamDic["PersonnelNumber"].ToString();
            }
            if (ParamDic.ContainsKey("Sex") && int.Parse(ParamDic["Sex"].ToString(), CultureInfo.InvariantCulture) != -1)
            {
                personAdvanceSearchProxy.Sex = (PersonSex)Enum.ToObject(typeof(PersonSex), int.Parse(ParamDic["Sex"].ToString(), CultureInfo.InvariantCulture));
            }
            if (ParamDic.ContainsKey("FatherName") && ParamDic["FatherName"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.FatherName = ParamDic["FatherName"].ToString();
            }
            if (ParamDic.ContainsKey("MarriageState") && int.Parse(ParamDic["MarriageState"].ToString(), CultureInfo.InvariantCulture) != -1)
            {
                personAdvanceSearchProxy.MaritalStatus = (MaritalStatus)Enum.ToObject(typeof(MaritalStatus), int.Parse(ParamDic["MarriageState"].ToString(), CultureInfo.InvariantCulture));
            }
            if (ParamDic.ContainsKey("MilitaryState") && int.Parse(ParamDic["MilitaryState"].ToString(), CultureInfo.InvariantCulture) != -1)
            {
                personAdvanceSearchProxy.Military = (MilitaryStatus)Enum.ToObject(typeof(MilitaryStatus), int.Parse(ParamDic["MilitaryState"].ToString(), CultureInfo.InvariantCulture));
            }
            if (ParamDic.ContainsKey("Education") && ParamDic["Education"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.Education = ParamDic["Education"].ToString();
            }
            if (ParamDic.ContainsKey("BirthLocation") && ParamDic["BirthLocation"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.BirthPlace = ParamDic["BirthLocation"].ToString();
            }
            if (ParamDic.ContainsKey("CardNumber") && ParamDic["CardNumber"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.CartNumber = ParamDic["CardNumber"].ToString();
            }
            if (ParamDic.ContainsKey("EmployNumber") && ParamDic["EmployNumber"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.EmployeeNumber = ParamDic["EmployNumber"].ToString();
            }
            if (ParamDic.ContainsKey("DepartmentID") && ParamDic["DepartmentID"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.DepartmentListId = CreateIdListFromSerializationStringId(ParamDic["DepartmentID"].ToString());
            }
            if (ParamDic.ContainsKey("IsContainsSubDepartment"))
            {
                personAdvanceSearchProxy.IncludeSubDepartments = bool.Parse(ParamDic["IsContainsSubDepartment"].ToString());
            }
            if (ParamDic.ContainsKey("OrganizationPostID") && decimal.Parse(ParamDic["OrganizationPostID"].ToString(), CultureInfo.InvariantCulture) != 0)
            {
                personAdvanceSearchProxy.OrganizationUnitId = decimal.Parse(ParamDic["OrganizationPostID"].ToString(), CultureInfo.InvariantCulture);
            }
            if (ParamDic.ContainsKey("EmployTypeID") && ParamDic["EmployTypeID"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.EmploymentTypeListId = CreateIdListFromSerializationStringId(ParamDic["EmployTypeID"].ToString());
            }
            if (ParamDic.ContainsKey("EmployFromDate") && ParamDic["EmployFromDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.FromEmploymentDate = ParamDic["EmployFromDate"].ToString();
            }
            if (ParamDic.ContainsKey("EmployToDate") && ParamDic["EmployToDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.ToEmploymentDate = ParamDic["EmployToDate"].ToString();
            }
            if (ParamDic.ContainsKey("ControlStationID") && ParamDic["ControlStationID"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.ControlStationListId = CreateIdListFromSerializationStringId(ParamDic["ControlStationID"].ToString());
            }
            if (ParamDic.ContainsKey("FromBirthDate") && ParamDic["FromBirthDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.FromBirthDate = ParamDic["FromBirthDate"].ToString();
            }
            if (ParamDic.ContainsKey("ToBirthDate") && ParamDic["ToBirthDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.ToBirthDate = ParamDic["ToBirthDate"].ToString();
            }
            if (ParamDic.ContainsKey("WorkGroupID") && decimal.Parse(ParamDic["WorkGroupID"].ToString(), CultureInfo.InvariantCulture) != 0)
            {
                personAdvanceSearchProxy.WorkGroupId = decimal.Parse(ParamDic["WorkGroupID"].ToString(), CultureInfo.InvariantCulture);
            }
            if (ParamDic.ContainsKey("WorkGroupFromDate") && ParamDic["WorkGroupFromDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.WorkGroupFromDate = ParamDic["WorkGroupFromDate"].ToString();
            }
            if (ParamDic.ContainsKey("RuleGroupID") && decimal.Parse(ParamDic["RuleGroupID"].ToString(), CultureInfo.InvariantCulture) != 0)
            {
                personAdvanceSearchProxy.RuleGroupId = decimal.Parse(ParamDic["RuleGroupID"].ToString(), CultureInfo.InvariantCulture);
            }
            if (ParamDic.ContainsKey("RuleGroupFromDate") && ParamDic["RuleGroupFromDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.RuleGroupFromDate = ParamDic["RuleGroupFromDate"].ToString();
            }
            if (ParamDic.ContainsKey("RuleGroupToDate") && ParamDic["RuleGroupToDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.RuleGroupToDate = ParamDic["RuleGroupToDate"].ToString();
            }
            if (ParamDic.ContainsKey("CalculationRangeID") && decimal.Parse(ParamDic["CalculationRangeID"].ToString(), CultureInfo.InvariantCulture) != 0)
            {
                personAdvanceSearchProxy.CalculationDateRangeId = decimal.Parse(ParamDic["CalculationRangeID"].ToString(), CultureInfo.InvariantCulture);
            }
            if (ParamDic.ContainsKey("CalculationRangeFromDate") && ParamDic["CalculationRangeFromDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.CalculationFromDate = ParamDic["CalculationRangeFromDate"].ToString();
            }
            if (ParamDic.ContainsKey("GradeID") && decimal.Parse(ParamDic["GradeID"].ToString(), CultureInfo.InvariantCulture) != 0)
            {
                personAdvanceSearchProxy.GradeId = decimal.Parse(ParamDic["GradeID"].ToString(), CultureInfo.InvariantCulture);
            }
            if (ParamDic.ContainsKey("CostCenterID") && decimal.Parse(ParamDic["CostCenterID"].ToString(), CultureInfo.InvariantCulture) != 0)
            {
                personAdvanceSearchProxy.CostCenterId = decimal.Parse(ParamDic["CostCenterID"].ToString(), CultureInfo.InvariantCulture);
            }
            if (ParamDic.ContainsKey("IntegratedSearchTerm") && ParamDic["IntegratedSearchTerm"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.IntegratedSearchTerm = ParamDic["IntegratedSearchTerm"].ToString();
            }
            if (ParamDic.ContainsKey("UIValidationGroupID") && ParamDic["UIValidationGroupID"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.UIValidationGroupListId = CreateIdListFromSerializationStringId(ParamDic["UIValidationGroupID"].ToString());
            }
            if (ParamDic.ContainsKey("ContractID") && decimal.Parse(ParamDic["ContractID"].ToString(), CultureInfo.InvariantCulture) != 0)
            {
                personAdvanceSearchProxy.ContractId = decimal.Parse(ParamDic["ContractID"].ToString(), CultureInfo.InvariantCulture);
            }
            if (ParamDic.ContainsKey("ContractFromDate") && ParamDic["ContractFromDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.ContractFromDate = ParamDic["ContractFromDate"].ToString();
            }
            if (ParamDic.ContainsKey("ContractToDate") && ParamDic["ContractToDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.ContractToDate = ParamDic["ContractToDate"].ToString();
            }
        }
        return(personAdvanceSearchProxy);
    }
Пример #28
0
    public PersonAdvanceSearchProxy CreateAdvancedPersonnelSearchProxy(string StrObjPersonnelAdvancedSearch)
    {
        PersonAdvanceSearchProxy personAdvanceSearchProxy = new PersonAdvanceSearchProxy();
        JavaScriptSerializer     JsSerializer             = new JavaScriptSerializer();

        if (StrObjPersonnelAdvancedSearch != string.Empty)
        {
            Dictionary <string, object> ParamDic = (Dictionary <string, object>)JsSerializer.DeserializeObject(StrObjPersonnelAdvancedSearch);
            if (ParamDic.ContainsKey("Active") && ParamDic["Active"].ToString() == string.Empty)
            {
                personAdvanceSearchProxy.PersonActivateState = null;
            }
            else
            {
                personAdvanceSearchProxy.PersonActivateState = bool.Parse(ParamDic["Active"].ToString());
            }
            if (ParamDic.ContainsKey("Sex") && int.Parse(ParamDic["Sex"].ToString()) != -1)
            {
                personAdvanceSearchProxy.Sex = (PersonSex)Enum.ToObject(typeof(PersonSex), int.Parse(ParamDic["Sex"].ToString()));
            }
            if (ParamDic.ContainsKey("FatherName") && ParamDic["FatherName"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.FatherName = ParamDic["FatherName"].ToString();
            }
            if (ParamDic.ContainsKey("MarriageState") && int.Parse(ParamDic["MarriageState"].ToString()) != -1)
            {
                personAdvanceSearchProxy.MaritalStatus = (MaritalStatus)Enum.ToObject(typeof(MaritalStatus), int.Parse(ParamDic["MarriageState"].ToString()));
            }
            if (ParamDic.ContainsKey("MilitaryState") && int.Parse(ParamDic["MilitaryState"].ToString()) != -1)
            {
                personAdvanceSearchProxy.Military = (MilitaryStatus)Enum.ToObject(typeof(MilitaryStatus), int.Parse(ParamDic["MilitaryState"].ToString()));
            }
            if (ParamDic.ContainsKey("Education") && ParamDic["Education"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.Education = ParamDic["Education"].ToString();
            }
            if (ParamDic.ContainsKey("BirthLocation") && ParamDic["BirthLocation"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.BirthPlace = ParamDic["BirthLocation"].ToString();
            }
            if (ParamDic.ContainsKey("CardNumber") && ParamDic["CardNumber"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.CartNumber = ParamDic["CardNumber"].ToString();
            }
            if (ParamDic.ContainsKey("EmployNumber") && ParamDic["EmployNumber"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.EmployeeNumber = ParamDic["EmployNumber"].ToString();
            }
            if (ParamDic.ContainsKey("DepartmentID") && decimal.Parse(ParamDic["DepartmentID"].ToString()) != 0)
            {
                personAdvanceSearchProxy.DepartmentId = decimal.Parse(ParamDic["DepartmentID"].ToString());
            }
            if (ParamDic.ContainsKey("IsContainsSubDepartment"))
            {
                personAdvanceSearchProxy.IncludeSubDepartments = bool.Parse(ParamDic["IsContainsSubDepartment"].ToString());
            }
            if (ParamDic.ContainsKey("OrganizationPostID") && decimal.Parse(ParamDic["OrganizationPostID"].ToString()) != 0)
            {
                personAdvanceSearchProxy.OrganizationUnitId = decimal.Parse(ParamDic["OrganizationPostID"].ToString());
            }
            if (ParamDic.ContainsKey("EmployTypeID") && decimal.Parse(ParamDic["EmployTypeID"].ToString()) != 0)
            {
                personAdvanceSearchProxy.EmploymentType = decimal.Parse(ParamDic["EmployTypeID"].ToString());
            }
            if (ParamDic.ContainsKey("EmployFromDate") && ParamDic["EmployFromDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.FromEmploymentDate = ParamDic["EmployFromDate"].ToString();
            }
            if (ParamDic.ContainsKey("EmployToDate") && ParamDic["EmployToDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.ToEmploymentDate = ParamDic["EmployToDate"].ToString();
            }
            if (ParamDic.ContainsKey("ControlStationID") && decimal.Parse(ParamDic["ControlStationID"].ToString()) != 0)
            {
                personAdvanceSearchProxy.ControlStationId = decimal.Parse(ParamDic["ControlStationID"].ToString());
            }
            if (ParamDic.ContainsKey("FromBirthDate") && ParamDic["FromBirthDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.FromBirthDate = ParamDic["EmployToDate"].ToString();
            }
            if (ParamDic.ContainsKey("ToBirthDate") && ParamDic["ToBirthDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.ToBirthDate = ParamDic["ToBirthDate"].ToString();
            }
            if (ParamDic.ContainsKey("WorkGroupID") && decimal.Parse(ParamDic["WorkGroupID"].ToString()) != 0)
            {
                personAdvanceSearchProxy.WorkGroupId = decimal.Parse(ParamDic["WorkGroupID"].ToString());
            }
            if (ParamDic.ContainsKey("WorkGroupFromDate") && ParamDic["WorkGroupFromDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.WorkGroupFromDate = ParamDic["WorkGroupFromDate"].ToString();
            }
            if (ParamDic.ContainsKey("RuleGroupID") && decimal.Parse(ParamDic["RuleGroupID"].ToString()) != 0)
            {
                personAdvanceSearchProxy.RuleGroupId = decimal.Parse(ParamDic["RuleGroupID"].ToString());
            }
            if (ParamDic.ContainsKey("RuleGroupFromDate") && ParamDic["RuleGroupFromDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.RuleGroupFromDate = ParamDic["RuleGroupFromDate"].ToString();
            }
            if (ParamDic.ContainsKey("RuleGroupToDate") && ParamDic["RuleGroupToDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.RuleGroupToDate = ParamDic["RuleGroupToDate"].ToString();
            }
            if (ParamDic.ContainsKey("CalculationRangeID") && decimal.Parse(ParamDic["CalculationRangeID"].ToString()) != 0)
            {
                personAdvanceSearchProxy.CalculationDateRangeId = decimal.Parse(ParamDic["CalculationRangeID"].ToString());
            }
            if (ParamDic.ContainsKey("CalculationRangeFromDate") && ParamDic["CalculationRangeFromDate"].ToString() != string.Empty)
            {
                personAdvanceSearchProxy.CalculationFromDate = ParamDic["CalculationRangeFromDate"].ToString();
            }
        }
        return(personAdvanceSearchProxy);
    }
Пример #29
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;
            }
        }
Пример #30
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;
            }
        }