예제 #1
0
        public IActionResult AddPictureLocation(AddPictureLocationViewModel addPictureLocationViewModel)
        {
            if (ModelState.IsValid)
            {
                string _stackID = addPictureLocationViewModel.StackID;

                int locationID = addPictureLocationViewModel.LocationID;

                List <int> pictureIDs = addPictureLocationViewModel.PictureIDs;

                foreach (var pictureID in pictureIDs)
                {
                    PictureLocation pictureLocation = new PictureLocation()
                    {
                        PictureID  = pictureID,
                        LocationID = locationID
                    };

                    context.PictureLocations.Add(pictureLocation);
                }

                context.SaveChanges();

                return(Redirect(string.Format("/Picture/AddPIctureLocation?StackID={0}", _stackID)));
            }

            return(View(addPictureLocationViewModel));
        }
예제 #2
0
 public PictureInfo(PictureLocation pictureLocation, string locationData) : this()
 {
     PictureLocation = pictureLocation;
     LocationData    = locationData;
 }
예제 #3
0
 private void updateLocation(PictureLocation loc)
 {
     if (this.InvokeRequired)
     {
         update d = new update(updateLocation);
         this.Invoke(d, new object[] { loc });
     }
     else
     {
         long a = ((this.Width - 19) - (int)((this.Width - 19) * 33 / 800)) / 3;
         this.pictureBox1.Location = new Point(loc.x + (int)(a * 0.45 / 5.8), loc.y);
         this.pictureBox21.Location = new Point(loc.x, loc.y);
         this.pictureBox22.Location = new Point(loc.x + (int)(a * 0.25 / 5.8), loc.y);
     }
 }
예제 #4
0
 private PictureLocation calcLocation(int x, int y)
 {
     PictureLocation loc = new PictureLocation();
     loc.x = x;
     loc.y = y;
     return loc;
 }
예제 #5
0
        /// <summary>
        /// Adds a new picture
        /// </summary>
        /// <param name="upperLeftRow"></param>
        /// /// <param name="upperLeftColumn"></param>
        /// /// <param name="lowerRightRow"></param>
        /// /// <param name="lowerRightColumn"></param>
        /// /// <param name="picturePath">Specify if picture is located on Saaspoe storage or on local server.</param>
        /// <returns></returns>
        public bool AddPicture(string picturePath, PictureLocation location,
                               int upperLeftRow = 0, int upperLeftColumn = 0, int lowerRightRow = 0, int lowerRightColumn = 0)
        {
            //check whether file is set or not
            if (FileName == "")
            {
                throw new Exception("No file name specified");
            }
            //check whether picturePath is set or not
            if (picturePath == "" || picturePath == null)
            {
                throw new Exception("Please specify picture path");
            }

            StreamReader reader = null;

            if (location == PictureLocation.Server)
            {
                //build URI
                string strURI = Saaspose.Common.Product.BaseProductUri + "/cells/" + FileName;
                strURI += "/worksheets/" + WorkSheetName + "/pictures?upperLeftRow=" +
                          upperLeftRow + "&upperLeftColumn=" + upperLeftColumn +
                          "&lowerRightRow=" + lowerRightRow + "&lowerRightColumn=" + lowerRightColumn +
                          "&picturePath=" + picturePath;

                //sign URI
                string signedURI = Utils.Sign(strURI);

                reader = new StreamReader(Utils.ProcessCommand(signedURI, "PUT"));
            }
            else
            {
                using (FileStream stream = new FileStream(picturePath, FileMode.Open))
                {
                    //build URI
                    string strURI = Saaspose.Common.Product.BaseProductUri + "/cells/" + FileName;
                    strURI += "/worksheets/" + WorkSheetName + "/pictures?upperLeftRow=" +
                              upperLeftRow + "&upperLeftColumn=" + upperLeftColumn +
                              "&lowerRightRow=" + lowerRightRow + "&lowerRightColumn=" + lowerRightColumn;

                    //sign URI
                    string signedURI = Utils.Sign(strURI);

                    reader = new StreamReader(Utils.ProcessCommand(signedURI, "PUT", stream));
                }
            }
            //further process JSON response
            string strJSON = reader.ReadToEnd();

            //Parse the json string to JObject
            JObject parsedJSON = JObject.Parse(strJSON);

            BaseResponse baseResponse = JsonConvert.DeserializeObject <BaseResponse>(parsedJSON.ToString());

            if (baseResponse.Code == "200" && baseResponse.Status == "OK")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #6
0
        /// <summary>
        /// Adds a new picture
        /// </summary>
        /// <param name="upperLeftRow"></param>
        /// /// <param name="upperLeftColumn"></param>
        /// /// <param name="lowerRightRow"></param>
        /// /// <param name="lowerRightColumn"></param>
        /// /// <param name="picturePath">Specify if picture is located on Saaspoe storage or on local server.</param>
        /// <returns></returns>
        public bool AddPicture(string picturePath, PictureLocation location,
            int upperLeftRow = 0, int upperLeftColumn = 0, int lowerRightRow = 0, int lowerRightColumn = 0)
        {
            //check whether file is set or not
            if (FileName == "")
                throw new Exception("No file name specified");
            //check whether picturePath is set or not
            if (picturePath == "" || picturePath == null)
                throw new Exception("Please specify picture path");

            StreamReader reader = null;

            if (location == PictureLocation.Server)
            {
                //build URI
                string strURI = Aspose.Cloud.Common.Product.BaseProductUri + "/cells/" + FileName;
                strURI += "/worksheets/" + WorksheetName + "/pictures?upperLeftRow=" +
                    upperLeftRow + "&upperLeftColumn=" + upperLeftColumn +
                    "&lowerRightRow=" + lowerRightRow + "&lowerRightColumn=" + lowerRightColumn +
                    "&picturePath=" + picturePath;

                //sign URI
                string signedURI = Utils.Sign(strURI);

                reader = new StreamReader(Utils.ProcessCommand(signedURI, "PUT"));
            }
            else
            {
                using (FileStream stream = new FileStream(picturePath, FileMode.Open))
                {
                    //build URI
                    string strURI = Aspose.Cloud.Common.Product.BaseProductUri + "/cells/" + FileName;
                    strURI += "/worksheets/" + WorksheetName + "/pictures?upperLeftRow=" +
                        upperLeftRow + "&upperLeftColumn=" + upperLeftColumn +
                        "&lowerRightRow=" + lowerRightRow + "&lowerRightColumn=" + lowerRightColumn;

                    //sign URI
                    string signedURI = Utils.Sign(strURI);

                    reader = new StreamReader(Utils.ProcessCommand(signedURI, "PUT", stream));
                }

            }
            //further process JSON response
            string strJSON = reader.ReadToEnd();

            //Parse the json string to JObject
            JObject parsedJSON = JObject.Parse(strJSON);

            BaseResponse baseResponse = JsonConvert.DeserializeObject<BaseResponse>(parsedJSON.ToString());

            if (baseResponse.Code == "200" && baseResponse.Status == "OK")
                return true;
            else
                return false;
        }
예제 #7
0
 public PictureInfo(PictureLocation pictureLocation, string locationData) : this()
 {
     PictureLocation = pictureLocation;
     LocationData = locationData;
 }