Sunday, July 3, 2016

Code C# --> Web form to AX data entry




using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication7
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            ServiceReference1.IntegrationCustomServiceClient clien = new ServiceReference1.IntegrationCustomServiceClient();
            clien.ClientCredentials.Windows.ClientCredential.UserName = "AosServiceUser";
            clien.ClientCredentials.Windows.ClientCredential.Password = "r1@jNjWtTMNcKx";
            clien.ClientCredentials.Windows.ClientCredential.Domain = "epgax.com";
            ServiceReference1.CallContext context = new ServiceReference1.CallContext();
            //ServiceReference1.ClsRegistration parm = new ServiceReference1.ClsRegistration();
            ServiceReference1.ClsPayment parm = new ServiceReference1.ClsPayment();
            ServiceReference1.ClsAXTransactionMessage[] getTransMsg = null;  // new ServiceReference1.ClsAXTransactionMessage[1];
            parm.AcademicYear = ServiceReference1.AcademicYear.Next;
            parm.TrasactionDate = DateTime.Today;
            parm.PaymentType = ServiceReference1.PayType.Fee;
            parm.Amount = 100;
            parm.CustomerAccount = "2001F";
            parm.AxDocDocumentNo = "2001F";
            parm.EFormDocumentNo = "EFORM2001F";
            parm.DimensionBU = "99";
            parm.DimensionCC = "37";
            parm.DimensionDept = "1";
            parm.Description = "Payment towards Next year student";
            context.Company = "EPGE";
            context.LogonAsUser = "AosServiceUser@epgax.com";
            context.Language = "EN-US";
            getTransMsg = clien.CreatePayment(context, parm);
            if (getTransMsg != null)
            {
                foreach (ServiceReference1.ClsAXTransactionMessage item in getTransMsg)
                {
                     MessageBox.Show(item.AxDocDocumentNo);
                     MessageBox.Show(item.EFormDocumentNo);
                     MessageBox.Show(item.AXOperationType);
                     MessageBox.Show(item.StatusMessage);
                     MessageBox.Show(item.SuccesFlag.ToString());
                }
              
            }
            clien.Close();
        }
    }
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...