public void AddBusinessPartnerContact(ContactEmployee contact, AppConnData oAppConnData) { bizBusinessPartner.AddContact(contact, oAppConnData); }
public List<ContactEmployee> GetContactList(string cardCode) { StringBuilder oSQL = new StringBuilder(); oSQL.Append("SELECT name, firstName, middleName, lastName, title, position, address, tel1, tel2, cellolar, e_maill "); oSQL.Append("FROM OCPR T0 "); oSQL.Append(string.Format("WHERE cardCode = '{0}'", cardCode)); DbCommand myCommand = this.dataBase.GetSqlStringCommand(oSQL.ToString()); List<ContactEmployee> contacts = new List<ContactEmployee>(); using (this.reader = this.dataBase.ExecuteReader(myCommand)) { while (this.reader.Read()) { ContactEmployee contact = new ContactEmployee(); contact.name = this.reader.IsDBNull(0) ? "" : this.reader.GetValue(0).ToString(); contact.firstName = this.reader.IsDBNull(1) ? "" : this.reader.GetValue(1).ToString(); contact.middleName = this.reader.IsDBNull(2) ? "" : this.reader.GetValue(2).ToString(); contact.lastName = this.reader.IsDBNull(3) ? "" : this.reader.GetValue(3).ToString(); contact.title = this.reader.IsDBNull(4) ? "" : this.reader.GetValue(4).ToString(); contact.position = this.reader.IsDBNull(5) ? "" : this.reader.GetValue(5).ToString(); contact.address = this.reader.IsDBNull(6) ? "" : this.reader.GetValue(6).ToString(); contact.telephone1 = this.reader.IsDBNull(7) ? "" : this.reader.GetValue(7).ToString(); contact.telephone2 = this.reader.IsDBNull(8) ? "" : this.reader.GetValue(8).ToString(); contact.cellolar = this.reader.IsDBNull(9) ? "" : this.reader.GetValue(9).ToString(); contact.e_mail = this.reader.IsDBNull(10) ? "" : this.reader.GetValue(10).ToString(); contacts.Add(contact); } } return contacts; }
public void AddBusinessPartnerContact(ContactEmployee contact, AppConnData oAppConnData) { try { facade = new BizFacade(BusinessClass.BizBusinessPartner); facade.AddBusinessPartnerContact(contact, oAppConnData); } catch (Exception ex) { DataAccessFault detalleError = new DataAccessFault(); foreach (string valores in ex.Data.Keys) { switch (valores) { case "1": detalleError.ErrorID = ex.Data[valores].ToString(); break; case "2": detalleError.ErrorSAP = ex.Data[valores].ToString(); break; case "3": detalleError.Description = ex.Data[valores].ToString(); break; default: detalleError.ErrorID = ex.Data[valores].ToString(); break; } } throw new FaultException<DataAccessFault>(detalleError, "Error al Procesar la solicitud"); } }
public void AddContact(ContactEmployee contact, SAPConnection sapConn) { List<ContactEmployee> contacts = GetContactList(contact.cardCode); BusinessPartners bp; //= new BusinessPartners(); bp = (BusinessPartners)sapConn.company.GetBusinessObject(BoObjectTypes.oBusinessPartners); bp.GetByKey(contact.cardCode); int contactQty = contacts.Count(); bp.ContactEmployees.Add(); bp.ContactEmployees.SetCurrentLine(contactQty); bp.ContactEmployees.Name = contact.name; if (!string.IsNullOrEmpty(contact.firstName)) bp.ContactEmployees.FirstName = contact.firstName; if (!string.IsNullOrEmpty(contact.middleName)) bp.ContactEmployees.MiddleName = contact.middleName; if (!string.IsNullOrEmpty(contact.lastName)) bp.ContactEmployees.LastName = contact.lastName; if (!string.IsNullOrEmpty(contact.title)) bp.ContactEmployees.Title = contact.title; if (!string.IsNullOrEmpty(contact.position)) bp.ContactEmployees.Position = contact.position; if (!string.IsNullOrEmpty(contact.address)) bp.ContactEmployees.Address = contact.address; if (!string.IsNullOrEmpty(contact.telephone1)) bp.ContactEmployees.Phone1 = contact.telephone1; if (!string.IsNullOrEmpty(contact.telephone2)) bp.ContactEmployees.Phone2 = contact.telephone2; if (!string.IsNullOrEmpty(contact.cellolar)) bp.ContactEmployees.MobilePhone = contact.cellolar; if (!string.IsNullOrEmpty(contact.e_mail)) bp.ContactEmployees.E_Mail = contact.e_mail; bp.Update(); }
public bool AddContact(ContactEmployee contact, AppConnData oAppConnData) { try { if (!BizUtilities.ValidateServiceConnection(oAppConnData)) throw new BusinessException(15, "Nombre de Usuario o Contraseña incorrecta para el Servicio"); oAppConnData = BizUtilities.GetDataConnection(oAppConnData); string licenseServer = Cryptography.Decrypt(HexSerialization.HexToString(ConfigurationManager.AppSettings["licenseServer"])); string dbServer = Cryptography.Decrypt(HexSerialization.HexToString(ConfigurationManager.AppSettings["dbServer"])); string dbUser = Cryptography.Decrypt(HexSerialization.HexToString(ConfigurationManager.AppSettings["dbUser"])); string dbUserPassword = Cryptography.Decrypt(HexSerialization.HexToString(ConfigurationManager.AppSettings["dbUserPassword"])); string serverType = ConfigurationManager.AppSettings["serverType"]; DataConnection = new SAPConnectionData(oAppConnData.dataBaseName, licenseServer, dbServer, oAppConnData.sapUser, oAppConnData.sapUserPassword, dbUser, dbUserPassword, serverType); if (DataConnection.ConnectCompany(oAppConnData.dataBaseName, oAppConnData.sapUser, oAppConnData.sapUserPassword)) { DataConnection.BeginTran(); BusinessPartnerAccess = new BusinessPartnerData(oAppConnData.adoConnString); BusinessPartnerAccess.AddContact(contact, DataConnection.Conn); DataConnection.EndTranAndRelease(BoWfTransOpt.wf_Commit); return true; } } #region Catch catch (SAPException ex) { DataConnection.EndTranAndRelease(SAPbobsCOM.BoWfTransOpt.wf_RollBack); BizUtilities.ProcessSapException(ex, "Gestión de Pagos"); return false; } catch (COMException ex) { DataConnection.EndTranAndRelease(SAPbobsCOM.BoWfTransOpt.wf_RollBack); Exception outEx; try { if (ExceptionPolicy.HandleException(ex, "Politica_Excepcion_Com", out outEx)) { outEx.Data.Add("1", "3"); outEx.Data.Add("2", "NA"); outEx.Data.Add("3", outEx.Message); throw outEx; } else { throw; } } catch (Exception) { } throw new Exception(ex.Message + "::" + ex.StackTrace); } catch (DbException ex) { Exception outEx; if (ExceptionPolicy.HandleException(ex, "Politica_SQLServer", out outEx)) { outEx.Data.Add("1", "14"); outEx.Data.Add("2", "NA"); //outEx.Data.Add("3", outEx.Message); outEx.Data.Add("3", outEx.Message + " Descripción: " + ex.Message); throw outEx; } else { throw ex; } } catch (BusinessException ex) { ex.Data.Add("1", ex.ErrorId); ex.Data.Add("2", "NA"); ex.Data.Add("3", ex.Message); throw ex; } catch (Exception ex) { DataConnection.EndTranAndRelease(SAPbobsCOM.BoWfTransOpt.wf_RollBack); Exception outEx; if (ex.Data["1"] == null) { if (ExceptionPolicy.HandleException(ex, "Politica_ExcepcionGenerica", out outEx)) { outEx.Data.Add("1", "3"); outEx.Data.Add("2", "NA"); outEx.Data.Add("3", outEx.Message); throw outEx; } } else { throw ex; //return 0; } return false; } #endregion return false; }