예제 #1
0
 public void InsertBOMDescrDefered(IUnitOfWork uow, DescTypeInfo item)
 {
     InvokeBody.AddOneInvokeBody(this, uow, MethodBase.GetCurrentMethod(), item);
 }
예제 #2
0
        /// <summary>
        /// 保存一条Bom Description的记录数据(Add), 若Code与存在记录的Code的名称相同,则提示业务异常
        /// </summary>
        /// <param name="obj">BomDescrDef结构</param>
        public void AddBomDescr(BomDescrDef obj)
        {
            try
            {
                IBOMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();

                //Code与存在记录的Code的名称相同,则提示业务异常
                IList<DescTypeInfo> exists = itemRepository.GetBOMDescrsByCode(obj.Code);
                if (exists != null && exists.Count > 0)
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT089", erpara);
                    throw ex;

                }

                DescTypeInfo newItem = new DescTypeInfo();
                newItem.code = obj.Code;
                newItem.editor = obj.Editor;
                newItem.tp = obj.Type;
                newItem.description = obj.Descr;
                itemRepository.InsertBOMDescr(newItem);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #3
0
        public void InsertBOMDescr(DescTypeInfo item)
        {
            try
            {
                MethodBase mthObj = MethodBase.GetCurrentMethod();
                int tk = mthObj.MetadataToken;
                SQLContextNew sqlCtx = null;
                lock (mthObj)
                {
                    if (!SQLCache.PeerTheSQL(tk, out sqlCtx))
                    {
                        sqlCtx = FuncNew.GetAquireIdInsert<DescType>(tk);
                    }
                }
                DateTime cmDt = _Schema.SqlHelper.GetDateTime();

                sqlCtx = FuncNew.SetColumnFromField<DescType, DescTypeInfo>(sqlCtx, item);

                sqlCtx.Param(DescType.fn_cdt).Value = cmDt;
                sqlCtx.Param(DescType.fn_udt).Value = cmDt;

                item.id = _Schema.SqlHelper.ExecuteScalarForAquireIdInsert(_Schema.SqlHelper.ConnectionString_GetData, CommandType.Text, sqlCtx.Sentence, sqlCtx.Params);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #4
0
        /// <summary>
        /// 保存一条Bom Description的记录数据(update), 若Code与存在记录的Code的名称相同,则提示业务异常
        /// </summary>
        /// <param name="obj">更新BomDescrDef结构</param>
        /// <param name="oldCode">修改前Code</param>
        public void UpdateBomDescr(BomDescrDef obj, String oldCode)
        {
            try
            {
                IBOMRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();

                //Code与存在记录的Code的名称相同,则提示业务异常
                IList<DescTypeInfo> exists = itemRepository.GetBOMDescrsByCode(obj.Code);
                if (exists != null && exists.Count > 0 && oldCode != obj.Code)
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT089", erpara);
                    throw ex;

                }

                DescTypeInfo itemOld = itemRepository.FindBOMDescrById(Int32.Parse(obj.ID));
                if (itemOld == null)
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("DMT082", erpara);
                    throw ex;
                }

                DescTypeInfo newItem = new DescTypeInfo();
                newItem.code = obj.Code;
                newItem.id = Int32.Parse(obj.ID);
                newItem.editor = obj.Editor;
                newItem.tp = obj.Type;
                newItem.description = obj.Descr;
                newItem.cdt = DateTime.Now; //Convert.ToDateTime(obj.Cdt);
                itemRepository.UpdateBOMDescrById(newItem);
            }
            catch (Exception)
            {
                throw;
            }
        }