Example #1
0
        public BizLogicMsg CommitUpdate(EntityObject_MCE_B_SALES_RETURN_D updateBaseEntity, EntityObject_[] saveDetailEntities, EntityObject_[] updateDetailEntities, EntityObject_[] deleteDetailEntities)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            SystemLogic.Proxy.AuditEdit(updateBaseEntity);
                            HelperObject_MCE_B_SALES_RETURN_D.Update(updateBaseEntity, transaction);

                            //平台自动生成代码
                            foreach (EntityObject_ obj in saveDetailEntities)
                            {
                                obj. = updateBaseEntity.ID;
                                SystemLogic.Proxy.AuditAdd(obj);
                                HelperObject_.Save(obj, transaction);
                            }
                            foreach (EntityObject_ obj in updateDetailEntities)
                            {
                                SystemLogic.Proxy.AuditEdit(obj);
                                HelperObject_.Update(obj, transaction);
                            }
                            foreach (EntityObject_ obj in deleteDetailEntities)
                            {
                                HelperObject_.Delete(obj, transaction);
                            }
                            PostSave(updateBaseEntity, transaction);
                            transaction.Commit();
                        }
                        catch (Exception expt)
                        {
                            transaction.Rollback();
                            msg = new BizLogicMsg(false, expt.Message);
                            Error(expt);
                        }
                        finally
                        {
                            IDALProvider.IDAL.PushConnection(connection);
                        }
                    }
                }
                return(msg);
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D>(ServiceUri))
                {
                    return(smgr.Service.CommitUpdate(updateBaseEntity, saveDetailEntities, updateDetailEntities, deleteDetailEntities));
                }
            }
        }
Example #2
0
 public int DeleteByTrans2(CauseObject_MCE_B_SALES_RETURN_D cause, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         return(HelperObject_MCE_B_SALES_RETURN_D.Delete(cause, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Example #3
0
 public int UpdateByTrans(EntityObject_MCE_B_SALES_RETURN_D obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditEdit(obj);
         return(HelperObject_MCE_B_SALES_RETURN_D.Update(obj, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Example #4
0
 public int SaveByTrans(EntityObject_MCE_B_SALES_RETURN_D obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditAdd(obj);
         int amount = HelperObject_MCE_B_SALES_RETURN_D.Save(obj, transaction);
         //平台自动生成代码
         return(amount);
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Example #5
0
 public DisplayObject_MCE_B_SALES_RETURN_D[] List()
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_SALES_RETURN_D.List());
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D>(ServiceUri))
         {
             return(smgr.Service.List());
         }
     }
 }
Example #6
0
 public EntityObject_MCE_B_SALES_RETURN_D Get(EntityObject_MCE_B_SALES_RETURN_D obj)
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_SALES_RETURN_D.Get(obj));
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D>(ServiceUri))
         {
             return(smgr.Service.Get(obj));
         }
     }
 }
Example #7
0
 public BizLogicMsg UndoAudit(EntityObject_MCE_B_SALES_RETURN_D obj)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     SystemLogic.Proxy.AuditUndoAudit(obj);
                     int amount = HelperObject_MCE_B_SALES_RETURN_D.Update(obj, transaction);
                     //平台自动生成代码
                     PostUndoAudit(obj, transaction);
                     //执行撤回操作
                     msg = SystemLogic.Proxy.BillUndoAudit(obj, transaction);
                     if (!msg.Succeed)
                     {
                         throw new Exception(msg.Message);
                     }
                     transaction.Commit();
                 }
                 catch (Exception expt)
                 {
                     SystemLogic.Proxy.AuditState(obj, Ipedf.Common.数据状态.已审核);
                     transaction.Rollback();
                     msg = new BizLogicMsg(false, expt.Message);
                     Error(expt);
                 }
                 finally
                 {
                     IDALProvider.IDAL.PushConnection(connection);
                 }
             }
         }
         return(msg);
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D>(ServiceUri))
         {
             return(smgr.Service.UndoAudit(obj));
         }
     }
 }
Example #8
0
        public BizLogicMsg BatchUpdate(EntityObject_MCE_B_SALES_RETURN_D[] objs)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (EntityObject_MCE_B_SALES_RETURN_D obj in objs)
                            {
                                SystemLogic.Proxy.AuditEdit(obj);
                            }
                            int amount = 0;

                            //平台自动生成代码
                            foreach (EntityObject_MCE_B_SALES_RETURN_D obj in objs)
                            {
                                amount += HelperObject_MCE_B_SALES_RETURN_D.Update(obj, transaction);
                            }
                            transaction.Commit();
                        }
                        catch (Exception expt)
                        {
                            transaction.Rollback();
                            msg = new BizLogicMsg(false, expt.Message);
                            Error(expt);
                        }
                        finally
                        {
                            IDALProvider.IDAL.PushConnection(connection);
                        }
                    }
                }
                return(msg);
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D>(ServiceUri))
                {
                    return(smgr.Service.BatchUpdate(objs));
                }
            }
        }
Example #9
0
        public DisplayObject_MCE_B_SALES_RETURN_D[] Query(CauseObject_MCE_B_SALES_RETURN_D cause, PagingParamter paging, OrderByParameter order)
        {
            if (LocalMode)
            {
                SystemLogic.Proxy.AuditQuery(cause);

                //平台自动生成代码
                return(HelperObject_MCE_B_SALES_RETURN_D.Query(cause, paging, order));
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D>(ServiceUri))
                {
                    return(smgr.Service.Query(cause, paging, order));
                }
            }
        }
Example #10
0
        public EntityObject_MCE_B_SALES_RETURN_D Load(IDbTransaction transaction, string id, out EntityObject_MDM_D_DEPT prd_id, out EntityObject_COM_TYPE unit_id, out EntityObject_MCE_D_MCE_TYPE asset_type_id, out EntityObject_MCE_B_SALES_RETURN base_id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_SALES_RETURN_D obj = new EntityObject_MCE_B_SALES_RETURN_D();

                //平台自动生成代码
                prd_id        = new EntityObject_MDM_D_DEPT();
                unit_id       = new EntityObject_COM_TYPE();
                asset_type_id = new EntityObject_MCE_D_MCE_TYPE();
                base_id       = new EntityObject_MCE_B_SALES_RETURN();


                obj.ID = id;
                obj    = HelperObject_MCE_B_SALES_RETURN_D.Get(obj, transaction);
                if (!string.IsNullOrEmpty(obj.PRD_ID))
                {
                    prd_id.ID = obj.PRD_ID;
                    prd_id    = HelperObject_MDM_D_DEPT.Get(prd_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.UNIT_ID))
                {
                    unit_id.ID = obj.UNIT_ID;
                    unit_id    = HelperObject_COM_TYPE.Get(unit_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.ASSET_TYPE_ID))
                {
                    asset_type_id.ID = obj.ASSET_TYPE_ID;
                    asset_type_id    = HelperObject_MCE_D_MCE_TYPE.Get(asset_type_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.BASE_ID))
                {
                    base_id.ID = obj.BASE_ID;
                    base_id    = HelperObject_MCE_B_SALES_RETURN.Get(base_id, transaction);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
Example #11
0
 public BizLogicMsg CommitDelete(EntityObject_MCE_B_SALES_RETURN_D deleteBaseEntity)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     //平台自动生成代码
                     CauseObject_ p = new CauseObject_();
                     p. = deleteBaseEntity.ID;
                     HelperObject_.Delete(p, transaction);
                     HelperObject_MCE_B_SALES_RETURN_D.Delete(deleteBaseEntity, transaction);
                     transaction.Commit();
                 }
                 catch (Exception expt)
                 {
                     transaction.Rollback();
                     msg = new BizLogicMsg(false, expt.Message);
                     Error(expt);
                 }
                 finally
                 {
                     IDALProvider.IDAL.PushConnection(connection);
                 }
             }
         }
         return(msg);
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D>(ServiceUri))
         {
             return(smgr.Service.CommitDelete(deleteBaseEntity));
         }
     }
 }
Example #12
0
 public BizLogicMsg Delete(CauseObject_MCE_B_SALES_RETURN_D cause)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     int amount = HelperObject_MCE_B_SALES_RETURN_D.Delete(cause, transaction);
                     //平台自动生成代码
                     transaction.Commit();
                 }
                 catch (Exception expt)
                 {
                     transaction.Rollback();
                     msg = new BizLogicMsg(false, expt.Message);
                     Error(expt);
                 }
                 finally
                 {
                     IDALProvider.IDAL.PushConnection(connection);
                 }
             }
         }
         return(msg);
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN_D>(ServiceUri))
         {
             return(smgr.Service.Delete(cause));
         }
     }
 }
        public BizLogicMsg Save_Ext(JsonMCE_SALESRETURN jsonMCE_SALESRETURN)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_SALES_RETURN entity = new EntityObject_MCE_B_SALES_RETURN();


                            if (!string.IsNullOrEmpty(jsonMCE_SALESRETURN.ID))
                            {
                                entity.ID = jsonMCE_SALESRETURN.ID;

                                entity = HelperObject_MCE_B_SALES_RETURN.Get(entity);

                                if (entity == null)
                                {
                                    throw new Exception("获取数据出错.");
                                }
                            }


                            entity.CODE = jsonMCE_SALESRETURN.CODE;

                            if (!string.IsNullOrEmpty(jsonMCE_SALESRETURN.CREATE_DATE))
                            {
                                entity.CREATE_DATE = DateTime.Parse(jsonMCE_SALESRETURN.CREATE_DATE);
                            }
                            entity.PROVIDER_ID = jsonMCE_SALESRETURN.PROVIDER_ID;

                            entity.USER_ID  = jsonMCE_SALESRETURN.USER_ID;
                            entity.STOCK_ID = jsonMCE_SALESRETURN.STOCK_ID;

                            entity.COMMENTS = jsonMCE_SALESRETURN.COMMENTS;

                            entity.STATE = 1;

                            if (string.IsNullOrEmpty(jsonMCE_SALESRETURN.ID))
                            {
                                entity.CREATE_TIME    = DateTime.Now;
                                entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                int amount = HelperObject_MCE_B_SALES_RETURN.Save(entity, transaction);
                            }
                            else
                            {
                                int amount = HelperObject_MCE_B_SALES_RETURN.Update(entity, transaction);
                            }


                            if (jsonMCE_SALESRETURN.DELETEIDS != null && jsonMCE_SALESRETURN.DELETEIDS.Count > 0)
                            {
                                foreach (string strID in jsonMCE_SALESRETURN.DELETEIDS)
                                {
                                    EntityObject_MCE_B_SALES_RETURN_D entity_D = new EntityObject_MCE_B_SALES_RETURN_D();

                                    if (!string.IsNullOrEmpty(strID))
                                    {
                                        entity_D.ID = strID;

                                        entity_D = HelperObject_MCE_B_SALES_RETURN_D.Get(entity_D);

                                        if (entity_D == null)
                                        {
                                            throw new Exception("获取数据出错.");
                                        }
                                        else
                                        {
                                            HelperObject_MCE_B_SALES_RETURN_D.Delete(entity_D, transaction);
                                        }
                                    }
                                }
                            }

                            if (jsonMCE_SALESRETURN.children != null && jsonMCE_SALESRETURN.children.Count > 0)
                            {
                                decimal decTotMoney = 0;
                                foreach (JsonMCE_SALESRETURN_D item in jsonMCE_SALESRETURN.children)
                                {
                                    EntityObject_MCE_B_SALES_RETURN_D entity_D = new EntityObject_MCE_B_SALES_RETURN_D();

                                    if (!string.IsNullOrEmpty(item.ID))
                                    {
                                        entity_D.ID = item.ID;

                                        entity_D = HelperObject_MCE_B_SALES_RETURN_D.Get(entity_D);

                                        if (entity_D == null)
                                        {
                                            throw new Exception("获取数据出错.");
                                        }
                                    }

                                    entity_D.BASE_ID = entity.ID;

                                    entity_D.ASSETS_ID    = item.ASSETS_ID;
                                    entity_D.ASSETS_NAME  = item.ASSETS_NAME;
                                    entity_D.ASSETS_CODE  = item.ASSETS_CODE;
                                    entity_D.REF_TAB_ID   = item.REF_TAB_ID;
                                    entity_D.REF_TAB_NAME = item.REF_TAB_NAME;
                                    entity_D.SPEC         = item.SPEC;
                                    entity_D.COMMENTS     = item.COMMENTS;

                                    entity_D.MONEY = item.MONEY;
                                    entity_D.PRICE = item.PRICE;

                                    if (!string.IsNullOrEmpty(item.PRD_DATE))
                                    {
                                        entity_D.PRD_DATE = DateTime.Parse(item.PRD_DATE);
                                        entity_D.PRD_ID   = item.PRD_ID;
                                    }

                                    decTotMoney = decTotMoney + entity_D.MONEY;

                                    if (string.IsNullOrEmpty(item.ID))
                                    {
                                        HelperObject_MCE_B_SALES_RETURN_D.Save(entity_D, transaction);
                                    }
                                    else
                                    {
                                        HelperObject_MCE_B_SALES_RETURN_D.Update(entity_D, transaction);
                                    }
                                }
                                entity.TOTAL_MONEY = decTotMoney;

                                HelperObject_MCE_B_SALES_RETURN.Update(entity, transaction);
                            }

                            msg.Message = entity.ID;

                            transaction.Commit();
                        }
                        catch (Exception expt)
                        {
                            transaction.Rollback();
                            msg = new BizLogicMsg(false, expt.Message);
                            Error(expt);
                        }
                        finally
                        {
                            IDALProvider.IDAL.PushConnection(connection);
                        }
                    }
                }
                return(msg);
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(jsonMCE_SALESRETURN));
                }
            }
        }