예제 #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                DataGridViewRow dgr = dataGridView1.CurrentRow;
                dgr.Cells["Address"].Value          = this.tbxHouseAddress.Text;
                dgr.Cells["CompactNumber"].Value    = this.tbxHouseCompactNumber.Text;
                dgr.Cells["Area"].Value             = this.tbxHouseArea.Text;
                dgr.Cells["RegisterDate"].Value     = this.tbxHouseRegisterDate.Text;
                dgr.Cells["InsuranceDate"].Value    = this.tbxHouseInsuranceDate.Text;
                dgr.Cells["NotarizationDate"].Value = this.tbxHouseNotarizationDate.Text;

                DDHouseInfo newHouse = new DDHouseInfo("HouseID", Convert.ToInt32(dgr.Cells["HouseID"].Value));
                newHouse.Address          = this.tbxHouseAddress.Text;
                newHouse.CompactNumber    = this.tbxHouseCompactNumber.Text;
                newHouse.Area             = this.tbxHouseArea.Text;
                newHouse.RegisterDate     = this.tbxHouseRegisterDate.Text;
                newHouse.InsuranceDate    = this.tbxHouseInsuranceDate.Text;
                newHouse.NotarizationDate = this.tbxHouseNotarizationDate.Text;
                newHouse.Save();
                MessageBox.Show("信息更新成功!", "提示信息");
            }
            catch
            {
                MessageBox.Show("信息更新错误,请检查数据库是否连接正确!", "提示信息");
            }
        }
예제 #2
0
        public void Update(int HouseID, string Address, string CompactNumber, string Area, string RegisterDate, string InsuranceDate, string NotarizationDate, int?PawnageID)
        {
            DDHouseInfo item = new DDHouseInfo();

            item.MarkOld();
            item.IsLoaded = true;

            item.HouseID = HouseID;

            item.Address = Address;

            item.CompactNumber = CompactNumber;

            item.Area = Area;

            item.RegisterDate = RegisterDate;

            item.InsuranceDate = InsuranceDate;

            item.NotarizationDate = NotarizationDate;

            item.PawnageID = PawnageID;

            item.Save(UserName);
        }
예제 #3
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            RowSelected = e.RowIndex;
            if (e.RowIndex != -1)
            {
                if (dataGridView1.Rows[RowSelected].Cells["PhotoPath"].Value.ToString() != "")
                {
                    btnShowPhoto.Enabled = true;
                }
                else
                {
                    btnShowPhoto.Enabled = false;
                }

                if (dataGridView1.Rows[RowSelected].Cells["FirstClass"].Value.ToString() == "10")
                {
                    gbxHouseInfo.Hide();

                    this.tbxCarCaseNumber.Text    = "";
                    this.tbxCarCheckDate.Text     = "";
                    this.tbxCarEngineNumber.Text  = "";
                    this.tbxCarLicenseNumber.Text = "";
                    this.tbxCarRoadDate.Text      = "";
                    this.tbxCarType.Text          = "";
                    this.tbxCarInsuranceDate.Text = "";

                    DDCarInfo newCar = new DDCarInfo("PawnageID", dataGridView1.Rows[RowSelected].Cells["PawnageID"].Value.ToString());
                    this.tbxCarCaseNumber.Text    = newCar.CarcaseNumber;
                    this.tbxCarCheckDate.Text     = newCar.CheckDate;
                    this.tbxCarEngineNumber.Text  = newCar.EngineNumber;
                    this.tbxCarInsuranceDate.Text = newCar.InsuranceDate;
                    this.tbxCarLicenseNumber.Text = newCar.LicenseNumber;
                    this.tbxCarRoadDate.Text      = newCar.RoadtollDate;
                    this.tbxCarType.Text          = newCar.CarType;

                    this.gbxCarInfo.Show();
                }
                else if (dataGridView1.Rows[RowSelected].Cells["FirstClass"].Value.ToString() == "11")
                {
                    gbxCarInfo.Hide();

                    this.tbxHouseAddress.Text       = "";
                    this.tbxHouseArea.Text          = "";
                    this.tbxHouseCompactNumber.Text = "";
                    this.tbxHouseInsuranceDate.Text = "";
                    this.tbxHouseNotarizaDate.Text  = "";
                    this.tbxHouseRegisterDate.Text  = "";

                    DDHouseInfo newHouse = new DDHouseInfo("PawnageID", dataGridView1.Rows[RowSelected].Cells["PawnageID"].Value.ToString());
                    this.tbxHouseAddress.Text       = newHouse.Address;
                    this.tbxHouseArea.Text          = newHouse.Area;
                    this.tbxHouseCompactNumber.Text = newHouse.CompactNumber;
                    this.tbxHouseInsuranceDate.Text = newHouse.InsuranceDate;
                    this.tbxHouseNotarizaDate.Text  = newHouse.NotarizationDate;
                    this.tbxHouseRegisterDate.Text  = newHouse.RegisterDate;

                    this.gbxHouseInfo.Show();
                }
                else
                {
                    this.gbxCarInfo.Hide();
                    this.gbxHouseInfo.Hide();
                }
            }
        }
예제 #4
0
 public bool Destroy(object HouseID)
 {
     return(DDHouseInfo.Destroy(HouseID) == 1);
 }
예제 #5
0
 public bool Delete(object HouseID)
 {
     return(DDHouseInfo.Delete(HouseID) == 1);
 }