public BizLogicMsg Audit_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_DEPR_ALLOT obj = new EntityObject_MCE_B_ASSETS_DEPR_ALLOT();
                            obj.ID = strID;

                            obj = HelperObject_MCE_B_ASSETS_DEPR_ALLOT.Get(obj);

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

                                obj.AUDIT_STATE   = 3;
                                obj.AUDIT_TIME    = DateTime.Now;
                                obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                HelperObject_MCE_B_ASSETS_DEPR_ALLOT.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_DEPR_ALLOT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(strID));
                }
            }
        }
Example #2
0
        public BizLogicMsg CommitUpdate(EntityObject_MCE_B_ASSETS_DEPR_ALLOT 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_ASSETS_DEPR_ALLOT.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_ASSETS_DEPR_ALLOT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT>(ServiceUri))
                {
                    return(smgr.Service.CommitUpdate(updateBaseEntity, saveDetailEntities, updateDetailEntities, deleteDetailEntities));
                }
            }
        }
Example #3
0
 public int DeleteByTrans2(CauseObject_MCE_B_ASSETS_DEPR_ALLOT cause, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         return(HelperObject_MCE_B_ASSETS_DEPR_ALLOT.Delete(cause, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Example #4
0
 public int UpdateByTrans(EntityObject_MCE_B_ASSETS_DEPR_ALLOT obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditEdit(obj);
         return(HelperObject_MCE_B_ASSETS_DEPR_ALLOT.Update(obj, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Example #5
0
 public int SaveByTrans(EntityObject_MCE_B_ASSETS_DEPR_ALLOT obj, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         SystemLogic.Proxy.AuditAdd(obj);
         int amount = HelperObject_MCE_B_ASSETS_DEPR_ALLOT.Save(obj, transaction);
         //平台自动生成代码
         return(amount);
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Example #6
0
 public DisplayObject_MCE_B_ASSETS_DEPR_ALLOT[] List()
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_ASSETS_DEPR_ALLOT.List());
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT>(ServiceUri))
         {
             return(smgr.Service.List());
         }
     }
 }
Example #7
0
 public EntityObject_MCE_B_ASSETS_DEPR_ALLOT Get(EntityObject_MCE_B_ASSETS_DEPR_ALLOT obj)
 {
     if (LocalMode)
     {
         //平台自动生成代码
         return(HelperObject_MCE_B_ASSETS_DEPR_ALLOT.Get(obj));
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT>(ServiceUri))
         {
             return(smgr.Service.Get(obj));
         }
     }
 }
Example #8
0
 public BizLogicMsg UndoAudit(EntityObject_MCE_B_ASSETS_DEPR_ALLOT 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_DEPR_ALLOT.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_DEPR_ALLOT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT>(ServiceUri))
         {
             return(smgr.Service.UndoAudit(obj));
         }
     }
 }
Example #9
0
        public BizLogicMsg BatchUpdate(EntityObject_MCE_B_ASSETS_DEPR_ALLOT[] objs)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (EntityObject_MCE_B_ASSETS_DEPR_ALLOT obj in objs)
                            {
                                SystemLogic.Proxy.AuditEdit(obj);
                            }
                            int amount = 0;

                            //平台自动生成代码
                            foreach (EntityObject_MCE_B_ASSETS_DEPR_ALLOT obj in objs)
                            {
                                amount += HelperObject_MCE_B_ASSETS_DEPR_ALLOT.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_DEPR_ALLOT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT>(ServiceUri))
                {
                    return(smgr.Service.BatchUpdate(objs));
                }
            }
        }
Example #10
0
        public DisplayObject_MCE_B_ASSETS_DEPR_ALLOT[] Query(CauseObject_MCE_B_ASSETS_DEPR_ALLOT cause, PagingParamter paging, OrderByParameter order)
        {
            if (LocalMode)
            {
                SystemLogic.Proxy.AuditQuery(cause);

                //平台自动生成代码
                return(HelperObject_MCE_B_ASSETS_DEPR_ALLOT.Query(cause, paging, order));
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT>(ServiceUri))
                {
                    return(smgr.Service.Query(cause, paging, order));
                }
            }
        }
Example #11
0
 public BizLogicMsg CommitDelete(EntityObject_MCE_B_ASSETS_DEPR_ALLOT 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_DEPR_ALLOT.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_DEPR_ALLOT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT>(ServiceUri))
         {
             return(smgr.Service.CommitDelete(deleteBaseEntity));
         }
     }
 }
Example #12
0
 public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_DEPR_ALLOT 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_DEPR_ALLOT.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_DEPR_ALLOT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT>(ServiceUri))
         {
             return(smgr.Service.Delete(cause));
         }
     }
 }
Example #13
0
        public EntityObject_MCE_B_ASSETS_DEPR_ALLOT Load(IDbTransaction transaction, string id, out EntityObject_COM_DEPART dept_id, out EntityObject_MCE_B_ASSETS assets_id, out EntityObject_MCE_D_DEPR_TYPE depr_id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_DEPR_ALLOT obj = new EntityObject_MCE_B_ASSETS_DEPR_ALLOT();

                //平台自动生成代码
                dept_id   = new EntityObject_COM_DEPART();
                assets_id = new EntityObject_MCE_B_ASSETS();
                depr_id   = new EntityObject_MCE_D_DEPR_TYPE();


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_DEPR_ALLOT.Get(obj, transaction);
                if (!string.IsNullOrEmpty(obj.DEPT_ID))
                {
                    dept_id.ID = obj.DEPT_ID;
                    dept_id    = HelperObject_COM_DEPART.Get(dept_id, 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.DEPR_ID))
                {
                    depr_id.ID = obj.DEPR_ID;
                    depr_id    = HelperObject_MCE_D_DEPR_TYPE.Get(depr_id, transaction);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
        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_DEPR_ALLOT obj = new EntityObject_MCE_B_ASSETS_DEPR_ALLOT();
                            obj.ID = strID;

                            obj = HelperObject_MCE_B_ASSETS_DEPR_ALLOT.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_DEPR_ALLOT";

                                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_DEPR_ALLOT.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_AFFIX> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_AFFIX>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(strID));
                }
            }
        }
        public BizLogicMsg Save_Ext(JsonMceAssetsDeprAllot item)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_DEPR_ALLOT obj = new EntityObject_MCE_B_ASSETS_DEPR_ALLOT();

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

                                obj = HelperObject_MCE_B_ASSETS_DEPR_ALLOT.Get(obj);

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

                            obj.DEPT_ID   = item.dept_id;
                            obj.DEPR_ID   = item.depr_id;
                            obj.ASSETS_ID = item.assets_id;
                            if (!string.IsNullOrEmpty(item.ratio))
                            {
                                obj.RATIO = decimal.Parse(item.ratio);
                            }

                            if (!string.IsNullOrEmpty(item.depr_years))
                            {
                                obj.DEPR_YEARS = decimal.Parse(item.depr_years);
                            }

                            obj.COMMENTS = item.comments;


                            if (string.IsNullOrEmpty(item.id))
                            {
                                obj.AUDIT_STATE = 1;
                                obj.CREATE_TIME = DateTime.Now;
                                HelperObject_MCE_B_ASSETS_DEPR_ALLOT.Save(obj, transaction);
                            }
                            else
                            {
                                obj.ID = item.id;
                                HelperObject_MCE_B_ASSETS_DEPR_ALLOT.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_DEPR_ALLOT";
                                                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_DEPR_ALLOT";
                                                    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_DEPR_ALLOT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR_ALLOT>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(item));
                }
            }
        }