Esempio n. 1
0
    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 + "/" + "ShortMessage", dt, true, true);
        ShortMessageApplicationLogic instanceShortMessageApplicationLogic = (ShortMessageApplicationLogic)CreateApplicationLogicInstance(typeof(ShortMessageApplicationLogic));

        foreach (DataRow dr in dt.Rows)
        {
            appData = new ShortMessageApplicationData();

            int i = 0;

            appData = instanceShortMessageApplicationLogic.Add(appData);
        }
    }
Esempio n. 2
0
    protected void btnInfoFromDS_Click(object sender, EventArgs e)
    {
        int totalCount  = 0;
        int importCount = 0;
        int updateCount = 0;

        try
        {
            var appDatas = ShortMessageApplicationData.GetDataFromDataFile <ShortMessageApplicationData>(InfoFromDoc.Text, true, true, recordStartLine: ShortMessageContants.ImportDataSetStartLineNum);
            ShortMessageApplicationLogic instanceShortMessageApplicationLogic = (ShortMessageApplicationLogic)CreateApplicationLogicInstance(typeof(ShortMessageApplicationLogic));
            totalCount = appDatas.Count;
            foreach (var app in appDatas)
            {
                if (!DXXBT.Text.IsHtmlNullOrWiteSpace())
                {
                    app.DXXBT = Convert.ToString(DXXBT.Text);
                }

                app.DXXLX = "01";
                if (!DXXNR.Text.IsHtmlNullOrWiteSpace())
                {
                    app.DXXNR = Convert.ToString(DXXNR.Text);
                }

                if (!DXXFJ.Text.IsHtmlNullOrWiteSpace())
                {
                    app.DXXFJ = Convert.ToString(DXXFJ.Text);
                }

                app.FSSJ = DateTime.Now;
                app.FSR  = (string)Session[ConstantsManager.SESSION_USER_ID];
                string strFSR = GetValue(new RICH.Common.BM.T_PM_UserInfo.T_PM_UserInfoApplicationLogicBase().GetValueByFixCondition("UserNickName", app.FSR, "UserID"));
                if (!DataValidateManager.ValidateIsNull(strFSR))
                {
                    app.FSR = strFSR;
                }
                app.FSBM = (string)Session[ConstantsManager.SESSION_SSDW_ID];
                string strFSBM = GetValue(new RICH.Common.BM.T_BM_DWXX.T_BM_DWXXApplicationLogicBase().GetValueByFixCondition("DWMC", app.FSBM, "DWBH"));
                if (!DataValidateManager.ValidateIsNull(strFSBM))
                {
                    app.FSBM = strFSBM;
                }
                app.FSIP = (string)Request.ServerVariables["REMOTE_ADDR"];
                string strJSR = GetValue(new RICH.Common.BM.T_PM_UserInfo.T_PM_UserInfoApplicationLogicBase().GetValueByFixCondition("UserNickName", app.JSR, "UserID"));
                if (!DataValidateManager.ValidateIsNull(strJSR))
                {
                    app.JSR = strJSR;
                }
                if (!JSR.SelectedValues.IsHtmlNullOrWiteSpace())
                {
                    app.JSR = Convert.ToString(JSR.SelectedValues);
                }

                instanceShortMessageApplicationLogic.Add(app);
                if (app.ResultCode == RICH.Common.Base.ApplicationData.ApplicationDataBase.ResultState.Succeed)
                {
                    importCount++;
                }
                else
                {
                    app.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.PK;
                    instanceShortMessageApplicationLogic.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);
        }
    }