Esempio n. 1
0
        //新增保存
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //让用户输入新保存的样式名称
            frmReportStyle frmStyle = new frmReportStyle(styleObject);

            if (frmStyle.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            isDefault = false;
            styleName = frmStyle.styleName;
            string     fileName   = string.Format("Report/{0}{1}.frx", styleObject, frmStyle.styleName);
            FileStream fileStream = new FileStream(fileName, FileMode.Create);

            //获取模板文件流
            //designerReport.Report.Save(fileStream);
            designerReport.Report.Save(fileStream);
            fileStream.Close();
            fileStream.Dispose();
            //FileTransferOperation fileOperation = new FileTransferOperation();
            //fileOperation.UpReceive += new HXCFileTransferCache_Client.UpLoadFileReceiveHandler<HXCFileTransferCache_Client.UpLoadFileReceiveEventArgs>(fileOperation_UpReceive);
            //fileName = localFileName.Replace("Report/", "");
            ////fileName = "./" + fileName;
            ////fileOperation.UploadFile(fileName, null);
            //fileOperation.UploadFile(localFileName, "//Report");
            //上传到服务器
            //if (!FileOperation.UploadFile(fileName, Path.GetFileName(fileName)))
            if (!FileOperation.UploadFileByPath("Report", fileName))
            {
                return;
            }
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("style_id", Guid.NewGuid().ToString());
            dic.Add("style_object", styleObject);
            dic.Add("style_name", frmStyle.styleName);
            dic.Add("style_url", Path.GetFileName(fileName));
            dic.Add("create_by", GlobalStaticObj.UserID);
            dic.Add("create_time", DateTime.UtcNow.Ticks.ToString());
            if (DBHelper.Submit_AddOrEdit("新增打印样式", "tb_print_style", null, null, dic))
            {
                MessageBoxEx.Show("新增成功!");
                fileStream.Close();
                fileStream.Dispose();
                BindStyle(styleName);
                cboPrintStyle.SelectedValue = fileName;
            }
            else
            {
                MessageBoxEx.Show("新增失败!");
            }
        }
 //新增保存
 private void btnAdd_Click(object sender, EventArgs e)
 {
     //让用户输入新保存的样式名称
     frmReportStyle frmStyle = new frmReportStyle(styleObject);
     if (frmStyle.ShowDialog() != DialogResult.OK)
     {
         return;
     }
     isDefault = false;
     styleName = frmStyle.styleName;
     string localFileName = string.Format("Report/{0}{1}.frx", styleObject, frmStyle.styleName);
     FileStream fileStream = new FileStream(localFileName, FileMode.Create);
     //获取模板文件流
     //designerReport.Report.Save(fileStream);
     designerReport.Report.Save(fileStream);
     fileStream.Close();
     fileStream.Dispose();
     //FileTransferOperation fileOperation = new FileTransferOperation();
     //fileOperation.UpReceive += new HXCFileTransferCache_Client.UpLoadFileReceiveHandler<HXCFileTransferCache_Client.UpLoadFileReceiveEventArgs>(fileOperation_UpReceive);
     //fileName = localFileName.Replace("Report/", "");
     ////fileName = "./" + fileName;
     ////fileOperation.UploadFile(fileName, null);
     //fileOperation.UploadFile(localFileName, "//Report");
     //上传到服务器
     if (!FileOperation.UploadFile(fileName, fileName))
     {
         return;
     }
     Dictionary<string, string> dic = new Dictionary<string, string>();
     dic.Add("style_id", Guid.NewGuid().ToString());
     dic.Add("style_object", styleObject);
     dic.Add("style_name", frmStyle.styleName);
     dic.Add("style_url", fileName);
     dic.Add("create_by", GlobalStaticObj.UserID);
     dic.Add("create_time", DateTime.UtcNow.Ticks.ToString());
     if (DBHelper.Submit_AddOrEdit("新增打印样式", "tb_print_style", null, null, dic))
     {
         MessageBoxEx.Show("新增成功!");
         fileStream.Close();
         fileStream.Dispose();
         BindStyle(styleName);
         cboPrintStyle.SelectedValue = fileName;
     }
     else
     {
         MessageBoxEx.Show("新增失败!");
     }
 }