示例#1
0
        public void SaveClicked()
        {
            m_view.ReadUserInput();
            Customer      customerDataEntity = m_viewModel.CustomerData;
            List <string> lstMessages        = new List <string>();
            bool          isValid            = m_PersonDao.Validate(customerDataEntity, out lstMessages);

            if (isValid)
            {
                Person mypersonEntity = customerDataEntity as Person;
                if (customerDataEntity.PersonId == 0)
                {
                    m_PersonDao.Insert(mypersonEntity);
                }
                else
                {
                    m_PersonDao.Update(mypersonEntity);
                }
                GetAllCustomer();
            }
            else
            {
                string strMessages = String.Join(Environment.NewLine, lstMessages.Select(a => a.ToString()));
                m_view.Message = strMessages;
                m_view.ShowError();
            }
        }