Esempio n. 1
0
        private void buttonExport_Click(object sender, EventArgs e)
        {
            UseWaitCursor = true;
            Application.DoEvents();

            try
            {
                if (spotShoot == null)
                {
                    spotShoot = new SpotShoot();
                    spotShoot.FilePath = Utility.GetFileSavePath() + Utility.BuilderFileName();
                }
                spotShoot.Status = 1;
                SaveData();
                WordDocument doc = new WordDocument("现场图片");

                doc.AddField("SpotName", spotShoot.SpotName);

                //pictureBoxShoot1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
                string dir = spotShoot.Items[0].SpotPhoto.Remove(0, 1);
                Image image = CommonInvoke.ResizeImageFile(LoadImage(dir).ToArray(), 330, 320);
                doc.AddField("SpotPhoto1",image , EFieldType.Image);
                doc.AddField("ShootAddress1", ShootAddress1.Text);
                doc.AddField("PhotoIllustr1", PhotoIllustr1.Text);

                //pictureBoxShoot2.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
                dir = spotShoot.Items[1].SpotPhoto.Remove(0, 1);
                image = CommonInvoke.ResizeImageFile(LoadImage(dir).ToArray(), 330, 320);
                doc.AddField("SpotPhoto2", image, EFieldType.Image);

                doc.AddField("ShootAddress2", ShootAddress2.Text);
                doc.AddField("PhotoIllustr2", PhotoIllustr2.Text);

                //OutputDocuemnt frm = new OutputDocuemnt(doc);
                //frm.OpenWindow(this);
                OnNavigationRequest(new Maleos.NavigationRequestEventArgs("Maleos.Modules.OutputDocuemnt",
                    new object[] { doc, "EnforceForm.frmSpotShoots", spotShoot.FilePath }));
            }
            catch (Exception ex)
            {
                CommonInvoke.ErrorMessageBox(ex);
            }

            UseWaitCursor = false;
        }
Esempio n. 2
0
 public frmSpotShoot(SpotShoot spotShoot)
     : this()
 {
     this.spotShoot = spotShoot;
 }
Esempio n. 3
0
        private void SaveData()
        {
            if (spotShoot == null)
            {
                spotShoot = new SpotShoot();
                spotShoot.FilePath = Utility.GetFileSavePath() + Utility.BuilderFileName();
            }

            spotShoot.SpotName = SpotName.Text;
            spotShoot.ShootDate = ShootDate.Value;

            Image image1 = (Image)pictureBoxShoot1.Image.Clone();
            pictureBoxShoot1.Image.Dispose();
            pictureBoxShoot1.Image = null;
            Image image2 = (Image)pictureBoxShoot2.Image.Clone();
            pictureBoxShoot2.Image.Dispose();
            pictureBoxShoot2.Image = null;

            int length = spotShoot.Items.Count;
            string[] filename = new string[length];

            for (int i = 0; i < length; i++) {

                filename[i] = spotShoot.Items[i].SpotPhoto;
            }

            //foreach (SpotShootItem subItem in spotShoot.Items)
            //{
            //    File.Delete(subItem.SpotPhoto);
            //}

            spotShoot.Items.Clear();
            SpotShootItem item = new SpotShootItem();
            item.SpotPhoto = SaveFile(image1);//SaveFile(pictureBoxShoot1);
            item.ShootAddress = ShootAddress1.Text;
            item.PhotoIllustr = PhotoIllustr1.Text;
            spotShoot.Items.Add(item);

            item = new SpotShootItem();
            item.SpotPhoto = SaveFile(image2);//SaveFile(pictureBoxShoot2);
            item.ShootAddress = ShootAddress2.Text;
            item.PhotoIllustr = PhotoIllustr2.Text;

            spotShoot.Items.Add(item);

            InvokeUtil.SystemService.EntityUpdate(spotShoot);

            for (int i = 0; i < length; i++) {

                File.Delete(filename[i]);
            }
        }