Ejemplo n.º 1
0
 private UcLucrari()
 {
     InitializeComponent();
     _lucrare = new Lucrare();
     FillCombobox();
     FillGridView(_filter, DateTime.Today.Year.ToString());
     ClearFormLucrare();
 }
Ejemplo n.º 2
0
        private void LucrariView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = null;
            foreach (DataGridViewRow iterator in LucrariView.SelectedRows)
            {
                row = iterator;
            }

            if (row == null) return;
            var conta = new ContaContext();
            var unitOfWork = new UnitOfWork(conta);

            // ReSharper disable once ConstantConditionalAccessQualifier
            var id = row?.Cells["LucrareId"].Value;
            if (id == null) return;
            _lucrare = unitOfWork.Lucrari.Get((int)id);

            if (_lucrare == null) return;

            int sStatusAccept = unitOfWork.AcceptateRespinse.Get(_lucrare.AcceptataRefuzataId).AcceptataRefuzataId;
            if (--sStatusAccept >= 0)
                cbAcceptResp.SelectedIndex = sStatusAccept;

            int sStatusRec = unitOfWork.ReceptionateRespinse.Get(_lucrare.ReceptionatRespinsId).ReceptionatRespinsId;
            if(--sStatusRec >= 0)
                cbReceptionatRespins.SelectedIndex = sStatusRec;

            if (_lucrare.ContractId != null)
                cbContract.SelectedText = unitOfWork.Contracte.Get((int)_lucrare.ContractId).NrContract;

            if (_lucrare.DataInregistrare != null)
                dateTimePickerInreg.Value = (DateTime)_lucrare.DataInregistrare;

            if (_lucrare.TermenSolutionare != null)
                dateTimePickerTermen.Value = (DateTime)_lucrare.TermenSolutionare;

            unitOfWork.Dispose();
            conta.Dispose();

            txtInreg.Text = _lucrare.Nr_OCPI;
            txtDoc.Text = _lucrare.NrProiect;
            txtAvizator.Text = _lucrare.AvizatorRegistrator;
            txtUAT.Text = _lucrare.UAT;
            txtObservatii.Text = _lucrare.Observatii;
            txtCad.Text = _lucrare.CadTop;

            //Set enable disabe or visibilty for controls
            bttNewLucrare.Enabled = false;
            bttDeleteLucrari.Enabled = false;
            grBoxLucrare.Enabled = true;
            bttEdit.Visible = true;
            bttCancel.Visible = true;
            bttSave.Visible = false;
            bttClearlucrare.Visible = false;
        }