Exemplo n.º 1
0
        private void 员工资料RToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string title = getTitleFromMenuItem(sender);

            logDao.saveLog(Parameter.user, title);

            EmployeeFrm employeeFrm = new EmployeeFrm();

            employeeFrm.MdiParent = this;
            employeeFrm.Text      = title;
            employeeFrm.Show();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Edit current item
        /// </summary>
        public override void Edit()
        {
            Employee emp = (Employee)mainGridView.GetRow(mainGridView.FocusedRowHandle);

            if (emp != null)
            {
                using (EmployeeFrm frm = new EmployeeFrm())
                {
                    frm.Entity = emp;
                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        if (emp.ID == 0)
                        {
                            try
                            {
                                ClientEnvironment.EmployeeService.Save(emp);
                            }
                            catch (EntityException ex)
                            {
                                // 2think: what details should we show?
                                // 2think: how to localize?
                                using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex))
                                {
                                    form.Text = GetLocalized("CannotSaveEmployee");
                                    form.ShowDialog(this);
                                }
                            }
                        }
                        else
                        {
                            try
                            {
                                ClientEnvironment.EmployeeService.SaveOrUpdate(emp);
                            }
                            catch (EntityException ex)
                            {
                                // 2think: what details should we show?
                                // 2think: how to localize?
                                using (FrmEntityExceptionDetails form = new FrmEntityExceptionDetails(ex))
                                {
                                    form.Text = GetLocalized("CannotSaveEmployee");
                                    form.ShowDialog(this);
                                }
                            }
                        }
                        RefreshData();
                    }
                }
            }
        }