Ejemplo n.º 1
0
 private void BtnEditRepo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (LetterGridView.GetFocusedRow() is Letters item)
     {
         frmAddEditLetterV2 frm = new frmAddEditLetterV2(item, MethodType.Edit);
         frm.ShowDialog();
         Init();
     }
 }
Ejemplo n.º 2
0
        private void btnDuplicate_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (this.LetterGridView.GetFocusedRow() is Letters item)
            {
                if (MessageBox.Show("Do you want to duplicate this?", "Duplicate", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                try
                {
                    UnitOfWork unitOfWork = new UnitOfWork();
                    item = new Letters()
                    {
                        Body                = item.Body,
                        CC                  = item.CC,
                        Closing             = item.Closing,
                        ControlNo           = item.ControlNo,
                        CreatedBy           = User.UserId,
                        Date                = item.Date,
                        DateCreated         = DateTime.Now,
                        InsideAddress       = item.InsideAddress,
                        InTheAbsence        = item.InTheAbsence,
                        OfficeId            = item.OfficeId,
                        RefId               = item.RefId,
                        Salutation          = item.Salutation,
                        SignatoriesPosition = item.SignatoriesPosition,
                        Signatories         = item.Signatories,
                        TableName           = item.TableName,
                        Template            = item.Template,
                        Title               = item.Title,
                        Type                = item.Type,
                    };
                    unitOfWork.LettersRepo.Insert(item);
                    unitOfWork.Save();

                    frmAddEditLetterV2 frm = new frmAddEditLetterV2(item, MethodType.Edit);
                    frm.ShowDialog();
                    Init();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 3
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            //frmAddEditLetters frm = new frmAddEditLetters(MethodType.Add, new Letters()
            //{
            //    RefId = this.refId,
            //    TableName = tableName,
            //    ControlNo = this.itemControlNo
            //});
            //frm.ShowDialog();
            //Init();
            frmAddEditLetterV2 frm = new frmAddEditLetterV2(new Letters()
            {
                TableName = tableName, ControlNo = itemControlNo, RefId = refId
            }, MethodType.Add);

            frm.ShowDialog();
            Init();
        }