Esempio n. 1
0
        private void Save()
        {
            try
            {
                var Type = _TypeRepo.GetById(id);
                if (id > 0 && Type != null)
                {
                    Type.NAME = txtName.Value;
                    Type.NOTE = txtNote.Value;

                    _TypeRepo.Update(Type);
                }
                else
                {
                    Type      = new TYPE();
                    Type.NAME = txtName.Value;
                    Type.NOTE = txtNote.Value;

                    _TypeRepo.Create(Type);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Response.Redirect("loai-hang.aspx");
            }
        }
        public long CreateType(string caption)
        {
            Debug.Assert(!string.IsNullOrEmpty(caption));

            OrganizationType type = new OrganizationType {
                Caption = caption
            };
            var unit_of_work = UnitOfWorkProvider.GetUnitOfWork();

            unit_of_work.BeginTransaction();
            TypeRepo.Create(type);
            unit_of_work.Commit();

            _is_type_cache_valid = false;

            return(0);
        }