Click here to Skip to main content
15,897,187 members
Articles / Programming Languages / C# 3.5

Integrate Microsoft Dynamics Axapta with Temperature Conversion C# Application - Part II

Rate me:
Please Sign up or sign in to vote.
4.86/5 (6 votes)
14 Dec 2010CPOL5 min read 72.2K   1.1K   13  
This article will demonstrate that after sending the data from Axapta to Temperature conversion application, how we can post back the converted temperature to Axapta.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CvrtC2Frnt
{
    public partial class ShowTemperature : Form
    {
       
        public ShowTemperature(double Temperature, Boolean Fahrenheit, string SalesId)
        {
            InitializeComponent();
            txtSourceTmp.Text = Temperature.ToString();
            ConvertTemp.Faren = Fahrenheit;
            ConvertTemp.sourceTemp = Temperature;
            ConvertTemp.SalesId = SalesId;
            
        }

        private void btnConvert_Click(object sender, EventArgs e)
        {
            AxHelper axhlp = new AxHelper();

            if (ConvertTemp.Faren == true)
            {
                txtDestTmp.Text = Convert.ToString(ConvertTemp.ConvertFahrenheitToCelsius(double.Parse(txtSourceTmp.Text)));
                axhlp.SetAxRec(false, ConvertTemp.ConvertFahrenheitToCelsius(double.Parse(txtSourceTmp.Text)),ConvertTemp.SalesId);

            }

            if (ConvertTemp.Faren == false)
            {
                txtDestTmp.Text = Convert.ToString(ConvertTemp.ConvertCelsiusToFahrenheit(double.Parse(txtSourceTmp.Text)));
                axhlp.SetAxRec(true, ConvertTemp.ConvertCelsiusToFahrenheit(double.Parse(txtSourceTmp.Text)), ConvertTemp.SalesId);

           }
        }

        private void ShowTemperature_Load(object sender, EventArgs e)
        {
            if (ConvertTemp.Faren == true)
            {
                lblsrcTemp.Text = "Farenheit";
                lbldesTemp.Text = "Celsius";
            }
            else
            {
                lblsrcTemp.Text = "Celsius";
                lbldesTemp.Text = "Farenheit";
            }
        } 

        
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions