Exemplo n.º 1
0
        /// <summary>
        /// 保存一条family的记录数据(update), 若Family名称为其他存在的Family的名称相同,则提示业务异常
        /// </summary>
        /// <param name="Object"></param>
        public void UpdateFamily(FamilyDef obj, String oldFamilyId)
        {
            try
            {
                IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
                Family item = new Family(obj.Family, obj.Descr, obj.CustomerID);
                item.FamilyName = obj.Family;
                item.Customer = obj.CustomerID;
                item.Description = obj.Descr;
                item.Editor = obj.Editor;
                item.Udt = DateTime.Now;
                itemRepository.ChangeFamily(item, oldFamilyId);
            }
            catch (Exception)
            {
                throw;
            }

        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存一条family的记录数据(Add)
        /// </summary>
        /// <param name="Object"></param>
        public void AddFamily(FamilyDef obj)
        {
            FamilyDef familyObj = obj;

            try
            {
                IFamilyRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();

                UnitOfWork uow = new UnitOfWork();
                Family item = new Family(obj.Family,obj.Descr,obj.CustomerID);
                item.FamilyName = obj.Family;
                item.Customer = obj.CustomerID;
                item.Description = obj.Descr;
                item.Editor = obj.Editor;
                item.Cdt = DateTime.Now;
                item.Udt = DateTime.Now;
                itemRepository.Add(item, uow);
                uow.Commit();
            }
            catch (Exception)
            {
                throw;
            }


        }