Пример #1
0
        private bool Save()
        {
            if (!IsFieldValueValid())
            {
                return(false);
            }
            bool success = false;

            try
            {
                OrgEntity editEntity = PrepareSave();
                int       ret        = orgDal.Save(editEntity, isNew);
                if (ret == -1)
                {
                    MsgBox.Warn("编号已存在,请改为其他的编号。");
                }
                else if (ret == -2)
                {
                    MsgBox.Warn("更新失败,该行已经被其他人删除。");
                }
                else
                {
                    success = true;
                    if (DataSourceChanged != null)
                    {
                        DataSourceChanged(editEntity, null);
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.Err(ex.Message);
            }

            return(success);
        }