Exemplo n.º 1
0
        public TFlexDocsSignDialog(SEPO_TFLEX_SIGN_DOCS docSign, IRepository <SEPO_TFLEX_SIGN_DOCS> repo) : this(repo)
        {
            dialogType = DialogType.Edit;
            DocSign    = docSign;

            signBox.Text = DocSign.SIGN;
        }
Exemplo n.º 2
0
        private DataGridViewRow AddRow(SEPO_TFLEX_SIGN_DOCS item)
        {
            DataGridViewRow row = new DataGridViewRow();

            row.CreateCells(scene, item.SIGN);
            row.Tag = item.ID;

            scene.Rows.Add(row);

            return(row);
        }
Exemplo n.º 3
0
        protected void OnEditItemClick(object sender, EventArgs e)
        {
            DataGridViewRow row = scene.SelectedRows[0];
            int             id  = (int)row.Tag;

            SEPO_TFLEX_SIGN_DOCS docSign = signDocsRepo.GetById(id);

            TFlexDocsSignDialog dialog = new TFlexDocsSignDialog(docSign, signDocsRepo);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                UpdateRow(row, dialog.DocSign);
            }
        }
Exemplo n.º 4
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            if (dialogType == DialogType.Add)
            {
                SEPO_TFLEX_SIGN_DOCS sign = new SEPO_TFLEX_SIGN_DOCS
                {
                    SIGN = signBox.Text
                };

                using (var transaction = new UnitOfWork())
                {
                    try
                    {
                        signDocsRepo.Create(sign);
                        DocSign = sign;

                        transaction.Commit();

                        DialogResult = DialogResult.OK;
                    }
                    catch (Exception)
                    {
                        transaction.Rollback();
                        throw;
                    }
                }
            }
            else
            {
                using (var transaction = new UnitOfWork())
                {
                    try
                    {
                        DocSign.SIGN = signBox.Text;
                        signDocsRepo.Update(DocSign);

                        transaction.Commit();

                        DialogResult = DialogResult.OK;
                    }
                    catch (Exception)
                    {
                        transaction.Rollback();
                        throw;
                    }
                }
            }
        }
Exemplo n.º 5
0
        protected void OnDeleteItemClick(object sender, EventArgs e)
        {
            DataGridViewRow row = scene.SelectedRows[0];

            int id = (int)row.Tag;

            using (var transaction = new UnitOfWork())
            {
                try
                {
                    SEPO_TFLEX_SIGN_DOCS signDoc = signDocsRepo.GetById(id);
                    signDocsRepo.Delete(signDoc);

                    transaction.Commit();

                    scene.Rows.Remove(row);
                }
                catch (Exception)
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
Exemplo n.º 6
0
 private void UpdateRow(DataGridViewRow row, SEPO_TFLEX_SIGN_DOCS item)
 {
     row.Cells[0].Value = item.SIGN;
 }