public IList <Model.CustomerProcessingDetail> Select(Model.CustomerProcessing CustomerProcessing)
 {
     //
     // todo: add other logic here.
     //
     return(accessor.Select(CustomerProcessing));
 }
 private void Validate(Model.CustomerProcessing customerProcessing)
 {
     //if (string.IsNullOrEmpty(customerProcessing.Id))
     //{
     //    throw new Helper.RequireValueException(Model.CustomerProcessing.PROPERTY_ID);
     //}
     if (this.Exists(customerProcessing.Id))
     {
         throw new Helper.InvalidValueException(Model.CustomerProcessing.PROPERTY_ID);
     }
 }
        /// <summary>
        /// Update a CustomerProcessing.
        /// </summary>
        public void Update(Model.CustomerProcessing customerProcessing)
        {
            //
            // todo: add other logic here.
            //
            //string sequencekey = "";
            //foreach (Model.CustomerProcessingDetail customerProcessingDetail in customerProcessing.detail)
            //{
            //    sequencekey += customerProcessingDetail.ProcessCategory.Id;
            //}

            //if (string.IsNullOrEmpty(customerProcessing.Id))
            //    customerProcessing.Id = GetNewId(sequencekey);


            //if (string.IsNullOrEmpty(customerProcessing.Id))
            //{
            //    throw new Helper.RequireValueException(Model.CustomerProcessing.PROPERTY_ID);
            //}
            if (this.ExistsExcept(customerProcessing))
            {
                throw new Helper.InvalidValueException(Model.CustomerProcessing.PROPERTY_ID);
            }

            customerProcessing.UpdateTime = DateTime.Now;

            try
            {
                BL.V.BeginTransaction();
                accessor.Delete(customerProcessing.CustomerProcessingId);
                this.Insert(customerProcessing);
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
            // accessor.Update(customerProcessing);
        }
        /// <summary>
        /// Insert a CustomerProcessing.
        /// </summary>
        public void Insert(Model.CustomerProcessing customerProcessing)
        {
            //
            // todo:add other logic here
            //
            //设置KEY值
            Validate(customerProcessing);
            // string sequencekey = "";
            //foreach (Model.CustomerProcessingDetail customerProcessingDetail in customerProcessing.detail)
            //{
            // sequencekey+=customerProcessingDetail.ProcessCategory.Id;
            //}

            //if (string.IsNullOrEmpty(customerProcessing.Id))
            //    customerProcessing.Id = GetNewId(sequencekey);



            SequenceManager.Increment(this.GetInvoiceKind());

            customerProcessing.InsertTime = DateTime.Now;
            customerProcessing.UpdateTime = DateTime.Now;

            accessor.Insert(customerProcessing);
            foreach (Model.CustomerProcessingDetail customerProcessingDetail in customerProcessing.detail)
            {
                if (customerProcessingDetail.ProcessCategory == null || string.IsNullOrEmpty(customerProcessingDetail.ProcessCategoryId) || customerProcessingDetail.Process == null)
                {
                    continue;
                }

                customerProcessingDetail.CustomerProcessingDetailId = Guid.NewGuid().ToString();
                customerProcessingDetail.ProcessCategoryId          = customerProcessingDetail.ProcessCategory.ProcessCategoryId;
                customerProcessingDetail.CustomerProcessing         = customerProcessing;
                customerProcessingDetail.CustomerProcessingId       = customerProcessing.CustomerProcessingId;
                customerProcessingDetail.ProcessId = customerProcessingDetail.Process.ProcessId;
                accessorDetail.Insert(customerProcessingDetail);
            }
            //
        }
 public Model.CustomerProcessing GetNext(Model.CustomerProcessing e)
 {
     return(accessor.GetNext(e));
 }
 public Model.CustomerProcessing GetPrev(Model.CustomerProcessing e)
 {
     return(accessor.GetPrev(e));
 }
 public bool HasRowsAfter(Model.CustomerProcessing e)
 {
     return(accessor.HasRowsAfter(e));
 }
 public bool HasRowsBefore(Model.CustomerProcessing e)
 {
     return(accessor.HasRowsBefore(e));
 }
 public bool ExistsExcept(Model.CustomerProcessing e)
 {
     return(accessor.ExistsExcept(e));
 }