public customer customerByProductOrderID()
        {
            customer customer = new customer();
            createConnection();
            SqlDataAdapter adapter = new SqlDataAdapter("Select customerId,ProductOrderID from productOrderSell", connection);
            adapter.Fill(customerByProductOrderId);

            DataTable table = new DataTable();
            SqlDataAdapter adapter2 = new SqlDataAdapter("Select * from customerdb", connection);
            adapter2.Fill(table);

            for (int i = 0; i < customerByProductOrderId.Rows.Count; i++)
            {
                for (int j = 0; j < table.Rows.Count; j++)
                {
                    if (Convert.ToInt32(table.Rows[j][0])==Convert.ToInt32(customerByProductOrderId.Rows[i][0]))
                    {
                        customer.code = Convert.ToInt32(customerByProductOrderId.Rows[i][0]);
                        customer.name= table.Rows[j][1].ToString();
                        customer.surname = table.Rows[j][2].ToString();
                    }
                }
            }
            return customer;
        }
        public void customerAdd(customer customer)
        {
            createConnection();
            if (connection.State==ConnectionState.Closed)
            {
                connection.Open();
            }

            SqlCommand command = new SqlCommand();
            command.Connection = connection;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "customerAdd";

            command.Parameters.Add("@name", SqlDbType.NVarChar, 50);
            command.Parameters["@name"].Value = customer.name;
            command.Parameters.Add("@surname", SqlDbType.NVarChar, 50);
            command.Parameters["@surname"].Value = customer.surname;
            command.Parameters.Add("@title", SqlDbType.NVarChar, 50);
            command.Parameters["@title"].Value = customer.title;
            command.Parameters.Add("@accountNumber", SqlDbType.Int, 50);
            command.Parameters["@accountNumber"].Value = customer.accountNumber;
            command.Parameters.Add("@bankName", SqlDbType.NVarChar, 50);
            command.Parameters["@bankName"].Value = customer.bankName;
            command.Parameters.Add("@officeName", SqlDbType.NVarChar, 50);
            command.Parameters["@officeName"].Value = customer.officeName;
            command.Parameters.Add("@officeCode", SqlDbType.Int, 50);
            command.Parameters["@officeCode"].Value = customer.officeCode;
            command.Parameters.Add("@billTitle", SqlDbType.NVarChar, 50);
            command.Parameters["@billTitle"].Value = customer.billTitle;
            command.Parameters.Add("@taxDepartment", SqlDbType.NVarChar, 50);
            command.Parameters["@taxDepartment"].Value = customer.taxDepartment;
            command.Parameters.Add("@taxNumber", SqlDbType.Int, 50);
            command.Parameters["@taxNumber"].Value = customer.taxNumber;
            command.Parameters.Add("@billAdress", SqlDbType.NVarChar, 50);
            command.Parameters["@billAdress"].Value = customer.billAdress;
            command.Parameters.Add("@tel1", SqlDbType.Int, 50);
            command.Parameters["@tel1"].Value = customer.tel1;
            command.Parameters.Add("@tel1code", SqlDbType.Int, 50);
            command.Parameters["@tel1code"].Value = customer.tel1code;
            command.Parameters.Add("@tel2", SqlDbType.Int, 50);
            command.Parameters["@tel2"].Value = customer.tel2;
            command.Parameters.Add("@tel2code", SqlDbType.Int, 50);
            command.Parameters["@tel2code"].Value = customer.tel2code;
            command.Parameters.Add("@tel3", SqlDbType.Int, 50);
            command.Parameters["@tel3"].Value = customer.tel3;
            command.Parameters.Add("@tel3code", SqlDbType.Int, 50);
            command.Parameters["@tel3code"].Value = customer.tel3code;
            command.Parameters.Add("@tel4", SqlDbType.Int, 50);
            command.Parameters["@tel4"].Value = customer.tel4;
            command.Parameters.Add("@tel4code", SqlDbType.Int, 50);
            command.Parameters["@tel4code"].Value = customer.tel4code;
            command.Parameters.Add("@tel5", SqlDbType.Int, 50);
            command.Parameters["@tel5"].Value = customer.tel5;
            command.Parameters.Add("@tel5code", SqlDbType.Int, 50);
            command.Parameters["@tel5code"].Value = customer.tel5code;
            command.Parameters.Add("@tel6", SqlDbType.Int, 50);
            command.Parameters["@tel6"].Value = customer.tel6;
            command.Parameters.Add("@tel6code", SqlDbType.Int, 50);
            command.Parameters["@tel6code"].Value = customer.tel6code;
            command.Parameters.Add("@addhood", SqlDbType.NVarChar, 50);
            command.Parameters["@addhood"].Value = customer.addhood;
            command.Parameters.Add("@addstreet", SqlDbType.NVarChar, 50);
            command.Parameters["@addstreet"].Value = customer.addstreet;
            command.Parameters.Add("@addstreeet", SqlDbType.NVarChar, 50);
            command.Parameters["@addstreeet"].Value = customer.addstreeet;
            command.Parameters.Add("@addno", SqlDbType.Int, 50);
            command.Parameters["@addno"].Value = customer.addno;
            command.Parameters.Add("@addbuilding", SqlDbType.NVarChar, 50);
            command.Parameters["@addbuilding"].Value = customer.addbuilding;
            command.Parameters.Add("@addfloor", SqlDbType.Int, 50);
            command.Parameters["@addfloor"].Value = customer.addfloor;
            command.Parameters.Add("@addnoo", SqlDbType.Int, 50);
            command.Parameters["@addnoo"].Value = customer.addnoo;
            command.Parameters.Add("@addtown", SqlDbType.NVarChar, 50);
            command.Parameters["@addtown"].Value = customer.addtown;
            command.Parameters.Add("@addcity", SqlDbType.NVarChar, 50);
            command.Parameters["@addcity"].Value = customer.addcity;
            command.Parameters.Add("@adddescrip", SqlDbType.NVarChar, 50);
            command.Parameters["@adddescrip"].Value = customer.adddescrip;

            command.ExecuteNonQuery();

            connection.Close();
            connection.Dispose();
        }
Exemple #3
0
        public void customerAdd(customer customer)
        {
            createConnection();
            if (connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }

            SqlCommand command = new SqlCommand();

            command.Connection  = connection;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "customerAdd";

            command.Parameters.Add("@name", SqlDbType.NVarChar, 50);
            command.Parameters["@name"].Value = customer.name;
            command.Parameters.Add("@surname", SqlDbType.NVarChar, 50);
            command.Parameters["@surname"].Value = customer.surname;
            command.Parameters.Add("@title", SqlDbType.NVarChar, 50);
            command.Parameters["@title"].Value = customer.title;
            command.Parameters.Add("@accountNumber", SqlDbType.Int, 50);
            command.Parameters["@accountNumber"].Value = customer.accountNumber;
            command.Parameters.Add("@bankName", SqlDbType.NVarChar, 50);
            command.Parameters["@bankName"].Value = customer.bankName;
            command.Parameters.Add("@officeName", SqlDbType.NVarChar, 50);
            command.Parameters["@officeName"].Value = customer.officeName;
            command.Parameters.Add("@officeCode", SqlDbType.Int, 50);
            command.Parameters["@officeCode"].Value = customer.officeCode;
            command.Parameters.Add("@billTitle", SqlDbType.NVarChar, 50);
            command.Parameters["@billTitle"].Value = customer.billTitle;
            command.Parameters.Add("@taxDepartment", SqlDbType.NVarChar, 50);
            command.Parameters["@taxDepartment"].Value = customer.taxDepartment;
            command.Parameters.Add("@taxNumber", SqlDbType.Int, 50);
            command.Parameters["@taxNumber"].Value = customer.taxNumber;
            command.Parameters.Add("@billAdress", SqlDbType.NVarChar, 50);
            command.Parameters["@billAdress"].Value = customer.billAdress;
            command.Parameters.Add("@tel1", SqlDbType.Int, 50);
            command.Parameters["@tel1"].Value = customer.tel1;
            command.Parameters.Add("@tel1code", SqlDbType.Int, 50);
            command.Parameters["@tel1code"].Value = customer.tel1code;
            command.Parameters.Add("@tel2", SqlDbType.Int, 50);
            command.Parameters["@tel2"].Value = customer.tel2;
            command.Parameters.Add("@tel2code", SqlDbType.Int, 50);
            command.Parameters["@tel2code"].Value = customer.tel2code;
            command.Parameters.Add("@tel3", SqlDbType.Int, 50);
            command.Parameters["@tel3"].Value = customer.tel3;
            command.Parameters.Add("@tel3code", SqlDbType.Int, 50);
            command.Parameters["@tel3code"].Value = customer.tel3code;
            command.Parameters.Add("@tel4", SqlDbType.Int, 50);
            command.Parameters["@tel4"].Value = customer.tel4;
            command.Parameters.Add("@tel4code", SqlDbType.Int, 50);
            command.Parameters["@tel4code"].Value = customer.tel4code;
            command.Parameters.Add("@tel5", SqlDbType.Int, 50);
            command.Parameters["@tel5"].Value = customer.tel5;
            command.Parameters.Add("@tel5code", SqlDbType.Int, 50);
            command.Parameters["@tel5code"].Value = customer.tel5code;
            command.Parameters.Add("@tel6", SqlDbType.Int, 50);
            command.Parameters["@tel6"].Value = customer.tel6;
            command.Parameters.Add("@tel6code", SqlDbType.Int, 50);
            command.Parameters["@tel6code"].Value = customer.tel6code;
            command.Parameters.Add("@addhood", SqlDbType.NVarChar, 50);
            command.Parameters["@addhood"].Value = customer.addhood;
            command.Parameters.Add("@addstreet", SqlDbType.NVarChar, 50);
            command.Parameters["@addstreet"].Value = customer.addstreet;
            command.Parameters.Add("@addstreeet", SqlDbType.NVarChar, 50);
            command.Parameters["@addstreeet"].Value = customer.addstreeet;
            command.Parameters.Add("@addno", SqlDbType.Int, 50);
            command.Parameters["@addno"].Value = customer.addno;
            command.Parameters.Add("@addbuilding", SqlDbType.NVarChar, 50);
            command.Parameters["@addbuilding"].Value = customer.addbuilding;
            command.Parameters.Add("@addfloor", SqlDbType.Int, 50);
            command.Parameters["@addfloor"].Value = customer.addfloor;
            command.Parameters.Add("@addnoo", SqlDbType.Int, 50);
            command.Parameters["@addnoo"].Value = customer.addnoo;
            command.Parameters.Add("@addtown", SqlDbType.NVarChar, 50);
            command.Parameters["@addtown"].Value = customer.addtown;
            command.Parameters.Add("@addcity", SqlDbType.NVarChar, 50);
            command.Parameters["@addcity"].Value = customer.addcity;
            command.Parameters.Add("@adddescrip", SqlDbType.NVarChar, 50);
            command.Parameters["@adddescrip"].Value = customer.adddescrip;

            command.ExecuteNonQuery();

            connection.Close();
            connection.Dispose();
        }
Exemple #4
0
        private void button11_Click(object sender, EventArgs e)
        {
            if (selectname == 1)
            {
                customer cu = new customer();
                cu.cusIDlabel.Text  = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
                cu.Nic.Text         = this.dataGridView1.CurrentRow.Cells[1].Value.ToString();
                cu.name.Text        = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
                cu.richAddress.Text = this.dataGridView1.CurrentRow.Cells[3].Value.ToString();
                cu.ContNumber.Text  = this.dataGridView1.CurrentRow.Cells[4].Value.ToString();
                cu.Email.Text       = this.dataGridView1.CurrentRow.Cells[5].Value.ToString();
                cu.Show();

                cu.button2.Visible = true;
                cu.button1.Visible = false;
            }
            else if (selectname == 2)
            {
                Orders or = new Orders();
                or.orderIDlabel.Text      = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
                or.cusIDtextBox.Text      = this.dataGridView1.CurrentRow.Cells[1].Value.ToString();
                or.typecomboBox.Text      = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
                or.sizecomboBox.Text      = this.dataGridView1.CurrentRow.Cells[3].Value.ToString();
                or.ColortextBox.Text      = this.dataGridView1.CurrentRow.Cells[4].Value.ToString();
                or.DesigntextBox.Text     = this.dataGridView1.CurrentRow.Cells[5].Value.ToString();
                or.QuantytextBox.Text     = this.dataGridView1.CurrentRow.Cells[6].Value.ToString();
                or.ortypecomboBox.Text    = this.dataGridView1.CurrentRow.Cells[7].Value.ToString();
                or.ordateTimePicker.Text  = this.dataGridView1.CurrentRow.Cells[8].Value.ToString();
                or.duedateTimePicker.Text = this.dataGridView1.CurrentRow.Cells[9].Value.ToString();
                or.comstatecomboBox.Text  = this.dataGridView1.CurrentRow.Cells[10].Value.ToString();
                or.fullpaytextBox.Text    = this.dataGridView1.CurrentRow.Cells[11].Value.ToString();
                or.advancetextBox.Text    = this.dataGridView1.CurrentRow.Cells[12].Value.ToString();
                or.labelarrear.Text       = this.dataGridView1.CurrentRow.Cells[13].Value.ToString();
                or.substatuscomboBox.Text = this.dataGridView1.CurrentRow.Cells[15].Value.ToString();
                or.subdatetextBox.Text    = this.dataGridView1.CurrentRow.Cells[14].Value.ToString();
                or.Show();

                or.button3.Visible = true;
                or.button2.Visible = false;
            }
            else if (selectname == 4)
            {
                payHistory ph = new payHistory();
                ph.ortextBox.Text             = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
                ph.cidlabel.Text              = this.dataGridView1.CurrentRow.Cells[1].Value.ToString();
                ph.tpaylabel.Text             = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
                ph.advalabel.Text             = this.dataGridView1.CurrentRow.Cells[3].Value.ToString();
                ph.dateTimePicker1.Text       = this.dataGridView1.CurrentRow.Cells[4].Value.ToString();
                ph.labelArear.Text            = this.dataGridView1.CurrentRow.Cells[5].Value.ToString();
                ph.paymethodtextBox.Text      = this.dataGridView1.CurrentRow.Cells[7].Value.ToString();
                ph.rentallabel.Text           = this.dataGridView1.CurrentRow.Cells[6].Value.ToString();
                ph.donecomboBox.Text          = this.dataGridView1.CurrentRow.Cells[10].Value.ToString();
                ph.fullpaystatuscomboBox.Text = this.dataGridView1.CurrentRow.Cells[8].Value.ToString();
                ph.Show();

                ph.button3.Visible = true;
                ph.button1.Visible = false;
            }
            else
            {
                MessageBox.Show("Please select right button", "Error window", MessageBoxButtons.OK);
            }
        }