Esempio n. 1
0
        /// <summary>
        /// Delete SAP record if exist
        /// </summary>
        /// <param name="sap">SAP connection</param>
        /// <param name="key">Key to delete</param>
        /// <returns></returns>
        public bool Delete(SAPConnection sap, int key)
        {
            IEmployeesInfo partner = sap.Company.GetBusinessObject(BoObjectTypes.oEmployeesInfo);

            if (partner.GetByKey(key))
            {
                sap.CheckResponse(partner.Remove());
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new business partner
        /// </summary>
        /// <param name="sap">SAP connection</param>
        /// <param name="firstName">First name</param>
        /// <param name="lastName">Last name</param>
        /// <param name="active">Employee activation</param>
        /// <returns>Retrieve new object key</returns>
        public int Create(
            SAPConnection sap,
            string firstName,
            string lastName,
            bool active)
        {
            IEmployeesInfo partner = sap.Company.GetBusinessObject(BoObjectTypes.oEmployeesInfo);

            partner.FirstName = firstName;
            partner.LastName  = lastName;
            partner.Active    = active ? BoYesNoEnum.tYES : BoYesNoEnum.tNO;

            sap.CheckResponse(partner.Add());
            return(int.Parse(sap.Company.GetNewObjectKey()));
        }