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));
                }
            }
        }
        public BizLogicMsg Save_Ext(JsonMceAssetsImportation item)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_IMPORTATION obj = new EntityObject_MCE_B_ASSETS_IMPORTATION();

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

                                obj = HelperObject_MCE_B_ASSETS_IMPORTATION.Get(obj);

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

                            obj.ASSETS_ID   = item.assets_id;
                            obj.COUNTRY_ID  = item.country_id;
                            obj.CURRENCY_ID = item.currency_id;

                            if (!string.IsNullOrEmpty(item.purchase_money))
                            {
                                obj.PURCHASE_MONEY = decimal.Parse(item.purchase_money);
                            }

                            if (!string.IsNullOrEmpty(item.foreign_currency_rate))
                            {
                                obj.FOREIGN_CURRENCY_RATE = decimal.Parse(item.foreign_currency_rate);
                            }

                            obj.FOREIGN_CURRENCY_SOURCE_ID = item.foreign_currency_source_id;
                            obj.APPROVE_FILE_CODE          = item.approve_file_code;
                            obj.EXEMPTION_CODE             = item.exemption_code;

                            if (!string.IsNullOrEmpty(item.customs))
                            {
                                obj.CUSTOMS = decimal.Parse(item.customs);
                            }

                            obj.COMMENTS = item.comments;


                            if (string.IsNullOrEmpty(item.id))
                            {
                                obj.AUDIT_STATE = 1;
                                obj.CREATE_TIME = DateTime.Now;
                                HelperObject_MCE_B_ASSETS_IMPORTATION.Save(obj, transaction);
                            }
                            else
                            {
                                obj.ID = item.id;
                                HelperObject_MCE_B_ASSETS_IMPORTATION.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_IMPORTATION";
                                                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_IMPORTATION";
                                                    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_IMPORTATION> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_IMPORTATION>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(item));
                }
            }
        }
Beispiel #3
0
        public BizLogicMsg Save_Ext(JsonMCE_Meter_Check json)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_METER_CHECK entity = new EntityObject_MCE_B_ASSETS_METER_CHECK();

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

                                entity = HelperObject_MCE_B_ASSETS_METER_CHECK.Get(entity);

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

                            if (!string.IsNullOrEmpty(json.ACTUAL_IDENTIFICATION))
                            {
                                entity.ACTUAL_IDENTIFICATION = DateTime.Parse(json.ACTUAL_IDENTIFICATION);
                            }

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

                            entity.CERTIFICATE_CODE = json.CERTIFICATE_CODE;

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

                            entity.CHECK_PERSON = json.CHECK_PERSON;


                            entity.COMMENTS = json.COMMENTS;

                            int amount = HelperObject_MCE_B_ASSETS_METER_CHECK.Update(entity, 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_METER_CHECK";
                            HelperObject_COM_FILE.Delete(pCOM_FILE, 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_METER_CHECK";
                                    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_METER_CHECK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER_CHECK>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(json));
                }
            }
        }
Beispiel #4
0
        public BizLogicMsg Save_RollFiles(List <JsonMceAssetsRollFile> listItem)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            if (listItem != null && listItem.Count > 0)
                            {
                                EntityObject_MCE_B_ASSETS_ROLL objRoll = new EntityObject_MCE_B_ASSETS_ROLL();

                                objRoll.ID = listItem[0].base_id;

                                objRoll = HelperObject_MCE_B_ASSETS_ROLL.Get(objRoll);

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

                                if (objRoll.AUDIT_STATE == 3 || objRoll.AUDIT_STATE == 4)
                                {
                                    throw new Exception("已经审核的案卷信息文件不能保存.");
                                }

                                foreach (JsonMceAssetsRollFile item in listItem)
                                {
                                    EntityObject_MCE_B_ASSETS_ROLLFILE obj = new EntityObject_MCE_B_ASSETS_ROLLFILE();

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

                                        obj = HelperObject_MCE_B_ASSETS_ROLLFILE.Get(obj);

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

                                    obj.BASE_ID = item.base_id;
                                    obj.CODE    = item.code;
                                    obj.NAME    = item.name;

                                    if (!string.IsNullOrEmpty(item.create_date))
                                    {
                                        obj.CREATE_DATE = DateTime.Parse(item.create_date);
                                    }

                                    if (!string.IsNullOrEmpty(item.page_num))
                                    {
                                        obj.PAGE_NUM = decimal.Parse(item.page_num);
                                    }

                                    obj.SUMMARYS = item.summarys;

                                    obj.COMMENTS = item.comments;

                                    if (string.IsNullOrEmpty(item.id))
                                    {
                                        HelperObject_MCE_B_ASSETS_ROLLFILE.Save(obj, transaction);
                                    }
                                    else
                                    {
                                        obj.ID = item.id;
                                        HelperObject_MCE_B_ASSETS_ROLLFILE.Update(obj, transaction);
                                    }

                                    if (!string.IsNullOrEmpty(item.filename))
                                    {
                                        try
                                        {
                                            string strFileURL = System.Web.HttpContext.Current.Server.MapPath("~/upload/mce/" + item.filename);//路径
                                            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_ROLLFILE";
                                                pCOM_FILE.SERVER_NAME  = item.filename;
                                                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_ROLLFILE";
                                                    entityPicFile.CLIENT_NAME    = item.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    = item.filename;
                                                    entityPicFile.IS_IMPORT      = 0;
                                                    Ipedf.Web.DataAccess.HelperObject_COM_FILE.Save(entityPicFile, transaction);
                                                }
                                            }
                                        }
                                        catch { }
                                    }
                                }
                            }
                            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_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri))
                {
                    return(smgr.Service.Save_RollFiles(listItem));
                }
            }
        }
Beispiel #5
0
        public BizLogicMsg Save_Ext(JsonMceAssetsWriteOff item)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_WRITE_OFF obj = new EntityObject_MCE_B_ASSETS_WRITE_OFF();

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

                                obj = HelperObject_MCE_B_ASSETS_WRITE_OFF.Get(obj);

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

                            obj.ASSETS_ID = item.assets_id;
                            //   obj.CODE = item.code;
                            obj.FINANCE_CYCLE = item.finance_cycle;
                            if (!string.IsNullOrEmpty(item.create_date))
                            {
                                obj.CREATE_DATE = DateTime.Parse(item.create_date);
                            }
                            obj.WRITE_OFF_TYPE_ID = item.write_off_type_id;

                            obj.WRITE_OFF_CAUSE_ID = item.write_off_cause_id;

                            if (!string.IsNullOrEmpty(item.original_value))
                            {
                                obj.ORIGINAL_VALUE = decimal.Parse(item.original_value);
                            }
                            if (!string.IsNullOrEmpty(item.net_value))
                            {
                                obj.NET_VALUE = decimal.Parse(item.net_value);
                            }
                            if (!string.IsNullOrEmpty(item.rudimental_value))
                            {
                                obj.RUDIMENTAL_VALUE = decimal.Parse(item.rudimental_value);
                            }
                            obj.INCOME = item.income;



                            obj.COMMENTS = item.comments;

                            if (string.IsNullOrEmpty(item.id))
                            {
                                obj.CODE        = GetWriteOffCode();
                                obj.AUDIT_STATE = 1;
                                obj.STATE       = 1;
                                HelperObject_MCE_B_ASSETS_WRITE_OFF.Save(obj, transaction);
                            }
                            else
                            {
                                obj.ID = item.id;
                                HelperObject_MCE_B_ASSETS_WRITE_OFF.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_WRITE_OFF";
                                                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_WRITE_OFF";
                                                    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_WRITE_OFF> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_WRITE_OFF>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(item));
                }
            }
        }
Beispiel #6
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));
                }
            }
        }
        public BizLogicMsg Save_Ext(JsonMceAssetsMeter item)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_METER obj = new EntityObject_MCE_B_ASSETS_METER();

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

                                obj = HelperObject_MCE_B_ASSETS_METER.Get(obj);

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

                            obj.ASSETS_ID = item.assets_id;
                            //  obj.CODE = item.code;
                            obj.ACCURACY_CLASS = item.accuracy_class;
                            obj.METER_CLASS    = item.meter_class;
                            obj.METER_TYPE     = item.meter_type;

                            obj.MEASURE_RANGE = item.measure_range;
                            obj.DIVID_VALUE   = item.divid_value;

                            if (!string.IsNullOrEmpty(item.identification_cycle))
                            {
                                obj.IDENTIFICATION_CYCLE = decimal.Parse(item.identification_cycle);
                            }

                            if (!string.IsNullOrEmpty(item.next_identification))
                            {
                                obj.NEXT_IDENTIFICATION = DateTime.Parse(item.next_identification);
                            }

                            obj.TIME_ZONE = item.time_zone;

                            if (!string.IsNullOrEmpty(item.is_force_sense))
                            {
                                obj.IS_FORCE_SENSE = decimal.Parse(item.is_force_sense);
                            }

                            obj.COMMENTS = item.comments;

                            if (string.IsNullOrEmpty(item.id))
                            {
                                obj.CODE        = GetMeterCode();
                                obj.AUDIT_STATE = 1;
                                obj.STATE       = 1;
                                HelperObject_MCE_B_ASSETS_METER.Save(obj, transaction);
                            }
                            else
                            {
                                obj.ID = item.id;
                                HelperObject_MCE_B_ASSETS_METER.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_METER";
                                                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_METER";
                                                    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_METER> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(item));
                }
            }
        }
        public BizLogicMsg Save_Ext(JsonMCE_MT_APPLY json)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_MT_APPLY entity = new EntityObject_MCE_B_ASSETS_MT_APPLY();


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

                                entity = HelperObject_MCE_B_ASSETS_MT_APPLY.Get(entity);

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


                            entity.CODE          = json.CODE;
                            entity.APPLY_DEPT_ID = json.APPLY_DEPT_ID;
                            entity.APPLY_USER_ID = json.APPLY_USER_ID;
                            entity.ASSETS_ID     = json.ASSETS_ID;
                            entity.ASSETS_CODE   = json.ASSETS_CODE;
                            entity.SPEC          = json.SPEC;

                            entity.ASSETS_TYPE_ID   = json.ASSETS_TYPE_ID;
                            entity.PRD_ID           = json.PRD_ID;
                            entity.MTN_TYPE_ID      = json.MTN_TYPE_ID;
                            entity.FAULT_TYPE       = json.FAULT_TYPE;
                            entity.EMERGENCY_DEGREE = json.EMERGENCY_DEGREE;
                            entity.REPAIR_RESULT    = json.REPAIR_RESULT;

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

                            entity.APPLY_USER_PHONE = json.APPLY_USER_PHONE;

                            if (!string.IsNullOrEmpty(json.COMPLETE_TIME))
                            {
                                entity.COMPLETE_TIME = DateTime.Parse(json.COMPLETE_TIME);
                            }

                            entity.MTN_ENGINEER = json.MTN_ENGINEER;

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

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

                            entity.INVOICE_CODE   = json.INVOICE_CODE;
                            entity.FAULT_DESC     = json.FAULT_DESC;
                            entity.FAULT_ANALYSIS = json.FAULT_ANALYSIS;
                            entity.FAULT_SOLUTION = json.FAULT_SOLUTION;

                            if (string.IsNullOrEmpty(entity.ID))
                            {
                                entity.STATE          = 1;
                                entity.CREATE_TIME    = DateTime.Now;
                                entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                int amount = HelperObject_MCE_B_ASSETS_MT_APPLY.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_MT_APPLY.Update(entity, 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_MT_APPLY";
                                HelperObject_COM_FILE.Delete(pCOM_FILE, 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_MT_APPLY";
                                    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_MT_APPLY> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_APPLY>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(json));
                }
            }
        }