Example #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_KCBXX", dt, true, true);
        T_BM_KCBXXApplicationLogic instanceT_BM_KCBXXApplicationLogic = (T_BM_KCBXXApplicationLogic)CreateApplicationLogicInstance(typeof(T_BM_KCBXXApplicationLogic));

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

            appData.KCBBH = instanceT_BM_KCBXXApplicationLogic.AutoGenerateKCBBH(appData);

            int i = 0;

            appData = instanceT_BM_KCBXXApplicationLogic.Add(appData);
        }
    }
Example #2
0
    protected void btnInfoFromDS_Click(object sender, EventArgs e)
    {
        int totalCount  = 0;
        int importCount = 0;
        int updateCount = 0;

        try
        {
            var appDatas = T_BM_KCBXXApplicationData.GetDataFromDataFile <T_BM_KCBXXApplicationData>(InfoFromDoc.Text, true, true, recordStartLine: T_BM_KCBXXContants.ImportDataSetStartLineNum);
            T_BM_KCBXXApplicationLogic instanceT_BM_KCBXXApplicationLogic = (T_BM_KCBXXApplicationLogic)CreateApplicationLogicInstance(typeof(T_BM_KCBXXApplicationLogic));
            totalCount = appDatas.Count;
            foreach (var app in appDatas)
            {
                app.KCBBH = instanceT_BM_KCBXXApplicationLogic.AutoGenerateKCBBH(app);

                string strKCXLBH = GetValue(new RICH.Common.BM.T_BM_KCXLXX.T_BM_KCXLXXApplicationLogicBase().GetValueByFixCondition("KCXLMC", app.KCXLBH, "KCXLBH"));
                if (!DataValidateManager.ValidateIsNull(strKCXLBH))
                {
                    app.KCXLBH = strKCXLBH;
                }
                if (!KCXLBH.SelectedValue.IsHtmlNullOrWiteSpace())
                {
                    app.KCXLBH = Convert.ToString(KCXLBH.SelectedValue);
                }

                string strKCBH = GetValue(new RICH.Common.BM.T_BM_KCXX.T_BM_KCXXApplicationLogicBase().GetValueByFixCondition("KCMC", app.KCBH, "KCBH"));
                if (!DataValidateManager.ValidateIsNull(strKCBH))
                {
                    app.KCBH = strKCBH;
                }
                if (!KCBH.SelectedValue.IsHtmlNullOrWiteSpace())
                {
                    app.KCBH = Convert.ToString(KCBH.SelectedValue);
                }

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

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

                string strSKJS = GetValue(new RICH.Common.BM.T_PM_UserInfo.T_PM_UserInfoApplicationLogicBase().GetValueByFixCondition("UserNickName", app.SKJS, "UserID"));
                if (!DataValidateManager.ValidateIsNull(strSKJS))
                {
                    app.SKJS = strSKJS;
                }
                if (!SKJS.SelectedValue.IsHtmlNullOrWiteSpace())
                {
                    app.SKJS = Convert.ToString(SKJS.SelectedValue);
                }

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

                instanceT_BM_KCBXXApplicationLogic.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_KCBXXApplicationLogic.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);
        }
    }