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_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)); } } }