public async Task <LoginResponce> LogInOffline(string name, string password) { string result = String.Empty; bool success = false; try { if (sqliteService == null) { sqliteService = new SQLiteService(_sqlitePlatform, await _fileSystemService.GetPath(_configuration.SqlDatabaseName)); } } catch (Exception exp) { sqliteService = null; } try { if (sqliteService != null) { LoginInfoDTO currentLoginInfo = new LoginInfoDTO(); currentLoginInfo.UserName = name; currentLoginInfo.Password = SecurytyHash.CalculateSha1Hash(password); result = _localizservice.Localize("NotSavedDataOffline"); List <LoginInfoDTO> listlogins = await sqliteService.Get <LoginInfoDTO>(); if (listlogins != null && listlogins.Count != 0) { foreach (LoginInfoDTO login in listlogins) { if (login.UserName == currentLoginInfo.UserName) { result = string.Empty; if (login.Password == currentLoginInfo.Password) { success = true; result = string.Empty; } else { result = _localizservice.Localize("IncorrectLoginOrPassword"); } } } } } } catch (Exception e) { result = String.Format("Error = " + e.Message); success = false; } return(await Helper.Complete(new LoginResponce(success, result))); }
public VTSModel ConvertToVTSModel(VacationInfoModel vacationInfo) { VTSModel vtsModel = new VTSModel(); vtsModel.Id = vacationInfo.Id; if (vacationInfo.Type.Value != null) { vtsModel.VacationType = vacationInfo.Type.Value; } vtsModel.StartDate = vacationInfo.StartDate; vtsModel.EndDate = vacationInfo.EndDate; var startDate = LocalizeMonth((new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).AddMilliseconds(vacationInfo.StartDate).ToLocalTime().ToString("MMM dd, yyyy")); var endDate = LocalizeMonth((new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).AddMilliseconds(vacationInfo.EndDate).ToLocalTime().ToString("MMM dd, yyyy")); var _startDate = ConverterHelper.ConvertMillisecToDateTime(vacationInfo.StartDate); var _endDate = ConverterHelper.ConvertMillisecToDateTime(vacationInfo.EndDate); var dayCount = ConverterHelper.CalculateDuration(_startDate, _endDate); var days = string.Empty; if (dayCount == 1) { days = _localizer.Localize("day"); } else { if (dayCount > 1 && dayCount < 5) { days = _localizer.Localize("day24"); } else { days = _localizer.Localize("days"); } } vtsModel.Date = startDate + " - " + endDate + " (" + dayCount + " " + days + ")"; if (vacationInfo.Status != null) { vtsModel.Status = vacationInfo.Status.Value; } if (vacationInfo.Type.Value != null) { vtsModel.VacationType = vacationInfo.Type.Value; } return(vtsModel); }
protected string ResolveRequestSync(string resourceName, string?culture = null) { culture ??= options.DefaultCulture; string?appName = null; if (options.UseApplicationName && !string.IsNullOrEmpty(options.ApplicationName)) { appName = options.ApplicationName; } var requestModel = new ResourceRequestModel(resourceName, culture, appName); var result = localizeService.Localize(requestModel); return(result.Value); }
private bool Validate() { if (string.IsNullOrWhiteSpace(Login) || string.IsNullOrWhiteSpace(Password)) { ErrorMessage = localizservice.Localize("EnterCredentials"); return(false); } else { ErrorMessage = string.Empty; return(true); } }
private void InitMenuItem() { menuItems = new List <StringElement>(); menuItems.Add(new StringElement(_localizeService.Localize("Requests"), delegate { if (RowClicked != null) { RowClicked(this, new RowClickedEventArgs(Utils.LIST_VACATION)); } })); menuItems.Add(new StringElement(_localizeService.Localize("addVacation"), delegate { if (RowClicked != null) { RowClicked(this, new RowClickedEventArgs(Utils.VACATION_REQUEST)); } })); menuItems.Add(new StringElement(_localizeService.Localize("SickToday"), delegate { if (RowClicked != null) { RowClicked(this, new RowClickedEventArgs(Utils.SICK_REQUEST)); } })); menuItems.Add(new StringElement(_localizeService.Localize("Overtime"), delegate { if (RowClicked != null) { RowClicked(this, new RowClickedEventArgs(Utils.OVERTIME_REQUEST)); } })); menuItems.Add(new StringElement(_localizeService.Localize("LeaveWOPay"), delegate { if (RowClicked != null) { RowClicked(this, new RowClickedEventArgs(Utils.LIVEWOP_REQUEST)); } })); menuItems.Add(new StringElement(_localizeService.Localize("ExceptionalLeave"), delegate { if (RowClicked != null) { RowClicked(this, new RowClickedEventArgs(Utils.EXCEPTIONAL_REQUEST)); } })); menuItems.Add(new StringElement(_localizeService.Localize("Exit"), delegate { if (RowClicked != null) { RowClicked(this, new RowClickedEventArgs(Utils.EXIT_REQUEST)); } })); }
public string Localize(string key) { return(_localizeService.Localize(key)); }