public static DetailsInNode GetDetailsInNode(string node_id, string lang = "EN") { string npl = node_id.Substring(0, node_id.IndexOf("_")); string nplblk = node_id.Substring(node_id.IndexOf("_") + 1); DetailsInNode detailsInNode = new DetailsInNode { node_id = node_id }; string strCommand = " SELECT " + " pp.xplblk " + " FROM " + " pl_pbldst pp " + " WHERE " + " pp.npl = @npl " + " AND pp.nplblk = @nplblk " + " AND pp.clangjap = @lang; "; string strCommDeatil = " SELECT " + " pp.hpartplblk number, " + " p.xpartext name " + " FROM " + " pl_pblpat pp " + " LEFT JOIN pl_ppartt p ON pp.npartgenu = p.npartgenu " + " AND pp.disc_no = p.disc_no " + " WHERE " + " pp.npl = @npl " + " AND " + " pp.nplblk = @nplblk ; "; try { using (IDbConnection db = new MySqlConnection(strConn)) { detailsInNode.name = db.Query <string>(strCommand, new { npl, nplblk, lang }).FirstOrDefault(); detailsInNode.parts = db.Query <Detail>(strCommDeatil, new { npl, nplblk }).ToList(); } images images = new images { id = nplblk, ext = ".png" }; List <images> listImages = new List <images>(); listImages.Add(images); detailsInNode.images = listImages; for (int i = 0; i < detailsInNode.parts.Count; i++) { detailsInNode.parts[i].hotspots = GetHotspots(node_id); } } catch (Exception ex) { string Error = ex.Message; int y = 0; } return(detailsInNode); }
public static imageDTO toimageDto(this images img) { return(new imageDTO() { id = img.id, url = img.url, skuId = img.skuId }); }
public static images RequestToTweet(TweetRequest entity) { var tweet = new images() { TweetId = entity.TweetId, text = entity.Text, media_url = entity.MediaUrl }; return(tweet); }
public static images ToDataModel(TweetRequest entity) { var image = new images { TweetId = entity.TweetId, text = entity.Text, media_url = entity.MediaUrl }; return(image); }
public ActionResult UpravljanjeSlikama(UploadImagesModels uploadImagesModels) { if (uploadImagesModels.ImageFile[0] == null) { TempData["shortMessage"] = "Niste odabrali niti jednu sliku..."; return(RedirectToAction("UpravljanjeSlikama", new { idPoduzeća = User.Identity.GetUserId() })); } else { Random rnd = new Random(); int brojGreski = 0; foreach (HttpPostedFileBase file in uploadImagesModels.ImageFile) { string extension = Path.GetExtension(file.FileName); System.Drawing.Image image = System.Drawing.Image.FromStream(file.InputStream, true, true); int width = image.Width; int height = image.Height; if ((extension == ".png" || extension == ".jpg" || extension == ".bmp" || extension == ".jpeg") && width >= 1080 && width <= 2160 && height >= 800 && height <= 1440) { // } else { brojGreski++; } } if (brojGreski > 0) { TempData["shortMessage"] = "Dopuštene su samo slike .png, .jpg ili .bmp formata i moraju biti minimalno 1080x800 te maksimalno 2160x1440 piksela..."; return(RedirectToAction("UpravljanjeSlikama", new { idPoduzeća = User.Identity.GetUserId() })); } else { foreach (HttpPostedFileBase file in uploadImagesModels.ImageFile) { string folderPath = "~/Images/"; string fileName = Path.GetFileNameWithoutExtension(file.FileName); string extension = Path.GetExtension(file.FileName); fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension; images images = new images { imagePathOnDisk = folderPath + fileName, imageId = DateTime.Now.ToString("yymmssfff") + rnd.Next(1, 100000000).ToString(), imageIdByPoduzeće = User.Identity.GetUserId() }; fileName = Path.Combine(Server.MapPath("~/Images/"), fileName); file.SaveAs(fileName); db.images.Add(images); db.SaveChanges(); } TempData["shortMessage"] = "Slike uspješno uploadane."; return(RedirectToAction("UpravljanjeSlikama", new { idPoduzeća = User.Identity.GetUserId() })); } } }
/// <summary> /// Initializes the ColorfulSchemeRestProperty object from a ColorfulSchemeJsonParser object. /// </summary> /// <param name="json">(ColorfulSchemeJsonParser)object from API call.</param> public ColorfulSchemeRestProperty(object json) { var schemeData = (ColorfulSchemeJsonParser)json; Mode = schemeData.Mode; Count = schemeData.Count; Colors = schemeData.Colors; Seed = schemeData.Seed; Links = new links(schemeData.Links); Images = new images(schemeData.Images); }
public void DeleteImage(long?id) { if (id != null) { images im = db.images.Find(id); if (im != null) { db.images.Remove(im); } } }
// POST: odata/images public async Task <IHttpActionResult> Post(images images) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.images.Add(images); await db.SaveChangesAsync(); return(Created(images)); }
// DELETE: odata/images(5) public async Task <IHttpActionResult> Delete([FromODataUri] int key) { images images = await db.images.FindAsync(key); if (images == null) { return(NotFound()); } db.images.Remove(images); await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
public void AddPicture(images im) { try { images image = new images { imageName = im.imageName, userId = im.userId }; db.images.Add(image); } catch { throw new HttpResponseException(HttpStatusCode.BadRequest); } }
private void control() { int counter = 0; images[] realPixel = new images[16]; images[] shufflePixel = new images[16]; int j = 0; while (j < realPixel.Length) { realPixel[j].pixel = new string[realPictures[j].Width, realPictures[j].Height]; shufflePixel[j].pixel = new string[pictures[j].Width, pictures[j].Height]; j++; } int count = 0; int i = 0; while (i < 16) { int x = 0; while (x < realPictures[i].Width) { int y = 0; while (y < realPictures[i].Height) { realPixel[i].pixel[x, y] = realPictures[i].GetPixel(x, y).Name; //orjinal resmin parçaları shufflePixel[i].pixel[x, y] = pictures[i].GetPixel(x, y).Name; //karışmış resim parçaları if (realPixel[i].pixel[x, y] == shufflePixel[i].pixel[x, y]) { count++; } //parça kontrolü y++; } x++; } if (count == (pictures[i].Width * pictures[i].Height)) { listBox1.Items.Add((i + 1) + ".Buton Resmi Doğru"); Buttons[i].Enabled = false; counter++; } count = 0; i++; } if (counter >= 1) { BtnShuffle.Visible = false; } }
public images PostToDb(images im) { if (im == null) { throw new ArgumentNullException("null"); } images image = new images { imageName = im.imageName, userId = im.userId }; r.AddPicture(image); r.Save(); return(image); }
public ActionResult DeletePicturePoduzeće(string idSlike, string id) { images slika = db.images.Find(idSlike); string putanjaSlike = Server.MapPath(slika.imagePathOnDisk); if (System.IO.File.Exists(putanjaSlike)) { System.IO.File.Delete(putanjaSlike); } db.images.Remove(slika); db.SaveChanges(); return(RedirectToAction("UpravljanjeSlikamaPoduzeće", new { idPoduzeća = id })); }
public void UploadImages(List <HttpPostedFileBase> fileUpload, int IdObject) { if (fileUpload.Count() == 0) { return; } List <HttpPostedFileBase> finalFilesToUpload = fileUpload; foreach (HttpPostedFileBase item in fileUpload) { if (item != null) { //Save phisical File & generate virtual Path var virtualPath = GeneratePhisicalFile(item); images i = null; switch (_definedType) { case UploadImagesEnum.offer: i = new images() { IdOffer = IdObject, ImagePath = virtualPath }; break; case UploadImagesEnum.product: i = new images() { IdProduct = IdObject, ImagePath = virtualPath }; break; case UploadImagesEnum.store: i = new images() { IdStore = IdObject, ImagePath = virtualPath }; break; } //Save Images db.images.Add(i); db.SaveChanges(); } } }
private void AddScreen(mydbContext mydb, posts post) { images img = new images { href = Imgs.Poster, type = "post", posts = post }; mydb.images.Add(img); if (Imgs.Screens != null) { foreach (string item in Imgs.Screens) { img = new images { href = item, type = "screen", posts = post }; mydb.images.Add(img); } } if (Imgs.Views != null) { foreach (string item in Imgs.Views) { img = new images { href = item, type = "view", posts = post }; mydb.images.Add(img); } } mydb.SaveChanges(); }
private void main(object sender, System.EventArgs e) { images img = new images(); C = img.ImagesListColors(@"C:\Users\UnderKo\Downloads\unnamed.jpg"); for (int x = 0; x < img.X; x++) { for (int y = 0; y < img.Y; y++) { draw.AddVector(new Vector(0.0, (double)x, (double)y)); } } double A = new Angle().AngleToRadians(trackBar1.Value); double B = new Angle().AngleToRadians(trackBar2.Value); draw.Ang = new Angle(A, B, 0); draw.DrawPanel = this; draw.Draw3D(C); }
public ActionResult DeletePicture(string idSlike) { string id = User.Identity.GetUserId(); images slika = db.images.Find(idSlike); if (slika.imageIdByPoduzeće != id) { return(View("NeovlašteniPristup")); } else { string putanjaSlike = Server.MapPath(slika.imagePathOnDisk); if (System.IO.File.Exists(putanjaSlike)) { System.IO.File.Delete(putanjaSlike); } db.images.Remove(slika); db.SaveChanges(); return(RedirectToAction("UpravljanjeSlikama", new { idPoduzeća = id })); } }
// PUT: odata/images(5) public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <images> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } images images = await db.images.FindAsync(key); if (images == null) { return(NotFound()); } patch.Put(images); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!imagesExists(key)) { return(NotFound()); } else { throw; } } return(Updated(images)); }
// GET: api/MainImageListHTML/5 public string Get(String Location) { string _retval = ""; clsMainProgram cls = new clsMainProgram(); images<image> imagelist = new images<image>(); imagelist = cls.SearchImagesPerLocation(Location); int i = 0; string clickevent = ""; char kwot = (char)34; char crlf = (char)13; int strLen = 0; int maxTextLenth = 31; _retval += "<table width=" + kwot + "100%" + kwot + " style=" + kwot + "width:100%" + kwot + ">"; foreach (image img in imagelist) { i++; if (i == 1) { clickevent = kwot + "getImgData('" + img.imgGUID + "');" + kwot; strLen = img.title.Length; if (strLen > maxTextLenth) { strLen = maxTextLenth; } _retval += "<tr><td><img class=" + kwot + "imagelist" + kwot + " onmouseover='cursor:pointer' onclick=" + clickevent + " src=" + kwot + "data:image/jpeg;base64," + img.webImageThumbnail240x250Base64Encoded + "" + kwot + " /> <p class=" + kwot + "imagename" + kwot + ">" + img.title.Replace("`", "'").Substring(0,strLen) + "</p></td>" + crlf; } if (i == 2) { clickevent = kwot + "getImgData('" + img.imgGUID + "');" + kwot; strLen = img.title.Length; if (strLen > maxTextLenth) { strLen = maxTextLenth; } _retval += "<td><img class=" + kwot + "imagelist" + kwot + " onmouseover='cursor:pointer' onclick=" + clickevent + " src=" + kwot + "data:image/jpeg;base64," + img.webImageThumbnail240x250Base64Encoded + "" + kwot + " /> <p class=" + kwot + "imagename" + kwot + ">" + img.title.Replace("`", "'").Substring(0, strLen) + "</p></td>" + crlf; } if (i == 3) { clickevent = kwot + "getImgData('" + img.imgGUID + "');" + kwot; strLen = img.title.Length; if (strLen > maxTextLenth) { strLen = maxTextLenth; } _retval += "<td><img class=" + kwot + "imagelist" + kwot + " onmouseover='cursor:pointer' onclick=" + clickevent + " src=" + kwot + "data:image/jpeg;base64," + img.webImageThumbnail240x250Base64Encoded + "" + kwot + " /> <p class=" + kwot + "imagename" + kwot + ">" + img.title.Replace("`", "'").Substring(0, strLen) + "</p></td>" + crlf; } if (i == 4) { clickevent = kwot + "getImgData('" + img.imgGUID + "');" + kwot; strLen = img.title.Length; if (strLen > maxTextLenth) { strLen = maxTextLenth; } _retval += "<td><img class=" + kwot + "imagelist" + kwot + " onmouseover='cursor:pointer' onclick=" + clickevent + " src=" + kwot + "data:image/jpeg;base64," + img.webImageThumbnail240x250Base64Encoded + "" + kwot + " /> <p class=" + kwot + "imagename" + kwot + ">" + img.title.Replace("`", "'").Substring(0, strLen) + "</p></td></tr>" + crlf; i = 0; } //if (i == 1) //{ // clickevent = kwot + "getImgData('" + img.imgGUID + "');" + kwot; // _retval += "<td><table><tr><td><img class=" + kwot + "imagelist" + kwot + " onmouseover='cursor:pointer' onclick=" + clickevent + " src=" + kwot + "data:image/jpeg;base64," + img.webImageThumbnail250x250Base64Encoded + "" + kwot + " /></td></tr><tr><td> <p class=" + kwot + "imagename" + kwot + ">" + img.title.Replace("`", "'") + "</p></td></tr></table></td></tr>" + crlf; // i = 0; //} //else //{ // clickevent = kwot + "getImgData('" + img.imgGUID + "');" + kwot; // _retval += "<tr><td><table><tr><td><img class=" + kwot + "imagelist" + kwot + " onmouseover='cursor:pointer' onclick=" + clickevent + " src=" + kwot + "data:image/jpeg;base64," + img.webImageThumbnail250x250Base64Encoded + "" + kwot + " /></td></tr><tr><td> <p class=" + kwot + "imagename" + kwot + ">" + img.title.Replace("`", "'") + "</p></td></tr></table></td>" + crlf; // i++; //} } _retval += "</table>"; return _retval; }
public static void Mapto3(this images img, imageDTO img1) { img.url = img1.url; img.skuId = img1.skuId; }
public string ChangeCoverImage(string exMainPath, string newMainPath, bool mustRemovePrevious, int idObject) { if (exMainPath == newMainPath) { return(exMainPath); } if (!String.IsNullOrEmpty(newMainPath)) { images exMain = null; IQueryable <images> newMainQuery = null; switch (_definedType) { case UploadImagesEnum.product: exMain = new images() { IdProduct = idObject, ImagePath = exMainPath }; newMainQuery = from i in db.images where i.ImagePath == newMainPath && i.IdProduct == idObject select i; break; case UploadImagesEnum.offer: exMain = new images() { IdOffer = idObject, ImagePath = exMainPath }; newMainQuery = from i in db.images where i.ImagePath == newMainPath && i.IdOffer == idObject select i; break; case UploadImagesEnum.store: exMain = new images() { IdStore = idObject, ImagePath = exMainPath }; newMainQuery = from i in db.images where i.ImagePath == newMainPath && i.IdStore == idObject select i; break; default: break; } if (!mustRemovePrevious && !String.IsNullOrEmpty(exMainPath) && exMain != null) { //the previous main is one more image. db.images.Add(exMain); } if (!String.IsNullOrEmpty(newMainPath)) { var toRemove = newMainQuery.FirstOrDefault(); if (toRemove != null) { db.images.Remove(toRemove); } } db.SaveChanges(); return(newMainPath); } return(null); }
/// <summary> /// Initializes the ColorfulSchemeRestProperty object from a ColorfulSchemeJsonParser object. /// </summary> /// <param name="json">(ColorfulSchemeJsonParser)object from API call.</param> public ColorfulSchemeRestProperty(object json) { var schemeData = (ColorfulSchemeJsonParser)json; Mode = schemeData.Mode; Count = schemeData.Count; Colors = schemeData.Colors; Seed = schemeData.Seed; Links = new links(schemeData.Links); Images = new images(schemeData.Images); }