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 BizLogicMsg Save_Prd_Ext(string strJson) { if (LocalMode) { string strUserID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; string strUserName = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.NAME; BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { DateTime dtCur = DateTime.Now; List <EntityObject_PRV_D_DEPT> listPrd = JsonConvert.DeserializeObject <List <EntityObject_PRV_D_DEPT> >(strJson); List <string> listPrdId = new List <string>(); foreach (EntityObject_PRV_D_DEPT entityObject_PRV_D_DEPT in listPrd) { CauseObject_MDM_D_DEPT pMDM_D_DEPT = new CauseObject_MDM_D_DEPT(); pMDM_D_DEPT.CODE = entityObject_PRV_D_DEPT.CODE; pMDM_D_DEPT.AUDIT_STATE = "COM_1002_01"; pMDM_D_DEPT.DEPT_TYPE_ID = "00340003"; DisplayObject_MDM_D_DEPT[] listMDM_D_DEPT = BizLogicObject_MDM_D_DEPT.Proxy.Query(pMDM_D_DEPT); if (listMDM_D_DEPT != null && listMDM_D_DEPT.Length > 0) { continue; } if (!listPrdId.Contains(entityObject_PRV_D_DEPT.ID)) { listPrdId.Add(entityObject_PRV_D_DEPT.ID); } else { continue; } EntityObject_MDM_D_DEPT entityPrd = new Entity.EntityObject_MDM_D_DEPT(); entityPrd.CODE = entityObject_PRV_D_DEPT.CODE; entityPrd.NAME = entityObject_PRV_D_DEPT.NAME; entityPrd.SHORT_NAME = Ipedf.Core.ChineseHelper.GetChineseSpell(entityObject_PRV_D_DEPT.NAME); entityPrd.BALANCE_TYPE_ID = entityObject_PRV_D_DEPT.BALANCE_TYPE_ID; entityPrd.ADDRESS = entityObject_PRV_D_DEPT.ADDRESS; entityPrd.LINK_PERSON = entityObject_PRV_D_DEPT.LINK_PERSON; entityPrd.LAW_PERSON = entityObject_PRV_D_DEPT.LAW_PERSON; entityPrd.SERVICES = entityObject_PRV_D_DEPT.SERVICES; entityPrd.PHONE = entityObject_PRV_D_DEPT.PHONE; entityPrd.EMAIL = entityObject_PRV_D_DEPT.EMAIL; entityPrd.REGISTER_FUND = entityObject_PRV_D_DEPT.REGISTER_FUND; entityPrd.CREATE_USER_ID = strUserID; entityPrd.CREATE_TIME = dtCur; entityPrd.STATE = 1; entityPrd.DEPT_TYPE_ID = "00340003"; entityPrd.AUDIT_STATE = "COM_1002_01"; entityPrd.AUDIT_USER_ID = strUserID; entityPrd.AUDIT_TIME = dtCur; entityPrd.REF_ID = entityObject_PRV_D_DEPT.ID; HelperObject_MDM_D_DEPT.Save(entityPrd, 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_D_MCE_TYPE> smgr = new ServiceManager <ServiceContract_MCE_D_MCE_TYPE>(ServiceUri)) { return(smgr.Service.Save_Prd_Ext(strJson)); } } }
public BizLogicMsg Save_Ext(JsonMCE_SALESRETURN jsonMCE_SALESRETURN) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_B_SALES_RETURN entity = new EntityObject_MCE_B_SALES_RETURN(); if (!string.IsNullOrEmpty(jsonMCE_SALESRETURN.ID)) { entity.ID = jsonMCE_SALESRETURN.ID; entity = HelperObject_MCE_B_SALES_RETURN.Get(entity); if (entity == null) { throw new Exception("获取数据出错."); } } entity.CODE = jsonMCE_SALESRETURN.CODE; if (!string.IsNullOrEmpty(jsonMCE_SALESRETURN.CREATE_DATE)) { entity.CREATE_DATE = DateTime.Parse(jsonMCE_SALESRETURN.CREATE_DATE); } entity.PROVIDER_ID = jsonMCE_SALESRETURN.PROVIDER_ID; entity.USER_ID = jsonMCE_SALESRETURN.USER_ID; entity.STOCK_ID = jsonMCE_SALESRETURN.STOCK_ID; entity.COMMENTS = jsonMCE_SALESRETURN.COMMENTS; entity.STATE = 1; if (string.IsNullOrEmpty(jsonMCE_SALESRETURN.ID)) { entity.CREATE_TIME = DateTime.Now; entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; int amount = HelperObject_MCE_B_SALES_RETURN.Save(entity, transaction); } else { int amount = HelperObject_MCE_B_SALES_RETURN.Update(entity, transaction); } if (jsonMCE_SALESRETURN.DELETEIDS != null && jsonMCE_SALESRETURN.DELETEIDS.Count > 0) { foreach (string strID in jsonMCE_SALESRETURN.DELETEIDS) { EntityObject_MCE_B_SALES_RETURN_D entity_D = new EntityObject_MCE_B_SALES_RETURN_D(); if (!string.IsNullOrEmpty(strID)) { entity_D.ID = strID; entity_D = HelperObject_MCE_B_SALES_RETURN_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } else { HelperObject_MCE_B_SALES_RETURN_D.Delete(entity_D, transaction); } } } } if (jsonMCE_SALESRETURN.children != null && jsonMCE_SALESRETURN.children.Count > 0) { decimal decTotMoney = 0; foreach (JsonMCE_SALESRETURN_D item in jsonMCE_SALESRETURN.children) { EntityObject_MCE_B_SALES_RETURN_D entity_D = new EntityObject_MCE_B_SALES_RETURN_D(); if (!string.IsNullOrEmpty(item.ID)) { entity_D.ID = item.ID; entity_D = HelperObject_MCE_B_SALES_RETURN_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } } entity_D.BASE_ID = entity.ID; entity_D.ASSETS_ID = item.ASSETS_ID; entity_D.ASSETS_NAME = item.ASSETS_NAME; entity_D.ASSETS_CODE = item.ASSETS_CODE; entity_D.REF_TAB_ID = item.REF_TAB_ID; entity_D.REF_TAB_NAME = item.REF_TAB_NAME; entity_D.SPEC = item.SPEC; entity_D.COMMENTS = item.COMMENTS; entity_D.MONEY = item.MONEY; entity_D.PRICE = item.PRICE; if (!string.IsNullOrEmpty(item.PRD_DATE)) { entity_D.PRD_DATE = DateTime.Parse(item.PRD_DATE); entity_D.PRD_ID = item.PRD_ID; } decTotMoney = decTotMoney + entity_D.MONEY; if (string.IsNullOrEmpty(item.ID)) { HelperObject_MCE_B_SALES_RETURN_D.Save(entity_D, transaction); } else { HelperObject_MCE_B_SALES_RETURN_D.Update(entity_D, transaction); } } entity.TOTAL_MONEY = decTotMoney; HelperObject_MCE_B_SALES_RETURN.Update(entity, transaction); } msg.Message = entity.ID; transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN>(ServiceUri)) { return(smgr.Service.Save_Ext(jsonMCE_SALESRETURN)); } } }
public BizLogicMsg Delete_Ext(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) { CauseObject_MCE_D_MCE_TYPE p_Type = new CauseObject_MCE_D_MCE_TYPE(); p_Type.PARENT_ID = strID; DisplayObject_MCE_D_MCE_TYPE[] listMCE_D_MCE_TYPE = BizLogicObject_MCE_D_MCE_TYPE.Proxy.Query(p_Type); if (listMCE_D_MCE_TYPE != null && listMCE_D_MCE_TYPE.Length > 0) { throw new Exception("该资产分类下存在子分类,不能删除."); } CauseObject_MCE_B_ASSETS p = new CauseObject_MCE_B_ASSETS(); p.MACHINE_TYPE_ID = strID; DisplayObject_MCE_B_ASSETS[] list = BizLogicObject_MCE_B_ASSETS.Proxy.Query(p); if (list != null && list.Length > 0) { throw new Exception("在资产卡片中已经使用的资产分类不能删除."); } EntityObject_MCE_D_MCE_TYPE obj = new EntityObject_MCE_D_MCE_TYPE(); obj.ID = strID; if (obj.STATE == 1) { throw new Exception("状态为[正常]的资产分类不能删除."); } obj = HelperObject_MCE_D_MCE_TYPE.Get(obj); if (obj != null) { HelperObject_MCE_D_MCE_TYPE.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_D_MCE_TYPE> smgr = new ServiceManager <ServiceContract_MCE_D_MCE_TYPE>(ServiceUri)) { return(smgr.Service.Delete_Ext(listID)); } } }
public BizLogicMsg Save_Dept_Ext(List <string> idList) { if (LocalMode) { string strUserID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; string strUserName = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.NAME; BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { DateTime dtCur = DateTime.Now; Ipedf.Hrp.BizLogic.PRV_MCE_Web_Service.PRV_Web_Service service = new Ipedf.Hrp.BizLogic.PRV_MCE_Web_Service.PRV_Web_Service(); if (System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"] != null) { string strServiceURL = System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"]; service.Url = strServiceURL; } foreach (string strID in idList) { string strRegionAccount = service.GetAccountInfo(strID); JsonRegionAccount regionAccount = (JsonConvert.DeserializeObject <JsonRegionAccount>(strRegionAccount)); CauseObject_MDM_D_DEPT pMDM_D_DEPT = new CauseObject_MDM_D_DEPT(); pMDM_D_DEPT.CODE = regionAccount.code; pMDM_D_DEPT.AUDIT_STATE = "COM_1002_01"; DisplayObject_MDM_D_DEPT[] listMDM_D_DEPT = BizLogicObject_MDM_D_DEPT.Proxy.Query(pMDM_D_DEPT); if (listMDM_D_DEPT != null && listMDM_D_DEPT.Length > 0) { throw new Exception("企业代码" + pMDM_D_DEPT.CODE + "已经存在."); } string strEnterPriseInfo = service.GetEnterPriseInfo(strID); JsonRegionEnterPrise regionEnterPrise = (JsonConvert.DeserializeObject <JsonRegionEnterPrise>(strEnterPriseInfo)); string strPrvCertList = service.GetPrvCertList(strID); List <DisplayObject_V_PRV_PRVCERT_INFO> listRegionCert = JsonConvert.DeserializeObject <List <DisplayObject_V_PRV_PRVCERT_INFO> >(strPrvCertList); EntityObject_MDM_D_DEPT entityObject_PRV_D_DEPT = new Entity.EntityObject_MDM_D_DEPT(); entityObject_PRV_D_DEPT.CODE = regionAccount.code; entityObject_PRV_D_DEPT.NAME = regionEnterPrise.name; entityObject_PRV_D_DEPT.SHORT_NAME = Ipedf.Core.ChineseHelper.GetChineseSpell(regionEnterPrise.name); entityObject_PRV_D_DEPT.BALANCE_TYPE_ID = regionEnterPrise.balance_type_id; entityObject_PRV_D_DEPT.ADDRESS = regionEnterPrise.address; entityObject_PRV_D_DEPT.LINK_PERSON = regionEnterPrise.link_Person; entityObject_PRV_D_DEPT.LAW_PERSON = regionEnterPrise.law_Person; entityObject_PRV_D_DEPT.SERVICES = regionEnterPrise.services; entityObject_PRV_D_DEPT.PHONE = regionAccount.phone; entityObject_PRV_D_DEPT.EMAIL = regionAccount.email; entityObject_PRV_D_DEPT.REGISTER_FUND = regionEnterPrise.register_fund; entityObject_PRV_D_DEPT.CREATE_USER_ID = strUserID; entityObject_PRV_D_DEPT.CREATE_TIME = dtCur; entityObject_PRV_D_DEPT.STATE = 1; entityObject_PRV_D_DEPT.DEPT_TYPE_ID = "00340005"; entityObject_PRV_D_DEPT.AUDIT_STATE = "COM_1002_01"; entityObject_PRV_D_DEPT.AUDIT_USER_ID = strUserID; entityObject_PRV_D_DEPT.AUDIT_TIME = dtCur; entityObject_PRV_D_DEPT.REF_ID = strID; HelperObject_MDM_D_DEPT.Save(entityObject_PRV_D_DEPT, transaction); if (listRegionCert != null && listRegionCert.Count > 0) { foreach (DisplayObject_V_PRV_PRVCERT_INFO regionCert in listRegionCert) { if (!string.IsNullOrEmpty(regionCert.SAVE_NAME)) { EntityObject_MTR_B_PRV_CERT pRV_B_PRV_CERT = new EntityObject_MTR_B_PRV_CERT(); pRV_B_PRV_CERT.NATURE_ID = "MTR_20010001"; pRV_B_PRV_CERT.TYPE_ID = regionCert.TYPE_ID; pRV_B_PRV_CERT.NAME = regionCert.NAME; pRV_B_PRV_CERT.BEGIN_DATE = regionCert.BEGIN_DATE; pRV_B_PRV_CERT.END_DATE = regionCert.END_DATE; pRV_B_PRV_CERT.USER_ID = strUserID; pRV_B_PRV_CERT.CREATE_DATE = dtCur; pRV_B_PRV_CERT.PRV_ID = entityObject_PRV_D_DEPT.ID; pRV_B_PRV_CERT.REF_ID = regionCert.ID; HelperObject_MTR_B_PRV_CERT.Save(pRV_B_PRV_CERT, transaction); if (!string.IsNullOrEmpty(regionCert.SAVE_NAME)) { string aLastName = System.IO.Path.GetExtension(regionCert.SAVE_NAME).ToLower(); try { WebClient client = new WebClient(); string strNetaddress = regionCert.SAVE_NAME; byte[] bytes = client.DownloadData(new Uri(strNetaddress)); MemoryStream ms = new MemoryStream(bytes); ms.Seek(0, SeekOrigin.Begin); // string strFileExt = c.PICFILENAME.Substring(1 + c.PICFILENAME.LastIndexOf(".")); string strPicName = Guid.NewGuid().ToString() + aLastName; string folder = "mce\\"; string uploadPath = HttpRuntime.AppDomainAppPath.ToString(); if (uploadPath.EndsWith("\\")) { uploadPath = uploadPath + "upload\\" + folder; } else { uploadPath = uploadPath + "\\upload\\" + folder; } uploadPath = uploadPath + strPicName; FileStream fs = new FileStream(uploadPath, FileMode.Create); //将byte数组写入文件中 fs.Write(bytes, 0, bytes.Length); //所有流类型都要关闭流,否则会出现内存泄露问题 fs.Close(); byte[] photo = new byte[] { }; //原图 byte[] thumbPhoto = new byte[] { }; //缩略图 EntityObject_MTR_FILE prv_File = new EntityObject_MTR_FILE(); prv_File.SAVE_NAME = strPicName; prv_File.FILE_NAME = strPicName; prv_File.REF_TAB_NAME = "MTR_B_PRV_CERT"; prv_File.REF_TAB_ID = pRV_B_PRV_CERT.ID; prv_File.SUFFIX = aLastName; prv_File.THUMB_BINARY = thumbPhoto; prv_File.FILE_BINARY = photo; HelperObject_MTR_FILE.Save(prv_File, transaction); } catch { } } } } } } string strJson = JsonConvert.SerializeObject(idList); int intRet = service.SetPrvAuditStatus(strJson, "COM_1002_01", strUserID, strUserName); if (intRet == 0) { throw new Exception("更新供应商端状态错误."); } 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_D_MCE_TYPE> smgr = new ServiceManager <ServiceContract_MCE_D_MCE_TYPE>(ServiceUri)) { return(smgr.Service.Save_Dept_Ext(idList)); } } }
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; string strType = ""; if (!string.IsNullOrEmpty(request["oType"])) { strType = request["oType"]; } else { throw new Exception("参数错误."); } StringBuilder rsb = new StringBuilder(); int bytelengg = (int)request.InputStream.Length; using (var reader = new StreamReader(request.InputStream, Encoding.UTF8)) { var read = new Char[bytelengg]; var count = reader.Read(read, 0, bytelengg); while (count > 0) { var str = new string(read, 0, count); rsb.Append(str); count = reader.Read(read, 0, bytelengg); } reader.Close(); reader.Dispose(); request.InputStream.Close(); request.InputStream.Dispose(); } if (string.IsNullOrEmpty(rsb.ToString())) { throw new Exception("参数错误."); } List <string> idList = JsonConvert.DeserializeObject <List <string> >(rsb.ToString()); if (idList == null || idList.Count == 0) { throw new Exception("参数错误."); } if (strType == "submit") { BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_TRANSFER.Proxy.Submit_Ext(idList); if (!msg.Succeed) { throw new Exception(msg.Message); } } else if (strType == "audit") { BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_TRANSFER.Proxy.Audit_Ext(idList); if (!msg.Succeed) { throw new Exception(msg.Message); } } else if (strType == "delete") { BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_TRANSFER.Proxy.Delete_Ext(idList); if (!msg.Succeed) { throw new Exception(msg.Message); } } jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); 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; StringBuilder rsb = new StringBuilder(); int bytelengg = (int)request.InputStream.Length; using (var reader = new StreamReader(request.InputStream, Encoding.UTF8)) { var read = new Char[bytelengg]; var count = reader.Read(read, 0, bytelengg); while (count > 0) { var str = new string(read, 0, count); rsb.Append(str); count = reader.Read(read, 0, bytelengg); } reader.Close(); reader.Dispose(); request.InputStream.Close(); request.InputStream.Dispose(); } if (string.IsNullOrEmpty(rsb.ToString())) { throw new Exception("参数错误."); } List <string> listID = JsonConvert.DeserializeObject <List <string> >(rsb.ToString()); if (listID == null || listID.Count == 0) { throw new Exception("请选择要删除的文件."); } BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_ROLL.Proxy.Delete_RollFiles(listID); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.Message; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); context.Response.End(); } }
public BizLogicMsg Audit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_ASSETS_DEPR obj = new EntityObject_MCE_B_ASSETS_DEPR(); obj.ID = strID; obj = HelperObject_MCE_B_ASSETS_DEPR.Get(obj); if (obj != null) { if (obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经审核的数据不能再审核."); } obj.STATE = 3; obj.AUDIT_TIME = DateTime.Now; obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; HelperObject_MCE_B_ASSETS_DEPR.Update(obj, transaction); CauseObject_MCE_B_ASSETS_DEPR_D pDeprDetail = new CauseObject_MCE_B_ASSETS_DEPR_D(); pDeprDetail.BASE_ID = strID; EntityObject_MCE_B_ASSETS_DEPR_D[] deprDetails = HelperObject_MCE_B_ASSETS_DEPR_D.Query(pDeprDetail, transaction); //更新资产卡片记录 foreach (EntityObject_MCE_B_ASSETS_DEPR_D deprDetail in deprDetails) { EntityObject_MCE_B_ASSETS assets = new EntityObject_MCE_B_ASSETS(); assets.ID = deprDetail.ASSETS_ID; assets.NET_VALUE = deprDetail.NEW_NET_VALUE; //净值 assets.DEPR_MONTH_AMOUNT += 1; //累计折旧月份 assets.ACCUMULATED_DEPRECIATION += deprDetail.MONEY; //累计折旧金额 assets.SetUpdate("NET_VALUE", "DEPR_MONTH_AMOUNT", "ACCUMULATED_DEPRECIATION"); HelperObject_MCE_B_ASSETS.Update(assets, transaction); } } } //平台自动生成代码 transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR>(ServiceUri)) { return(smgr.Service.Audit_Ext(listID)); } } }
public BizLogicMsg Save_Ext(JsonMCE_PURCHASE_PLAN json) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_B_ASSETS_PURCHASE_PLAN entity = new EntityObject_MCE_B_ASSETS_PURCHASE_PLAN(); if (!string.IsNullOrEmpty(json.ID)) { entity.ID = json.ID; entity = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN.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.PRV_ID = json.PRV_ID; entity.PRV_NAME = json.PRV_NAME; if (!string.IsNullOrEmpty(json.CREATE_DATE)) { entity.CREATE_DATE = DateTime.Parse(json.CREATE_DATE); } entity.PURCHASE_DEPT_ID = json.PURCHASE_DEPT_ID; entity.APPLY_USER_ID = json.APPLY_USER_ID; entity.COMMENTS = json.COMMENTS; entity.STATE = 1; if (string.IsNullOrEmpty(json.ID)) { entity.CREATE_TIME = DateTime.Now; entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; entity.CREATE_DEPT_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.DEPART_ID; int amount = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN.Save(entity, transaction); } else { entity.MODIFY_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; entity.MODIFY_DEPT_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.DEPART_ID; int amount = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN.Update(entity, transaction); } if (json.DELETEIDS != null && json.DELETEIDS.Count > 0) { foreach (string strID in json.DELETEIDS) { EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D entity_D = new EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D(); if (!string.IsNullOrEmpty(strID)) { entity_D.ID = strID; entity_D = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } else { HelperObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Delete(entity_D, transaction); } } } } if (json.children != null && json.children.Count > 0) { decimal decTotMoney = 0; foreach (JsonMCE_PURCHASE_PLAN_D item in json.children) { EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D entity_D = new EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D(); if (!string.IsNullOrEmpty(item.ID)) { entity_D.ID = item.ID; entity_D = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } } entity_D.BASE_ID = entity.ID; entity_D.TYPE_ID = item.TYPE_ID; entity_D.ASSETS_ID = item.ASSETS_ID; entity_D.ASSET_NAME = item.ASSET_NAME; entity_D.SPEC = item.SPEC; if (string.IsNullOrEmpty(item.ID)) { if (!string.IsNullOrEmpty(item.PRD_ID)) { string strPrdID = ""; CauseObject_MDM_D_DEPT p = new CauseObject_MDM_D_DEPT(); p.REF_ID = item.PRD_ID; DisplayObject_MDM_D_DEPT[] listPrd = HelperObject_MDM_D_DEPT.Query(p); if (listPrd != null && listPrd.Length > 0) { strPrdID = listPrd[0].ID; } entity_D.PRD_ID = strPrdID; } entity_D.REF_PRD_ID = item.PRD_ID; } entity_D.PRD_NAME = item.PRD_NAME; entity_D.PRICE = item.PRICE; entity_D.AMOUNT = item.AMOUNT; entity_D.UNIT_ID = item.UNIT_ID; entity_D.REF_TAB_ID = item.REF_TAB_ID; entity_D.REF_TAB_NAME = item.REF_TAB_NAME; entity_D.MONEY = item.AMOUNT * item.PRICE; decTotMoney = decTotMoney + entity_D.MONEY; if (string.IsNullOrEmpty(item.ID)) { HelperObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Save(entity_D, transaction); } else { HelperObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Update(entity_D, transaction); } } entity.APPLY_MONEY = decTotMoney; HelperObject_MCE_B_ASSETS_PURCHASE_PLAN.Update(entity, transaction); } msg.Message = entity.ID; transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE_PLAN> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE_PLAN>(ServiceUri)) { return(smgr.Service.Save_Ext(json)); } } }
public BizLogicMsg Audit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_ASSETS_CHECK obj = new EntityObject_MCE_B_ASSETS_CHECK(); obj.ID = strID; obj = HelperObject_MCE_B_ASSETS_CHECK.Get(obj); if (obj != null) { if (obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经审核的数据不能再审核."); } obj.STATE = 3; obj.AUDIT_TIME = DateTime.Now; obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; HelperObject_MCE_B_ASSETS_CHECK.Update(obj, transaction); CauseObject_MCE_B_ASSETS_CHECK_D pDetail = new CauseObject_MCE_B_ASSETS_CHECK_D(); pDetail.BASE_ID = strID; EntityObject_MCE_B_ASSETS_CHECK_D[] deprDetails = HelperObject_MCE_B_ASSETS_CHECK_D.Query(pDetail, transaction); //更新资产卡片记录 foreach (EntityObject_MCE_B_ASSETS_CHECK_D dDetail in deprDetails) { string strOldState = dDetail.OLD_ASSETS_STATE ?? ""; string strNewState = dDetail.NEW_ASSETS_STATE ?? ""; if (strOldState != strNewState && !string.IsNullOrEmpty(strNewState)) { EntityObject_MCE_B_ASSETS assets = new EntityObject_MCE_B_ASSETS(); assets.ID = dDetail.ASSETS_ID; assets.ASSETS_STATE = dDetail.NEW_ASSETS_STATE;//净值 assets.SetUpdate("ASSETS_STATE"); HelperObject_MCE_B_ASSETS.Update(assets, transaction); } } } } //平台自动生成代码 transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_CHECK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CHECK>(ServiceUri)) { return(smgr.Service.Audit_Ext(listID)); } } }
public BizLogicMsg Save_Ext(JsonMCE_Depr jsonEntity) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_B_ASSETS_DEPR entity = new EntityObject_MCE_B_ASSETS_DEPR(); if (!string.IsNullOrEmpty(jsonEntity.ID)) { entity.ID = jsonEntity.ID; entity = HelperObject_MCE_B_ASSETS_DEPR.Get(entity); if (entity == null) { throw new Exception("获取数据出错."); } } entity.CODE = jsonEntity.CODE; entity.DEPT_ID = jsonEntity.DEPT_ID; entity.USER_ID = jsonEntity.USER_ID; if (!string.IsNullOrEmpty(jsonEntity.CREATE_DATE)) { entity.CREATE_DATE = DateTime.Parse(jsonEntity.CREATE_DATE); } entity.FINANCE_CYCLE = jsonEntity.FINANCE_CYCLE; entity.COMMENTS = jsonEntity.COMMENTS; entity.STATE = 1; if (string.IsNullOrEmpty(jsonEntity.ID)) { entity.CREATE_TIME = DateTime.Now; entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; int amount = HelperObject_MCE_B_ASSETS_DEPR.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_DEPR.Update(entity, transaction); } if (!string.IsNullOrEmpty(jsonEntity.ID)) { CauseObject_MCE_B_ASSETS_DEPR_D pDeprDetail = new CauseObject_MCE_B_ASSETS_DEPR_D(); pDeprDetail.BASE_ID = jsonEntity.ID; HelperObject_MCE_B_ASSETS_DEPR_D.Delete(pDeprDetail, transaction); } if (jsonEntity.children != null && jsonEntity.children.Count > 0) { foreach (JsonMceDepr_D item in jsonEntity.children) { EntityObject_MCE_B_ASSETS_DEPR_D entity_D = new EntityObject_MCE_B_ASSETS_DEPR_D(); if (!string.IsNullOrEmpty(item.ID)) { entity_D.ID = item.ID; entity_D = HelperObject_MCE_B_ASSETS_DEPR_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } } entity_D.BASE_ID = entity.ID; entity_D.ASSETS_ID = item.ASSETS_ID; entity_D.ASSETS_CODE = item.ASSETS_CODE; entity_D.CURRENCY_ID = item.CURRENCY_ID; entity_D.ORIGINAL_VALUE = item.ORIGINAL_VALUE; entity_D.NET_VALUE = item.NET_VALUE; entity_D.MONEY = item.MONEY; entity_D.NEW_NET_VALUE = item.NEW_NET_VALUE; HelperObject_MCE_B_ASSETS_DEPR_D.Save(entity_D, 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_DEPR> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_DEPR>(ServiceUri)) { return(smgr.Service.Save_Ext(jsonEntity)); } } }
public BizLogicMsg Audit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_ASSETS_OUTSTOCK obj = new EntityObject_MCE_B_ASSETS_OUTSTOCK(); obj.ID = strID; obj = HelperObject_MCE_B_ASSETS_OUTSTOCK.Get(obj); if (obj != null) { if (obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经审核的数据不能再审核."); } obj.STATE = 3; obj.AUDIT_TIME = DateTime.Now; obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(obj, transaction); #region 资产卡片更新 DisplayObject_MCE_B_ASSETS_OUTSTOCK_D[] disOutstock = BizLogicObject_MCE_B_ASSETS_OUTSTOCK_D.Proxy.Query(new CauseObject_MCE_B_ASSETS_OUTSTOCK_D() { BASE_ID = obj.ID }); if (disOutstock.Length > 0) { for (int i = 0; i < disOutstock.Length; i++) { if (string.IsNullOrEmpty(disOutstock[i].REF_TAB_ID) || string.IsNullOrEmpty(disOutstock[i].REF_TAB_NAME)) { continue; } if (disOutstock[i].REF_TAB_NAME == "MCE_B_ASSETS") { EntityObject_MCE_B_ASSETS entAssets = BizLogicObject_MCE_B_ASSETS.Proxy.Get(new EntityObject_MCE_B_ASSETS() { ID = disOutstock[i].REF_TAB_ID }); if (entAssets != null) { entAssets.CUSTODY_DEPT_ID = obj.USING_DEPT_ID; entAssets.CUSTODY_USER_ID = obj.USING_USER_ID; entAssets.SUBJECTION_DEPT_ID = obj.USING_DEPT_ID; entAssets.USING_DEPT_ID = obj.USING_DEPT_ID; entAssets.USING_USER_ID = obj.USING_USER_ID; entAssets.CUSTODY_DEPT_ID = obj.USING_DEPT_ID; entAssets.ENABLE_DATE = obj.CREATE_DATE; entAssets.USE_STATE = "00540001"; //在用 entAssets.ASSETS_STATE = "00530002"; //资产状态(启用). entAssets.CARD_TYPE_ID = "00680002"; entAssets.ECONOMIC_USE_TYPE_ID = disOutstock[0].ECONOMIC_USE_TYPE_ID; //hsc 如果出库是多个设备 则会出错 BizLogicObject_MCE_B_ASSETS.Proxy.UpdateByTrans(entAssets, transaction); } } else { //因为这个方法取出的值只有ID跟状态.所以必须重新取值. DisplayObject_MCE_B_ASSETS[] disAssets = HelperObject_MCE_B_ASSETS.QueryIdState(disOutstock[i].REF_TAB_ID, disOutstock[i].REF_TAB_NAME); foreach (DisplayObject_MCE_B_ASSETS item in disAssets) { EntityObject_MCE_B_ASSETS entAssets = BizLogicObject_MCE_B_ASSETS.Proxy.Get(new EntityObject_MCE_B_ASSETS() { ID = item.ID }); if (entAssets != null) { entAssets.CUSTODY_DEPT_ID = obj.USING_DEPT_ID; entAssets.CUSTODY_USER_ID = obj.USING_USER_ID; entAssets.SUBJECTION_DEPT_ID = obj.USING_DEPT_ID; entAssets.USING_DEPT_ID = obj.USING_DEPT_ID; entAssets.USING_USER_ID = obj.USING_USER_ID; entAssets.CUSTODY_DEPT_ID = obj.USING_DEPT_ID; entAssets.ENABLE_DATE = obj.CREATE_DATE; entAssets.USE_STATE = "00540001"; //在用 entAssets.ASSETS_STATE = "00530002"; //资产状态(启用). entAssets.CARD_TYPE_ID = "00680002"; entAssets.ECONOMIC_USE_TYPE_ID = disOutstock[0].ECONOMIC_USE_TYPE_ID; //hsc 如果出库是多个设备 则会出错 BizLogicObject_MCE_B_ASSETS.Proxy.UpdateByTrans(entAssets, transaction); } } } } } #endregion } } //平台自动生成代码 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_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri)) { return(smgr.Service.Audit_Ext(listID)); } } }
public BizLogicMsg Submit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_ASSETS_OUTSTOCK obj = new EntityObject_MCE_B_ASSETS_OUTSTOCK(); obj.ID = strID; obj = HelperObject_MCE_B_ASSETS_OUTSTOCK.Get(obj); if (obj != null) { if (obj.STATE == 2 || obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经提交的数据不能再提交."); } if (string.IsNullOrEmpty(obj.CODE)) { throw new Exception("单号不能为空."); } if (string.IsNullOrEmpty(obj.USING_DEPT_ID)) { throw new Exception("领用科室不能为空."); } if (string.IsNullOrEmpty(obj.USING_USER_ID)) { throw new Exception("领用人不能为空."); } obj.STATE = 2; HelperObject_MCE_B_ASSETS_OUTSTOCK.Update(obj, transaction); } } //平台自动生成代码 transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_OUTSTOCK>(ServiceUri)) { return(smgr.Service.Audit_Ext(listID)); } } }
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_IMPORTATION obj = new EntityObject_MCE_B_ASSETS_IMPORTATION(); obj.ID = strID; obj = HelperObject_MCE_B_ASSETS_IMPORTATION.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_IMPORTATION"; 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_IMPORTATION.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_IMPORTATION> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_IMPORTATION>(ServiceUri)) { return(smgr.Service.Audit_Ext(strID)); } } }
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; StringBuilder rsb = new StringBuilder(); int bytelengg = (int)request.InputStream.Length; using (var reader = new StreamReader(request.InputStream, Encoding.UTF8)) { var read = new Char[bytelengg]; var count = reader.Read(read, 0, bytelengg); while (count > 0) { var str = new string(read, 0, count); rsb.Append(str); count = reader.Read(read, 0, bytelengg); } reader.Close(); reader.Dispose(); request.InputStream.Close(); request.InputStream.Dispose(); } if (string.IsNullOrEmpty(rsb.ToString())) { throw new Exception("参数错误."); } JsonWriteOffIdentity entity = JsonConvert.DeserializeObject <JsonWriteOffIdentity>(rsb.ToString()); if (string.IsNullOrEmpty(entity.ID)) { throw new Exception("参数错误,ID不能为空."); } if (string.IsNullOrEmpty(entity.IDENTITY_STATE)) { throw new Exception("参数错误,鉴定意见不能为空."); } if (string.IsNullOrEmpty(entity.IDENTITY_USER_ID)) { throw new Exception("参数错误,鉴定人不能为空."); } if (string.IsNullOrEmpty(entity.IDENTITY_TIME)) { throw new Exception("参数错误,鉴定日期不能为空."); } if (string.IsNullOrEmpty(entity.IDENTITY_PARAM)) { throw new Exception("参数错误,鉴定参数不能为空."); } BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_WRITE_OFF.Proxy.Identity(entity); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.Message; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); context.Response.End(); } }
public BizLogicMsg Audit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_ASSETS_PURCHASE_PLAN obj = new EntityObject_MCE_B_ASSETS_PURCHASE_PLAN(); obj.ID = strID; obj = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN.Get(obj); if (obj != null) { if (obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经审核的数据不能再审核."); } obj.STATE = 3; obj.AUDIT_TIME = DateTime.Now; obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; HelperObject_MCE_B_ASSETS_PURCHASE_PLAN.Update(obj, transaction); DisplayObject_MCE_B_ASSETS_PURCHASE_PLAN_D[] list_D = BizLogicObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Proxy.Query(new CauseObject_MCE_B_ASSETS_PURCHASE_PLAN_D() { BASE_ID = obj.ID }); if (list_D != null && list_D.Length > 0) { foreach (DisplayObject_MCE_B_ASSETS_PURCHASE_PLAN_D item in list_D) { if (item.REF_TAB_NAME == "MCE_B_ASSETS_PURCHASE" && !string.IsNullOrEmpty(item.REF_TAB_ID)) { EntityObject_MCE_B_ASSETS_PURCHASE obj_Pur = new EntityObject_MCE_B_ASSETS_PURCHASE(); obj_Pur.ID = item.REF_TAB_ID; obj_Pur = HelperObject_MCE_B_ASSETS_PURCHASE.Get(obj_Pur); if (obj_Pur != null) { obj_Pur.REF_USED_AMOUNT = obj_Pur.REF_USED_AMOUNT + item.AMOUNT; HelperObject_MCE_B_ASSETS_PURCHASE.Update(obj_Pur, 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_PURCHASE_PLAN> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE_PLAN>(ServiceUri)) { return(smgr.Service.Audit_Ext(listID)); } } }
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; StringBuilder rsb = new StringBuilder(); int bytelengg = (int)request.InputStream.Length; using (var reader = new StreamReader(request.InputStream, Encoding.UTF8)) { var read = new Char[bytelengg]; var count = reader.Read(read, 0, bytelengg); while (count > 0) { var str = new string(read, 0, count); rsb.Append(str); count = reader.Read(read, 0, bytelengg); } reader.Close(); reader.Dispose(); request.InputStream.Close(); request.InputStream.Dispose(); } if (string.IsNullOrEmpty(rsb.ToString())) { throw new Exception("参数错误."); } JsonMceAssetsContract item = JsonConvert.DeserializeObject <JsonMceAssetsContract>(rsb.ToString()); /* * if (string.IsNullOrEmpty(item.code)) * { * throw new Exception("合同编号不能为空."); * } */ if (string.IsNullOrEmpty(item.name)) { throw new Exception("合同名称不能为空."); } /* * CauseObject_MCE_B_ASSETS_CONTRACT p = new CauseObject_MCE_B_ASSETS_CONTRACT(); * p.CODE = item.code; * * * if (!string.IsNullOrEmpty(item.id)) * { * string strCondition = " and MCE_B_ASSETS_CONTRACT.ID<>'" + item.id + "'"; * p.SetCustomCondition(strCondition); * } * * * DisplayObject_MCE_B_ASSETS_CONTRACT[] list = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Query(p); * if (list != null && list.Length > 0) * { * throw new Exception("合同编号:[" + item.code + "]已经在用."); * } */ BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Save_Ext(item); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.Message; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); context.Response.End(); } }
public BizLogicMsg Submit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_ASSETS_MT_EXEC obj = new EntityObject_MCE_B_ASSETS_MT_EXEC(); obj.ID = strID; obj = HelperObject_MCE_B_ASSETS_MT_EXEC.Get(obj); if (obj != null) { if (obj.STATE == 2 || obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经提交的数据不能再提交."); } if (obj.ACTUAL_EXEC_DATE < DateTime.Now.AddDays(-100)) { throw new Exception("执行日期错误."); } DisplayObject_MCE_B_ASSETS_MT_EXEC_D[] list_D = BizLogicObject_MCE_B_ASSETS_MT_EXEC_D.Proxy.Query(new CauseObject_MCE_B_ASSETS_MT_EXEC_D() { BASE_ID = obj.ID }); foreach (DisplayObject_MCE_B_ASSETS_MT_EXEC_D item in list_D) { if (item.RESULT_ID <= 0) { throw new Exception("请选择保养结果."); } } obj.STATE = 2; HelperObject_MCE_B_ASSETS_MT_EXEC.Update(obj, transaction); } } //平台自动生成代码 transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_ASSETS_MT_EXEC> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_EXEC>(ServiceUri)) { return(smgr.Service.Audit_Ext(listID)); } } }
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; StringBuilder rsb = new StringBuilder(); int bytelengg = (int)request.InputStream.Length; using (var reader = new StreamReader(request.InputStream, Encoding.UTF8)) { var read = new Char[bytelengg]; var count = reader.Read(read, 0, bytelengg); while (count > 0) { var str = new string(read, 0, count); rsb.Append(str); count = reader.Read(read, 0, bytelengg); } reader.Close(); reader.Dispose(); request.InputStream.Close(); request.InputStream.Dispose(); } if (string.IsNullOrEmpty(rsb.ToString())) { throw new Exception("参数错误."); } JsonMceAssetsWriteOff item = JsonConvert.DeserializeObject <JsonMceAssetsWriteOff>(rsb.ToString()); /* * if (string.IsNullOrEmpty(item.code)) * { * throw new Exception("报废单号不能为空."); * } */ if (string.IsNullOrEmpty(item.create_date)) { throw new Exception("报废日期不能为空."); } if (string.IsNullOrEmpty(item.finance_cycle)) { throw new Exception("财务月份不能为空."); } BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_WRITE_OFF.Proxy.Save_Ext(item); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.Message; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); context.Response.End(); } }
public BizLogicMsg Save_Ext(JsonMCE_MT_EXEC json) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_B_ASSETS_MT_EXEC entity = new EntityObject_MCE_B_ASSETS_MT_EXEC(); if (!string.IsNullOrEmpty(json.ID)) { entity.ID = json.ID; entity = HelperObject_MCE_B_ASSETS_MT_EXEC.Get(entity); if (entity == null) { throw new Exception("获取数据出错."); } } else { throw new Exception("参数错误."); } if (!string.IsNullOrEmpty(json.ACTUAL_EXEC_DATE)) { entity.ACTUAL_EXEC_DATE = DateTime.Parse(json.ACTUAL_EXEC_DATE); } entity.COMMENTS = json.COMMENTS; decimal decTotMoney = 0; if (json.children != null && json.children.Count > 0) { foreach (JsonMCE_MT_EXEC_D item in json.children) { EntityObject_MCE_B_ASSETS_MT_EXEC_D entity_D = new EntityObject_MCE_B_ASSETS_MT_EXEC_D(); if (!string.IsNullOrEmpty(item.ID)) { entity_D.ID = item.ID; entity_D = HelperObject_MCE_B_ASSETS_MT_EXEC_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } } else { throw new Exception("获取数据出错."); } if (!string.IsNullOrEmpty(item.RESULT_ID)) { entity_D.RESULT_ID = int.Parse(item.RESULT_ID); } if (!string.IsNullOrEmpty(item.MONEY)) { entity_D.MONEY = decimal.Parse(item.MONEY); } decTotMoney = decTotMoney + entity_D.MONEY; entity_D.COMMENTS = item.COMMENTS; HelperObject_MCE_B_ASSETS_MT_EXEC_D.Update(entity_D, transaction); } } entity.TOTAL_MONEY = decTotMoney; int amount = HelperObject_MCE_B_ASSETS_MT_EXEC.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_EXEC"; 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_EXEC"; 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_EXEC> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_EXEC>(ServiceUri)) { return(smgr.Service.Save_Ext(json)); } } }
public BizLogicMsg Save_Ext(EntityObject_MCE_D_DEPR_TYPE item) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_D_DEPR_TYPE obj = new EntityObject_MCE_D_DEPR_TYPE(); if (!string.IsNullOrEmpty(item.ID)) { obj.ID = item.ID; obj = HelperObject_MCE_D_DEPR_TYPE.Get(obj); if (obj == null) { throw new Exception("获取数据出错."); } } obj.CODE = item.CODE; obj.NAME = item.NAME; obj.YEARLY_SCALE = item.YEARLY_SCALE; obj.MONTHLY_SCALE = item.YEARLY_SCALE / 12.00m; obj.STATE = 1; if (string.IsNullOrEmpty(item.ID)) { obj.CREATE_TIME = DateTime.Now; obj.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; int amount = HelperObject_MCE_D_DEPR_TYPE.Save(obj, transaction); } else { obj.MODIFY_TIME = DateTime.Now; obj.MODIFY_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; int amount = HelperObject_MCE_D_DEPR_TYPE.Update(obj, transaction); } 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_D_DEPR_TYPE> smgr = new ServiceManager <ServiceContract_MCE_D_DEPR_TYPE>(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; // string strID = request["id"].ToString(); StringBuilder rsb = new StringBuilder(); int bytelengg = (int)request.InputStream.Length; using (var reader = new StreamReader(request.InputStream, Encoding.UTF8)) { var read = new Char[bytelengg]; var count = reader.Read(read, 0, bytelengg); while (count > 0) { var str = new string(read, 0, count); rsb.Append(str); count = reader.Read(read, 0, bytelengg); } reader.Close(); reader.Dispose(); request.InputStream.Close(); request.InputStream.Dispose(); } List <string> idList = JsonConvert.DeserializeObject <List <string> >(rsb.ToString()); foreach (string strID in idList) { CauseObject_MDM_D_DEPT p = new CauseObject_MDM_D_DEPT(); p.REF_ID = strID; p.AUDIT_STATE = "COM_1002_01"; DisplayObject_MDM_D_DEPT[] listExist = BizLogicObject_MDM_D_DEPT.Proxy.Query(p); if (listExist != null && listExist.Length > 0) { throw new Exception("供应商" + listExist[0].NAME + "已经审核."); } } BizLogicMsg msg = BizLogicObject_MCE_D_MCE_TYPE.Proxy.Save_Dept_Ext(idList); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); context.Response.End(); } }
public BizLogicMsg Save_Ext(JsonMceType jsonMceType) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_D_MCE_TYPE obj = new EntityObject_MCE_D_MCE_TYPE(); obj.CODE = jsonMceType.code; obj.NAME = jsonMceType.name; obj.PARENT_ID = jsonMceType.parent_id; obj.STATE = jsonMceType.state; if (string.IsNullOrEmpty(jsonMceType.id)) { obj.CREATE_TIME = DateTime.Now; obj.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; int amount = HelperObject_MCE_D_MCE_TYPE.Save(obj, transaction); } else { obj.ID = jsonMceType.id; int amount = HelperObject_MCE_D_MCE_TYPE.Update(obj, transaction); /* * CauseObject_MCE_D_TYPE_DEPT cause = new CauseObject_MCE_D_TYPE_DEPT(); * cause.MCE_TYPE_ID = jsonMceType.id; * int amount1 = HelperObject_MCE_D_TYPE_DEPT.Delete(cause, transaction); */ } /* * if (jsonMceType.listDeptID != null && jsonMceType.listDeptID.Count>0) * { * foreach (string strDeptID in jsonMceType.listDeptID) * { * EntityObject_MCE_D_TYPE_DEPT item = new EntityObject_MCE_D_TYPE_DEPT(); * item.MCE_TYPE_ID = obj.ID; * item.DEPT_ID = strDeptID; * HelperObject_MCE_D_TYPE_DEPT.Save(item, 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_D_MCE_TYPE> smgr = new ServiceManager <ServiceContract_MCE_D_MCE_TYPE>(ServiceUri)) { return(smgr.Service.Save_Ext(jsonMceType)); } } }
public BizLogicMsg Audit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_ASSETS_MT_PLAN obj = new EntityObject_MCE_B_ASSETS_MT_PLAN(); obj.ID = strID; obj = HelperObject_MCE_B_ASSETS_MT_PLAN.Get(obj); if (obj != null) { if (obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经审核的数据不能再审核."); } obj.STATE = 3; obj.AUDIT_TIME = DateTime.Now; obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; HelperObject_MCE_B_ASSETS_MT_PLAN.Update(obj, transaction); EntityObject_MCE_B_ASSETS_MT_EXEC entity = new EntityObject_MCE_B_ASSETS_MT_EXEC(); entity.PLAN_ID = obj.ID; entity.CODE = obj.CODE; entity.NAME = obj.NAME; entity.MTN_TYPE_ID = obj.MTN_TYPE_ID; entity.MTN_COMPANY_ID = obj.MTN_COMPANY_ID; entity.EXECUTE_PERIOD = obj.EXECUTE_PERIOD; entity.MTN_TYPE_ID = obj.MTN_TYPE_ID; entity.CREATE_DATE = obj.CREATE_DATE; entity.EXECUTE_PERIOD_UNIT = obj.EXECUTE_PERIOD_UNIT; entity.APPLY_USER_ID = obj.APPLY_USER_ID; entity.COMMENTS = obj.COMMENTS; // entity.PLAN_STATE = obj.PLAN_STATE; 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_EXEC.Save(entity, transaction); DisplayObject_MCE_B_ASSETS_MT_PLAN_D[] list_D = BizLogicObject_MCE_B_ASSETS_MT_PLAN_D.Proxy.Query(new CauseObject_MCE_B_ASSETS_MT_PLAN_D() { BASE_ID = obj.ID }); foreach (DisplayObject_MCE_B_ASSETS_MT_PLAN_D item in list_D) { EntityObject_MCE_B_ASSETS_MT_EXEC_D entity_D = new EntityObject_MCE_B_ASSETS_MT_EXEC_D(); entity_D.BASE_ID = entity.ID; entity_D.ASSETS_ID = item.ASSETS_ID; entity_D.ASSET_CODE = item.ASSET_CODE; entity_D.SPEC = item.SPEC; entity_D.DEPT_ID = item.DEPT_ID; entity_D.ITEM_ID = item.ITEM_ID; entity_D.SEQ_NUMBER = item.SEQ_NUMBER; entity_D.COMMENTS = item.COMMENTS; HelperObject_MCE_B_ASSETS_MT_EXEC_D.Save(entity_D, 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_MT_PLAN> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_PLAN>(ServiceUri)) { return(smgr.Service.Audit_Ext(listID)); } } }
public BizLogicMsg CancelPrvAudit(List <string> idList) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { string strUserID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; string strUserName = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.NAME; foreach (string strID in idList) { CauseObject_MDM_D_DEPT p = new CauseObject_MDM_D_DEPT(); p.REF_ID = strID; DisplayObject_MDM_D_DEPT[] list_MDM_D_DEPT = BizLogicObject_MDM_D_DEPT.Proxy.Query(p); if (list_MDM_D_DEPT != null && list_MDM_D_DEPT.Length > 0) { string strPrvID = list_MDM_D_DEPT[0].ID; EntityObject_MDM_D_DEPT entity = new EntityObject_MDM_D_DEPT(); entity.ID = strPrvID; entity = BizLogicObject_MDM_D_DEPT.Proxy.Get(entity); if (entity != null) { entity.AUDIT_STATE = "COM_1002_02"; entity.AUDIT_TIME = DateTime.Now; entity.AUDIT_USER_ID = strUserID; BizLogicObject_MDM_D_DEPT.Proxy.Update(entity); } } if (!msg.Succeed) { throw new Exception(msg.Message); } } transaction.Commit(); string strJson = JsonConvert.SerializeObject(idList); Ipedf.Hrp.BizLogic.PRV_MCE_Web_Service.PRV_Web_Service service = new Ipedf.Hrp.BizLogic.PRV_MCE_Web_Service.PRV_Web_Service(); if (System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"] != null) { string strServiceURL = System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"]; service.Url = strServiceURL; } service.SetPrvAuditStatus(strJson, "COM_1002_02", strUserID, strUserName); } 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_D_MCE_TYPE> smgr = new ServiceManager <ServiceContract_MCE_D_MCE_TYPE>(ServiceUri)) { return(smgr.Service.CancelPrvAudit(idList)); } } }
public BizLogicMsg Save_Ext(JsonMCE_TRANSFER jsonMCE_TRANSFER) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { EntityObject_MCE_B_ASSETS_TRANSFER entity = new EntityObject_MCE_B_ASSETS_TRANSFER(); if (!string.IsNullOrEmpty(jsonMCE_TRANSFER.ID)) { entity.ID = jsonMCE_TRANSFER.ID; entity = HelperObject_MCE_B_ASSETS_TRANSFER.Get(entity); if (entity == null) { throw new Exception("获取数据出错."); } } entity.CODE = jsonMCE_TRANSFER.CODE; if (!string.IsNullOrEmpty(jsonMCE_TRANSFER.CREATE_DATE)) { entity.CREATE_DATE = DateTime.Parse(jsonMCE_TRANSFER.CREATE_DATE); } entity.TRANSFER_DEPT_ID = jsonMCE_TRANSFER.TRANSFER_DEPT_ID; entity.TRANSFER_USER_ID = jsonMCE_TRANSFER.TRANSFER_USER_ID; entity.DEPT_ID = jsonMCE_TRANSFER.DEPT_ID; entity.USER_ID = jsonMCE_TRANSFER.USER_ID; entity.COMMENTS = jsonMCE_TRANSFER.COMMENTS; entity.STATE = 1; if (string.IsNullOrEmpty(jsonMCE_TRANSFER.ID)) { entity.CREATE_TIME = DateTime.Now; entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; int amount = HelperObject_MCE_B_ASSETS_TRANSFER.Save(entity, transaction); } else { int amount = HelperObject_MCE_B_ASSETS_TRANSFER.Update(entity, transaction); } if (jsonMCE_TRANSFER.DELETEIDS != null && jsonMCE_TRANSFER.DELETEIDS.Count > 0) { foreach (string strID in jsonMCE_TRANSFER.DELETEIDS) { EntityObject_MCE_B_ASSETS_TRANSFER_D entity_D = new EntityObject_MCE_B_ASSETS_TRANSFER_D(); if (!string.IsNullOrEmpty(strID)) { entity_D.ID = strID; entity_D = HelperObject_MCE_B_ASSETS_TRANSFER_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } else { HelperObject_MCE_B_ASSETS_TRANSFER_D.Delete(entity_D, transaction); } } } } if (jsonMCE_TRANSFER.children != null && jsonMCE_TRANSFER.children.Count > 0) { foreach (JsonMCE_TRANSFER_D item in jsonMCE_TRANSFER.children) { EntityObject_MCE_B_ASSETS_TRANSFER_D entity_D = new EntityObject_MCE_B_ASSETS_TRANSFER_D(); if (!string.IsNullOrEmpty(item.ID)) { entity_D.ID = item.ID; entity_D = HelperObject_MCE_B_ASSETS_TRANSFER_D.Get(entity_D); if (entity_D == null) { throw new Exception("获取数据出错."); } } entity_D.BASE_ID = entity.ID; entity_D.ASSETS_ID = item.ASSETS_ID; entity_D.ASSETS_NAME = item.ASSETS_NAME; entity_D.ASSETS_CODE = item.ASSETS_CODE; entity_D.SPEC = item.SPEC; entity_D.COMMENTS = item.COMMENTS; if (string.IsNullOrEmpty(item.ID)) { HelperObject_MCE_B_ASSETS_TRANSFER_D.Save(entity_D, transaction); } else { HelperObject_MCE_B_ASSETS_TRANSFER_D.Update(entity_D, 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_TRANSFER> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_TRANSFER>(ServiceUri)) { return(smgr.Service.Save_Ext(jsonMCE_TRANSFER)); } } }
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; // string strID = request["id"].ToString(); StringBuilder rsb = new StringBuilder(); int bytelengg = (int)request.InputStream.Length; using (var reader = new StreamReader(request.InputStream, Encoding.UTF8)) { var read = new Char[bytelengg]; var count = reader.Read(read, 0, bytelengg); while (count > 0) { var str = new string(read, 0, count); rsb.Append(str); count = reader.Read(read, 0, bytelengg); } reader.Close(); reader.Dispose(); request.InputStream.Close(); request.InputStream.Dispose(); } if (string.IsNullOrEmpty(rsb.ToString())) { throw new Exception("参数错误."); } JsonMCE_PURCHASE_PLAN entity = JsonConvert.DeserializeObject <JsonMCE_PURCHASE_PLAN>(rsb.ToString()); if (string.IsNullOrEmpty(entity.CODE)) { throw new Exception("参数错误,单号不能为空."); } if (string.IsNullOrEmpty(entity.PRV_ID)) { throw new Exception("参数错误,供应商不能为空."); } if (string.IsNullOrEmpty(entity.PURCHASE_DEPT_ID)) { throw new Exception("参数错误,采购科室不能为空."); } if (entity.children != null && entity.children.Count > 0) { foreach (JsonMCE_PURCHASE_PLAN_D item in entity.children) { if (string.IsNullOrEmpty(item.TYPE_ID)) { throw new Exception("参数错误,设备类型不能为空."); } if (string.IsNullOrEmpty(item.ASSET_NAME)) { throw new Exception("参数错误,设备名称不能为空."); } if (item.AMOUNT <= 0) { throw new Exception("参数错误,设备数量不能为空."); } if (item.PRICE <= 0) { throw new Exception("参数错误,设备价格不能为空."); } } } else { throw new Exception("没有明细数据"); } BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_PURCHASE_PLAN.Proxy.Save_Ext(entity); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.Message; //jsonMsg.Message = "提交成功."; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); context.Response.End(); } }
public BizLogicMsg Audit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_ASSETS_TRANSFER obj = new EntityObject_MCE_B_ASSETS_TRANSFER(); obj.ID = strID; obj = HelperObject_MCE_B_ASSETS_TRANSFER.Get(obj); if (obj != null) { if (obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经审核的数据不能再审核."); } obj.STATE = 3; obj.AUDIT_TIME = DateTime.Now; obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; HelperObject_MCE_B_ASSETS_TRANSFER.Update(obj, transaction); DisplayObject_MCE_B_ASSETS_TRANSFER_D[] disTransfer = BizLogicObject_MCE_B_ASSETS_TRANSFER_D.Proxy.Query(new CauseObject_MCE_B_ASSETS_TRANSFER_D() { BASE_ID = obj.ID }); if (disTransfer.Length > 0) { for (int i = 0; i < disTransfer.Length; i++) { if (string.IsNullOrEmpty(disTransfer[i].ASSETS_ID)) { continue; } //资产卡片更新 EntityObject_MCE_B_ASSETS entAssets = BizLogicObject_MCE_B_ASSETS.Proxy.Get(new EntityObject_MCE_B_ASSETS() { ID = disTransfer[i].ASSETS_ID }); if (entAssets != null) { entAssets.CUSTODY_DEPT_ID = obj.DEPT_ID; entAssets.CUSTODY_USER_ID = obj.USER_ID; entAssets.SUBJECTION_DEPT_ID = obj.DEPT_ID; entAssets.USING_DEPT_ID = obj.DEPT_ID; entAssets.USING_USER_ID = obj.USER_ID; entAssets.USE_STATE = "00540001"; //在用 BizLogicObject_MCE_B_ASSETS.Proxy.UpdateByTrans(entAssets, 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_TRANSFER> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_TRANSFER>(ServiceUri)) { return(smgr.Service.Audit_Ext(listID)); } } }
public BizLogicMsg Audit_Ext(List <string> listID) { if (LocalMode) { BizLogicMsg msg = new BizLogicMsg(); using (IDbConnection connection = IDALProvider.IDAL.PopConnection()) { using (IDbTransaction transaction = connection.BeginTransaction()) { try { foreach (string strID in listID) { EntityObject_MCE_B_SALES_RETURN obj = new EntityObject_MCE_B_SALES_RETURN(); obj.ID = strID; obj = HelperObject_MCE_B_SALES_RETURN.Get(obj); if (obj != null) { if (obj.STATE == 3 || obj.STATE == 4) { throw new Exception("已经审核的数据不能再审核."); } obj.STATE = 3; obj.AUDIT_TIME = DateTime.Now; obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID; HelperObject_MCE_B_SALES_RETURN.Update(obj, transaction); DisplayObject_MCE_B_SALES_RETURN_D[] disBack = BizLogicObject_MCE_B_SALES_RETURN_D.Proxy.Query(new CauseObject_MCE_B_SALES_RETURN_D() { BASE_ID = obj.ID }); if (disBack.Length > 0) { for (int i = 0; i < disBack.Length; i++) { if (string.IsNullOrEmpty(disBack[i].ASSETS_ID)) { continue; } //资产卡片更新 EntityObject_MCE_B_ASSETS entAssets = BizLogicObject_MCE_B_ASSETS.Proxy.Get(new EntityObject_MCE_B_ASSETS() { ID = disBack[i].ASSETS_ID }); if (entAssets != null) { entAssets.ASSETS_STATE = "00530004"; //退货 BizLogicObject_MCE_B_ASSETS.Proxy.UpdateByTrans(entAssets, transaction); /* * if (!string.IsNullOrEmpty(disBack[i].REF_TAB_ID)) * { * EntityObject_MCE_B_ASSETS_OUTSTOCK_D oUTSTOCK_D = BizLogicObject_MCE_B_ASSETS_OUTSTOCK_D.Proxy.Get(new EntityObject_MCE_B_ASSETS_OUTSTOCK_D() { ID = disBack[i].REF_TAB_ID }); * * if (oUTSTOCK_D != null) * { * oUTSTOCK_D.IS_RETURN = 1; * } * BizLogicObject_MCE_B_ASSETS_OUTSTOCK_D.Proxy.UpdateByTrans(oUTSTOCK_D, transaction); * } */ } } } } } //平台自动生成代码 transaction.Commit(); } catch (Exception expt) { transaction.Rollback(); msg = new BizLogicMsg(false, expt.Message); Error(expt); } finally { IDALProvider.IDAL.PushConnection(connection); } } } return(msg); } else { using (ServiceManager <ServiceContract_MCE_B_SALES_RETURN> smgr = new ServiceManager <ServiceContract_MCE_B_SALES_RETURN>(ServiceUri)) { return(smgr.Service.Audit_Ext(listID)); } } }
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; StringBuilder rsb = new StringBuilder(); int bytelengg = (int)request.InputStream.Length; using (var reader = new StreamReader(request.InputStream, Encoding.UTF8)) { var read = new Char[bytelengg]; var count = reader.Read(read, 0, bytelengg); while (count > 0) { var str = new string(read, 0, count); rsb.Append(str); count = reader.Read(read, 0, bytelengg); } reader.Close(); reader.Dispose(); request.InputStream.Close(); request.InputStream.Dispose(); } if (string.IsNullOrEmpty(rsb.ToString())) { throw new Exception("参数错误."); } EntityObject_MCE_D_DEPR_TYPE item = JsonConvert.DeserializeObject <EntityObject_MCE_D_DEPR_TYPE>(rsb.ToString()); if (string.IsNullOrEmpty(item.CODE) || string.IsNullOrEmpty(item.NAME)) { throw new Exception("编码、名称不能为空."); } CauseObject_MCE_D_DEPR_TYPE p = new CauseObject_MCE_D_DEPR_TYPE(); p.CODE = item.CODE; string strCondition = ""; if (!string.IsNullOrEmpty(item.ID)) { strCondition = strCondition + " and MCE_D_DEPR_TYPE.ID<>'" + item.ID + "'"; p.SetCustomCondition(strCondition); } DisplayObject_MCE_D_DEPR_TYPE[] list = BizLogicObject_MCE_D_DEPR_TYPE.Proxy.Query(p); if (list != null && list.Length > 0) { throw new Exception("编码:[" + item.CODE + "]已经存在."); } BizLogicMsg msg = BizLogicObject_MCE_D_DEPR_TYPE.Proxy.Save_Ext(item); if (!msg.Succeed) { throw new Exception(msg.Message); } jsonMsg.Succeed = 1; jsonMsg.Message = msg.Message; } catch (Exception ex) { jsonMsg.Succeed = 0; jsonMsg.Message = ex.Message; } finally { context.Response.Write(JsonConvert.SerializeObject(jsonMsg)); context.Response.End(); } }