1
Reply

N-Tier Building

Gurkan

Gurkan

Jan 2 2009 11:10 AM
3.8k
Hi,
I try to separate the project like business-tier, presentation-tier etc. but I have some problems.
I have a form in presentation tier(telephone book), it has three button: insert, update, delete.
In the business tier, I want to do the operations(insert, update, delete).
I create a class library(Business-tier), and add a class(Operations). So, insert update and delete are the methods in this class.

First question, is the main-building right ?

Second question, this is my Insert code:
public static void Insert()
        {
            XmlTextWriter xmlDocument = new XmlTextWriter(@"c:\deneme.xml", System.Text.UTF8Encoding.UTF8);
            try
            {
               
                xmlDocument.WriteStartDocument();
               
                xmlDocument.WriteStartElement("kisiler");
                xmlDocument.WriteStartElement("kisi");
                xmlDocument.WriteElementString("ad",textBox1.Text);//error
                xmlDocument.WriteElementString("soyad", textBox2.Text);//error
                xmlDocument.WriteElementString("telefon", textBox3.Text);//error
                xmlDocument.WriteElementString("yas", textBox4.Text);//error

                xmlDocument.WriteEndElement();
                xmlDocument.WriteEndElement();

                xmlDocument.WriteEndDocument();
               
                xmlDocument.Close();
            }
            catch (Exception ex)
            {
                throw new Exception("No Insert");
            }
        }

textBox1,2,3,4 are in my form(in the presentation-tier). How can I use them in here..?  Or, what are the other ways ?

Answers (1)