public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "CODE"; StringBuilder strCondition = new StringBuilder(); CauseObject_MCE_B_ASSETS_CONTRACT p = new CauseObject_MCE_B_ASSETS_CONTRACT(); p.ASSETS_ID = request["id"]; if (!string.IsNullOrEmpty(request["condition"]))// { strCondition.Append(" and (MCE_B_ASSETS_CONTRACT.CODE like '%" + request["condition"].ToString().Trim() + "%' or MDM_D_DEPT_SECOND_PARTY.NAME like '%" + request["condition"].ToString().Trim() + "%' or COM_DEPART_FIRST_PARTY.NAME like '%" + request["condition"].ToString().Trim() + "%' or COM_TYPE_TYPE_ID.NAME like '%" + request["condition"].ToString().Trim() + "%' )"); } if (!string.IsNullOrEmpty(strCondition.ToString())) { p.SetCustomCondition(strCondition.ToString()); } DisplayObject_MCE_B_ASSETS_CONTRACT[] list = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Query(p, null, orderBy); if (list != null && list.Length > 0) { foreach (DisplayObject_MCE_B_ASSETS_CONTRACT item in list) { string strFiles = ""; CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE(); pCOM_FILE.REF_TAB_ID = item.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 file in listCOM_FILE) { if (!string.IsNullOrEmpty(file.SERVER_NAME)) { strFiles = strFiles + file.SERVER_NAME + "/" + file.CLIENT_NAME + ","; } } strFiles = strFiles.TrimEnd(','); } item.BACKUP1 = strFiles; } } jsonMsg.Message = list; jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } CauseObject_MCE_B_ASSETS_CONTRACT p = new CauseObject_MCE_B_ASSETS_CONTRACT(); p.ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_CONTRACT[] listHead = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Query(p); JSON_PAGER_Contract jsonPager = new JSON_PAGER_Contract(); if (listHead == null) { throw new Exception("获取列表信息失败."); } jsonPager.head = listHead[0]; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "ASSETS_CODE"; CauseObject_MCE_B_ASSETS pd = new CauseObject_MCE_B_ASSETS(); pd.SetCustomCondition(" and MCE_B_ASSETS.ID in(select asset_id from MCE_B_ASSETS_CONTRACT_D where base_id='" + request["id"].ToString() + "')"); DisplayObject_MCE_B_ASSETS[] listDetail = BizLogicObject_MCE_B_ASSETS.Proxy.Query(pd, null, orderBy); jsonPager.total = listDetail.Length; jsonPager.rows = listDetail; OrderByParameter orderByPay = new OrderByParameter(); orderByPay.Asc = true; orderByPay.OrderBy = "PERIODS"; CauseObject_MCE_B_ASSETS_CONTRACT_PAY p_Pay = new CauseObject_MCE_B_ASSETS_CONTRACT_PAY(); p_Pay.BASE_ID = request["id"]; DisplayObject_MCE_B_ASSETS_CONTRACT_PAY[] listPay = BizLogicObject_MCE_B_ASSETS_CONTRACT_PAY.Proxy.Query(p_Pay, null, orderByPay); jsonPager.payRows = listPay; OrderByParameter orderByAttach = new OrderByParameter(); orderByAttach.Asc = false; orderByAttach.OrderBy = "CREATE_TIME"; CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE(); pCOM_FILE.REF_TAB_ID = request["id"]; pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_CONTRACT"; List <JsonMCEMT_APPLY_MTN_ATTACH> list = new List <JsonMCEMT_APPLY_MTN_ATTACH>(); DisplayObject_COM_FILE[] listAttach = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE, null, orderByAttach); if (listAttach != null && listAttach.Length > 0) { foreach (DisplayObject_COM_FILE item in listAttach) { JsonMCEMT_APPLY_MTN_ATTACH attach = new JsonMCEMT_APPLY_MTN_ATTACH(); attach.ID = item.ID; attach.CLIENT_NAME = item.CLIENT_NAME; attach.SERVER_NAME = item.SERVER_NAME; attach.CREATE_USER_ID = item.CREATE_USER_ID; if (!string.IsNullOrEmpty(attach.CREATE_USER_ID)) { EntityObject_COM_USER entity = new EntityObject_COM_USER(); entity.ID = attach.CREATE_USER_ID; entity = BizLogicObject_COM_USER.Proxy.Get(entity); if (entity != null) { attach.CREATE_USER_ID_NAME = entity.NAME; } } attach.CREATE_TIME = item.CREATE_TIME; list.Add(attach); } } jsonPager.attach = list; jsonMsg.Succeed = 1; jsonMsg.Message = jsonPager; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
public void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "CODE"; //PagingParamter pager = new PagingParamter(); //pager.PageSize = int.MaxValue; //pager.PageIndex = 0; StringBuilder strCondition = new StringBuilder(); if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } CauseObject_MCE_B_ASSETS_AFFIX p = new CauseObject_MCE_B_ASSETS_AFFIX(); p.ASSETS_ID = request["id"]; if (!string.IsNullOrEmpty(request["condition"]))// { strCondition.Append(" and (MCE_B_ASSETS_AFFIX.CODE like '%" + request["condition"].ToString().Trim() + "%' or MCE_B_ASSETS_AFFIX.NAME like '%" + request["condition"].ToString().Trim() + "%' or MCE_B_ASSETS_AFFIX.SPEC like '%" + request["condition"].ToString().Trim() + "%' )"); } if (!string.IsNullOrEmpty(strCondition.ToString())) { p.SetCustomCondition(strCondition.ToString()); } DisplayObject_MCE_B_ASSETS_AFFIX[] list = BizLogicObject_MCE_B_ASSETS_AFFIX.Proxy.Query(p, null, orderBy); if (list != null && list.Length > 0) { foreach (DisplayObject_MCE_B_ASSETS_AFFIX item in list) { string strFiles = ""; CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE(); pCOM_FILE.REF_TAB_ID = item.ID; pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_AFFIX"; DisplayObject_COM_FILE[] listCOM_FILE = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE); if (listCOM_FILE != null && listCOM_FILE.Length > 0) { foreach (DisplayObject_COM_FILE file in listCOM_FILE) { if (!string.IsNullOrEmpty(file.SERVER_NAME)) { strFiles = strFiles + file.SERVER_NAME + "/" + file.CLIENT_NAME + ","; } } strFiles = strFiles.TrimEnd(','); } item.BACKUP1 = strFiles; item.BACKUP2 = BarCodeHelper.GenerateBarCode(item.CODE); } } //JSON_PAGER jsonPager = new JSON_PAGER(); //jsonPager.total = pager.TotalRecords; //jsonPager.rows = list; jsonMsg.Message = list; jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
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)); } } }
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)); } } }
public void ProcessRequest(HttpContext context) { context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; CauseObject_MCE_B_ASSETS_MT_EXEC p = new CauseObject_MCE_B_ASSETS_MT_EXEC(); p.ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_MT_EXEC[] listHead = BizLogicObject_MCE_B_ASSETS_MT_EXEC.Proxy.Query(p); JSON_PAGER_MT_EXEC jsonPager = new JSON_PAGER_MT_EXEC(); if (listHead == null) { throw new Exception("获取列表信息失败."); } if (listHead[0].STATE <= 1 && listHead[0].ACTUAL_EXEC_DATE < DateTime.Now.AddYears(-100)) { listHead[0].ACTUAL_EXEC_DATE = DateTime.Now; } jsonPager.head = listHead[0]; OrderByParameter orderBy = new OrderByParameter(); orderBy.Asc = true; orderBy.OrderBy = "ASSETS_NAME"; CauseObject_MCE_B_ASSETS_MT_EXEC_D pd = new CauseObject_MCE_B_ASSETS_MT_EXEC_D(); pd.BASE_ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_MT_EXEC_D[] listDetail = BizLogicObject_MCE_B_ASSETS_MT_EXEC_D.Proxy.Query(pd, null, orderBy); OrderByParameter orderByAttach = new OrderByParameter(); orderByAttach.Asc = false; orderByAttach.OrderBy = "CREATE_TIME"; CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE(); pCOM_FILE.REF_TAB_ID = request["id"]; pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_MT_EXEC"; List <JsonMCEMT_APPLY_MTN_ATTACH> list = new List <JsonMCEMT_APPLY_MTN_ATTACH>(); DisplayObject_COM_FILE[] listAttach = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE, null, orderByAttach); if (listAttach != null && listAttach.Length > 0) { foreach (DisplayObject_COM_FILE item in listAttach) { JsonMCEMT_APPLY_MTN_ATTACH attach = new JsonMCEMT_APPLY_MTN_ATTACH(); attach.ID = item.ID; attach.CLIENT_NAME = item.CLIENT_NAME; attach.SERVER_NAME = item.SERVER_NAME; attach.CREATE_USER_ID = item.CREATE_USER_ID; if (!string.IsNullOrEmpty(attach.CREATE_USER_ID)) { EntityObject_COM_USER entity = new EntityObject_COM_USER(); entity.ID = attach.CREATE_USER_ID; entity = BizLogicObject_COM_USER.Proxy.Get(entity); if (entity != null) { attach.CREATE_USER_ID_NAME = entity.NAME; } } attach.CREATE_TIME = item.CREATE_TIME; list.Add(attach); } } jsonPager.attach = list; jsonPager.total = listDetail.Length; jsonPager.rows = listDetail; jsonMsg.Succeed = 1; jsonMsg.Message = jsonPager; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); context.Response.Write(strMsg); context.Response.End(); } }
public BizLogicMsg Delete_RollFiles(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { if (listID != null && listID.Count > 0) { foreach (string strID in listID) { if (string.IsNullOrEmpty(strID)) { continue; } EntityObject_MCE_B_ASSETS_ROLLFILE obj = new EntityObject_MCE_B_ASSETS_ROLLFILE(); obj.ID = strID; obj = HelperObject_MCE_B_ASSETS_ROLLFILE.Get(obj); if (obj != null) { EntityObject_MCE_B_ASSETS_ROLL objRoll = new EntityObject_MCE_B_ASSETS_ROLL(); objRoll.ID = obj.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("已经审核的案卷信息文件不能删除."); } 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"; 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_ROLLFILE.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_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri)) { return(smgr.Service.Delete_RollFiles(listID)); } } }
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(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)); } } }
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)); } } }
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)); } } }
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_Ext2(JsonMCE_METER json) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_B_ASSETS_METER entity = new EntityObject_MCE_B_ASSETS_METER(); if (!string.IsNullOrEmpty(json.ID)) { entity.ID = json.ID; entity = HelperObject_MCE_B_ASSETS_METER.Get(entity); if (entity == null) { throw new Exception("获取数据出错."); } } entity.CODE = json.CODE; entity.ASSETS_ID = json.ASSETS_ID; entity.ASSETS_CODE = json.ASSETS_CODE; entity.SPEC = json.SPEC; entity.PRD_ID = json.PRD_ID; entity.UNIT_ID = json.UNIT_ID; entity.USING_DEPT_ID = json.USING_DEPT_ID; entity.PRD_CODE = json.PRD_CODE; if (!string.IsNullOrEmpty(json.IDENTIFICATION_CYCLE)) { entity.IDENTIFICATION_CYCLE = decimal.Parse(json.IDENTIFICATION_CYCLE); } entity.METER_TYPE = json.METER_TYPE; entity.HEAD_USER_ID = json.HEAD_USER_ID; if (!string.IsNullOrEmpty(json.IDENTIFICATION_TYPE)) { entity.IDENTIFICATION_TYPE = decimal.Parse(json.IDENTIFICATION_TYPE); } if (!string.IsNullOrEmpty(json.IS_FORCE_SENSE)) { entity.IS_FORCE_SENSE = decimal.Parse(json.IS_FORCE_SENSE); } if (!string.IsNullOrEmpty(json.NEXT_IDENTIFICATION)) { entity.NEXT_IDENTIFICATION = DateTime.Parse(json.NEXT_IDENTIFICATION); } if (!string.IsNullOrEmpty(json.EARLY_WARNING_DAYS)) { entity.EARLY_WARNING_DAYS = decimal.Parse(json.EARLY_WARNING_DAYS); } entity.COMMENTS = json.COMMENTS; 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_METER.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_METER.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"; HelperObject_COM_FILE.Delete(pCOM_FILE, 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> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_METER>(ServiceUri)) { return(smgr.Service.Save_Ext2(json)); } } }
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 void ProcessRequest(HttpContext context) { //允许跨域 context.Response.AddHeader("Access-Control-Allow-Origin", "*"); JSON_MSG jsonMsg = new JSON_MSG(); try { context.Response.ContentType = "text/plain"; HttpRequest request = context.Request; if (string.IsNullOrEmpty(request["id"])) { throw new Exception("参数错误."); } CauseObject_MCE_B_ASSETS_ROLLFILE p = new CauseObject_MCE_B_ASSETS_ROLLFILE(); p.ID = request["id"].ToString(); DisplayObject_MCE_B_ASSETS_ROLLFILE[] listHead = BizLogicObject_MCE_B_ASSETS_ROLLFILE.Proxy.Query(p); if (listHead == null || listHead.Length == 0) { throw new Exception("获取列表信息失败."); } string strFiles = ""; CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE(); pCOM_FILE.REF_TAB_ID = listHead[0].ID; pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_ROLLFILE"; DisplayObject_COM_FILE[] listCOM_FILE = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE); if (listCOM_FILE != null && listCOM_FILE.Length > 0) { strFiles = listCOM_FILE[0].SERVER_NAME; } listHead[0].BACKUP1 = strFiles; jsonMsg.Succeed = 1; jsonMsg.Message = listHead[0]; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm" }; string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter); strMsg = strMsg.Replace("0001-01-01 00:00", ""); context.Response.Write(strMsg); context.Response.End(); } }
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(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)); } } }