private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (_Variable == null)
            {
                lblMessage.Text = "Düzenlenecek değişkeni seçiniz.";
                return;
            }
            if (_Unit == null)
            {
                lblMessage.Text = "Birimi seçiniz.";
                return;
            }
            try
            {
                using (IVariableRepository variableRepo = new VariableRepository(new Datacore.Data.BeamDeflectionDbContext()))
                {
                    Variable variable = variableRepo.Get(x => x.ID == _Variable.ID).Result;
                    variable.Name      = txtName.Text;
                    variable.Display   = txtDisplay.Text;
                    variable.IsActive  = chkIsActive.Checked;
                    variable.IsDeleted = chkIsDeleted.Checked;
                    variable.UnitId    = ((Unit)cmbUnits.SelectedItem).ID;
                    variable.Value     = Convert.ToDouble(txtValue.Text);
                    variable.UpdatedAt = DateTime.UtcNow;

                    var result = variableRepo.Update(variable);
                    switch (result.State)
                    {
                    case Basecore.Model.Enums.BusinessResultType.NotSet:
                        lblMessage.Text = result.Message;
                        break;

                    case Basecore.Model.Enums.BusinessResultType.Success:
                        lblMessage.Text = "Düzenleme başarılı. Son düzenlenen değişkenin adı : " + result.Result.Name;

                        break;

                    case Basecore.Model.Enums.BusinessResultType.Error:
                        lblMessage.Text = result.Message;
                        break;

                    case Basecore.Model.Enums.BusinessResultType.Warning:
                        lblMessage.Text = result.Message;
                        break;

                    case Basecore.Model.Enums.BusinessResultType.Info:
                        lblMessage.Text = result.Message;
                        break;

                    default:
                        break;
                    }
                    ucEditVariables_Load(sender, e);
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Hata : " + ex.GetBaseException();
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (_Variable == null)
                {
                    lblMessage.Text = "Silinecek değişkeni seçiniz.";
                    return;
                }
                using (IVariableRepository varRepo = new VariableRepository(new Datacore.Data.BeamDeflectionDbContext()))
                {
                    Variable oldVar = varRepo.Get(x => x.ID == _Variable.ID).Result;
                    var      result = varRepo.Delete(oldVar);
                    switch (result.State)
                    {
                    case Basecore.Model.Enums.BusinessResultType.NotSet:
                        lblMessage.Text = result.Message;
                        break;

                    case Basecore.Model.Enums.BusinessResultType.Success:
                        lblMessage.Text = "Başarıyla silindi. Son silinen değişkenin adı : " + oldVar.Name;

                        break;

                    case Basecore.Model.Enums.BusinessResultType.Error:
                        lblMessage.Text = result.Message;
                        break;

                    case Basecore.Model.Enums.BusinessResultType.Warning:
                        lblMessage.Text = result.Message;
                        break;

                    case Basecore.Model.Enums.BusinessResultType.Info:
                        lblMessage.Text = result.Message;
                        break;

                    default:
                        break;
                    }
                    ucEditVariables_Load(sender, e);
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Hata : " + ex.GetBaseException();
            }
        }