Solved

WCF Architecture

Posted on 2011-03-20
2
500 Views
Last Modified: 2012-05-11
Experts
please see the attached images and the code also.
please see the images are 1,2,3,4,5,6,7,8,9 serial wise.
I do not know how to explain the entire thing so I have explained them in images.
thanking you
anindya
1 1 2
//code behind of the Quotation.cs form(Winform Form)
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;
using Presentation.Common;
using BLL.Modules.Account;
using BLL.Account;

namespace Presentation.Account.Quotation
{
    public partial class QuotationCreation : Skin
    {
        BLL.Modules.Account.Quotation q = new BLL.Modules.Account.Quotation();
        AccountBO ab = new AccountBO();
        public QuotationCreation()
        {
            InitializeComponent();
            this.Load += new EventHandler(QuotationCreation_Load);
            this.button_OK.Click += new EventHandler(button_OK_Click);
        }
        public int _saved = 0;
        public int Saved
        {
            get
            {
                return _saved;
            }
            set
            {
                _saved = value;
            }
        }

        void button_OK_Click(object sender, EventArgs e)
        {
            SaveQuotation();
            if (Saved == 1)
            {
                this.Close();
            }
            else
            {

            }
        }

        private void SaveQuotation()
        {
            q.Description = textBox_Description.Text.Trim();
            q.ChargeDuration = textBox_ChargeDuration.Text.Trim();
            q.ShipDate = dateTimePicker_ShipDate.Value;
            q.ReturnDate = dateTimePicker_ReturnDate.Value;
            int? CustomerInfoID = null;
            q.CustomerInfoID =Convert.ToInt32( CustomerInfoID);

            if ((textBox_IDCustomerInfo.Text.Trim() != null) && (textBox_IDCustomerInfo.Text.Trim() != ""))
            {
                q.CustomerInfoID = Convert.ToInt32(textBox_IDCustomerInfo.Text.Trim());
            }
                        
            q.CustomerInfoCompany = textBox_Company.Text.Trim();
            q.CustomerInfoContact = textBox_Contact.Text.Trim();
            q.ShipVia = comboBox_ShipVia.SelectedIndex.ToString();
            q.ReturnVia = comboBox_ReturnVia.SelectedIndex.ToString();
            q.UserName = textBox_UserName.Text.Trim();
            if (checkBox_SalesOrder.Checked)
            {
                q.SaleOrder = "Y";
            }
            else
            {
                q.SaleOrder = "N";
            }
            if (checkBox_EventPricing.Checked)
            {
                q.EventPricing = "Y";
            }
            else
            {
                q.EventPricing = "N";
            }
            int? BillingCompanyInfoID = null;
            q.BillingCoInfoID =Convert.ToInt32(  BillingCompanyInfoID);
            if (textBox_IDBillingCoInfo.Text.Trim() != "")
            {
                q.BillingCoInfoID =Convert.ToInt32( textBox_IDBillingCoInfo.Text.Trim());
            }
            q.BillingInfoCompany = textBox_CompanyBillingCoInfo.Text.Trim();
            q.BillingInfoContact = textBox_ContactBillingCoInfo.Text.Trim();
            string msg = ab.Save("Table_Quotation", q);
            if (msg.ToString() == "Saved")
            {
                MyMessageBox.ShowBox(msg.ToString());
                _saved = 1;
            }
            else
            {
                MyMessageBox.ShowBox(msg.ToString());
                _saved = 0;
            }
            
        }

        void QuotationCreation_Load(object sender, EventArgs e)
        {
            SetSkin("Theme1");
            this.Text = "Order Information";
        }
                
    }
}




//here is the Quotation.cs class of the BLL >Module> Account

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BLL.Modules.Account
{
    public class Quotation
    {
        public Int32 QuotationID
        {
            get;
            set;
        }
        public string Description
        {
            get;
            set;
        }
        public string ChargeDuration
        {
            get;
            set;
        }
        public DateTime ShipDate
        {
            get;
            set;
        }
        public DateTime ReturnDate
        {
            get;
            set;
        }
        public Int32 CustomerInfoID
        {
            get;
            set;
        }
        public string CustomerInfoCompany
        {
            get;
            set;
        }
        public string CustomerInfoContact
        {
            get;
            set;
        }
        public string ShipVia
        {
            get;
            set;
        }
        public string ReturnVia
        {
            get;
            set;
        }
        public string UserName
        {
            get;
            set;
        }
        public string SaleOrder
        {
            get;
            set;
        }
        public string EventPricing
        {
            get;
            set;
        }
        public Int32 BillingCoInfoID
        {
            get;
            set;
        }
        public string BillingInfoCompany
        {
            get;
            set;
        }
        public string BillingInfoContact
        {
            get;
            set;
        }
            
    }
}

Open in new window

3.JPG
4.JPG
5.JPG
6.JPG
7.JPG
8.JPG
9.JPG
0
Comment
Question by:ANINDYA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
lenordiste earned 500 total points
ID: 35175822
if I understood your problem correctly you are facing design issues due to the DTO design pattern. Here is some litterature on it:
http://www.designpatternsfor.net/default.aspx?pid=99

You should regard your DataContract as a DTO. Since you wish to keep a 3 tier architecture and make minimum changes I would advise you to put all your WCF logic inside the BLL.
The problem you are facing is that at one point you have a WCF function (namely ListCustomers) which needs to return a datacontract while your DAL only works with "actual business" objects. There are two ways to work around this issue:
- implement methods in your DLL to convert DTO to business classes and vice versa.
- make the transformation as needed directly in your WCF service methods: call your DAL methods directly from your WCF service methods and transform the data on the fly into a data contract (usually easily done with linq).

0
 

Author Closing Comment

by:ANINDYA
ID: 35885559
My membership had expired so I failed to accept your answer as solution.sorry
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question