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 + "/" + "T_BM_HYXX", dt, true, true);
        T_BM_HYXXApplicationLogic instanceT_BM_HYXXApplicationLogic = (T_BM_HYXXApplicationLogic)CreateApplicationLogicInstance(typeof(T_BM_HYXXApplicationLogic));

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

            appData.HYBH = instanceT_BM_HYXXApplicationLogic.AutoGenerateHYBH(appData);

            int i = 0;

            appData = instanceT_BM_HYXXApplicationLogic.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 = T_BM_HYXXApplicationData.GetDataFromDataFile <T_BM_HYXXApplicationData>(InfoFromDoc.Text, true, true, recordStartLine: T_BM_HYXXContants.ImportDataSetStartLineNum);
            T_BM_HYXXApplicationLogic instanceT_BM_HYXXApplicationLogic = (T_BM_HYXXApplicationLogic)CreateApplicationLogicInstance(typeof(T_BM_HYXXApplicationLogic));
            totalCount = appDatas.Count;
            foreach (var app in appDatas)
            {
                app.HYBH = instanceT_BM_HYXXApplicationLogic.AutoGenerateHYBH(app);

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

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

                if (!HYSR.Text.IsHtmlNullOrWiteSpace())
                {
                    app.HYSR = Convert.ToDateTime(HYSR.Text);
                }

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

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

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

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

                if (!ZCSJ.Text.IsHtmlNullOrWiteSpace())
                {
                    app.ZCSJ = Convert.ToDateTime(ZCSJ.Text);
                }

                if (!ZKSS.Text.IsHtmlNullOrWiteSpace())
                {
                    app.ZKSS = Convert.ToInt32(ZKSS.Text);
                }

                if (!XHKSS.Text.IsHtmlNullOrWiteSpace())
                {
                    app.XHKSS = Convert.ToInt32(XHKSS.Text);
                }

                if (!SYKSS.Text.IsHtmlNullOrWiteSpace())
                {
                    app.SYKSS = Convert.ToInt32(SYKSS.Text);
                }

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