예제 #1
0
        public BizLogicMsg Contract_Stop(string strID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_CONTRACT obj = new EntityObject_MCE_B_ASSETS_CONTRACT();
                            obj.ID = strID;

                            obj = HelperObject_MCE_B_ASSETS_CONTRACT.Get(obj);

                            if (obj != null)
                            {
                                if (obj.STATE == 2)
                                {
                                    throw new Exception("该合同已经终止.");
                                }

                                obj.STATE = 2;

                                HelperObject_MCE_B_ASSETS_CONTRACT.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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.Contract_Stop(strID));
                }
            }
        }
예제 #2
0
        public EntityObject_MCE_B_ASSETS_CONTRACT Load(IDbTransaction transaction, string id, out EntityObject_COM_USER input_person, out EntityObject_MCE_B_ASSETS assets_id, out EntityObject_COM_TYPE type_id, out EntityObject_MDM_D_DEPT second_party, out EntityObject_COM_DEPART first_party, out EntityObject_COM_USER archivist)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_CONTRACT obj = new EntityObject_MCE_B_ASSETS_CONTRACT();

                //平台自动生成代码
                input_person = new EntityObject_COM_USER();
                assets_id    = new EntityObject_MCE_B_ASSETS();
                type_id      = new EntityObject_COM_TYPE();
                second_party = new EntityObject_MDM_D_DEPT();
                first_party  = new EntityObject_COM_DEPART();
                archivist    = new EntityObject_COM_USER();


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_CONTRACT.Get(obj, transaction);
                if (!string.IsNullOrEmpty(obj.INPUT_PERSON))
                {
                    input_person.ID = obj.INPUT_PERSON;
                    input_person    = HelperObject_COM_USER.Get(input_person, transaction);
                }
                if (!string.IsNullOrEmpty(obj.ASSETS_ID))
                {
                    assets_id.ID = obj.ASSETS_ID;
                    assets_id    = HelperObject_MCE_B_ASSETS.Get(assets_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.TYPE_ID))
                {
                    type_id.ID = obj.TYPE_ID;
                    type_id    = HelperObject_COM_TYPE.Get(type_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.SECOND_PARTY))
                {
                    second_party.ID = obj.SECOND_PARTY;
                    second_party    = HelperObject_MDM_D_DEPT.Get(second_party, transaction);
                }
                if (!string.IsNullOrEmpty(obj.FIRST_PARTY))
                {
                    first_party.ID = obj.FIRST_PARTY;
                    first_party    = HelperObject_COM_DEPART.Get(first_party, transaction);
                }
                if (!string.IsNullOrEmpty(obj.ARCHIVIST))
                {
                    archivist.ID = obj.ARCHIVIST;
                    archivist    = HelperObject_COM_USER.Get(archivist, transaction);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
예제 #3
0
 public int DeleteByTrans2(CauseObject_MCE_B_ASSETS_CONTRACT cause, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         return(HelperObject_MCE_B_ASSETS_CONTRACT.Delete(cause, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
예제 #4
0
 public int UpdateByTrans(EntityObject_MCE_B_ASSETS_CONTRACT obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditEdit(obj);
         return(HelperObject_MCE_B_ASSETS_CONTRACT.Update(obj, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
예제 #5
0
 public int SaveByTrans(EntityObject_MCE_B_ASSETS_CONTRACT obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditAdd(obj);
         int amount = HelperObject_MCE_B_ASSETS_CONTRACT.Save(obj, transaction);
         //平台自动生成代码
         return(amount);
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
예제 #6
0
 public BizLogicMsg CommitUpdate(EntityObject_MCE_B_ASSETS_CONTRACT[] saveEntities, EntityObject_MCE_B_ASSETS_CONTRACT[] updateEntities, EntityObject_MCE_B_ASSETS_CONTRACT[] deleteEntities)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     //平台自动生成代码
                     foreach (EntityObject_MCE_B_ASSETS_CONTRACT obj in saveEntities)
                     {
                         SystemLogic.Proxy.AuditAdd(obj);
                         HelperObject_MCE_B_ASSETS_CONTRACT.Save(obj, transaction);
                     }
                     foreach (EntityObject_MCE_B_ASSETS_CONTRACT obj in updateEntities)
                     {
                         SystemLogic.Proxy.AuditEdit(obj);
                         HelperObject_MCE_B_ASSETS_CONTRACT.Update(obj, transaction);
                     }
                     foreach (EntityObject_MCE_B_ASSETS_CONTRACT obj in deleteEntities)
                     {
                         HelperObject_MCE_B_ASSETS_CONTRACT.Delete(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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
         {
             return(smgr.Service.CommitUpdate(saveEntities, updateEntities, deleteEntities));
         }
     }
 }
예제 #7
0
 public DisplayObject_MCE_B_ASSETS_CONTRACT[] List()
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_ASSETS_CONTRACT.List());
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
         {
             return(smgr.Service.List());
         }
     }
 }
예제 #8
0
 public EntityObject_MCE_B_ASSETS_CONTRACT Get(EntityObject_MCE_B_ASSETS_CONTRACT obj)
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_ASSETS_CONTRACT.Get(obj));
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
         {
             return(smgr.Service.Get(obj));
         }
     }
 }
예제 #9
0
        public BizLogicMsg BatchUpdate(EntityObject_MCE_B_ASSETS_CONTRACT[] objs)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (EntityObject_MCE_B_ASSETS_CONTRACT obj in objs)
                            {
                                SystemLogic.Proxy.AuditEdit(obj);
                            }
                            int amount = 0;

                            //平台自动生成代码
                            foreach (EntityObject_MCE_B_ASSETS_CONTRACT obj in objs)
                            {
                                amount += HelperObject_MCE_B_ASSETS_CONTRACT.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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.BatchUpdate(objs));
                }
            }
        }
예제 #10
0
        public DisplayObject_MCE_B_ASSETS_CONTRACT[] Query(CauseObject_MCE_B_ASSETS_CONTRACT cause, PagingParamter paging, OrderByParameter order)
        {
            if (LocalMode)
            {
                SystemLogic.Proxy.AuditQuery(cause);

                //平台自动生成代码
                return(HelperObject_MCE_B_ASSETS_CONTRACT.Query(cause, paging, order));
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.Query(cause, paging, order));
                }
            }
        }
예제 #11
0
        public BizLogicMsg CommitSave(EntityObject_MCE_B_ASSETS_CONTRACT saveBaseEntity, EntityObject_[] saveDetailEntities)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            SystemLogic.Proxy.AuditAdd(saveBaseEntity);
                            HelperObject_MCE_B_ASSETS_CONTRACT.Save(saveBaseEntity, transaction);

                            //平台自动生成代码
                            foreach (EntityObject_ obj in saveDetailEntities)
                            {
                                obj. = saveBaseEntity.ID;
                                SystemLogic.Proxy.AuditAdd(obj);
                                HelperObject_.Save(obj, transaction);
                            }
                            PostSave(saveBaseEntity, 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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.CommitSave(saveBaseEntity, saveDetailEntities));
                }
            }
        }
예제 #12
0
 public BizLogicMsg UndoAudit(EntityObject_MCE_B_ASSETS_CONTRACT 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_ASSETS_CONTRACT.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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
         {
             return(smgr.Service.UndoAudit(obj));
         }
     }
 }
예제 #13
0
 public BizLogicMsg CommitDelete(EntityObject_MCE_B_ASSETS_CONTRACT 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_ASSETS_CONTRACT.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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
         {
             return(smgr.Service.CommitDelete(deleteBaseEntity));
         }
     }
 }
예제 #14
0
 public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_CONTRACT cause)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     int amount = HelperObject_MCE_B_ASSETS_CONTRACT.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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
         {
             return(smgr.Service.Delete(cause));
         }
     }
 }
예제 #15
0
        public EntityObject_MCE_B_ASSETS_CONTRACT_PAY Load(IDbTransaction transaction, string id, out EntityObject_MCE_B_ASSETS_CONTRACT base_id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_CONTRACT_PAY obj = new EntityObject_MCE_B_ASSETS_CONTRACT_PAY();

                //平台自动生成代码
                base_id = new EntityObject_MCE_B_ASSETS_CONTRACT();


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_CONTRACT_PAY.Get(obj, transaction);
                if (!string.IsNullOrEmpty(obj.BASE_ID))
                {
                    base_id.ID = obj.BASE_ID;
                    base_id    = HelperObject_MCE_B_ASSETS_CONTRACT.Get(base_id, transaction);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
예제 #16
0
        public BizLogicMsg Delete_Ext(string strID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_CONTRACT obj = new EntityObject_MCE_B_ASSETS_CONTRACT();
                            obj.ID = strID;

                            obj = HelperObject_MCE_B_ASSETS_CONTRACT.Get(obj);

                            if (obj != null)
                            {
                                if (obj.AUDIT_STATE == 3 || obj.AUDIT_STATE == 4)
                                {
                                    throw new Exception("已经审核的合同信息不能删除.");
                                }

                                CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE();
                                pCOM_FILE.REF_TAB_ID   = obj.ID;
                                pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_CONTRACT";

                                DisplayObject_COM_FILE[] listCOM_FILE = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE);

                                if (listCOM_FILE != null && listCOM_FILE.Length > 0)
                                {
                                    foreach (DisplayObject_COM_FILE item in listCOM_FILE)
                                    {
                                        if (!string.IsNullOrEmpty(item.SERVER_NAME))
                                        {
                                            string strFileURL = System.Web.HttpContext.Current.Server.MapPath("~/upload/mce/" + item.SERVER_NAME);//路径
                                            if (File.Exists(strFileURL))
                                            {
                                                File.Delete(strFileURL);
                                            }
                                        }
                                    }
                                }
                                HelperObject_COM_FILE.Delete(pCOM_FILE, transaction);

                                HelperObject_MCE_B_ASSETS_CONTRACT.Delete(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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(strID));
                }
            }
        }
예제 #17
0
        public BizLogicMsg Save_Ext2(JsonMCE_Contract json)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_CONTRACT entity = new EntityObject_MCE_B_ASSETS_CONTRACT();


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

                                entity = HelperObject_MCE_B_ASSETS_CONTRACT.Get(entity);

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

                            entity.CODE = json.CODE;
                            entity.NAME = json.NAME;

                            if (!string.IsNullOrEmpty(json.SIGN_DATE))
                            {
                                entity.SIGN_DATE = DateTime.Parse(json.SIGN_DATE);
                            }
                            if (!string.IsNullOrEmpty(json.EXPIRE_DATE))
                            {
                                entity.EXPIRE_DATE = DateTime.Parse(json.EXPIRE_DATE);
                            }
                            entity.TYPE_ID     = json.TYPE_ID;
                            entity.FIRST_PARTY = json.FIRST_PARTY;

                            entity.SECOND_PARTY       = json.SECOND_PARTY;
                            entity.SECOND_LINK_PERSON = json.SECOND_LINK_PERSON;
                            entity.SECOND_LINK_PHONE  = json.SECOND_LINK_PHONE;

                            if (!string.IsNullOrEmpty(json.MONEY))
                            {
                                entity.MONEY = decimal.Parse(json.MONEY);
                            }

                            entity.ARCHIVE_NO = json.ARCHIVE_NO;

                            if (!string.IsNullOrEmpty(json.CHECK_DATE))
                            {
                                entity.CHECK_DATE = DateTime.Parse(json.CHECK_DATE);
                            }
                            entity.ARCHIVIST        = json.ARCHIVIST;
                            entity.INPUT_PERSON     = json.INPUT_PERSON;
                            entity.CONTRACT_CONTENT = json.CONTRACT_CONTENT;


                            entity.STATE = 1;

                            if (string.IsNullOrEmpty(json.ID))
                            {
                                entity.CONTRACT_STATE = 1;
                                entity.CREATE_TIME    = DateTime.Now;
                                entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                int amount = HelperObject_MCE_B_ASSETS_CONTRACT.Save(entity, transaction);
                            }
                            else
                            {
                                entity.MODIFY_TIME    = DateTime.Now;
                                entity.MODIFY_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                int amount = HelperObject_MCE_B_ASSETS_CONTRACT.Update(entity, transaction);


                                CauseObject_MCE_B_ASSETS_CONTRACT_D pCONTRACT_D = new CauseObject_MCE_B_ASSETS_CONTRACT_D();
                                pCONTRACT_D.BASE_ID = json.ID;
                                HelperObject_MCE_B_ASSETS_CONTRACT_D.Delete(pCONTRACT_D, transaction);


                                CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE();
                                pCOM_FILE.REF_TAB_ID   = entity.ID;
                                pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_CONTRACT";
                                HelperObject_COM_FILE.Delete(pCOM_FILE, transaction);


                                DisplayObject_MCE_B_ASSETS_CONTRACT_PAY[] list_Pay = BizLogicObject_MCE_B_ASSETS_CONTRACT_PAY.Proxy.Query(new CauseObject_MCE_B_ASSETS_CONTRACT_PAY()
                                {
                                    BASE_ID = entity.ID
                                });
                                if (list_Pay != null && list_Pay.Length > 0)
                                {
                                    foreach (DisplayObject_MCE_B_ASSETS_CONTRACT_PAY item_Pay in list_Pay)
                                    {
                                        var v_Pay = json.listPay.Find(l => l.ID == item_Pay.ID);
                                        if (v_Pay == null)
                                        {
                                            HelperObject_MCE_B_ASSETS_CONTRACT_PAY.Delete(item_Pay, transaction);
                                        }
                                    }
                                }
                            }


                            if (json.children != null && json.children.Count > 0)
                            {
                                foreach (JsonMCE_Contract_D item in json.children)
                                {
                                    EntityObject_MCE_B_ASSETS_CONTRACT_D entity_D = new EntityObject_MCE_B_ASSETS_CONTRACT_D();

                                    entity_D.BASE_ID  = entity.ID;
                                    entity_D.ASSET_ID = item.ASSET_ID;

                                    HelperObject_MCE_B_ASSETS_CONTRACT_D.Save(entity_D, transaction);
                                }
                            }


                            if (json.listPay != null && json.listPay.Count > 0)
                            {
                                foreach (JsonMCE_Contract_Pay item in json.listPay)
                                {
                                    EntityObject_MCE_B_ASSETS_CONTRACT_PAY entity_D = new EntityObject_MCE_B_ASSETS_CONTRACT_PAY();

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

                                        entity_D = HelperObject_MCE_B_ASSETS_CONTRACT_PAY.Get(entity_D);

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

                                    entity_D.BASE_ID = entity.ID;
                                    entity_D.PERIODS = item.PERIODS;
                                    if (!string.IsNullOrEmpty(item.MONEY))
                                    {
                                        entity_D.MONEY = decimal.Parse(item.MONEY);
                                    }
                                    if (!string.IsNullOrEmpty(item.PLAN_PAY_DATE))
                                    {
                                        entity_D.PLAN_PAY_DATE = DateTime.Parse(item.PLAN_PAY_DATE);
                                    }

                                    if (string.IsNullOrEmpty(item.ID))
                                    {
                                        entity_D.STATE = 2;
                                        HelperObject_MCE_B_ASSETS_CONTRACT_PAY.Save(entity_D, transaction);
                                    }
                                    else
                                    {
                                        HelperObject_MCE_B_ASSETS_CONTRACT_PAY.Update(entity_D, transaction);
                                    }
                                }
                            }


                            if (json.listAttach != null && json.listAttach.Count > 0)
                            {
                                foreach (JsonMCEMT_APPLY_MTN_ATTACH item in json.listAttach)
                                {
                                    Ipedf.Web.Entity.EntityObject_COM_FILE entityPicFile = new Ipedf.Web.Entity.EntityObject_COM_FILE();
                                    entityPicFile.REF_TAB_NAME   = "MCE_B_ASSETS_CONTRACT";
                                    entityPicFile.CLIENT_NAME    = item.CLIENT_NAME;
                                    entityPicFile.STATE          = 1;
                                    entityPicFile.CREATE_TIME    = item.CREATE_TIME;
                                    entityPicFile.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                    entityPicFile.REF_TAB_ID     = entity.ID;
                                    entityPicFile.SERVER_NAME    = item.SERVER_NAME;
                                    entityPicFile.IS_IMPORT      = 0;
                                    Ipedf.Web.DataAccess.HelperObject_COM_FILE.Save(entityPicFile, 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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext2(json));
                }
            }
        }
예제 #18
0
        public BizLogicMsg Submit_Ext2(List <string> listID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (string strID in listID)
                            {
                                EntityObject_MCE_B_ASSETS_CONTRACT obj = new EntityObject_MCE_B_ASSETS_CONTRACT();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_CONTRACT.Get(obj);

                                if (obj != null)
                                {
                                    if (obj.STATE == 2 || obj.STATE == 3 || obj.STATE == 4)
                                    {
                                        throw new Exception("已经提交的数据不能再提交.");
                                    }


                                    if (string.IsNullOrEmpty(obj.CODE))
                                    {
                                        throw new Exception("单号不能为空.");
                                    }

                                    obj.STATE = 2;
                                    HelperObject_MCE_B_ASSETS_CONTRACT.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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.Submit_Ext2(listID));
                }
            }
        }
예제 #19
0
        public BizLogicMsg Audit_Ext2(List <string> listID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (string strID in listID)
                            {
                                EntityObject_MCE_B_ASSETS_CONTRACT obj = new EntityObject_MCE_B_ASSETS_CONTRACT();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_CONTRACT.Get(obj);

                                if (obj != null)
                                {
                                    if (obj.STATE == 3 || obj.STATE == 4)
                                    {
                                        throw new Exception("已经审核的数据不能再审核.");
                                    }

                                    obj.STATE         = 3;
                                    obj.AUDIT_TIME    = DateTime.Now;
                                    obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                    HelperObject_MCE_B_ASSETS_CONTRACT.Update(obj, transaction);



                                    DisplayObject_MCE_B_ASSETS_CONTRACT_D[] list_D = BizLogicObject_MCE_B_ASSETS_CONTRACT_D.Proxy.Query(new CauseObject_MCE_B_ASSETS_CONTRACT_D()
                                    {
                                        BASE_ID = obj.ID
                                    });
                                    if (list_D != null && list_D.Length > 0)
                                    {
                                        foreach (DisplayObject_MCE_B_ASSETS_CONTRACT_D item_D in list_D)
                                        {
                                            EntityObject_MCE_B_ASSETS objMCE_B_ASSETS = new EntityObject_MCE_B_ASSETS();
                                            objMCE_B_ASSETS.ID = item_D.ASSET_ID;

                                            objMCE_B_ASSETS = HelperObject_MCE_B_ASSETS.Get(objMCE_B_ASSETS);

                                            if (obj != null)
                                            {
                                                objMCE_B_ASSETS.CONTRACT_CODE = obj.CODE;

                                                HelperObject_MCE_B_ASSETS.Update(objMCE_B_ASSETS, 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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext2(listID));
                }
            }
        }
예제 #20
0
        public BizLogicMsg Continue_Ext2(string strID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_CONTRACT obj = new EntityObject_MCE_B_ASSETS_CONTRACT();
                            obj.ID = strID;

                            obj = HelperObject_MCE_B_ASSETS_CONTRACT.Get(obj);

                            if (obj != null)
                            {
                                obj.CONTRACT_STATE = 2;
                                HelperObject_MCE_B_ASSETS_CONTRACT.Update(obj, transaction);

                                string strCode = BizLogicObject_MCE_B_ASSETS.Proxy.Generate_Bill_Code("MceContract");
                                obj.CODE           = strCode;
                                obj.STATE          = 1;
                                obj.CONTRACT_STATE = 1;
                                HelperObject_MCE_B_ASSETS_CONTRACT.Save(obj, transaction);



                                DisplayObject_MCE_B_ASSETS_CONTRACT_D[] list_D = BizLogicObject_MCE_B_ASSETS_CONTRACT_D.Proxy.Query(new CauseObject_MCE_B_ASSETS_CONTRACT_D()
                                {
                                    BASE_ID = strID
                                });
                                if (list_D != null && list_D.Length > 0)
                                {
                                    foreach (DisplayObject_MCE_B_ASSETS_CONTRACT_D item_D in list_D)
                                    {
                                        EntityObject_MCE_B_ASSETS_CONTRACT_D obj_D = new EntityObject_MCE_B_ASSETS_CONTRACT_D();
                                        obj_D.ID = item_D.ID;

                                        obj_D = HelperObject_MCE_B_ASSETS_CONTRACT_D.Get(obj_D);

                                        if (obj_D != null)
                                        {
                                            obj_D.BASE_ID = obj.ID;
                                            HelperObject_MCE_B_ASSETS_CONTRACT_D.Save(obj_D, transaction);
                                        }
                                    }
                                }


                                DisplayObject_MCE_B_ASSETS_CONTRACT_PAY[] list_P = BizLogicObject_MCE_B_ASSETS_CONTRACT_PAY.Proxy.Query(new CauseObject_MCE_B_ASSETS_CONTRACT_PAY()
                                {
                                    BASE_ID = strID
                                });
                                if (list_P != null && list_P.Length > 0)
                                {
                                    foreach (DisplayObject_MCE_B_ASSETS_CONTRACT_PAY item_P in list_P)
                                    {
                                        EntityObject_MCE_B_ASSETS_CONTRACT_PAY obj_P = new EntityObject_MCE_B_ASSETS_CONTRACT_PAY();
                                        obj_P.ID = item_P.ID;

                                        obj_P = HelperObject_MCE_B_ASSETS_CONTRACT_PAY.Get(obj_P);

                                        if (obj_P != null)
                                        {
                                            obj_P.BASE_ID = obj.ID;
                                            HelperObject_MCE_B_ASSETS_CONTRACT_PAY.Save(obj_P, transaction);
                                        }
                                    }
                                }

                                CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE();
                                pCOM_FILE.REF_TAB_ID   = strID;
                                pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_CONTRACT";
                                DisplayObject_COM_FILE[] list_F = HelperObject_COM_FILE.Query(pCOM_FILE);
                                if (list_F != null && list_F.Length > 0)
                                {
                                    foreach (DisplayObject_COM_FILE item_F in list_F)
                                    {
                                        EntityObject_COM_FILE obj_F = new EntityObject_COM_FILE();
                                        obj_F.ID = item_F.ID;

                                        obj_F = HelperObject_COM_FILE.Get(obj_F);

                                        if (obj_F != null)
                                        {
                                            obj_F.REF_TAB_ID = obj.ID;
                                            HelperObject_COM_FILE.Save(obj_F, 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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.Continue_Ext2(strID));
                }
            }
        }
예제 #21
0
        public BizLogicMsg Save_Ext(JsonMceAssetsContract item)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_CONTRACT obj = new EntityObject_MCE_B_ASSETS_CONTRACT();

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

                                obj = HelperObject_MCE_B_ASSETS_CONTRACT.Get(obj);

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

                            obj.ASSETS_ID = item.assets_id;
                            // obj.CODE = item.code;
                            obj.NAME         = item.name;
                            obj.TYPE_ID      = item.type_id;
                            obj.FIRST_PARTY  = item.first_party;
                            obj.SECOND_PARTY = item.second_party;

                            if (!string.IsNullOrEmpty(item.money))
                            {
                                obj.MONEY = decimal.Parse(item.money);
                            }

                            if (!string.IsNullOrEmpty(item.sign_date))
                            {
                                obj.SIGN_DATE = DateTime.Parse(item.sign_date);
                            }

                            if (!string.IsNullOrEmpty(item.expire_date))
                            {
                                obj.EXPIRE_DATE = DateTime.Parse(item.expire_date);
                            }

                            obj.COMMENTS = item.comments;


                            if (string.IsNullOrEmpty(item.id))
                            {
                                obj.CODE        = GetContractCode();
                                obj.AUDIT_STATE = 1;
                                obj.STATE       = 1;
                                HelperObject_MCE_B_ASSETS_CONTRACT.Save(obj, transaction);
                            }
                            else
                            {
                                obj.ID = item.id;
                                HelperObject_MCE_B_ASSETS_CONTRACT.Update(obj, transaction);
                            }

                            if (item.listFileName != null && (item.listFileName.Count > 0))
                            {
                                foreach (JsonMceAssetsFileInfo objFullName in item.listFileName)
                                {
                                    if (!string.IsNullOrEmpty(objFullName.saveName))
                                    {
                                        try
                                        {
                                            string strFileURL = System.Web.HttpContext.Current.Server.MapPath("~/upload/mce/" + objFullName.saveName);//路径
                                            if (File.Exists(strFileURL))
                                            {
                                                CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE();
                                                pCOM_FILE.REF_TAB_ID   = obj.ID;
                                                pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_CONTRACT";
                                                pCOM_FILE.SERVER_NAME  = objFullName.saveName;
                                                DisplayObject_COM_FILE[] listCOM_FILE = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE);

                                                if (listCOM_FILE == null || listCOM_FILE.Length == 0)
                                                {
                                                    Ipedf.Web.Entity.EntityObject_COM_FILE entityPicFile = new Ipedf.Web.Entity.EntityObject_COM_FILE();
                                                    entityPicFile.REF_TAB_NAME   = "MCE_B_ASSETS_CONTRACT";
                                                    entityPicFile.CLIENT_NAME    = objFullName.fileName;
                                                    entityPicFile.STATE          = 1;
                                                    entityPicFile.CREATE_TIME    = DateTime.Now;
                                                    entityPicFile.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                                    entityPicFile.REF_TAB_ID     = obj.ID;
                                                    entityPicFile.SERVER_NAME    = objFullName.saveName;
                                                    entityPicFile.IS_IMPORT      = 0;
                                                    Ipedf.Web.DataAccess.HelperObject_COM_FILE.Save(entityPicFile, transaction);
                                                }
                                            }
                                        }
                                        catch { }
                                    }
                                }
                            }

                            msg.Message = obj.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_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(item));
                }
            }
        }