private void btnAccept_Click(object sender, EventArgs e) { string Name = txtCompanyName.Text; string Address = txtAddress.Text; string District = txtDistrict.Text; string City = txtCity.Text; string Country = txtCountry.Text; string TaxCode = txtTaxCode.Text; string BankName = txtBankName.Text; string BankAccount = txtBankAccount.Text; string Tel = txtTel.Text; string Fax = txtFax.Text; string Email = txtEmail.Text; string Website = txtWeb.Text; DateTime FoundedDay = dtFoundedDay.Value; string Note = txtNote.Text; string companycode = txtCompanyCode.Text; string healthInsuranceID = txtHealthInsuranceID.Text; CompanyDO companyDO = new CompanyDO(); int result = 0; try { result=companyDO.UpdateDefaultCompanyInfo(Name, Address, City, Country, Tel, Fax, Email, District, Website, TaxCode, BankName, BankAccount, FoundedDay, Note, healthInsuranceID, companycode); } catch(Exception ex) { MessageBox.Show("Lỗi cập nhật CSDL !", "Thông báo"); } if(result==1) MessageBox.Show("Cập nhật thành công !", "Thông báo"); this.Close(); }
//private SystemDataConnect Sysconnect = new SystemDataConnect(); private void frmCompanyUserInfo_Load(object sender, EventArgs e) { CompanyDO companyDO = new CompanyDO(); DataSet dsCompany = companyDO.GetCompanyInfo(); if (dsCompany.Tables[0].Rows.Count == 0) return; DataRow row = dsCompany.Tables[0].Rows[0]; txtCompanyName.Text = row["Name"].ToString(); txtAddress.Text = row["Address"].ToString(); txtDistrict.Text = row["District"].ToString(); txtCity.Text = row["City"].ToString(); txtCountry.Text = row["Country"].ToString(); txtTaxCode.Text = row["TaxCode"].ToString(); txtBankAccount.Text = row["BankAccount"].ToString(); txtBankName.Text = row["BankName"].ToString(); txtTel.Text = row["Tel"].ToString(); txtFax.Text = row["Fax"].ToString(); txtEmail.Text = row["Email"].ToString(); txtWeb.Text = row["Website"].ToString(); dtFoundedDay.Value = DateTime.Parse(row["FoundedDay"].ToString()); txtNote.Text = row["Note"].ToString(); txtCompanyCode.Text = row["CompanyCode"].ToString(); txtHealthInsuranceID.Text = row["HealthInsuranceID"].ToString(); }