private void OpenDCB(DcbCredentials dcbCredentials) { if (null != DcbFacade) { return; // Already opened } DcbFacade = new DcbFacade(); if (null == dcbCredentials) { Tracer.Debug("DcbParser: Opening unsecured DCB database {0}", DcbOpticonJobBEO.DcbSourcePath); DcbFacade.OpenDCB(DcbOpticonJobBEO.DcbSourcePath, null, null); } else { Tracer.Debug("DcbParser: Opening secured DCB database {0}", DcbOpticonJobBEO.DcbSourcePath); DcbFacade.OpenDCB(DcbOpticonJobBEO.DcbSourcePath, dcbCredentials.Login, dcbCredentials.Password); } //Fix for UI bug IncludeDcbFieldsForContentInFieldMapping(); }
private void OpenDCBWithCreds() { //Adding one more empty pair to handle the case where user passes credentials for the //unsecured dcbs DcbOpticonJobBEO.DcbCredentialList.Add(Convert.ToString((char)174)); //If it is a secured dcb foreach (var usernamepasswordpair in DcbOpticonJobBEO.DcbCredentialList) { if (usernamepasswordpair == null) { continue; } var uidpwd = usernamepasswordpair.Split(new[] { (char)174 }); var login = uidpwd[0]; var password = (uidpwd.Length > 1) ? uidpwd[1] : ""; if (!string.IsNullOrEmpty(password)) { password = ApplicationConfigurationManager.Decrypt(password, ApplicationConfigurationManager.GetValue(UNPWEncryption, UNPWDataSecurity)); } try { Tracer.Debug("DcbSlicer: Opening secured DCB database {0}", DcbOpticonJobBEO.DcbSourcePath); DcbFacade.OpenDCB(DcbOpticonJobBEO.DcbSourcePath, login, password); DcbCredentials = new DcbCredentials { Login = login, Password = password }; return; } catch (Dcb2EvException ex) { if (ex.ErrorCode != (int)DcbFacadeErrorCodes.AccessDenied) { throw; } ex.Trace().Swallow(); } } var message = String.Format("Tried all login/password pairs for {0} and none worked", DcbOpticonJobBEO.DcbSourcePath); throw new Dcb2EvException(message, (int)DcbFacadeErrorCodes.AccessDenied); }
private void OpenDCBWithoutCreds() { Tracer.Debug("DcbSlicer: Opening unsecured DCB database {0}", DcbOpticonJobBEO.DcbSourcePath); DcbFacade.OpenDCB(DcbOpticonJobBEO.DcbSourcePath, null, null); }