private void BindEntity() { string applyData = "[{\"action\":\"SERVICE_REGISTER\",\"type\":\"R\",\"username\":\"" + Common.DataUserName + "\",\"password\":\"" + Common.DataPwd + "\",\"SYS_CODE\":\"BLCTZS\"}]"; string isEnableNet = ConfigurationManager.AppSettings["isEnableNet"]; //java if (string.IsNullOrEmpty(isEnableNet)) { WebJavaReference.EDIESBService javaeEdiesbService = new WebJavaReference.EDIESBService(); string returnJson = javaeEdiesbService.callEDIESBPub("BLCTZS", "MDM", "mdm_register", applyData, Common.EdiUserName, Common.EdiPwd); try { var model = JsonConvert.DeserializeObject <RegisterResultsEntity>(returnJson); if (model != null) { RegisterResultsEntity.Result2 result2 = model.Result; if (result2 != null) { RegisterResultsEntity.DataList2[] dataList = result2.DataList; rptEntityList.DataSource = dataList; rptEntityList.DataBind(); } } } catch (Exception ex) { BaseComponent.Error(ex.ToString()); throw ex; } } }
protected void lbtnRegister_Click(object sender, EventArgs e) { string isEnableNet = ConfigurationManager.AppSettings["isEnableNet"]; //java if (string.IsNullOrEmpty(isEnableNet)) { RegisterServiceEntity rs = new RegisterServiceEntity(); List <DataCollection> list = new List <DataCollection>(); DataCollection dc = new DataCollection(); dc.username = Common.DataUserName; dc.password = Common.DataPwd; dc.ENTITY_CODE = this.txtModuleName.Text; dc.MD_CODE = "MDM_NBG"; dc.SERVICE_NAME = "mdm_subscribe"; dc.SYS_CODE = "BLCTZS"; dc.TO_NODE = "BLCTZS"; list.Add(dc); rs.password = Common.ApplyDataUserPwd; rs.username = Common.ApplyDataUserName; rs.action = "SERVICE_REGISTER"; rs.data = list; rs.type = Type; string applyData = "[" + JsonConvert.SerializeObject(rs) + "]"; WebJavaReference.EDIESBService javaeEdiesbService = new WebJavaReference.EDIESBService(); string returnJson = javaeEdiesbService.callEDIESBPub("BLCTZS", "MDM", "mdm_register", applyData, Common.EdiUserName, Common.EdiPwd); var model = JsonConvert.DeserializeObject <ResultEntity>(returnJson); if (model != null) { ResultEntity.Result2 result2 = model.Result; if (result2 != null) { ResultEntity.ResultInfo[] resultInfos = result2.ResultInfos; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "sdel", "layer.alert('" + resultInfos[0].Msg + "!',9);", true); } } } }
private void GetAllData(string entityName, string key, int page = 1) { string isEnableNet = ConfigurationManager.AppSettings["isEnableNet"]; //java if (string.IsNullOrEmpty(isEnableNet)) { WebJavaReference.EDIESBService javaeEdiesbService = new WebJavaReference.EDIESBService(); GlobalRequestEntity globalRequestEntity = new GlobalRequestEntity(); globalRequestEntity.Type = "R"; globalRequestEntity.Action = "TRANSFOR"; globalRequestEntity.Model = "MDM_NBG"; globalRequestEntity.Entity = entityName; globalRequestEntity.Pagesize = SyncPageSize; globalRequestEntity.Page = page.ToString(); globalRequestEntity.Username = Common.ApplyDataUserName; globalRequestEntity.Password = Common.ApplyDataUserPwd; string applyData = "[" + JsonConvert.SerializeObject(globalRequestEntity) + "]"; string returnJson = javaeEdiesbService.callEDIESBPub("BLCTZS", "MDM", "mdm_publish", applyData, Common.EdiUserName, Common.EdiPwd); var model = JsonConvert.DeserializeObject <GlobalResultEntity>(returnJson); if (model != null) { GlobalResultEntity.Result2 result2 = model.Result; if (result2 != null) { DataTable dt = result2.DataList; if (dt != null) { SyncDataToSqlDb(entityName, key, dt); if (result2.IsMore == "Y" && result2.Total != 0) { page++; GetAllData(entityName, key, page); } } } } } }