Esempio n. 1
0
        public IHttpActionResult UpdateItem(Authorizations authorizations)
        {
            //Inicializo mi conexión a SAP
            SAPConnection conncetion = new SAPConnection();

            SAPbobsCOM.Company company = conncetion.OpenConnection();

            SAPbobsCOM.CompanyService          oCompanyService = company.GetCompanyService();
            SAPbobsCOM.ApprovalRequestsService approvalSrv     = oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.ApprovalRequestsService);
            ApprovalRequestParams oParams = approvalSrv.GetDataInterface(ApprovalRequestsServiceDataInterfaces.arsApprovalRequestParams) as ApprovalRequestParams;

            oParams.Code = authorizations.WddCode;
            ApprovalRequest oData = approvalSrv.GetApprovalRequest(oParams);

            //Agregar una autorización
            oData.ApprovalRequestDecisions.Add();
            oData.ApprovalRequestDecisions.Item(0).ApproverUserName = "******";
            oData.ApprovalRequestDecisions.Item(0).ApproverPassword = "******";
            oData.ApprovalRequestDecisions.Item(0).Status           = BoApprovalRequestDecisionEnum.ardApproved;
            oData.ApprovalRequestDecisions.Item(0).Remarks          = authorizations.Remarks;

            //Actualizar la autorización
            approvalSrv.UpdateRequest(oData);
            return(Ok(responseCall));
        }
Esempio n. 2
0
        public IHttpActionResult UpdateItems([FromBody] Authorizations authorizations)
        {
            //Inicializo mi conexión a SAP
            SAPConnection conncetion = new SAPConnection();

            SAPbobsCOM.Company company = conncetion.OpenConnection(authorizations.dbname, authorizations.userSap, authorizations.userSapPass);

            SAPbobsCOM.CompanyService          oCompanyService = company.GetCompanyService();
            SAPbobsCOM.ApprovalRequestsService approvalSrv     = oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.ApprovalRequestsService);
            ApprovalRequestParams oParams = approvalSrv.GetDataInterface(ApprovalRequestsServiceDataInterfaces.arsApprovalRequestParams) as ApprovalRequestParams;

            oParams.Code = authorizations.WddCode;
            ApprovalRequest oData = approvalSrv.GetApprovalRequest(oParams);

            //Agregar una autorización
            oData.ApprovalRequestDecisions.Add();
            oData.ApprovalRequestDecisions.Item(0).ApproverUserName = authorizations.userSap;
            oData.ApprovalRequestDecisions.Item(0).ApproverPassword = authorizations.userSapPass;
            //Autorizar
            if (authorizations.Status == "Y")
            {
                oData.ApprovalRequestDecisions.Item(0).Status = BoApprovalRequestDecisionEnum.ardApproved;
            }
            else
            if (authorizations.Status == "N")
            {
                oData.ApprovalRequestDecisions.Item(0).Status = BoApprovalRequestDecisionEnum.ardNotApproved;
            }
            oData.ApprovalRequestDecisions.Item(0).Remarks = authorizations.Remarks;

            //Actualizar la autorización
            approvalSrv.UpdateRequest(oData);
            return(Ok(authorizations));
        }
Esempio n. 3
0
        public IHttpActionResult AutorizacionesMasivas([FromBody] AuthorizationsM authorizationsm)
        {
            //return Ok (authorizationsm.WddCode[1]);
            //Inicializo mi conexión a SAP
            SAPConnection conncetion = new SAPConnection();

            SAPbobsCOM.Company company = conncetion.OpenConnection(authorizationsm.dbname, authorizationsm.userSap, authorizationsm.userSapPass);

            SAPbobsCOM.CompanyService          oCompanyService = company.GetCompanyService();
            SAPbobsCOM.ApprovalRequestsService approvalSrv     = oCompanyService.GetBusinessService(SAPbobsCOM.ServiceTypes.ApprovalRequestsService);
            ApprovalRequestParams oParams = approvalSrv.GetDataInterface(ApprovalRequestsServiceDataInterfaces.arsApprovalRequestParams) as ApprovalRequestParams;

            for (int i = 0; i < authorizationsm.WddCode.Length; i++)
            {
                oParams.Code = authorizationsm.WddCode[i];
                ApprovalRequest oData = approvalSrv.GetApprovalRequest(oParams);

                //Agregar una autorización
                oData.ApprovalRequestDecisions.Add();
                oData.ApprovalRequestDecisions.Item(0).ApproverUserName = authorizationsm.userSap;
                oData.ApprovalRequestDecisions.Item(0).ApproverPassword = authorizationsm.userSapPass;
                //Autorizar
                if (authorizationsm.Status == "Y")
                {
                    oData.ApprovalRequestDecisions.Item(0).Status = BoApprovalRequestDecisionEnum.ardApproved;
                }
                else
                if (authorizationsm.Status == "N")
                {
                    oData.ApprovalRequestDecisions.Item(0).Status = BoApprovalRequestDecisionEnum.ardNotApproved;
                }
                oData.ApprovalRequestDecisions.Item(0).Remarks = authorizationsm.Remarks;
                //Actualizar la autorización

                approvalSrv.UpdateRequest(oData);
            }

            return(Ok(responseCall));
            //return Json(new { status = "error", message = "error creating customer" });
        }