Mostrando entradas con la etiqueta BUSSINESS PARTNER. Mostrar todas las entradas
Mostrando entradas con la etiqueta BUSSINESS PARTNER. Mostrar todas las entradas

jueves, 10 de noviembre de 2016

EJEMPLO SUBIR CONTACTOS SAP B1 SDK DI API EN C#

SAPbobsCOM.BusinessPartners MiSocio;
         MiSocio = (SAPbobsCOM.BusinessPartners)Miconexion.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners);
                    SAPbobsCOM.BPAddresses Direcciones;
                    Direcciones =MiSocio.Addresses;          

sqlconContact.Open();
                        string sQueryContact;
                        sQueryContact = "SELECT [CardCode], [Name], [Position], [Address], [Tel1], [Tel2], [Cellolar], [Fax], [E_MailL], [Pager],"+
                            "[Notes1], [Notes2], [Password], [BirthPlace], [Gender], [Profession], [BirthCity], [Active] FROM OCPR WHERE CardCode='"+CardCode+"'";
                        SqlCommand cmdContact;
                        SqlDataReader drContact;
                        cmdContact = new SqlCommand(sQueryContact, sqlconContact);
                        drContact = cmdContact.ExecuteReader();
                        if (drContact.HasRows)
                        {
                            int registro = 0;
                            while (drContact.Read())
                            {
                                MiSocio.ContactEmployees.Add();
                                MiSocio.ContactEmployees.SetCurrentLine(registro);
                                MiSocio.ContactEmployees.Name = drContact["Name"].ToString();
                                MiSocio.ContactEmployees.Pager = drContact["Pager"] == null ? string.Empty : drContact["Pager"].ToString();
                                MiSocio.ContactEmployees.Remarks1 = drContact["Notes1"].ToString();
                                MiSocio.ContactEmployees.Remarks2 = drContact["Notes2"].ToString();
                                MiSocio.ContactEmployees.Phone1 = drContact["Tel1"].ToString();
                                MiSocio.ContactEmployees.Phone2 = drContact["Tel2"].ToString();
                                MiSocio.ContactEmployees.Address = drContact["Address"].ToString();
                                MiSocio.ContactEmployees.Position = drContact["Position"].ToString();
                                MiSocio.ContactEmployees.MobilePhone = drContact["Cellolar"].ToString();
                                MiSocio.ContactEmployees.E_Mail = drContact["E_mailL"].ToString();
                                switch(drContact["Active"].ToString())
                                {
                                    case "Y":
                                        MiSocio.ContactEmployees.Active = BoYesNoEnum.tYES;
                                        break;
                                    case "N":
                                        MiSocio.ContactEmployees.Active = BoYesNoEnum.tNO;
                                        break;
                                }
                                registro++;
                            }
                        }
                        drContact.Close();
                        sqlconContact.Close();