public override void Edit() { Domain.Colouring l = (Domain.Colouring)mainGridView.GetRow(mainGridView.FocusedRowHandle); if (l == null) { return; } FormColouring f = new FormColouring(); f.Text = GetLocalized("Edit Colouring"); f.Colouring = l; if (f.ShowDialog(OwnerForm) == DialogResult.OK) { try { ClientEnvironment.ColouringService.SaveOrUpdate(f.Colouring); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveColouring"); form.ShowDialog(this); } } } RefreshData(); }
public override void Add() { FormColouring f = new FormColouring(); f.Text = GetLocalized("New Colouring"); f.Colouring = new Domain.Colouring(); if (f.ShowDialog(OwnerForm) == DialogResult.OK) { try { ClientEnvironment.ColouringService.SaveOrUpdate(f.Colouring); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveColouring"); form.ShowDialog(this); } } } RefreshData(); }
public override void Edit() { AbsenceTypeWrapper e = (AbsenceTypeWrapper)mainGridView.GetRow(mainGridView.FocusedRowHandle); if (e == null) { return; } FormAbsenceType f = new FormAbsenceType(); f.Text = GetLocalized("Edit Absence Type"); f.AbsenceType = e; if (f.ShowDialog(OwnerForm) == DialogResult.OK) { f.AbsenceType.DecomposeName(ClientEnvironment.LanguageId); try { ClientEnvironment.AbsenceTypeService.SaveOrUpdate(f.AbsenceType.AbsenceType); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveAbsenceType"); form.ShowDialog(this); } } } RefreshData(); }
public override void Add() { FormAbsenceType f = new FormAbsenceType(); f.Text = GetLocalized("New Absence Type"); f.AbsenceType = new AbsenceTypeWrapper(new Domain.AbsenceType(), ""); if (f.ShowDialog(OwnerForm) == DialogResult.OK) { f.AbsenceType.DecomposeName(ClientEnvironment.LanguageId); try { ClientEnvironment.AbsenceTypeService.SaveOrUpdate(f.AbsenceType.AbsenceType); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveAbsenceType"); form.ShowDialog(this); } } } RefreshData(); }
protected virtual void ProcessEntityException(EntityException ex) { using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { //form.Text = GetLocalized("CannotSaveAbsence"); form.ShowDialog(this); } }
/// <summary> /// Edit current item /// </summary> /// public override void Edit() { UserInfo info = FocusedEntity; if (info != null) { using (FormUser frm = new FormUser()) { frm.Entity = info.User; if (frm.ShowDialog(this) == DialogResult.OK) { if (info.User.IsNew) { try { User usr = ClientEnvironment.UserService.Save(info.User); UserList.Add(new UserInfo(usr)); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveUser"); form.ShowDialog(this); } } } else { try { User usr = ClientEnvironment.UserService.SaveOrUpdate(info.User); UserList.ResetItemById(usr.ID); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveUser"); form.ShowDialog(this); } } } } } UserList.ResetItemById(info.User.ID); } RefreshData(); }
/// <summary> /// Edit current item /// </summary> public override void Edit() { Employee emp = (Employee)mainGridView.GetRow(mainGridView.FocusedRowHandle); if (emp != null) { using (EmployeeFrm frm = new EmployeeFrm()) { frm.Entity = emp; if (frm.ShowDialog(this) == DialogResult.OK) { if (emp.ID == 0) { try { ClientEnvironment.EmployeeService.Save(emp); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveEmployee"); form.ShowDialog(this); } } } else { try { ClientEnvironment.EmployeeService.SaveOrUpdate(emp); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveEmployee"); form.ShowDialog(this); } } } RefreshData(); } } } }
/// <summary> /// Delete selected items /// </summary> public override void Delete() { if (QuestionMessageYes(GetLocalized("questiondeleteuser"), GetLocalized("confirm"))) { List <long> ids = new List <long>(); foreach (int rowHandle in gridViewUser.GetSelectedRows()) { UserInfo info = GetEntityByRowHandle(rowHandle); if (info != null) { ids.Add(info.User.ID); UserList.Remove(info); } } if (ids.Count == 1) { try { ClientEnvironment.UserService.DeleteByID(ids[0]); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotDeleteUser"); form.ShowDialog(this); } } } else { try { ClientEnvironment.UserService.DeleteListByID(ids); } catch (EntityException) { // can't obtain more details while deleting list ErrorMessage(GetLocalized("SomeUsersNotDeleted")); } } } RefreshData(); }
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { log.Error("Unhandled", e.Exception); if (e.Exception is EntityException) { // 2think: how to localize? using (FrmEntityExceptionDetails frm = new FrmEntityExceptionDetails(e.Exception as EntityException)) { frm.Text = "Unhandled exception"; frm.ShowDialog(); } } else { MessageBox.Show(e.Exception.ToString(), "Unhandled exception"); } }
/// <summary> /// Delete selected items /// </summary> public override void Delete() { List <long> ids = new List <long>(); foreach (int rowHandle in mainGridView.GetSelectedRows()) { Employee entity = (Employee)mainGridView.GetRow(rowHandle); ids.Add(entity.ID); } if (!QuestionMessageYes(GetLocalized("QuestionDeleteEmployee"))) { return; } if (ids.Count == 1) { try { ClientEnvironment.EmployeeService.DeleteByID(ids[0]); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotDeleteEmployee"); form.ShowDialog(this); } } } else { try { ClientEnvironment.EmployeeService.DeleteListByID(ids); } catch (EntityException) { // can't obtain more details while deleting list ErrorMessage(GetLocalized("SomeEmployeesNotDeleted")); } } RefreshData(); }
public void ProcessEntityException(EntityException ex) { Form formMain = ClientEnvironment.MainForm; if (formMain.InvokeRequired) { formMain.BeginInvoke(new ProcessEntityExceptionDelegate(ProcessEntityException), ex); return; } using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = Localizer.GetLocalized("Error"); if (String.IsNullOrEmpty(form.Text)) { form.Text = ex.Message; } form.ShowDialog(this); } }
public override void Delete() { //XtraMessageBox.Show(this, "Delete", this.Name, MessageBoxButtons.OK); List <long> ids = new List <long>(); foreach (int rowHandle in mainGridView.GetSelectedRows()) { Domain.Colouring col = (Domain.Colouring)mainGridView.GetRow(rowHandle); ids.Add(col.ID); } if (ids.Count == 1) { try { ClientEnvironment.ColouringService.DeleteByID(ids[0]); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotDeleteColouring"); form.ShowDialog(this); } } } else { try { ClientEnvironment.ColouringService.DeleteListByID(ids); } catch (EntityException) { // can't obtain more details while deleting list ErrorMessage(GetLocalized("SomeColouringsNotDeleted")); } } RefreshData(); }
public override bool Commit() { if (CountryColor == null) { return(true); } if (CountryColor.IsNew || IsModified()) { CountryColor.L = LowValue; CountryColor.Y = YValue; CountryColor.X = XValue; CountryColor.H = HighValue; CountryColor.LCColour = LowerCriticalColor; CountryColor.NColour = NormalColor; CountryColor.HColour = HigherCautionColor; CountryColor.LColour = LowCautionColor; CountryColor.HCColour = HigherCriticalColor; try { ClientEnvironment.ColouringService.SaveOrUpdate(CountryColor); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveColouring"); form.ShowDialog(this); return(false); } } Modified = true; } return(true); }
public override bool Commit() { if (Language != null) { String l_name = textEditName.Text.Trim(); if (l_name != Language.Name) { Language.Name = l_name; Modified = true; } /*l_name = textEditCode.Text.Trim(); * if (l_name != Language.LanguageCode) * { * Language.LanguageCode = l_name; * Modified = true; * }*/ if (Modified) { if (Language.IsNew) { try { Domain.Language l = ClientEnvironment.LanguageService.Save(Language); Language.ID = l.ID; NotificationService.OnChangedLanguage(Language); } catch (DBDuplicateKeyException) { ErrorMessage(GetLocalized("languagenameexists")); return(false); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveLanguage"); form.ShowDialog(this); } return(false); } } else { try { ClientEnvironment.LanguageService.SaveOrUpdate(Language); NotificationService.OnChangedLanguage(Language); } catch (DBDuplicateKeyException) { ErrorMessage(GetLocalized("languagenameexists")); return(false); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveLanguage"); form.ShowDialog(this); } return(false); } } } } return(true); }
/// <summary> /// Delete selected items /// </summary> public override void Delete() { if (QuestionMessageYes(GetLocalized("questiondeleteuser"), GetLocalized("confirm"))) { List<long> ids = new List<long>(); foreach (int rowHandle in gridViewUser.GetSelectedRows()) { UserInfo info = GetEntityByRowHandle(rowHandle); if (info != null) { ids.Add(info.User.ID); UserList.Remove(info); } } if (ids.Count == 1) { try { ClientEnvironment.UserService.DeleteByID(ids[0]); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotDeleteUser"); form.ShowDialog(this); } } } else { try { ClientEnvironment.UserService.DeleteListByID(ids); } catch (EntityException) { // can't obtain more details while deleting list ErrorMessage(GetLocalized("SomeUsersNotDeleted")); } } } RefreshData(); }
/// <summary> /// Add new item /// </summary> public override void Add() { User usr = ClientEnvironment.UserService.CreateEntity(); using (FormUser frm = new FormUser()) { frm.Entity = usr; if (frm.ShowDialog(this) == DialogResult.OK) { if (usr.IsNew) { try { usr = ClientEnvironment.UserService.Save(usr); UserList.Add(new UserInfo(usr)); for (int row = 0 ; row < UserList.Count; row++) { if ( UserList[row].User.ID == usr.ID) { focusedRow = row; break; } } focusedUser = new UserInfo(usr); isRowNotFixed = true; fixedTimes = 3; fixFocusedEntity(); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveUser"); form.ShowDialog(this); } } } else { try { usr = ClientEnvironment.UserService.SaveOrUpdate(usr); UserList.ResetItemById(usr.ID); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveUser"); form.ShowDialog(this); } } } } } // RefreshData(); //******************!!!!!!!!! }
public override bool Commit() { if (_country != null) { long oldid = _country.CountryLanguage; long newid = (languageLookUpList.LanguageID); if (oldid != newid) { Modified = true; } _country.CountryLanguage = languageLookUpList.LanguageID; _country.LanguageID = SharedConsts.NeutralLangId; //languageLookUpList.LanguageID; //ClientEnvironment.LogonUser.LanguageID.Value ; /*byte b = Convert.ToByte(spinEditBaumaxID.Value); * if (_country.SystemID1 != b) * { * _country.SystemID1 = b; * Modified = true; * } * if (_country.SystemID2 != textEditBaumaxDescription.Text) * { * _country.SystemID2 = textEditBaumaxDescription.Text; * Modified = true; * } */ string value = textEditName.Text.Trim(); if (value != _country.Name) { Modified = true; _country.Name = value; } if (_country.IsNew) { Modified = true; try { _country = ClientEnvironment.CountryService.Save(_country); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveCountry"); form.ShowDialog(this); return(false); } } } else if (Modified) { try { ClientEnvironment.CountryService.SaveOrUpdate(_country); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveCountry"); form.ShowDialog(this); return(false); } } } if (Modified) { if (languageLookUpList.Language != null) { _country.LanguageName = languageLookUpList.Language.Name; } } } return(true); }
/// <summary> /// Add new item /// </summary> public override void Add() { User usr = ClientEnvironment.UserService.CreateEntity(); using (FormUser frm = new FormUser()) { frm.Entity = usr; if (frm.ShowDialog(this) == DialogResult.OK) { if (usr.IsNew) { try { usr = ClientEnvironment.UserService.Save(usr); UserList.Add(new UserInfo(usr)); for (int row = 0; row < UserList.Count; row++) { if (UserList[row].User.ID == usr.ID) { focusedRow = row; break; } } focusedUser = new UserInfo(usr); isRowNotFixed = true; fixedTimes = 3; fixFocusedEntity(); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveUser"); form.ShowDialog(this); } } } else { try { usr = ClientEnvironment.UserService.SaveOrUpdate(usr); UserList.ResetItemById(usr.ID); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveUser"); form.ShowDialog(this); } } } } } // RefreshData(); //******************!!!!!!!!! }
public override bool Commit() { if (Language != null) { String l_name = textEditName.Text.Trim(); if (l_name != Language.Name) { Language.Name = l_name; Modified = true; } /*l_name = textEditCode.Text.Trim(); if (l_name != Language.LanguageCode) { Language.LanguageCode = l_name; Modified = true; }*/ if (Modified) { if (Language.IsNew) { try { Domain.Language l = ClientEnvironment.LanguageService.Save(Language); Language.ID = l.ID; NotificationService.OnChangedLanguage(Language); } catch (DBDuplicateKeyException) { ErrorMessage(GetLocalized("languagenameexists")); return false; } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveLanguage"); form.ShowDialog(this); } return false; } } else { try { ClientEnvironment.LanguageService.SaveOrUpdate(Language); NotificationService.OnChangedLanguage(Language); } catch (DBDuplicateKeyException) { ErrorMessage(GetLocalized("languagenameexists")); return false; } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveLanguage"); form.ShowDialog(this); } return false; } } } } return true; }
public override bool Commit() { if (CountryColor == null) return true; if (CountryColor.IsNew || IsModified()) { CountryColor.L = LowValue ; CountryColor.Y = YValue ; CountryColor.X = XValue ; CountryColor.H = HighValue ; CountryColor.LCColour = LowerCriticalColor ; CountryColor.NColour = NormalColor ; CountryColor.HColour = HigherCautionColor ; CountryColor.LColour = LowCautionColor ; CountryColor.HCColour = HigherCriticalColor ; try { ClientEnvironment.ColouringService.SaveOrUpdate(CountryColor); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveColouring"); form.ShowDialog(this); return false; } } Modified = true; } return true; }
public override bool Commit() { if (_country != null) { long oldid = _country.CountryLanguage; long newid = (languageLookUpList.LanguageID); if (oldid != newid) { Modified = true; } _country.CountryLanguage = languageLookUpList.LanguageID; _country.LanguageID = SharedConsts.NeutralLangId; //languageLookUpList.LanguageID; //ClientEnvironment.LogonUser.LanguageID.Value ; /*byte b = Convert.ToByte(spinEditBaumaxID.Value); if (_country.SystemID1 != b) { _country.SystemID1 = b; Modified = true; } if (_country.SystemID2 != textEditBaumaxDescription.Text) { _country.SystemID2 = textEditBaumaxDescription.Text; Modified = true; } */ string value = textEditName.Text.Trim(); if (value != _country.Name) { Modified = true; _country.Name = value; } if (_country.IsNew) { Modified = true; try { _country = ClientEnvironment.CountryService.Save(_country); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveCountry"); form.ShowDialog(this); return false; } } } else if (Modified) { try { ClientEnvironment.CountryService.SaveOrUpdate(_country); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotSaveCountry"); form.ShowDialog(this); return false; } } } if (Modified) { if (languageLookUpList.Language != null) { _country.LanguageName = languageLookUpList.Language.Name; } } } return true; }
private static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += Application_ThreadException; ClientEnvironment.IsRuntimeMode = true; UCBaseEntity.IsDesignMode = false; DefaultDiction.BuildDefaultResource(); RemotingConfiguration.Configure("Baumax.Client.exe.config", false); // Define channel security IEnumerator channelEnum = ChannelServices.RegisteredChannels.GetEnumerator(); while (channelEnum.MoveNext()) { BasicChannelWithSecurity channel = channelEnum.Current as BasicChannelWithSecurity; if (channel != null) { channel.ITransportContext.IKeyStore.SetKey("/BAUMAX/SES", new KeyProvider_SelfEstablishingSymmetric()); } } if (!DoLogin()) { return; } try { mainForm = new MainForm(); mainForm.Text += String.Format(" - '{0}'", ClientEnvironment.AuthorizationService.GetCurrentUser().LoginName); ClientEnvironment.MainForm = mainForm; RequestNotificationService.Attach(mainForm); GenuineGlobalEventProvider.GenuineChannelsGlobalEvent += GenuineGlobalEventProvider_GenuineChannelsGlobalEvent; ReportLocalizer.InitDevExPreviewLocalizer(); DevExLocalizer.InitDevExLocalizer(); DevExGridLocalizer.InitDevExGridLocalizer(); Application.Run(mainForm); ClientEnvironment.DoLogout(); } catch (EntityException ex) { log.Error("Unhandled", ex); // 2think: how to localize? using (FrmEntityExceptionDetails frm = new FrmEntityExceptionDetails(ex)) { frm.Text = "Unhandled exception"; frm.ShowDialog(); } } catch (Exception ex) { log.Error("Unhandled", ex); MessageBox.Show(ex.ToString(), "Unhandled exception"); } }
public void DeleteEntity(Domain.Language aLang) { if (!ReadOnly) { List <long> ids = new List <long>(); int[] selectedIds = gridViewLanguages.GetSelectedRows(); foreach (int rowHandle in selectedIds) { Domain.Language lang = (Domain.Language)gridViewLanguages.GetRow(rowHandle); ids.Add(lang.ID); } if (ids.Count > 0) { if (QuestionMessageYes(GetLocalized("questiondeletelanguage"))) { // assume multiselect never be enabled. but just in case... if (ids.Count == 1) { try { ClientEnvironment.LanguageService.DeleteByID(ids[0]); System.Diagnostics.Debug.Assert(ids.Count == selectedIds.Length); // == 1 gridViewLanguages.DeleteRow(selectedIds[0]); } catch (DBReferenceConstraintConflictedException) { ErrorMessage(GetLocalized("LanguageAssignedToCountry")); } catch (ValidationException) { ErrorMessage(GetLocalized("CannotDeleteDefaultLanguage")); } catch (EntityException ex) { // 2think: what details should we show? // 2think: how to localize? using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex)) { form.Text = GetLocalized("CannotDeleteLanguage"); form.ShowDialog(this); } } } else { // assume multiselect will never be enabled. but just in case... try { ClientEnvironment.LanguageService.DeleteListByID(ids); foreach (int rowHandle in selectedIds) { gridViewLanguages.DeleteRow(rowHandle); } } catch (ValidationException) { ErrorMessage(GetLocalized("CannotDeleteDefaultLanguage")); } // can't exactly determine the reason of operation failure for each item separately // so just remove successfully deleted items from list and notify user catch (EntityException ex) { // 2think: isn't this too complicated? maybe we just should reread language list? if (ex.IDs != null) { List <long> failedIDs = new List <long>(ex.IDs); foreach (int rowHandle in selectedIds) { Domain.Language lang = (Domain.Language)gridViewLanguages.GetRow(rowHandle); if (failedIDs.Contains(lang.ID)) { continue; } gridViewLanguages.DeleteRow(rowHandle); } } ErrorMessage(GetLocalized("SomeLanguagesNotDeleted")); } } } } } }
private bool Login() { try { if (ClientEnvironment.ServerStateService.CanInteract) { if (ClientEnvironment.ServerStateService.ServerReady) { LoginResult result = ClientEnvironment.DoLogin(teLogin.Text, tePassword.Text); switch (result) { case LoginResult.Successful: if (ClientEnvironment.AuthorizationService.GetCurrentUser().ShouldChangePassword) { using (ChangePasswordForm cpf = new ChangePasswordForm()) { cpf.SetCaption(Localizer.GetLocalized("ShouldChangePassword")); cpf.ShowDialog(); } } return(true); case LoginResult.WrongLogin: case LoginResult.WrongPassword: XtraMessageBox.Show(this, Localizer.GetLocalized("WrongLoginOrPassword"), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); break; case LoginResult.UserIsInactive: XtraMessageBox.Show(this, Localizer.GetLocalized("UserIsInactive"), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); break; } } } } catch (EntityException ex) { // 2think: how to localize? using (FrmEntityExceptionDetails frm = new FrmEntityExceptionDetails(ex)) { frm.ShowDialog(this); } } catch (Exception ex) { if (ex is SocketException || ex.InnerException is SocketException) { XtraMessageBox.Show(this, Localizer.GetLocalized("ServerIsUnavailable"), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { XtraMessageBox.Show(this, ex.Message, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); } } return(false); }