コード例 #1
0
ファイル: Createing.aspx.cs プロジェクト: suizhikuo/KYCMS
    protected void CreateInfoColumn(int modelId)
    {
        M_InfoModel infoModelM = InfoModelBll.GetModel(modelId);                                                       //取得对应Id的模板信息
        string tableName = infoModelM.TableName;

        B_Create CreateBll = new B_Create();

        B_SiteInfo bllSite = new B_SiteInfo();
        M_InfoSite mInfoSite = bllSite.GetInfoModel();
        int pageSize = mInfoSite.InfoCreateNum;
        int pageIndex = 1;
        int recordCount = 0;
        int pageTotl = 0;

        string infoColId = Session["newscolumnid"].ToString();
        string wheStr = " and i.colid in(" + infoColId + ")";
        CreateBll.InfoRecordCount(tableName, wheStr,ref recordCount);

        pageTotl = (recordCount - 1) / pageSize + 1;
        Response.Write("<script>SetTotal(" + recordCount + ")</script>\r\n");
        Response.Flush();
        string currentPer = "0.0";
        for (int crti = 1; crti <= pageTotl; crti++)
        {
            pageIndex = crti;
            DataTable dt = CreateBll.GetColumnAll(tableName, infoColId,pageIndex, pageSize);
            for (int i = 1; i <= dt.Rows.Count; i++)
            {
                int currIndex = pageSize * (crti - 1) + i;
                string per = ((double)currIndex * 100 / (double)recordCount).ToString("F1");
                CreateBll.CreateInfo(dt.Rows[i - 1]);
                if (currentPer != per)
                {
                    currentPer = per;
                    Response.Write("<script>SetPr('" + per + "%'," + currIndex + ")</script>\r\n");
                    Response.Flush();
                }
            }
            dt.Dispose();
        }

        Response.Write("<script>SetPr('100.0%'," + recordCount + ")</script>");
        Response.Write("<script>document.getElementById('finallytd').innerText = '生成完毕'</script>");
        Response.Flush();
        CreateBll.ClearHashTable();
    }