コード例 #1
0
ファイル: BusinessForm.cs プロジェクト: dekal-bit/Harris
        private void btnSaveSelected_Click(object sender, EventArgs e)
        {
            int             index           = Int32.Parse(DBGbusiness.SelectedCells[0].Value.ToString());
            BusinessContact businessContact = new BusinessContact();

            businessContact.BusinessID       = index;
            businessContact.BusinessFName    = TbBusinessName.Text;
            businessContact.BusinessOrder    = TbOrder.Text;
            businessContact.BussinessAddress = TbAddress.Text;
            businessContact.BusinessPostcode = TbPostcode.Text;
            businessContact.BusinessCity     = TbCity.Text;
            businessContact.BusinessEmail    = TbEmail.Text;
            businessContact.BusinessTel      = TbBusinessTel.Text;
            businessContact.BusinessHomeTel  = TbHomeTel.Text;
            dbConn.UpdateBusiness(businessContact);
            DBGbusiness.DataSource  = dbConn.getAllBusiness();
            TbBusinessName.Enabled  = false;
            TbOrder.Enabled         = false;
            TbAddress.Enabled       = false;
            TbPostcode.Enabled      = false;
            TbCity.Enabled          = false;
            TbEmail.Enabled         = false;
            TbBusinessTel.Enabled   = false;
            TbHomeTel.Enabled       = false;
            btnUpdate.Enabled       = true;
            btnDelete.Enabled       = true;
            btnSaveSelected.Enabled = false;
            btnAddNew.Enabled       = true;
        }
コード例 #2
0
ファイル: BusinessForm.cs プロジェクト: dekal-bit/Harris
        private void btnSaveNew_Click(object sender, EventArgs e)
        {
            BusinessContact businessContact = new BusinessContact();

            businessContact.BusinessFName    = TbBusinessName.Text;
            businessContact.BusinessOrder    = TbOrder.Text;
            businessContact.BussinessAddress = TbAddress.Text;
            businessContact.BusinessPostcode = TbPostcode.Text;
            businessContact.BusinessCity     = TbCity.Text;
            businessContact.BusinessEmail    = TbEmail.Text;
            businessContact.BusinessTel      = TbBusinessTel.Text;
            businessContact.BusinessHomeTel  = TbHomeTel.Text;
            dbConn.InsertBusiness(businessContact);
            DBGbusiness.DataSource = dbConn.getAllBusiness();
            TbBusinessName.Enabled = false;
            TbOrder.Enabled        = false;
            TbAddress.Enabled      = false;
            TbPostcode.Enabled     = false;
            TbCity.Enabled         = false;
            TbEmail.Enabled        = false;
            TbBusinessTel.Enabled  = false;
            TbHomeTel.Enabled      = false;
            btnUpdate.Enabled      = true;
            btnDelete.Enabled      = true;
            btnSaveNew.Enabled     = true;
        }
コード例 #3
0
ファイル: DbConn.cs プロジェクト: dekal-bit/Harris
        public void InsertBusiness(BusinessContact businessContact)
        {
            using (var conn = new MySqlConnection(connString))

            {
                conn.Open();
                using (var cmd = new MySqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = "CALL InsertBusiness (@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8);";
                    cmd.Parameters.AddWithValue("p1", businessContact.BusinessFName);
                    cmd.Parameters.AddWithValue("p2", businessContact.BusinessOrder);
                    cmd.Parameters.AddWithValue("p3", businessContact.BussinessAddress);
                    cmd.Parameters.AddWithValue("p4", businessContact.BusinessPostcode);
                    cmd.Parameters.AddWithValue("p5", businessContact.BusinessCity);
                    cmd.Parameters.AddWithValue("p6", businessContact.BusinessEmail);
                    cmd.Parameters.AddWithValue("p7", businessContact.BusinessTel);
                    cmd.Parameters.AddWithValue("p8", businessContact.BusinessHomeTel);
                    cmd.ExecuteNonQuery();
                }
            }
        }