public void Update()
        {
            this.departmentID        = ProjectFiles.department_id.GetValueOrDefault(0);
            this.fileDiscript        = ProjectFiles.file_discript;
            this.fileName            = ProjectFiles.file_name;
            this.fileType            = ProjectFiles.file_type;
            this.manufactureNumber   = ProjectFiles.manufacture_number;
            this.rmanufactureNumber  = ProjectFiles.r_manufacture_number;
            this.projectFilesID      = ProjectFiles.project_files_id;
            this.userID              = ProjectFiles.user_id.GetValueOrDefault(0);
            this.fileUpdateTime      = ProjectFiles.file_updatetime;
            this.fileDelete          = ProjectFiles.file_delete.GetValueOrDefault(false);
            this.fileDeleteDescript  = ProjectFiles.file_delete_descript;
            this.fileDeleteTime      = ProjectFiles.file_delete_time;
            this.fileDeletePersionID = ProjectFiles.file_delete_persion_id.GetValueOrDefault(-1);
            this.fileTypeID          = ProjectFiles.file_type_id.GetValueOrDefault(-1);
            this.fileBytes           = ProjectFiles.file_bytes.GetValueOrDefault(0);

            string manufactureNumberTemp  = manufactureNumber.TrimEnd();
            string rmanufactureNumberTemp = "";

            if (!String.IsNullOrEmpty(rmanufactureNumber))
            {
                rmanufactureNumberTemp = rmanufactureNumber.TrimEnd();
            }
            this.fileUrl = (CustomUri.GetAbsoluteUrl(String.IsNullOrEmpty(rmanufactureNumber) ? manufactureNumberTemp : rmanufactureNumberTemp) + "/" + fileName);

            //this.fileUrl = (CustomUri.GetAbsoluteUrl(String.IsNullOrEmpty(rmanufactureNumber) ? manufactureNumber : rmanufactureNumber) + "/" + fileName);
        }
示例#2
0
        private void OnDownloadTempCommand()
        {
            String FileUrl = CustomUri.GetAbsoluteUrl("ProductmanagerFileTemp/重要部件到货信息导入模版.xls");

            try
            {
                saveFileDialog        = new SaveFileDialog();
                saveFileDialog.Filter = "All Files|*.*";
                saveFileDialog.GetType().GetMethod("set_DefaultFileName").Invoke(saveFileDialog, new object[] { "重要部件到货信息导入模版.xls" });
                bool?dialogResult = saveFileDialog.ShowDialog();
                if (dialogResult != true)
                {
                    return;
                }
                WebClient client = new WebClient();
                Uri       uri    = new Uri(FileUrl, UriKind.RelativeOrAbsolute);
                client.OpenReadCompleted += new OpenReadCompletedEventHandler(OpenReadCompleted);
                client.OpenReadAsync(uri);
            }
            catch (System.Exception ex)
            {
                NotifyWindow notifyWindow = new NotifyWindow("下载错误", ex.Message);
                notifyWindow.Show();
            }
        }
示例#3
0
        private void loadOperationProjectFiles_Completed(object sender, EventArgs e)
        {
            ProjectFilesEntityList.Clear();
            LoadOperation <ProductManager.Web.Model.project_files> loadOperation = sender as LoadOperation <ProductManager.Web.Model.project_files>;

            foreach (ProductManager.Web.Model.project_files project_files in loadOperation.Entities)
            {
                ProjectFilesEntity projectFilesEntity = new ProjectFilesEntity();
                projectFilesEntity.ProjectFiles = project_files;
                projectFilesEntity.Update();
                projectFilesEntity.FileUrl = CustomUri.GetAbsoluteUrl(projectFilesEntity.ManufactureNumber + "/" + projectFilesEntity.FileName);
                DepartmentEntity lDepartmentEntity;
                if (DepartmentEntityDictionary.TryGetValue(projectFilesEntity.DepartmentID, out lDepartmentEntity))
                {
                    projectFilesEntity.DepartmentName = lDepartmentEntity.DepartmentName;
                }
                UserEntity lUserEntity;
                if (UserEntityDictionary.TryGetValue(projectFilesEntity.UserID, out lUserEntity))
                {
                    projectFilesEntity.UserName = lUserEntity.CUserName;
                }
                FileTypeEntity lFileTypeEntity;
                if (FileTypeEntityDictionary.TryGetValue(projectFilesEntity.FileTypeID, out lFileTypeEntity))
                {
                    projectFilesEntity.FileTypeName = lFileTypeEntity.FileTypeName;
                }
                ProjectFilesEntityList.Add(projectFilesEntity);
            }
            IsBusy = false;
        }
示例#4
0
 public void Update()
 {
     this.fileName       = PlanFiles.file_name;
     this.userID         = PlanFiles.user_id.GetValueOrDefault(0);
     this.fileUploadTime = PlanFiles.file_uploadtime.GetValueOrDefault();
     this.fileBytes      = PlanFiles.file_bytes.GetValueOrDefault(0);
     this.fileUrl        = CustomUri.GetAbsoluteUrl("PlanOutline/" + fileName);
 }
        private bool canView(object aObject)
        {
            if (fileUrl == null)
            {
                if (TaxPayerIsLink.GetValueOrDefault(false))
                {
                    fileUrl = (CustomUri.GetAbsoluteUrl("upload/" + TaxPayerLinkId.Value) + "/" + TaxPayerDocumentName);
                }
                else
                {
                    fileUrl = (CustomUri.GetAbsoluteUrl("upload/" + TaxPayerId.Value) + "/" + TaxPayerDocumentName);
                }
            }

            if (fileUrl != null)
            {
                int lastDot = fileUrl.LastIndexOf(".");
                if (lastDot <= 0)
                {
                    return(false);
                }
                String lExt = fileUrl.Substring(lastDot, fileUrl.Length - lastDot).ToLower();
                if (lExt == ".pdf" ||
                    lExt == ".doc" ||
                    lExt == ".docx" ||
                    lExt == ".xls" ||
                    lExt == ".xlsx" ||
                    lExt == ".jpeg" ||
                    lExt == ".jpg" ||
                    lExt == ".png" ||
                    lExt == ".bmp" ||
                    lExt == ".tiff" ||
                    lExt == ".tif" ||
                    lExt == ".gif")
                {
                    if (!TaxPayerUpdateTime.HasValue)
                    {
                        return(false);
                    }
                    DateTime lToday = DateTime.Now;
                    if (lToday.Year == TaxPayerUpdateTime.Value.Year && lToday.Month == TaxPayerUpdateTime.Value.Month && lToday.Day == TaxPayerUpdateTime.Value.Day)
                    {
                        return(false);
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        private bool CanViewCommand(object aObject)
        {
            if (FileUrl == null)
            {
                string manufactureNumberTemp  = manufactureNumber.TrimEnd();
                string rmanufactureNumberTemp = "";
                if (!String.IsNullOrEmpty(rmanufactureNumber))
                {
                    rmanufactureNumberTemp = rmanufactureNumber.TrimEnd();
                }
                FileUrl = (CustomUri.GetAbsoluteUrl(String.IsNullOrEmpty(rmanufactureNumber) ? manufactureNumberTemp : rmanufactureNumberTemp) + "/" + fileName);
            }

            if (FileUrl != null)
            {
                int lastDot = FileUrl.LastIndexOf(".");
                if (lastDot <= 0)
                {
                    return(false);
                }
                String lExt = FileUrl.Substring(lastDot, FileUrl.Length - lastDot).ToLower();
                if (lExt == ".pdf" ||
                    lExt == ".doc" ||
                    lExt == ".docx" ||
                    lExt == ".xls" ||
                    lExt == ".xlsx" ||
                    lExt == ".jpeg" ||
                    lExt == ".jpg" ||
                    lExt == ".png" ||
                    lExt == ".bmp" ||
                    lExt == ".tiff" ||
                    lExt == ".tif" ||
                    lExt == ".gif")
                {
                    DateTime lToday = DateTime.Now;
                    if (lToday.Year == fileUpdateTime.Value.Year && lToday.Month == fileUpdateTime.Value.Month && lToday.Day == fileUpdateTime.Value.Day)
                    {
                        return(false);
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        private void onView()
        {
            if (fileUrl == null)
            {
                if (TaxPayerIsLink.GetValueOrDefault(false))
                {
                    fileUrl = (CustomUri.GetAbsoluteUrl("upload/" + TaxPayerLinkId.Value) + "/" + TaxPayerDocumentName);
                }
                else
                {
                    fileUrl = (CustomUri.GetAbsoluteUrl("upload/" + TaxPayerId.Value) + "/" + TaxPayerDocumentName);
                }
            }
            ReviewWindow review = new ReviewWindow(fileUrl + ".xod");

            review.Show();
        }
 private void OnDownloadCommand()
 {
     //MessageBox.Show(FileUrl);
     if (FileUrl == null)
     {
         string manufactureNumberTemp  = manufactureNumber.TrimEnd();
         string rmanufactureNumberTemp = "";
         if (!String.IsNullOrEmpty(rmanufactureNumber))
         {
             rmanufactureNumberTemp = rmanufactureNumber.TrimEnd();
         }
         FileUrl = (CustomUri.GetAbsoluteUrl(String.IsNullOrEmpty(rmanufactureNumber) ? manufactureNumberTemp : rmanufactureNumberTemp) + "/" + fileName);
         //FileUrl = (CustomUri.GetAbsoluteUrl(String.IsNullOrEmpty(rmanufactureNumber) ? manufactureNumber.TrimEnd() : rmanufactureNumber.TrimEnd()) + "/" + fileName);
     }
     //MessageBox.Show(FileUrl);
     try
     {
         saveFileDialog        = new SaveFileDialog();
         saveFileDialog.Filter = "All Files|*.*";
         saveFileDialog.GetType().GetMethod("set_DefaultFileName").Invoke(saveFileDialog, new object[] { this.FileName });
         //MessageBox.Show("3");
         bool?dialogResult = saveFileDialog.ShowDialog();
         if (dialogResult != true)
         {
             return;
         }
         //MessageBox.Show("4");
         WebClient client = new WebClient();
         Uri       uri    = new Uri(FileUrl, UriKind.RelativeOrAbsolute);
         client.OpenReadCompleted       += new OpenReadCompletedEventHandler(OpenReadCompleted);
         client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
         client.OpenReadAsync(uri);
         DownLoading = Visibility.Visible;
     }
     catch (System.Exception ex)
     {
         //MessageBox.Show(ex.Message);
         MessageBox.Show(ex.StackTrace);
     }
 }
示例#9
0
        private bool CanViewCommand(object aObject)
        {
            if (FileUrl == null)
            {
                FileUrl = CustomUri.GetAbsoluteUrl("PlanOutline/" + fileName);
            }

            if (FileUrl != null)
            {
                int    lastDot = FileUrl.LastIndexOf(".");
                String lExt    = FileUrl.Substring(lastDot, FileUrl.Length - lastDot).ToLower();
                if (lExt == ".pdf" ||
                    lExt == ".doc" ||
                    lExt == ".docx" ||
                    lExt == ".xls" ||
                    lExt == ".xlsx" ||
                    lExt == ".jpeg" ||
                    lExt == ".png" ||
                    lExt == ".bmp" ||
                    lExt == ".tiff" ||
                    lExt == ".gif")
                {
                    DateTime lToday = DateTime.Now;
                    if (lToday.Year == fileUploadTime.Year && lToday.Month == fileUploadTime.Month && lToday.Day == fileUploadTime.Day)
                    {
                        return(false);
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        private void onDownload()
        {
            if (fileUrl == null)
            {
                if (TaxPayerIsLink.GetValueOrDefault(false))
                {
                    fileUrl = (CustomUri.GetAbsoluteUrl("upload/" + TaxPayerLinkId.Value) + "/" + TaxPayerDocumentName);
                }
                else
                {
                    fileUrl = (CustomUri.GetAbsoluteUrl("upload/" + TaxPayerId.Value) + "/" + TaxPayerDocumentName);
                }
            }

            try
            {
                saveFileDialog        = new SaveFileDialog();
                saveFileDialog.Filter = "All Files|*.*";
                saveFileDialog.GetType().GetMethod("set_DefaultFileName").Invoke(saveFileDialog, new object[] { TaxPayerDocumentName });
                bool?dialogResult = saveFileDialog.ShowDialog();
                if (dialogResult != true)
                {
                    return;
                }
                WebClient client = new WebClient();
                Uri       uri    = new Uri(fileUrl, UriKind.RelativeOrAbsolute);
                client.OpenReadCompleted       += new OpenReadCompletedEventHandler(OpenReadCompleted);
                client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
                client.OpenReadAsync(uri);
                DownLoading = Visibility.Visible;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
            }
        }