//

        //
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                var      db        = new QuanLyPhongTroEntities2();
                int      RoomName  = (int)(this.cboRoomName.SelectedValue);
                DateTime dateStart = dtpStart.Value;
                DateTime dateEnd   = dtpEnd.Value;
                //
                int?duration;
                txtDuration.Text = (dtpEnd.Value - dtpStart.Value).TotalDays.ToString("#");
                duration         = int.Parse(txtDuration.Text);
                //
                int?Bill = int.Parse(txtBill.Text);
                //
                var newSession = db.Sessions.Find(this.session.ID);
                newSession.RoomID     = RoomName;
                newSession.DateStart  = dateStart;
                newSession.DateEnd    = dateEnd;
                newSession.Duration   = duration;
                newSession.TenantName = txtName.Text;
                newSession.TenantId   = txtIDN.Text;
                newSession.Total      = Bill;
                //
                db.Entry(newSession).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Invalid input : please dont let any field empty");
            }
        }
Exemplo n.º 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            var db        = new QuanLyPhongTroEntities2();
            var newPrice  = db.Prices.Find(this.price.ID);
            int tempValue = int.Parse(txtValue.Text);

            newPrice.Value           = tempValue;
            newPrice.ValueName       = txtVName.Text;
            db.Entry(newPrice).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            this.Close();
        }
Exemplo n.º 3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int Type    = (int)(this.cboRoomType.SelectedValue);
            int Status  = (int)(this.cboRoomStatus.SelectedValue);
            var db      = new QuanLyPhongTroEntities2();
            var newRoom = db.Rooms.Find(this.room.ID);

            newRoom.RoomName        = txtRoomName.Text;
            newRoom.TypeID          = Type;
            newRoom.StatusID        = Status;
            db.Entry(newRoom).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            this.Close();
        }