Пример #1
0
 public void SaveImage([System.Xml.Serialization.XmlElementAttribute(IsNullable = true)] CameraImage image, out bool SaveImageResult, [System.Xml.Serialization.XmlIgnoreAttribute()] out bool SaveImageResultSpecified)
 {
     object[] results = this.Invoke("SaveImage", new object[] {
         image
     });
     SaveImageResult          = ((bool)(results[0]));
     SaveImageResultSpecified = ((bool)(results[1]));
 }
Пример #2
0
        public CameraImage ReadImage(int id)
        {
            //Read an exoisting image
            CameraImage image = null;

            try {
                DataSet ds = new CameraGateway().ReadImage(id);
                if (ds.Tables["ImageTable"] != null)
                {
                    image          = new CameraImage();
                    image.ID       = int.Parse(ds.Tables["ImageTable"].Rows[0]["ID"].ToString());
                    image.Date     = DateTime.Parse(ds.Tables["ImageTable"].Rows[0]["Date"].ToString());
                    image.Filename = ds.Tables["ImageTable"].Rows[0]["Filename"].ToString();
                    image.File     = (byte[])ds.Tables["ImageTable"].Rows[0]["File"];
                }
            }
            catch (Exception ex) { throw new FaultException <CameraFault>(new CameraFault(ex.Message), "Service Error"); }
            return(image);
        }
Пример #3
0
        public bool SaveImage(CameraImage image)
        {
            //Create a new issue
            bool added = false;

            try {
                //Apply simple business rules

                //Create the TransactionScope to execute the commands, guaranteeing that both commands can commit or roll back as a single unit of work
                //using (TransactionScope scope = new TransactionScope()) {
                //
                added = new CameraGateway().CreateImage(image.Filename, image.File);

                //    //Commits the transaction; if an exception is thrown, Complete is not called and the transaction is rolled back
                //    scope.Complete();
                //}
            }
            catch (Exception ex) { throw new FaultException <CameraFault>(new CameraFault(ex.Message), "Service Error"); }
            return(added);
        }
Пример #4
0
        public static bool SaveImage(string filename, byte[] bytes)
        {
            //
            bool          res = false, resSpecified = false;
            CameraService client = new CameraService();

            //client.Credentials = System.Net.CredentialCache.DefaultCredentials;
            try {
                //Create DTO and call service
                CameraImage image = new CameraImage();
                image.Date     = DateTime.Now;
                image.Filename = filename;
                image.File     = bytes;

                client.SaveImage(image, out res, out resSpecified);
                client.Dispose();   //Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            //catch(FaultException<CameraFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            //catch(FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            //catch(CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(res);
        }
Пример #5
0
 /// <remarks/>
 public System.IAsyncResult BeginSaveImage(CameraImage image, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("SaveImage", new object[] {
         image
     }, callback, asyncState));
 }