private ApplicationLanguageSettings GetCurrentApplicationLanguageSettings() { EntityRepository <ApplicationLanguageSettings> appRep = new EntityRepository <ApplicationLanguageSettings>(false); ApplicationLanguageSettings appLangSet = appRep.GetByCriteria(new CriteriaStruct(GTS.Clock.Infrastructure.Utility.Utility.GetPropertyName(() => new ApplicationLanguageSettings().IsActive), true)).FirstOrDefault(); return(appLangSet); }
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; } }
/// <summary> /// /// </summary> /// <returns></returns> public string GetCurrentSysLanguage() { /* * EntityRepository<ApplicationLanguageSettings> appRep = new EntityRepository<ApplicationLanguageSettings>(false); * ApplicationLanguageSettings appLangSet = appRep.GetByCriteria(new CriteriaStruct(Utility.GetPropertyName(() => new ApplicationLanguageSettings().IsActive), true)).FirstOrDefault(); * if (appLangSet != null) * { * return appLangSet.Language.LangID; * } * return ""; */ /* */ if (!SessionHelper.HasSessionValue(SessionHelper.BussinessSystemLanguageSessionName1)) { string syslang = ""; EntityRepository <ApplicationLanguageSettings> appRep = new EntityRepository <ApplicationLanguageSettings>(false); ApplicationLanguageSettings appLangSet = appRep.GetByCriteria(new CriteriaStruct(Utility.GetPropertyName(() => new ApplicationLanguageSettings().IsActive), true)).FirstOrDefault(); if (appLangSet != null) { syslang = appLangSet.Language.LangID; SessionHelper.SaveSessionValue(SessionHelper.BussinessSystemLanguageSessionName1, syslang); return(syslang); } return(""); } return(Utility.ToString(SessionHelper.GetSessionValue(SessionHelper.BussinessSystemLanguageSessionName1))); }
public IList <SystemUserActionReport> GetSystemUserActionReportList(SystemReportType SRT, int PageSize, int PageIndex, SystemReportTypeFilterConditions SrtFilterConditions) { ApplicationLanguageSettings AppLanguageSettings = this.GetCurrentApplicationLanguageSettings(); System.Linq.Expressions.Expression <Func <SystemUserActionReport, bool> > SystemUserActionReportExpression = (System.Linq.Expressions.Expression <Func <SystemUserActionReport, bool> >) this.GetSystemReportTypeFilterConditions(SRT, SrtFilterConditions); IList <SystemUserActionReport> SystemUserActionReportList = this.SrtDataContext.SystemUserActionReports.Where(SystemUserActionReportExpression) .OrderByDescending(x => x.Date) .Skip(PageIndex * PageSize) .Take(PageSize) .AsEnumerable() .Select(x => { x.UIDate = AppLanguageSettings.Language.Name == LanguagesName.Parsi ? x.Date != null ? Utility.Utility.ToPersianDate(x.Date ?? DateTime.MinValue) : string.Empty : x.Date != null ? x.Date.Value.ToShortDateString() : string.Empty; return(x); }) .ToList(); return(SystemUserActionReportList); }
private Dictionary <string, DateTime> GetSystemReportTypeConditionsDates(SystemReportTypeFilterConditions SrtFilterConditions) { Dictionary <string, DateTime> SystemReportTypeConditionsDatesDic = new Dictionary <string, DateTime>(); ApplicationLanguageSettings appLangSet = this.GetCurrentApplicationLanguageSettings(); switch (appLangSet.Language.Name) { case LanguagesName.Parsi: SystemReportTypeConditionsDatesDic.Add("FromDate", SrtFilterConditions.FromDate != string.Empty ? Utility.Utility.ToMildiDate(SrtFilterConditions.FromDate) : (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue); SystemReportTypeConditionsDatesDic.Add("ToDate", SrtFilterConditions.ToDate != string.Empty ? Utility.Utility.ToMildiDate(SrtFilterConditions.ToDate) : (DateTime)System.Data.SqlTypes.SqlDateTime.MaxValue); break; case LanguagesName.English: SystemReportTypeConditionsDatesDic.Add("FromDate", SrtFilterConditions.FromDate != string.Empty ? Utility.Utility.ToMildiDateTime(SrtFilterConditions.FromDate) : (DateTime)System.Data.SqlTypes.SqlDateTime.MinValue); SystemReportTypeConditionsDatesDic.Add("ToDate", SrtFilterConditions.ToDate != string.Empty ? Utility.Utility.ToMildiDateTime(SrtFilterConditions.ToDate) : (DateTime)System.Data.SqlTypes.SqlDateTime.MaxValue); break; } return(SystemReportTypeConditionsDatesDic); }