Beispiel #1
0
        public bool FileDownLoad(string filedownloadpath)
        {
            string functionName = "FileDownLoad";

            try
            {
                AMS.ServiceProxy.FileOperate filedownload = new ServiceProxy.FileOperate();
                string result = filedownload.FileDownLoad(filedownloadpath + "\\" + _FileModel.Name, _FileModel.FilePath, SeatManage.EnumType.SeatManageSubsystem.SharingFile);
                if (!string.IsNullOrEmpty(result))
                {
                    ErrorMessage = string.Format("下载文件失败!{0}", result);
                    return(false);
                }
                return(true);
            }
            catch (AMS.Model.CustomerException ex)
            {
                ErrorMessage = string.Format("{0} 出自{1}.{2}", ex.Message, ex.ErrorSourcesClass, ex.ErrorSourcesFunction);
                return(false);
            }
            catch (Exception ex)
            {
                ErrorMessage = string.Format("{0} 出自{1}.{2}", ex.Message, CLASSNAME, functionName);
                return(false);
            }
        }
        /// <summary>
        /// 下载文件
        /// </summary>
        public bool DownLoadFile(string fileLocalPath, int index)
        {
            string functionName = "DownLoadFile";

            try
            {
                AMS.ServiceProxy.FileOperate fileDownLoad = new ServiceProxy.FileOperate();
                fileDownLoad.HandleProgress += new ServiceProxy.EventHandleFileTransport(fileDownLoad_HandleProgress);
                Vm_ProgressBar.ProgressType  = "文件下载进度";
                Vm_ProgressBar.ProgressName  = "正在下载\"" + _FileSharingList[index].FileModel.Name + "\"……";
                string result = fileDownLoad.FileDownLoad(fileLocalPath + "\\" + _FileSharingList[index].FileModel.Name, _FileSharingList[index].FileModel.FilePath, SeatManage.EnumType.SeatManageSubsystem.SharingFile);
                if (!string.IsNullOrEmpty(result))
                {
                    ErrorMessage = string.Format("下载失败!{0}", result);
                    return(false);
                }
                return(true);
            }
            catch (AMS.Model.CustomerException ex)
            {
                ErrorMessage = string.Format("{0} 出自{1}.{2}", ex.Message, ex.ErrorSourcesClass, ex.ErrorSourcesFunction);
                return(false);
            }
            catch (Exception ex)
            {
                ErrorMessage = string.Format("{0} 出自{1}.{2}", ex.Message, CLASSNAME, functionName);
                return(false);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 下载文件
        /// </summary>
        /// <returns></returns>
        public bool DownLoadFile()
        {
            string functionName = "DownLoadFile";

            try
            {
                string resultstr = "";
                AMS.ServiceProxy.FileOperate download = new ServiceProxy.FileOperate();
                download.HandleProgress    += new ServiceProxy.EventHandleFileTransport(download_HandleProgress);
                Vm_Progressbar.ProgressType = "媒体文件下载";
                Vm_Progressbar.FullProgress = _PlayModel.MediaFiles.Count;
                foreach (AMS.Model.AMS_VideoItem item in _PlayModel.MediaFiles)
                {
                    Vm_Progressbar.ProgressName = "正在下载\"" + item.Name + "\"……";
                    resultstr = download.FileDownLoad(loaclPath + item.Name, item.ReRelativeUrl, SeatManage.EnumType.SeatManageSubsystem.MediaFiles);
                    if (!string.IsNullOrEmpty(resultstr))
                    {
                        ErrorMessage = resultstr;
                        return(false);
                    }
                }
                return(true);
            }
            catch (AMS.Model.CustomerException ex)
            {
                ErrorMessage = string.Format("{0} 出自{1}.{2}", ex.Message, ex.ErrorSourcesClass, ex.ErrorSourcesFunction);
                return(false);
            }
            catch (Exception ex)
            {
                ErrorMessage = string.Format("{0} 出自{1}.{2}", ex.Message, CLASSNAME, functionName);
                return(false);
            }
        }
Beispiel #4
0
        //int i = 0;//记录打印行数
        void pd_PrintPage(object sender, PrintPageEventArgs e)
        {
            try
            {
                float       yPosition  = 0;//字符串纵向位置
                float       leftMargin = e.MarginBounds.Left;
                float       topMargin  = e.MarginBounds.Top;
                string      line       = "";
                Font        font;                                                  //字体
                string      strFont;                                               //字体名
                string      strSize;                                               //字体大小
                XmlNodeList nodes = newDoc.SelectSingleNode("//Print").ChildNodes; //获取文字内容

                for (int i = 0; i < nodes.Count; i++)
                {
                    switch (nodes[i].LocalName)
                    {
                    case "Content":
                        strFont = nodes[i].Attributes["font"].Value;
                        strSize = nodes[i].Attributes["size"].Value;
                        if (nodes[i].Attributes["italic"] != null && nodes[i].Attributes["bold"] != null && nodes[i].Attributes["bold"].Value == "Y" && nodes[i].Attributes["italic"].Value == "Y")
                        {
                            font = new Font(strFont, float.Parse(strSize), FontStyle.Bold | FontStyle.Italic);
                        }
                        else if (nodes[i].Attributes["bold"] != null && nodes[i].Attributes["bold"].Value == "Y")
                        {
                            font = new Font(strFont, float.Parse(strSize), FontStyle.Bold);
                        }
                        else if (nodes[i].Attributes["italic"] != null && nodes[i].Attributes["italic"].Value == "Y")
                        {
                            font = new Font(strFont, float.Parse(strSize), FontStyle.Italic);
                        }
                        else
                        {
                            font = new Font(strFont, float.Parse(strSize));
                        }

                        //替换打印内容中的标签
                        line = nodes[i].InnerText;
                        e.Graphics.DrawString(line, font, Brushes.Black, 0, yPosition);
                        yPosition = yPosition + font.GetHeight();      //判断上一行的高度

                        break;

                    case "Pic":
                        string imgUrl = AppDomain.CurrentDomain.BaseDirectory + "\\TestTemp\\" + type.ToString() + "\\" + nodes[i].InnerText;
                        AMS.ServiceProxy.FileOperate download = new ServiceProxy.FileOperate();
                        download.FileDownLoad(imgUrl, nodes[i].InnerText, type);
                        Image img    = imageLocation(imgUrl);
                        int   width  = Convert.ToInt32(nodes[i].Attributes["width"].Value.ToString().Split('.')[0]);
                        int   height = Convert.ToInt32(nodes[i].Attributes["height"].Value.ToString().Split('.')[0]);
                        e.Graphics.DrawImage(img, new Rectangle(0, (int)yPosition, width, height), 0, 0, img.Width, img.Height, System.Drawing.GraphicsUnit.Pixel);
                        img.Dispose();
                        yPosition = yPosition + height;      //判断上一行的高度
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                SeatManage.SeatManageComm.WriteLog.Write(ex.Message);
            }
        }