コード例 #1
0
        // Then create public set and get properties
        public void save()
        {
            // we will make a call to Data Access Layer to Insert
            //these value to SQL Server
            clsSqlServer obj = new clsSqlServer();

            obj.InsertCustomer(_CustomerName, _CountryName, _Gender, _Hobbies, _Email, _IsMarried);
        }
コード例 #2
0
ファイル: Class1.cs プロジェクト: Naseefk/Customer-Data
        public void save()
        {
            clsSqlServer objSave = new clsSqlServer();

            objSave.InsertCustomer(_CustomerName,
                                   _CountryName,
                                   _Gender,
                                   _Hobbies,
                                   _IsMarried,
                                   _Email);
        }
コード例 #3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            // Create a preview Form Object

            string sex     = "";
            string hobbies = "";
            string email   = "";
            bool   status  = false;

            //Gender selection grab value
            if (male.Checked)
            {
                sex = "Male";
            }
            else
            {
                sex = "Female";
            }

            // Hobbies selection grab value
            if (Painting.Checked)
            {
                hobbies = "Painting";
            }
            else
            {
                hobbies = "Reading";
            }
            //Status selection grab value
            if (Married.Checked)
            {
                status = true;
            }
            else
            {
                status = false;
            }


            // ADO.net code which will insert data to sql server
            email = txtEmail.Text;
            clsSqlServer insertObj = new clsSqlServer();

            insertObj.InsertCustomer(txtCustomerName.Text, ddlCountries.Text, sex, hobbies, txtEmail.Text, status);
            loadCustomers();
            ClearData();
        }
コード例 #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string gender  = "";
            string hobbies = "";
            string status  = "";

            if (rdoMale.Checked)
            {
                gender = "Male";
            }
            else
            {
                gender = "Female";
            }

            if (chkReading.Checked)
            {
                hobbies = "Reading";
            }
            else
            {
                hobbies = "Sports";
            }

            if (rdoMarried.Checked)
            {
                status = "1";
            }
            else
            {
                status = "0";
            }

            clsSqlServer objInsert = new clsSqlServer();

            objInsert.InsertCustomer(txtCustomerName.Text,
                                     cboCountry.Text,
                                     gender,
                                     hobbies,
                                     status);

            ClearData();
            LoadCustomers();
        }