예제 #1
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        List <int> idlist = new List <int>();

        bool doall = true;

        if (doall)
        {
            idlist.Clear();

            YHFramework.DAL.ApployInfoDal applist = new ApployInfoDal();
            List <YHFramework.SysModel.ApployInfoModel> datalist = applist.GetModelList();
            foreach (var item in datalist)
            {
                if (item.AutoCheck == false)
                {
                    idlist.Add(item.ID);
                }
            }
        }

        ApplyTools ApplyTools = new ApplyTools();

        foreach (var idkey in idlist)
        {
            ApplyTools.GetBagStatusInfo(idkey);
        }

        Response.Write("执行完毕<br/>");
    }
예제 #2
0
    public string GetBagStatusInfo(object appid)
    {
        string _result = "";
        int    _appId  = Common.Fun.ConvertTo <int>(appid, 0);

        YHFramework.DAL.ApployInfoDal        appdal      = new ApployInfoDal();
        YHFramework.SysModel.ApployInfoModel appinfodata = appdal.GetModel(_appId);
        if (appinfodata.AutoCheck == false)
        {
            int      datarow = appdal.GetCodeRowCountByAppId(_appId);
            FileInfo file    = new FileInfo(System.AppDomain.CurrentDomain.BaseDirectory + appinfodata.Url);
            if (file.Exists)
            {
                _result = "大小:" + file.Length / 1024 / 1024 + ",串码数量:" + datarow;
            }
            else
            {
                _result = "文件不存在";
            }

            appdal.UpdateBagInfo(_appId, _result);


            #region 写日志

            new YHFramework.DAL.ApployCheckLogDal().Add(new YHFramework.SysModel.ApployCheckLogModel()
            {
                ApployId = _appId,
                CreateOn = DateTime.Now,
                FileName = appinfodata.FileName,
                Message  = _result,
                Number   = datarow,
                TypeCode = "BagCheck"
            });

            #endregion
        }
        else
        {
            _result = appinfodata.CheckResult;
        }
        return(_result);
    }
예제 #3
0
    public void ExportFileByZip(int apployInfoId)
    {
        YHFramework.DAL.ApployInfoDal        apployInfoDal = new ApployInfoDal();
        YHFramework.SysModel.ApployInfoModel model         = apployInfoDal.GetModel(apployInfoId);
        OutFileFactory FileFactory  = new OutFileFactory();
        IOutFile       outfile      = FileFactory.CreateNewObj(GetOutFileType(apployInfoId));
        FileInfo       fileinfo     = new FileInfo(model.FileName);
        string         fileanme     = fileinfo.Name.Replace(fileinfo.Extension, "");
        string         tempfilename = fileanme + outfile.ExtName;
        string         zipfilename  = fileanme + ".zip";
        string         tempfilepath = System.AppDomain.CurrentDomain.BaseDirectory + "tempfile\\";
        string         zipfilepath  = System.AppDomain.CurrentDomain.BaseDirectory + "down\\";

        if (Directory.Exists(tempfilepath) == false)
        {
            Directory.CreateDirectory(tempfilepath);
        }

        #region 清理文件

        if (File.Exists(tempfilepath + tempfilename))
        {
            File.Delete(tempfilepath + tempfilename);
        }

        if (File.Exists(zipfilepath + zipfilename))
        {
            File.Delete(zipfilepath + zipfilename);
        }

        #endregion

        #region 写入临时文件

        int pagezise  = 20000;
        int pagecount = 0;
        int datacount = 0;


        YHFramework.DAL.CodeDataDal codedatadal = new CodeDataDal();
        string sqlwhere = " and ApployInfoId=" + apployInfoId + " ";
        datacount = codedatadal.GetCount(sqlwhere, "");
        if (datacount % pagezise == 0)
        {
            pagecount = datacount / pagezise;
        }
        else
        {
            pagecount = datacount / pagezise + 1;
        }

        for (int i = 1; i <= pagecount; i++)
        {
            DataTable dt = codedatadal.GetPageList(" a.* ", "", sqlwhere, i, pagezise);
            outfile.OutFilePath = tempfilepath;
            outfile.FileName    = tempfilename;
            outfile.OutFile(dt);
        }


        #endregion

        #region 压缩
        bool result = ZipCommon.ZipFile(tempfilepath + tempfilename, zipfilepath, fileanme, 5, 2048, model.Secret);
        if (result)
        {
            this.txtMsg.Text = "压缩成功";
        }
        else
        {
            this.txtMsg.Text = "压缩失败";
        }
        #endregion

        #region 更新任务

        #endregion
    }