Exemple #1
0
        public override object Do(object obj)
        {
            GenCheckBarCodes bpObj = (GenCheckBarCodes)obj;

            if (bpObj.CheckBarCodeDTOs == null || bpObj.CheckBarCodeDTOs.Count == 0)
            {
                return(null);
            }
            long orgID = bpObj.CheckBarCodeDTOs[0].OrgID;

            using (Session s = Session.Open())
            {
                foreach (CheckBarCodeDTO dto in bpObj.CheckBarCodeDTOs)
                {
                    CheckBarCode be = CheckBarCode.Create();
                    be.OrgKey       = new Organization.EntityKey(dto.OrgID);
                    be.ItemKey      = new ItemMaster.EntityKey(dto.ItemID);
                    be.BarCode      = dto.BarCode;
                    be.ActualLength = dto.ActualLength;
                    be.CheckedBy    = dto.CheckedBy;
                    be.CheckedOn    = dto.CheckedOn;
                }
                s.Commit();
            }

            return(null);
        }
        //[OperationBehavior]
        public void DoEx(ICommonDataContract commonData, List <UFIDA.U9.Cust.JSDY.BarCode.CheckBarCodeDTOData> checkBarCodeDTOs)
        {
            this.CommonData = commonData;
            try
            {
                BeforeInvoke("UFIDA.U9.Cust.JSDY.BarCode.GenCheckBarCodes");
                GenCheckBarCodes objectRef = new GenCheckBarCodes();


                if (checkBarCodeDTOs != null)
                {
                    DeSerializeKey(checkBarCodeDTOs);
                    List <UFIDA.U9.Cust.JSDY.BarCode.CheckBarCodeDTO> listCheckBarCodeDTOs = new List <UFIDA.U9.Cust.JSDY.BarCode.CheckBarCodeDTO>();
                    foreach (UFIDA.U9.Cust.JSDY.BarCode.CheckBarCodeDTOData obj in checkBarCodeDTOs)
                    {
                        if (obj == null)
                        {
                            continue;
                        }

                        UFIDA.U9.Cust.JSDY.BarCode.CheckBarCodeDTO child = new UFIDA.U9.Cust.JSDY.BarCode.CheckBarCodeDTO();
                        child.FromEntityData(obj);
                        //值对象应该是依赖主创建的.但此处不是.可能的问题?
                        listCheckBarCodeDTOs.Add(child);
                    }
                    objectRef.CheckBarCodeDTOs = listCheckBarCodeDTOs;
                }

                //处理返回类型.
                objectRef.Do();                 //没有返回值
            }
            catch (System.Exception e)
            {
                DealException(e);
                throw;
            }
            finally
            {
                FinallyInvoke("UFIDA.U9.Cust.JSDY.BarCode.GenCheckBarCodes");
            }
        }