protected void btnSave_Click(object sender, EventArgs e) { if (!this.ValidateInputs()) { return; } var cota = apartmentCota.Value.ToNullableDecimal(); var apartment = new Administratoro.DAL.Apartments { Name = userName.Value, Dependents = userDependents.Value.ToNullableInt().Value, ExtraInfo = userExtraInfo.Value, CotaIndiviza = cota ?? 0, Number = userNr.Value.ToNullableInt().Value, Telephone = userPhone.Value, Email = userEmail.Value, CreatedDate = DateTime.Now, id_Estate = Association.Id, Password = "******", Id_StairCase = userStairCase.SelectedValue.ToNullableInt(), HasHeatHelp = userHeatHelp.SelectedIndex == 1, FondReparatii = txtFondRepairs.Value.ToNullableDecimal(), FondRulment = txtfondRulment.Value.ToNullableDecimal() }; if (!string.IsNullOrEmpty(lblUserId.Text) && lblUserId.Text.ToNullableInt() != 0) { apartment.Id = lblUserId.Text.ToNullableInt().Value; ApartmentsManager.Update(apartment); } else { apartment = ApartmentsManager.Add(apartment); lblStatus.Text = FlowMessages.ApartmentAddSuccess; lblStatus.CssClass = "SuccessBox"; } ProcessSaveCounters(apartment); var association = AssociationsManager.GetById(Association.Id); Session[SessionConstants.SelectedAssociation] = association; Response.Redirect("~/Apartments/Manage.aspx?Message=UserUpdatedSuccess"); }