Example #1
0
 private void convertHD2Data(int size)
 {
     try
     {
         int begincode = 0;;
         if (Session["attachmentconvertbegincode"] != null)
         {
             begincode = int.Parse(Session["attachmentconvertbegincode"].ToString());
         }
         RmsPM.BLL.DocumentRule documentRule = DocumentRule.Instance();
         int i = documentRule.ConvertFileToAttachment(size, ref begincode);
         if (Session["attachmentconvertcount"] == null)
         {
             Session["attachmentconvertcount"] = 0;
         }
         Session["attachmentconvertcount"]     = int.Parse(Session["attachmentconvertcount"].ToString()) + i;
         Session["attachmentconvertbegincode"] = begincode;
         if (i > 0)
         {
             Session["attachmentconvertmsg"] = "转换中请等待,已转换" + Session["attachmentconvertcount"].ToString() + "个附件......";
             Label1.Text   = Session["attachmentconvertmsg"].ToString();
             TextBox1.Text = Session["attachmentconvertsize"].ToString();
             Response.Write(Rms.Web.JavaScript.Reload(true));
         }
         else
         {
             Label1.Text = "转换完成,共转换" + Session["attachmentconvertcount"].ToString() + "个附件.";
             Session["attachmentconvertsize"]      = null;
             Session["attachmentconvertmsg"]       = null;
             Session["attachmentconvertcount"]     = null;
             Session["attachmentconvertbegincode"] = null;
             //Response.Write(Rms.Web.JavaScript.Alert(true, "ok"));
         }
     }
     catch (Exception exp)
     {
         Session["attachmentconvertsize"]      = null;
         Session["attachmentconvertmsg"]       = null;
         Session["attachmentconvertcount"]     = null;
         Session["attachmentconvertbegincode"] = null;
         Label1.Text = Label1.Text + " ---- 转换中发生错误,错误信息:<br>" + exp.ToString();
     }
 }
Example #2
0
 private void convertData2HD(int size)
 {
     try
     {
         RmsPM.BLL.DocumentRule documentRule = DocumentRule.Instance();
         LogHelper.WriteLog("TestLog", new Exception("TestLog"));
         int i = documentRule.ConvertAttachmentToFile(size);
         if (Session["attachmentconvertcount"] == null)
         {
             Session["attachmentconvertcount"] = 0;
         }
         Session["attachmentconvertcount"] = (int)Session["attachmentconvertcount"] + i;
         if (i > 0)
         {
             Session["attachmentconvertmsg"] = "转换中请等待,已转换" + Session["attachmentconvertcount"].ToString() + "个附件......";
             Label1.Text   = Session["attachmentconvertmsg"].ToString();
             TextBox1.Text = Session["attachmentconvertsize"].ToString();
             Response.Write(Rms.Web.JavaScript.Reload(true));
         }
         else
         {
             Label1.Text = "转换完成,共转换" + Session["attachmentconvertcount"].ToString() + "个附件.";
             Session["attachmentconvertsize"]      = null;
             Session["attachmentconvertmsg"]       = null;
             Session["attachmentconvertcount"]     = null;
             Session["attachmentconvertbegincode"] = null;
             //Response.Write(Rms.Web.JavaScript.Alert(true, "ok"));
         }
     }
     catch (Exception exp)
     {
         Session["attachmentconvertsize"]      = null;
         Session["attachmentconvertmsg"]       = null;
         Session["attachmentconvertcount"]     = null;
         Session["attachmentconvertbegincode"] = null;
         Label1.Text = Label1.Text + " ---- 转换中发生错误,错误信息:<br>" + exp.ToString();
     }
 }
Example #3
0
    private void convertHD2HD(int size)
    {
        int begincode = 0;;

        if (Session["attachmentconvertbegincode"] != null)
        {
            begincode = int.Parse(Session["attachmentconvertbegincode"].ToString());
        }
        RmsPM.BLL.DocumentRule documentRule = DocumentRule.Instance();
        init();
        if (_SavePathMode == AttachmentSavePathMode.ROOT)
        {
            Label1.Text = "路径选项配置不正确,无法转换";
            return;
        }
        EntityData entity = new EntityData();

        using (SingleEntityDAO dao = new SingleEntityDAO("AttachMent"))
        {
            dao.FillEntity("select top " + size.ToString() + " * from attachment where content is  null and guidname is not null and attachmentcode>" + begincode + " order by attachmentcode", "", "", entity, "AttachMent");
        }
        DataTable dt    = entity.CurrentTable;
        int       count = 0;

        if (dt.Rows.Count > 0)
        {
            Rms.LogHelper.LogHelper.Warn("附件目录转换开始 code>" + begincode.ToString());
            try
            {
                foreach (DataRow dr in dt.Rows)
                {
                    DirectoryInfo dir = new DirectoryInfo(GetPath(dr["createdate"].ToString()));
                    if (!dir.Exists)
                    {
                        dir.Create();
                    }
                    FileInfo file = new FileInfo(Path.Combine(_Path, dr["guidname"].ToString()));
                    if (file.Exists)
                    {
                        file.MoveTo(GetFileName(file.Name, dr["createdate"].ToString()));
                    }
                    else
                    {
                        Rms.LogHelper.LogHelper.Warn("文件未找到" + file.Name);
                    }
                    if (int.Parse(dr["attachmentcode"].ToString()) > begincode)
                    {
                        begincode = int.Parse(dr["attachmentcode"].ToString());
                    }
                }
                Session["attachmentconvertbegincode"] = begincode;
                Session["attachmentconvertmsg"]       = "转换中请等待";
                Response.Write(Rms.Web.JavaScript.Reload(true));
            }
            catch (Exception exp)
            {
                Rms.LogHelper.LogHelper.Warn("转换错误", exp);
                Label1.Text = "转换异常中止,请查看错误日志";
            }
        }
        else
        {
            Label1.Text = "转换完成;";
            Session["attachmentconvertsize"]      = null;
            Session["attachmentconvertmsg"]       = null;
            Session["attachmentconvertcount"]     = null;
            Session["attachmentconvertbegincode"] = null;
        }
    }