Ejemplo n.º 1
0
        private PartForbidden convertToObjFromMaintainInfo(PartForbidden obj, PartForbiddenMaintainInfo temp)
        {

            obj.ID = temp.Id;
            obj.Family = temp.Family;
            obj.Model = temp.Model;
            obj.PartNo = temp.PartNo;
            obj.Descr = temp.Descr;
            obj.Status = temp.Status;
            obj.AssemblyCode = temp.AssemblyCode;
            obj.Editor = temp.Editor;

            return obj;
        }
Ejemplo n.º 2
0
        //add/save partforbidden
        public int SavePartForbidden(PartForbiddenMaintainInfo infoPartForbidden)
        {
            FisException ex;
            List<string> paraError = new List<string>();
            try
            {
                PartForbidden partForbiddenObj = null;
                if (infoPartForbidden.Id != 0)
                {
                    partForbiddenObj = partRepository.GetPartForbidden(infoPartForbidden.Id);
                }
                if (partForbiddenObj == null)
                {
                    //检查是否已存在相同的PartForbidden
                    int count = partRepository.CheckExistedPartForbidden(infoPartForbidden.Model, infoPartForbidden.Descr, infoPartForbidden.PartNo, infoPartForbidden.AssemblyCode, infoPartForbidden.Family);
                    if (count > 0)
                    {
                        ex = new FisException("DMT039", paraError);
                        throw ex;
                    }

                    partForbiddenObj = new PartForbidden();
                    partForbiddenObj = convertToObjFromMaintainInfo(partForbiddenObj, infoPartForbidden);

                    IUnitOfWork work = new UnitOfWork();
                    partRepository.AddPartForbiddenDefered(work, partForbiddenObj);
                    work.Commit();

                }
                else
                {

                    partForbiddenObj = convertToObjFromMaintainInfo(partForbiddenObj, infoPartForbidden);

                    IUnitOfWork work = new UnitOfWork();

                    partRepository.SavePartForbiddenDefered(work, partForbiddenObj);

                    work.Commit();
                }

                return partForbiddenObj.ID;

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw;
            }
        }
Ejemplo n.º 3
0
        private PartForbiddenMaintainInfo convertToMaintainInfoFromObj(PartForbidden temp)
        {
            PartForbiddenMaintainInfo partForbidden = new PartForbiddenMaintainInfo();

            partForbidden.Id = temp.ID;
            partForbidden.Family = temp.Family;
            partForbidden.Model = temp.Model;
            partForbidden.Descr = temp.Descr;
            partForbidden.PartNo = temp.PartNo;
            partForbidden.Status = temp.Status;
            partForbidden.AssemblyCode = temp.AssemblyCode;
            partForbidden.Editor = temp.Editor;
            partForbidden.Cdt = temp.Cdt;
            partForbidden.Udt = temp.Udt;

            return partForbidden;
        }