Beispiel #1
0
        /// <summary>
        /// اگر کاربر فعلی مدیر باشد درختی که تحت مدیریت او است را با خصیصه "پدیداری" مشخص میکند
        /// </summary>
        /// <returns></returns>
        public Department GetManagerDepartmentTree()
        {
            try
            {
                if (InitManager())
                {
                    Department root = new BDepartment().GetManagerDepartmentTree(manager.ID);
                    return(root);
                }
                else if (InitOperator())
                {
                    Department root = new BDepartment().GetOperatorDepartmentTree(BUser.CurrentUser.Person.ID);
                    return(root);
                }
                else
                {
                    throw new IllegalServiceAccess(String.Format("این سرویس تنها توسط مدیران قابل استفاده میباشد. شناسه کاربری {0} میباشد", this.Username), ExceptionSrc);
                }
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BWorkedTime", "GetManagerDepartmentTree");

                throw ex;
            }
        }
Beispiel #2
0
        /// <summary>
        /// پس از حذف آرشیو قبلی , دادههای جدید را کپی میکند
        /// </summary>
        /// <param name="year"></param>
        /// <param name="month"></param>
        /// <param name="personList"></param>
        /// <returns></returns>
        private bool ArchiveData(int year, int month, IList <Person> personList, bool overwrite)
        {
            try
            {
                DateTime date       = new DateTime(year, month, Utility.GetEndOfMiladiMonth(year, month));
                int      rangeOrder = month;

                if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    date = Utility.ToMildiDate(String.Format("{0}/{1}/{2}", year, month, Utility.GetEndOfPersianMonth(year, month)));
                }
                var ids = from o in personList
                          select o.ID;
                if (overwrite)
                {
                    archiveRep.DeleteArchiveValues(ids.ToList(), year, month);
                }
                foreach (Person person in personList)
                {
                    if (!overwrite && this.IsArchiveExsits(year, month, person.ID) != ArchiveExsitsConditions.NotExsitds)
                    {
                        continue;
                    }
                    archiveRep.ArchiveConceptValues(person.ID, year, rangeOrder, date);
                }
                return(true);
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex);

                throw ex;
            }
        }
Beispiel #3
0
        public IList <Person> GetPersonsByDepartment(IList <PersonDepartmentProxy> prsList)
        {
            try
            {
                List <Department> explicitContainsNode = new List <Department>();
                List <Department> implicitContainsNode = new List <Department>();
                List <Department> containsNode         = new List <Department>();
                List <Person>     containsPersons      = new List <Person>();
                List <Person>     persons = new List <Person>();
                foreach (PersonDepartmentProxy underManagment in prsList)
                {
                    if (underManagment.DepartmentId != null && underManagment.DepartmentId > 0)
                    {
                        if (underManagment.PersonId == null || underManagment.PersonId == 0)
                        {
                            Department department = new BDepartment().GetByID(underManagment.DepartmentId);
                            explicitContainsNode.Add(department);
                            if (underManagment.ContainsInnerchilds)
                            {
                                implicitContainsNode.AddRange(GetDepartmentChildList(department));
                            }
                        }
                        else
                        {
                            Person person = new PersonRepository(false).GetById(underManagment.PersonId, false);
                            containsPersons.Add(person);
                        }
                    }
                    else
                    {
                        throw new InvalidDatabaseStateException(UIFatalExceptionIdentifiers.UnderManagmentDepartmentNull, "بخش مربوط به افراد انتخابی بوسیله بخش در هیچ صورتی نباید تهی باشد", ExceptionSrc);
                    }
                }
                explicitContainsNode = explicitContainsNode.GroupBy(x => x.ID).Select(x => x.First()).ToList();
                implicitContainsNode = implicitContainsNode.GroupBy(x => x.ID).Select(x => x.First()).ToList();

                containsNode.AddRange(explicitContainsNode);
                containsNode.AddRange(implicitContainsNode);
                containsNode = containsNode.GroupBy(x => x.ID).Select(x => x.First()).ToList();

                foreach (Department dep in containsNode)
                {
                    persons.AddRange(dep.PersonList);
                }
                foreach (Person prs in containsPersons)
                {
                    persons.Add(prs);
                }

                persons = persons.GroupBy(x => x.ID).Select(x => x.First()).ToList();

                return(persons);
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BUnderManagment", "GetPersonsByDepartment");

                throw ex;
            }
        }
        /// <summary>
        /// تعداد افرادی که برای محاسبه فرستاده شده و نیاز به محاسبه داشتند
        /// </summary>
        /// <returns>تعداد</returns>
        public int GetTotalCountInCalculating()
        {
            try
            {
                int total = 0;
                if (SessionHelper.HasSessionValue(SessionHelper.BusinessTotalCalculateCount))
                {
                    total = Utility.ToInteger(SessionHelper.GetSessionValue(SessionHelper.BusinessTotalCalculateCount));
                }
                int newTotal = gtsEngineWS.GTS_GETTotalExecuting(BUser.CurrentUser.UserName);
                if (newTotal > total)
                {
                    SessionHelper.SaveSessionValue(SessionHelper.BusinessTotalCalculateCount, newTotal);
                    return(newTotal);
                }
                if (SessionHelper.GetSessionValue(SessionHelper.PersonIsFailedForCalculate) != null)
                {
                    total += Convert.ToInt32(SessionHelper.GetSessionValue(SessionHelper.PersonIsFailedForCalculate));
                }
                return(total);
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BEngineCalculator", "GetTotalCountInCalculating");

                throw ex;
            }
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public Languages GetLanguageByUsername(string username)
        {
            try
            {
                if (!SessionHelper.HasSessionValue(SessionHelper.BussinessLocalLanguageIDSessionName))
                {
                    UserRepository userRep = new UserRepository(false);
                    Languages      lang    = userRep.GetLanguageByUsername(username);
                    lang = lang == null ? new Languages() : lang;

                    SessionHelper.SaveSessionValue(SessionHelper.BussinessLocalLanguageIDSessionName, lang);

                    return(lang);
                }
                object obj = SessionHelper.GetSessionValue(SessionHelper.BussinessLocalLanguageIDSessionName);
                if (obj != null)
                {
                    return((Languages)obj);
                }
                else
                {
                    return(new Languages());
                }
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BLanguage", "GetLanguageByUsername");

                throw ex;
            }
        }
Beispiel #6
0
        public void UpdateRequestSubstituteAccordingToInActiveOrIsDeletedPerson(decimal substituteId)
        {
            try
            {
                string Description = string.Empty;
                if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    Description = "N' رد درخواست به دلیل غیر فعال شدن یا حذف پرسنل جانشین درخواست'";
                }
                else
                {
                    Description = "N'Request Reject because Ruqest Substitute Personnel Is InActive Or Deleted'";
                }
                string SQLCommand = "update TA_RequestSubstitute " +
                                    " set    requestSubstitute_Confirmed  = 0 , " +
                                    " requestSubstitute_Description = " + Description + " " +
                                    " where  requestSubstitute_SubstituteID =:substituteId and " +
                                    " requestSubstitute_Confirmed is null";

                NHibernateSessionManager.Instance.GetSession().CreateSQLQuery(SQLCommand)
                .SetParameter("substituteId", substituteId)
                .ExecuteUpdate();
            }
            catch (Exception ex)
            {
                BaseBusiness <RequestSubstitute> .LogException(ex, "BRequestSubstitute", "UpdateRequestSubstituteAccordingToInActiveOrIsDeletedPerson");

                throw ex;
            }
        }
        /// <summary>
        /// پارامتر های واسط کاربر را از کنترلها دریافت میکند و پارامترهای فایل گزارش را میسازد
        /// </summary>
        /// <param name="actionId">برای استفاده دوباره در شرایط دیگر از این کنترل , استفاده میشود</param>
        /// <param name="year"></param>
        /// <param name="month"></param>
        /// <returns></returns>
        public string GetParameterValue(decimal fileId, decimal uiParamerId, string actionId, int year, int month)
        {
            try
            {
                DateTime endDate = new DateTime();
                if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    int endOfMonth = Utility.GetEndOfPersianMonth(year, month);
                    endDate = Utility.ToMildiDate(String.Format("{0}/{1}/{2}", year, month, endOfMonth));
                }
                else
                {
                    int endOfMonth = Utility.GetEndOfMiladiMonth(year, month);
                    endDate = new DateTime(year, month, endOfMonth);
                }
                if (actionId.ToLower().Equals(ReportParametersActionId.PersonDateRange.ToString().ToLower()))
                {
                    int      dateRangeOrder = month;
                    DateTime toDate         = endDate;

                    string result = String.Format("@Order={0};@ToDate={1};", dateRangeOrder, Utility.ToString(toDate));
                    return(result);
                }
                return(String.Empty);
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex);

                // GetLog(ex, "BControlParameter_YearMonth", "GetParameterValue", ExceptionSrc);
                throw ex;
            }
        }
Beispiel #8
0
        /// <summary>
        /// آیا داده های اشخاص مشخص شده قبلا نتایج محاسبات شده اند
        /// </summary>
        /// <param name="year">سال</param>
        /// <param name="month">ماه</param>
        /// <param name="personList">لیست پرسنل</param>
        /// <returns>وضعیت نتایج محاسبات</returns>
        private ArchiveExistsConditions IsArchiveExsits(int year, int month, IList <Person> personList)
        {
            try
            {
                //personList = this.CheckMaxArrayParamCount(personList);
                int rangeOrder = month;
                var ids        = from o in personList
                                 select o.ID;
                int count = archiveRep.ExsitsArchiveCount(ids.ToList(), year, rangeOrder);
                if (count == 0)
                {
                    return(ArchiveExistsConditions.NotExists);
                }
                else if (count >= ids.Count())
                {
                    return(ArchiveExistsConditions.AllExists);
                }
                else
                {
                    return(ArchiveExistsConditions.SomeExists);
                }
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex);

                throw ex;
            }
        }
Beispiel #9
0
        public void SetArchiveGridSettings(IList <ArchiveFieldMap> mapList)
        {
            try
            {
                IList <ArchiveFieldMap> orginalMapList = mapRep.GetAll();
                foreach (ArchiveFieldMap changedMap in mapList)
                {
                    ArchiveFieldMap map = orginalMapList.Where(x => x.PId == changedMap.PId).FirstOrDefault();
                    if (map == null)
                    {
                        continue;
                    }
                    if (map.Visible != changedMap.Visible)
                    {
                        map.Visible = changedMap.Visible;
                        mapRep.Update(map);
                    }
                }
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex);

                throw ex;
            }
        }
        public string GetParameterValue(decimal fileId, decimal uiParamerId, string actionId, int year, int month, int hour, int minute)
        {
            try
            {
                DateTime endDate = new DateTime();
                if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    int endOfMonth = Utility.GetEndOfPersianMonth(year, month);
                    endDate = Utility.ToMildiDate(String.Format("{0}/{1}/{2}", year, month, endOfMonth));
                }
                else
                {
                    int endOfMonth = Utility.GetEndOfMiladiMonth(year, month);
                    endDate = new DateTime(year, month, endOfMonth);
                }

                int      dateRangeOrder = month;
                DateTime toDate         = endDate;
                int      TimeMinutes    = hour * 60 + minute;

                string result = String.Format("@Order={0};@ToDate={1};@Value={2};", dateRangeOrder, Utility.ToString(toDate), TimeMinutes);
                return(result);
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex);

                throw ex;
            }
        }
Beispiel #11
0
        /// <summary>
        /// بررسی تعداد لایسنس خریداری شده
        /// </summary>
        public static void CheckGTSLicense()
        {
            try
            {
                if (LicenseValue == 0)
                {
                    LicenseValue = GetLicense();
                }

                int personCount = 0;
                if (!SessionHelper.HasSessionValue(SessionHelper.LicensePersonCount))
                {
                    personCount = new BPerson().GetActivePersonCount();
                    SessionHelper.SaveSessionValue(SessionHelper.LicensePersonCount, personCount);
                }
                else
                {
                    personCount = Utility.ToInteger(SessionHelper.GetSessionValue(SessionHelper.LicensePersonCount));
                }

                if (personCount > LicenseValue)
                {
                    throw new BaseException("تعداد پرسنل داخل پایگاه داده بیشتر از مقدار لاسنس میباشد.لطفا نسبت به تهیه لاسنس اقدام نمایید", "اطلس حضور و غیاب");
                }
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex);

                throw ex;
            }
        }
Beispiel #12
0
        public void InsertSystemReportCurrentUserActivity(System.Web.UI.Page page, string action, string objectInfo)
        {
            try
            {
                BusinessActivityLogger businessActivityLogger = new BusinessActivityLogger();
                string username        = string.Empty;
                string className       = "BSystemReports";
                string methodName      = "InsertSystemReportCurrentUserActivity";
                string pageId          = Utility.GetCurrentPageID(page);
                string clientIPAddress = string.Empty;

                if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.Request != null)
                {
                    username = BUser.CurrentUser.UserName;
                    if (System.Web.HttpContext.Current.Request.UserHostAddress != null)
                    {
                        clientIPAddress = System.Web.HttpContext.Current.Request.UserHostAddress;
                    }
                }

                businessActivityLogger.Info(username, className, methodName, action, pageId, clientIPAddress, objectInfo);
            }
            catch (Exception ex)
            {
                BaseBusiness <GTS.Clock.Model.Report.SystemReportTypesDataContext> .LogException(ex, "BSystemReports", "InsertSystemReportCurrentUserActivity");

                throw ex;
            }
        }
Beispiel #13
0
        /// <summary>
        /// مقدار پارامتر قانون پرسنل را برمی گرداند
        /// </summary>
        /// <param name="currentDate">تاریخ جاری</param>
        /// <param name="person">پرسنل</param>
        /// <param name="ruleIdentifier">کد قانون</param>
        /// <param name="parameterName">نام پارامتر</param>
        /// <returns>مقدار پارامتر</returns>
        private object GetRuleParameter(DateTime currentDate, Person person, int ruleIdentifier, string parameterName)
        {
            try
            {
                if (person.AssignedRuleList != null)
                {
                    AssignedRule ar = person.AssignedRuleList.Where(x => x.FromDate <= currentDate && x.ToDate >= currentDate && x.IdentifierCode == ruleIdentifier).FirstOrDefault();
                    if (ar != null)
                    {
                        EntityRepository <AssignRuleParameter> paramRep  = new EntityRepository <AssignRuleParameter>();
                        IList <AssignRuleParameter>            paramList = paramRep.Find(x => x.Rule.ID == ar.RuleId).ToList();

                        AssignRuleParameter asp = paramList.Where(x => x.FromDate <= currentDate && x.ToDate >= currentDate).FirstOrDefault();
                        if (asp != null)
                        {
                            RuleParameter parameter = asp.RuleParameterList.Where(x => x.Name.ToLower().Equals(parameterName.ToLower())).FirstOrDefault();

                            if (parameter != null)
                            {
                                return(parameter.Value);
                            }
                        }
                    }
                }
                return(null);
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BUserInfo", "GetRuleParameter");

                throw ex;
            }
        }
Beispiel #14
0
        public static Languages GetCurrentSystemLanguage()
        {
            try
            {
                if (!SessionHelper.HasSessionValue(SessionHelper.BussinessSystemLanguageIDSessionName))
                {
                    EntityRepository <ApplicationLanguageSettings> appRep = new EntityRepository <ApplicationLanguageSettings>(false);
                    ApplicationLanguageSettings appLangSet = appRep.GetByCriteria(new CriteriaStruct(Utility.GetPropertyName(() => new ApplicationLanguageSettings().IsActive), true)).FirstOrDefault();
                    Languages lang = new Languages();
                    if (appLangSet != null)
                    {
                        lang = appLangSet.Language;
                    }

                    SessionHelper.SaveSessionValue(SessionHelper.BussinessSystemLanguageIDSessionName, lang);

                    return(lang);
                }
                object obj = SessionHelper.GetSessionValue(SessionHelper.BussinessSystemLanguageIDSessionName);
                if (obj != null)
                {
                    return((Languages)obj);
                }
                else
                {
                    return(new Languages());
                }
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BLanguage", "GetCurrentSystemLanguage()");

                throw ex;
            }
        }
Beispiel #15
0
        /// <summary>
        /// تعداد افراد تحت مدیریت را براساس کلمه جستجوشده برمیگرداند
        /// </summary>
        /// <param name="searchKey"></param>
        /// <param name="searchType"></param>
        /// <returns></returns>
        public int GetUnderManagmentBySearchCount(int month, string searchKey, GridSearchFields searchType)
        {
            try
            {
                if (InitManager())
                {
                    int Result = 0;
                    if (searchType == GridSearchFields.PersonName)
                    {
                        Result = managerRepository.GetUnderManagmentByDepartmentCount(GridSearchFields.PersonName, manager.ID, 0, searchKey, "");
                    }
                    else if (searchType == GridSearchFields.PersonCode)
                    {
                        Result = managerRepository.GetUnderManagmentByDepartmentCount(GridSearchFields.PersonCode, BUser.CurrentUser.Person.ID, 0, "", searchKey);
                    }
                    else
                    {
                        Result = managerRepository.GetUnderManagmentByDepartmentCount(GridSearchFields.PersonName, BUser.CurrentUser.Person.ID, 0, searchKey, "");
                        if (Result == 0)
                        {
                            Result = managerRepository.GetUnderManagmentByDepartmentCount(GridSearchFields.PersonCode, BUser.CurrentUser.Person.ID, 0, "", searchKey);
                        }
                    }
                    return(Result);
                }
                else if (InitOperator())
                {
                    decimal oprPrsId = BUser.CurrentUser.Person.ID;
                    int     Result   = 0;
                    if (searchType == GridSearchFields.PersonName)
                    {
                        Result = managerRepository.GetUnderManagmentOperatorByDepartmentCount(GridSearchFields.PersonName, oprPrsId, 0, searchKey, "");
                    }
                    else if (searchType == GridSearchFields.PersonCode)
                    {
                        Result = managerRepository.GetUnderManagmentOperatorByDepartmentCount(GridSearchFields.PersonCode, oprPrsId, 0, "", searchKey);
                    }
                    else
                    {
                        Result = managerRepository.GetUnderManagmentOperatorByDepartmentCount(GridSearchFields.PersonName, oprPrsId, 0, searchKey, "");
                        if (Result == 0)
                        {
                            Result = managerRepository.GetUnderManagmentOperatorByDepartmentCount(GridSearchFields.PersonCode, oprPrsId, 0, "", searchKey);
                        }
                    }
                    return(Result);
                }
                else
                {
                    throw new IllegalServiceAccess(String.Format("این سرویس تنها توسط مدیران قابل استفاده میباشد. شناسه کاربری {0} میباشد", this.Username), ExceptionSrc);
                }
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BWorkedTime", "GetUnderManagmentBySearchCount");

                throw ex;
            }
        }
Beispiel #16
0
        public IList <UISkin> GetAll()
        {
            try
            {
                IList <UISkin> skins = new List <UISkin>();
                if (!SessionHelper.HasSessionValue(SessionHelper.BussinessAllSkinSessionName))
                {
                    EntityRepository <UISkin> skinRep = new EntityRepository <UISkin>(false);
                    skins = skinRep.GetAll();
                    SessionHelper.SaveSessionValue(SessionHelper.BussinessAllSkinSessionName, skins);
                    return(skins);

                    foreach (UISkin skin in skins)
                    {
                        if (BLanguage.CurrentLocalLanguage == LanguagesName.Parsi)
                        {
                            skin.Name = skin.FnName;
                        }
                        else
                        {
                            skin.Name = skin.EnName;
                        }
                    }
                    return(skins);
                }
                object obj = SessionHelper.GetSessionValue(SessionHelper.BussinessAllSkinSessionName);
                if (obj != null)
                {
                    skins = (IList <UISkin>)obj;
                    if (skins == null || skins.Count == 0)
                    {
                        SessionHelper.ClearSessionValue(SessionHelper.BussinessAllSkinSessionName);
                    }
                    foreach (UISkin skin in skins)
                    {
                        if (BLanguage.CurrentLocalLanguage == LanguagesName.Parsi)
                        {
                            skin.Name = skin.FnName;
                        }
                        else
                        {
                            skin.Name = skin.EnName;
                        }
                    }
                    return(skins);
                }
                else
                {
                    return(new List <UISkin>());
                }
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BUserSettings", "GetAll");

                throw ex;
            }
        }
Beispiel #17
0
        /// <summary>
        /// پس از حذف نتایج محاسبات قبلی , دادههای جدید را کپی میکند
        /// بعلت محدودیت در تعداد پارامتر , دسته دسته نتایج محاسبات میشود
        /// </summary>
        /// <param name="year">سال</param>
        /// <param name="month">ماه</param>
        /// <param name="personList">لیست پرسنل</param>
        /// <param name="overwrite">بازنویسی</param>
        /// <returns>انجام  شد/انجام نشد</returns>
        private bool ArchiveData(int year, int month, IList <Person> personList, bool overwrite)
        {
            //DNN Note
            // ابتدا بررسی می کند که برای اشخاص محاسبات  در این روز انجام شده است یا خیر
            var CFPList       = cfpRe.GetByPersonIDList(personList.Select(c => c.ID).ToList()).ToList();
            var validCFPCount = CFPList.Where(c => c.CalculationIsValid == true && c.Date.Date >= DateTime.Now.Date).Count();

            if (validCFPCount < personList.Count)
            {
                UIValidationExceptions exception = new UIValidationExceptions();
                exception.Add(new ValidationException(ExceptionResourceKeys.PersonCalculationRequied, string.Format("نشانگر محاسبات پرسنل برای {0} نفر بروز نمی باشد, ابتدا انجام محاسبات اجرا شود", personList.Count - validCFPCount), ExceptionSrc));
                throw exception;
            }
            //----------------------------------------------------
            try
            {
                DateTime date       = new DateTime(year, month, Utility.GetEndOfMiladiMonth(year, month));
                int      rangeOrder = month;

                if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    date = Utility.ToMildiDate(String.Format("{0}/{1}/{2}", year, month, Utility.GetEndOfPersianMonth(year, month)));
                }
                int ofset = 2000;
                for (int i = 0; i < personList.Count; i += ofset)
                {
                    var ids = from o in personList
                              .Skip(i)
                              .Take(ofset)
                              select o.ID;

                    if (overwrite)
                    {
                        archiveRep.DeleteArchiveValues(ids.ToList(), year, month);
                    }
                    foreach (decimal id in ids)
                    {
                        if (!overwrite && this.IsArchiveExsits(year, month, id) != ArchiveExistsConditions.NotExists)
                        {
                            continue;
                        }
                        archiveRep.ArchiveConceptValues(id, year, rangeOrder, date, BUser.CurrentUser.Person.ID);
                        //DNN Note
                        var    person = personList.Where(c => c.ID == id).First();
                        string info   = string.Format("نتایج محاسبات برای پرسنل {0} با کد {1} مربوط به ماه {2} سال {3} آرشیو گردید", person.Name, person.BarCode, month, year);
                        base.LogUserAction(info, "Archive", BUser.CurrentUser.UserName, true);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex);

                throw ex;
            }
        }
Beispiel #18
0
        private int GetPermitCount(string searchKey, RequestType requestType, string theDate)
        {
            try
            {
                DateTime date;
                if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    date = Utility.ToMildiDate(theDate);
                }
                else
                {
                    date = Utility.ToMildiDateTime(theDate);
                }

                //IList<decimal> controlStationIds = accessPort.GetAccessibleControlStations();
                List <decimal>  prsIds     = new List <decimal>();
                IList <decimal> precardIds = accessPort.GetAccessiblePrecards();

                if (searchKey != null)
                {
                    IList <Person> quciSearchInUnderManagment = searchTool.QuickSearch(searchKey, PersonCategory.Sentry_UnderManagment);
                    var            ids = from o in quciSearchInUnderManagment
                                         select o.ID;
                    prsIds.AddRange(ids.ToList <decimal>());
                }
                else
                {
                    IList <Person> quciSearchInUnderManagment = searchTool.QuickSearch("", PersonCategory.Sentry_UnderManagment);
                    var            ids = from o in quciSearchInUnderManagment
                                         select o.ID;
                    prsIds = ids.ToList <decimal>();
                }

                IList <InfoRequest> requestList = new RequestRepository(false).GetAllRequestMinOneLevelConfirm(prsIds, precardIds, date, SentryPermitsOrderBy.PermitSubject);
                IList <Precard>     precardList = new BPrecard().GetAll();
                switch (requestType)
                {
                case RequestType.Daily:
                    requestList = requestList.Where(x => precardList.Any(y => y.IsDaily && y.ID == x.PrecardID)).ToList();
                    break;

                case RequestType.Hourly:
                    requestList = requestList.Where(x => precardList.Any(y => y.IsHourly && y.ID == x.PrecardID)).ToList();
                    break;
                }

                int count = requestList.Count;
                return(count);
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BSentryPermits", "GetPermitCount");

                throw ex;
            }
        }
        /// <summary>
        /// پارامترها را از رشته تولید شده استخراج میکند
        /// گزارش پارامتر آخر سال دارد که باید پشت کار حساب شود
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="actionId"></param>
        /// <returns></returns>
        public IDictionary <string, object> ParsParameter(string parameters, string actionId)
        {
            try
            {
                if (Utility.IsEmpty(parameters))
                {
                    return(null);
                }
                DateTime fromDate = new DateTime(), toDate = new DateTime(), endOfYear = new DateTime();
                IDictionary <string, object> ParamValues = new Dictionary <string, object>();
                bool   toDateOk = false, fromDateOk = false;
                string toDateName = "@toDate", fromDateName = "@fromDate", endOfYearName = "@endOfYear";
                if (actionId.ToLower() == ReportParametersActionId.ToDate_Implicit_StartOfYear_EndOfYear.ToString().ToLower())
                {
                    string[] split = Utility.Spilit(parameters, ';');
                    foreach (string s in split)
                    {
                        string p = s.ToLower();

                        if (p.Contains(toDateName.ToLower()))
                        {
                            toDate = Utility.ToMildiDateTime(p.Replace(toDateName.ToLower() + "=", ""));

                            endOfYear = Utility.GetDateOfEndYear(toDate, BLanguage.CurrentSystemLanguage);

                            toDateOk = true;
                        }
                        if (p.Contains(fromDateName.ToLower()))
                        {
                            fromDate   = Utility.ToMildiDateTime(p.Replace(fromDateName.ToLower() + "=", ""));
                            fromDateOk = true;
                        }
                    }
                    if (!(fromDateOk && toDateOk))
                    {
                        throw new ReportParameterIsNotMatchException(UIFatalExceptionIdentifiers.ReportParameterParsingIsNotMatch, "پارامترهای ارسالی جهت بازگشایی کامل نیستند", ExceptionSrc);
                    }
                    else
                    {
                        ParamValues.Add(fromDateName.Replace("@", ""), fromDate);
                        ParamValues.Add(toDateName.Replace("@", ""), toDate);
                        ParamValues.Add(endOfYearName.Replace("@", ""), endOfYear);
                    }
                }
                return(ParamValues);
            }

            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex);

                //GetLog(ex, "BControlParameter_YearMonth", "ParsParameter", ExceptionSrc);
                throw ex;
            }
        }
Beispiel #20
0
 private void LogException(Exception ex, string page)
 {
     if (ex.StackTrace != null)
     {
         BaseBusiness <Entity> .LogException(ex, ex.StackTrace.ToString());
     }
     else
     {
         BaseBusiness <Entity> .LogException(ex, page);
     }
 }
        /// <summary>
        /// پارامترها را از رشته تولید شده استخراج میکند
        /// </summary>
        /// <param name="parameters"></param>
        /// <param name="actionId"></param>
        /// <returns></returns>
        public IDictionary <string, object> ParsParameter(string parameters, string actionId)
        {
            try
            {
                if (Utility.IsEmpty(parameters))
                {
                    return(null);
                }
                int      monthOrder = 0;
                DateTime toDate     = new DateTime();
                IDictionary <string, object> ParamValues = new Dictionary <string, object>();
                bool   monthOrderOk = false, toDateOk = false;
                string toDateName = "@ToDate", dateRangeOrderName = "@Order";
                if (actionId.ToLower() == ReportParametersActionId.PersonDateRange.ToString().ToLower())
                {
                    string[] split = Utility.Spilit(parameters, ';');
                    foreach (string s in split)
                    {
                        string p = s;

                        if (p.Contains(toDateName))
                        {
                            toDate   = Utility.ToMildiDateTime(p.Replace(toDateName + "=", ""));
                            toDateOk = true;
                        }
                        if (p.Contains(dateRangeOrderName))
                        {
                            monthOrder   = Utility.ToInteger(p.Replace(dateRangeOrderName + "=", ""));
                            monthOrderOk = true;
                        }
                    }
                    if (!(monthOrderOk && toDateOk))
                    {
                        throw new ReportParameterIsNotMatchException(UIFatalExceptionIdentifiers.ReportParameterParsingIsNotMatch, "پارامترهای ارسالی جهت بازگشایی کامل نیستند", ExceptionSrc);
                    }
                    else
                    {
                        ParamValues.Add(dateRangeOrderName, monthOrder);
                        ParamValues.Add(toDateName, toDate);
                    }
                }
                return(ParamValues);
            }

            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex);

                //GetLog(ex, "BControlParameter_YearMonth", "ParsParameter", ExceptionSrc);
                throw ex;
            }
        }
Beispiel #22
0
        public int GetSystemReportTypeCount(SystemReportType SRT, SystemReportTypeFilterConditions SrtFilterConditions)
        {
            try
            {
                return(this.systemReportsRepository.GetSystemReportTypeCount(SRT, SrtFilterConditions));
            }
            catch (Exception ex)
            {
                BaseBusiness <SystemReportTypesDataContext> .LogException(ex, "BSystemReports", "GetSystemReportTypeCount");

                throw ex;
            }
        }
Beispiel #23
0
        /// <summary>
        /// سر ستون رزورو فیلدها را در گزارش کارکرد ماهانه برمیگرداند
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public string GetReservedFieldsName(ConceptReservedFields field)
        {
            try
            {
                return(new BPersonMonthlyWorkedTime(0).GetReservedFieldsName(field));
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, this.GetType().Name, "GetReservedFieldsName");

                throw ex;
            }
        }
Beispiel #24
0
        public int GetPermitCount(string searchKey, string theDate)
        {
            try
            {
                return(this.GetPermitCount(searchKey, RequestType.None, theDate));
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BSentryPermits", "GetPermitCount");

                throw ex;
            }
        }
Beispiel #25
0
        public IList <KartablProxy> GetAllPermits(RequestType requestType, string theDate, int pageIndex, int pageSize, SentryPermitsOrderBy orderby)
        {
            try
            {
                return(this.GetAllPermits(null, requestType, theDate, pageIndex, pageSize, orderby));
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BSentryPermits", "GetAllPermits");

                throw ex;
            }
        }
        /// <summary>
        /// تعداد افراد باقی مانده برای محاسبه
        /// </summary>
        /// <returns>تعداد</returns>
        public int GetRemainCountInCalculating()
        {
            try
            {
                return(gtsEngineWS.GTS_GETRemainExecuting(BUser.CurrentUser.UserName));
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BEngineCalculator", "GetRemainCountInCalculating");

                throw ex;
            }
        }
Beispiel #27
0
        private void DeleteAllSystemReportType <T>(string ClassName, string MethodName) where T : class
        {
            try
            {
                this.systemReportsRepository.DeleteAllSystemReportType <T>();
            }
            catch (Exception ex)
            {
                BaseBusiness <SystemReportTypesDataContext> .LogException(ex, ClassName, MethodName);

                throw ex;
            }
        }
Beispiel #28
0
        /// <summary>
        /// تعداد پیغامهای عمومی را برمیگرداند
        /// </summary>
        /// <returns>تعداد</returns>
        public int GetAllPublicNewsCount()
        {
            try
            {
                return(new BPublicMessage().GetAllPublicNewsCount());
            }
            catch (Exception ex)
            {
                BaseBusiness <PublicMessage> .LogException(ex);

                throw ex;
            }
        }
Beispiel #29
0
        public IList <SystemUserActionReport> GetSystemUserActionReportList(SystemReportType SRT, int PageSize, int PageIndex, SystemReportTypeFilterConditions SrtFilterConditions)
        {
            try
            {
                return(this.systemReportsRepository.GetSystemUserActionReportList(SRT, PageSize, PageIndex, SrtFilterConditions));
            }
            catch (Exception ex)
            {
                BaseBusiness <SystemReportTypesDataContext> .LogException(ex, "BSystemReports", "GetSystemUserActionReportList");

                throw ex;
            }
        }
        /// <summary>
        /// انجام محاسبات همه پرسنل در بازه زمانی مشخص
        /// </summary>
        /// <param name="fromDate">تاریخ شروع</param>
        /// <param name="toDate">تاریخ پایان</param>
        /// <param name="forceCalculate">محاسبات اجباری</param>
        /// <returns>انجام شد یا نشد</returns>
        public bool Calculate(string fromDate, string toDate, bool forceCalculate)
        {
            try
            {
                return(this.Calculate(String.Empty, fromDate, toDate, forceCalculate));
            }
            catch (Exception ex)
            {
                BaseBusiness <Entity> .LogException(ex, "BEngineCalculator", "Calculate(toDate)");

                throw ex;
            }
        }