Esempio n. 1
0
 public string GetUpLoadPicPath(HtmlInputFile FilePicName, string FilePicPath, bool WaterMark, bool NewSize, int MaxWidth, int MaxHeight, bool BiLi, int BiLiValue, int FileSize)
 {
     string fileName = Path.GetFileName(FilePicName.PostedFile.FileName);
     string str2 = Path.GetExtension(FilePicName.PostedFile.FileName).ToString();
     bool flag = false;
     if ((FileSize != 0) && (FilePicName.PostedFile.ContentLength > (FileSize * 0x400)))
     {
         HttpContext.Current.Response.Write("<script>alert('上传图片大小超出了限制');window.close();</script>");
         HttpContext.Current.Response.End();
     }
     B_SiteInfo info = new B_SiteInfo();
     string imgUploadType = info.GetInfoModel().ImgUploadType;
     string[] strArray = imgUploadType.Split(new char[] { '|' });
     for (int i = 0; i < strArray.Length; i++)
     {
         if (strArray[i].ToLower() == str2.ToLower())
         {
             flag = true;
             break;
         }
     }
     if (!flag)
     {
         HttpContext.Current.Response.Write("<script>alert('上传图片格式只能够是:" + imgUploadType + "!');window.close();</script>");
         HttpContext.Current.Response.End();
     }
     M_Site siteModel = new M_Site();
     siteModel = info.GetSiteModel();
     if (NewSize)
     {
         return this.PicNewSize(FilePicName, FilePicPath, WaterMark, MaxWidth, MaxHeight, BiLi, BiLiValue);
     }
     if (WaterMark)
     {
         if (siteModel.IsImgWaterMark)
         {
             return this.PicWaterMark(FilePicName, FilePicPath, "");
         }
         return this.LetterWaterMark(FilePicName, FilePicPath, "");
     }
     return this.NotWaterMark_NotNewSize(FilePicName, FilePicPath);
 }
Esempio n. 2
0
 public string UpLoadSoft(HtmlInputFile FilePicName, string FilePicPath)
 {
     string fileName = Path.GetFileName(FilePicName.PostedFile.FileName);
     string str2 = Path.GetExtension(FilePicName.PostedFile.FileName).ToString();
     bool flag = false;
     B_SiteInfo info = new B_SiteInfo();
     string softUploadType = info.GetInfoModel().SoftUploadType;
     string[] strArray = softUploadType.Split(new char[] { '|' });
     for (int i = 0; i < strArray.Length; i++)
     {
         if (strArray[i].ToLower() == str2.ToLower())
         {
             flag = true;
             break;
         }
     }
     if (!flag)
     {
         HttpContext.Current.Response.Write("<script>alert('上传软件格式只能够是:" + softUploadType + "');window.history.go(-1);</script>");
         HttpContext.Current.Response.End();
     }
     if ((((FilePicName.PostedFile.ContentType == "text/asp") || (FilePicName.PostedFile.ContentType == "video/x-ms-asf")) || ((FilePicName.PostedFile.ContentType == "text/html") || (FilePicName.PostedFile.ContentType == "application/xml"))) || (FilePicName.PostedFile.ContentType == "text/plain"))
     {
         HttpContext.Current.Response.Write("<script>alert('上传文件格式不正确,请压缩后再上传');window.history.go(-1);</script>");
         HttpContext.Current.Response.End();
     }
     string str4 = Function.GetFileName();
     string str5 = DateTime.Now.ToString("yyyyMM");
     string path = HttpContext.Current.Server.MapPath(FilePicPath) + str5 + "/";
     if (!Directory.Exists(path))
     {
         Directory.CreateDirectory(path);
     }
     string filename = path + str4 + str2;
     FilePicName.PostedFile.SaveAs(filename);
     return ("/" + str5 + "/" + str4 + str2);
 }
Esempio n. 3
0
    protected void CreateLastInfoRecord(int modelId)
    {
        M_InfoModel infoModelM = InfoModelBll.GetModel(modelId);                                                       //取得对应Id的模板信息
        string tableName = infoModelM.TableName;                                                                                        //取得模型的表名

        int newRecord = int.Parse(Request.QueryString["newsrecordcount"].ToString());
        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 = CreateBll.LastInfoCount(tableName, newRecord);
        int pageTotl = 0;

        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.GetNewRecordNum(tableName, newRecord, 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();
    }
Esempio n. 4
0
    protected void CreateInfoId(int modelIdNum)
    {
        M_InfoModel infoModelM = InfoModelBll.GetModel(modelIdNum);                                                       //取得对应Id的模板信息
        string tableName = infoModelM.TableName;                                                                                        //取得模型的表名

        int startId = int.Parse(Request.QueryString["startid"].ToString());
        int endId = int.Parse(Request.QueryString["endid"].ToString());
        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 wheStr = " and i.id in(select id from " + tableName + " where id>=" + startId + " and id<=" + endId + ") ";

        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.GetIdRange(tableName, startId, endId, 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();
    }
Esempio n. 5
0
    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();
    }
Esempio n. 6
0
    protected void CreateInfo(int modelIdNum)
    {
        M_InfoModel infoModelM = InfoModelBll.GetModel(modelIdNum);                                                       //取得对应Id的模板信息
        string tableName = infoModelM.TableName;                                                                          //取得模型的表名
        string modelName = infoModelM.ModelName;

        B_SiteInfo bllSite = new B_SiteInfo();
        M_InfoSite mInfoSite = bllSite.GetInfoModel();
        int pageSize = mInfoSite.InfoCreateNum;

        int pageIndex = 1;                                                                                                //初始化页的索引号
        int recordCount = 0;                                                                                              //统计要生成新闻的条数
        int pageTotl = 0;                                                                                                 //统计总页数

        B_Create createBll = new B_Create();
        createBll.InfoRecordCount(tableName, "", 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.GetInfo(tableName, 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();
    }