protected void btnInfoFromDocBatch_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dt = GetTemplateColumn(dt); dt = FileLibrary.GetDataFromWordBatch(ConstantsManager.WEBSITE_VIRTUAL_ROOT_DIR + "/" + ConstantsManager.UPLOAD_DOC_DIR + "/" + "T_BG_0601", dt, true, true); T_BG_0601ApplicationLogic instanceT_BG_0601ApplicationLogic = (T_BG_0601ApplicationLogic)CreateApplicationLogicInstance(typeof(T_BG_0601ApplicationLogic)); foreach (DataRow dr in dt.Rows) { appData = new T_BG_0601ApplicationData(); appData.FBH = instanceT_BG_0601ApplicationLogic.AutoGenerateFBH(appData); int i = 0; appData = instanceT_BG_0601ApplicationLogic.Add(appData); } }
protected void btnInfoFromDS_Click(object sender, EventArgs e) { int totalCount = 0; int importCount = 0; int updateCount = 0; try { var appDatas = T_BG_0601ApplicationData.GetDataFromDataFile <T_BG_0601ApplicationData>(InfoFromDoc.Text, true, true, recordStartLine: T_BG_0601Contants.ImportDataSetStartLineNum); T_BG_0601ApplicationLogic instanceT_BG_0601ApplicationLogic = (T_BG_0601ApplicationLogic)CreateApplicationLogicInstance(typeof(T_BG_0601ApplicationLogic)); totalCount = appDatas.Count; foreach (var app in appDatas) { app.FBH = instanceT_BG_0601ApplicationLogic.AutoGenerateFBH(app); if (!BT.Text.IsHtmlNullOrWiteSpace()) { app.BT = Convert.ToString(BT.Text); } string strFBLM = GetValue(new RICH.Common.BM.T_BG_0602.T_BG_0602ApplicationLogicBase().GetValueByFixCondition("LMM", app.FBLM, "LMH")); if (!DataValidateManager.ValidateIsNull(strFBLM)) { app.FBLM = strFBLM; } if (!FBLM.SelectedValue.IsHtmlNullOrWiteSpace()) { app.FBLM = Convert.ToString(FBLM.SelectedValue); } string strFBBM = GetValue(new RICH.Common.BM.T_BM_DWXX.T_BM_DWXXApplicationLogicBase().GetValueByFixCondition("DWMC", app.FBBM, "DWBH")); if (!DataValidateManager.ValidateIsNull(strFBBM)) { app.FBBM = strFBBM; } if (!FBBM.SelectedValue.IsHtmlNullOrWiteSpace()) { app.FBBM = Convert.ToString(FBBM.SelectedValue); } string strXXLX = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.XXLX, "DM")); if (!DataValidateManager.ValidateIsNull(strXXLX)) { app.XXLX = strXXLX; } if (!XXLX.SelectedValue.IsHtmlNullOrWiteSpace()) { app.XXLX = Convert.ToString(XXLX.SelectedValue); } if (!XXTPDZ.Text.IsHtmlNullOrWiteSpace()) { app.XXTPDZ = Convert.ToString(XXTPDZ.Text); } if (!XXNR.Text.IsHtmlNullOrWiteSpace()) { app.XXNR = Convert.ToString(XXNR.Text); } if (!FJXZDZ.Text.IsHtmlNullOrWiteSpace()) { app.FJXZDZ = Convert.ToString(FJXZDZ.Text); } app.XXZT = "02"; string strXXZT = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.XXZT, "DM")); if (!DataValidateManager.ValidateIsNull(strXXZT)) { app.XXZT = strXXZT; } string strIsTop = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.IsTop, "DM")); if (!DataValidateManager.ValidateIsNull(strIsTop)) { app.IsTop = strIsTop; } if (!IsTop.SelectedValue.IsHtmlNullOrWiteSpace()) { app.IsTop = Convert.ToString(IsTop.SelectedValue); } if (!TopSort.Text.IsHtmlNullOrWiteSpace()) { app.TopSort = Convert.ToInt32(TopSort.Text); } string strIsBest = GetValue(new RICH.Common.BM.Dictionary.DictionaryApplicationLogicBase().GetValueByFixCondition("MC", app.IsBest, "DM")); if (!DataValidateManager.ValidateIsNull(strIsBest)) { app.IsBest = strIsBest; } if (!IsBest.SelectedValue.IsHtmlNullOrWiteSpace()) { app.IsBest = Convert.ToString(IsBest.SelectedValue); } app.FBRJGH = (string)Session[ConstantsManager.SESSION_USER_ID]; string strFBRJGH = GetValue(new RICH.Common.BM.T_PM_UserInfo.T_PM_UserInfoApplicationLogicBase().GetValueByFixCondition("UserNickName", app.FBRJGH, "UserID")); if (!DataValidateManager.ValidateIsNull(strFBRJGH)) { app.FBRJGH = strFBRJGH; } app.FBSJRQ = DateTime.Now; app.FBIP = (string)Request.ServerVariables["REMOTE_ADDR"]; instanceT_BG_0601ApplicationLogic.Add(app); if (app.ResultCode == RICH.Common.Base.ApplicationData.ApplicationDataBase.ResultState.Succeed) { importCount++; } else { app.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.PK; instanceT_BG_0601ApplicationLogic.Modify(app); if (app.ResultCode == RICH.Common.Base.ApplicationData.ApplicationDataBase.ResultState.Succeed) { updateCount++; } } } MessageContent += @"<font color=""green"">共{0}条数据,导入数据{1}条,更新数据{2}条。</font>".FormatInvariantCulture(totalCount, importCount, updateCount); } catch (Exception ex) { MessageContent += @"<font color=""red"">导入数据过程出错:{0}<br/>共{1}条数据,已导入数据{2}条,已更新数据{3}条。</font>".FormatInvariantCulture(ex.Message, totalCount, importCount, updateCount); } }