public void AlbumArtRepositorySelectByIArtNonExistingErrorOnWebRequestTest() { var art = new Art{ ArtId = 1, ArtUrl = "art://art" }; _request = Substitute.For<WebRequest>(); var mockRes = Substitute.For<WebResponse>(); _request.GetResponse().Returns(mockRes); int timesCalled = 0; mockRes.GetResponseStream().Returns( x => { ++timesCalled; throw new Exception(); }); var target = new AlbumArtRepository("art"); var actual = target.SelectBy(art); Assert.That(timesCalled, Is.EqualTo(1)); Assert.That(actual, Is.Not.Null); Assert.That(actual.Count(), Is.EqualTo(0)); }
public ActionResult Create([Bind(Include = "Title,Category_ID,Subject,Price,Location_ID,Size,Medium,Statement,Status,Cover_Pic_Path,Art_Images")] ArtsViewModel model) { if (ModelState.IsValid) { Art item = new Art(); TryUpdateModel(item); var identity = ((ClaimsIdentity)User.Identity); string userid = identity.GetClaimValue(ClaimTypes.NameIdentifier); item.User_ID = userid; item.Status = StatusType.Draft.ToString(); item.Created = DateTime.Now; item.Modified = DateTime.Now; db.Arts.Add(item); db.SaveChanges(); string imagePath = Server.MapPath(Global.ArtImages + string.Format("Art_Cover_{0}_{1}.jpg", item.Art_ID, DateTime.Now.ToString("ddMMyyss"))); item.Cover_Pic_Path = ImageHelper.UploadImage(Request.Files["Cover_Pic_Path"], Global.ArtImages, imagePath, false); db.SaveChanges(); return RedirectToAction("Index"); } return View(model); }
public void AlbumArtRepositoryRemoveNonExistingTest() { Assert.That(File.Exists(Path.Combine("art", "1")), Is.False); var art = new Art{ ArtId = 1 }; var target = new AlbumArtRepository("art"); target.Remove(new AlbumArt { AlbumId = 1 }); Assert.That(File.Exists(Path.Combine("art", "1")), Is.False); }
public void AlbumArtRepositoryRemoveExistingTest() { var fs = File.Open(Path.Combine("art", 1.ToString()), FileMode.Create); fs.Close(); var art = new Art{ ArtId = 1 }; var target = new AlbumArtRepository("art"); target.Remove(new AlbumArt { AlbumId = 1 }); Assert.That(File.Exists(Path.Combine("art", "1")), Is.False); }
private static void Main(string[] args) { int letterWidth = int.Parse(Console.ReadLine()); int letterHeight = int.Parse(Console.ReadLine()); string encodedText = Console.ReadLine(); var fontFamily = new FontFamily(letterWidth, letterHeight); fontFamily.Load(); var asciiArt = new Art(fontFamily); Console.WriteLine(asciiArt.Transform(encodedText)); }
static void Login() { while (true) { var screen = new ConsoleScreen(Art.AsHeader(Title, Art.BitCoin)); screen.AddText("Login to start"); screen.AddBlankLines(); var username = screen.AddInput("User name: ", Validate.AsString()); var password = screen.AddPassword("Password: "******"Login Error", "Username-password combination was not valid."); } }
private bool Compare(int index) { if (m_Compare.ContainsKey(index)) { return(m_Compare[index]); } Bitmap bitorg = Art.GetLand(index); Bitmap bitsec = SecondArt.GetLand(index); if ((bitorg == null) && (bitsec == null)) { m_Compare[index] = true; return(true); } if (((bitorg == null) || (bitsec == null)) || (bitorg.Size != bitsec.Size)) { m_Compare[index] = false; return(false); } byte[] btImage1 = new byte[1]; btImage1 = (byte[])ic.ConvertTo(bitorg, btImage1.GetType()); byte[] btImage2 = new byte[1]; btImage2 = (byte[])ic.ConvertTo(bitsec, btImage2.GetType()); string hash1string = BitConverter.ToString(shaM.ComputeHash(btImage1)); string hash2string = BitConverter.ToString(shaM.ComputeHash(btImage2)); bool res; if (hash1string != hash2string) { res = false; } else { res = true; } m_Compare[index] = res; return(res); }
public EffectSkull(Vector2 position, Color c, Map m) : base(m) { this.position = position; Random rng = new Random(); rotation = (float)(rng.NextDouble() * 2 - 1) * 30f; color = c; skullSprite = new Sprite(Art.Load("Res/skull.png")); spikeMesh = new Mesh(new Vector3[] { new Vector3(-0.5f, 0f, 0f), new Vector3(-0.3f, 0.5f, 0f), new Vector3(0.5f, 0f, 0f), new Vector3(-0.3f, -0.5f, 0f) }); }
public ActionResult GridViewPartialUpdate(Art obj) { if (ModelState.IsValid) { try { // Insert here a code to update the item in your model var artikelLieferbar = unitOfWork.FindObject <ArtikelLieferbar>(CriteriaOperator.Parse("Artikel.Oid==?", obj.Oid)); if (artikelLieferbar != null) { artikelLieferbar.Artikel.Artikeltext1 = obj.Artikeltext1; artikelLieferbar.Artikel.Artikeltext2 = obj.Artikeltext2; artikelLieferbar.Artikel.Artikeltext3 = obj.Artikeltext3; artikelLieferbar.Artikel.Bestand = obj.Bestand; artikelLieferbar.Artikel.Bezeichnung = obj.Bezeichnung; artikelLieferbar.Artikel.Stueckzahl = obj.Stueckzahl; artikelLieferbar.Artikel.Verpackungseinheit = obj.Verpackungseinheit; artikelLieferbar.Artikel.Save(); artikelLieferbar.StueckzahlLieferbar = obj.StueckzahlLieferbar; artikelLieferbar.Save(); unitOfWork.CommitChanges(); } else { ViewData["EditError"] = "Unable to find the artikel"; } } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } var model = GetAll(); return(PartialView("~/Views/Items/_GridViewPartial.cshtml", model)); }
public ItemGump(Item item) { AcceptMouseInput = true; Item = item; X = item.X; Y = item.Y; HighlightOnMouseOver = true; CanPickUp = true; var texture = Art.GetStaticTexture(item.DisplayedGraphic); Texture = texture; Width = texture.Width; Height = texture.Height; Item.Disposed += ItemOnDisposed; WantUpdateSize = false; ShowLabel = true; }
public override bool Draw(SpriteBatchUI spriteBatch, Vector3 position, Vector3?hue = null) { if (Texture == null) { Texture = Art.GetStaticTexture(Item.DisplayedGraphic); Width = Texture.Width; Height = Texture.Height; } Vector3 huev = RenderExtentions.GetHueVector(MouseIsOver && HighlightOnMouseOver ? GameScene.MouseOverItemHue : Item.Hue, TileData.IsPartialHue((long)Item.ItemData.Flags), 0, false); if (Item.Amount > 1 && TileData.IsStackable((long)Item.ItemData.Flags) && Item.DisplayedGraphic == Item.Graphic) { spriteBatch.Draw2D(Texture, new Vector3(position.X - 5, position.Y - 5, 0), huev); } spriteBatch.Draw2D(Texture, position, huev); return(base.Draw(spriteBatch, position, hue)); }
private void OnClickSave(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure? Will take a while", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; Art.Save(FiddlerControls.Options.OutputPath); Cursor.Current = Cursors.Default; MessageBox.Show( String.Format("Saved to {0}", FiddlerControls.Options.OutputPath), "Save", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); Options.ChangedUltimaClass["Art"] = false; } }
public IActionResult AddNewImage(int id, IFormFile ImagePath) { var art = new Art(); Console.WriteLine(ImagePath); art.ImagePath = ImagePath.FileName; art.AlbumId = id; string path = "/images/" + ImagePath.FileName; using (var fileStream = new FileStream(_appEnvironment.WebRootPath + path, FileMode.Create)) { ImagePath.CopyTo(fileStream); } _context.Art.Add(art); _context.SaveChanges(); return(Content("You have create new album: " + ImagePath.FileName)); }
public IActionResult Guardar([FromBody] Art articulo, string Emp) { articulo.CoUsIn = string.IsNullOrEmpty(articulo.CoUsIn) ? "999" : articulo.CoUsIn; articulo.FeUsIn = DateTime.Now; articulo.CoUsMo = string.Empty; articulo.FeUsMo = Convert.ToDateTime("01/01/1900"); articulo.CoUsEl = string.Empty; articulo.FeUsEl = Convert.ToDateTime("01/01/1900"); resultado = metodo.Save(articulo, Emp); if (resultado.Status == "OK") { return(Ok(resultado)); } else { return(BadRequest(resultado)); } }
public void MakeMove() { //clears Planned move if (this.CentredAboveEnemy != 0 && this.OneLineAboveEnemy != 0) { Console.SetCursorPosition(this.CentredAboveEnemy, this.OneLineAboveEnemy); Console.WriteLine($"{new String(' ', this.PlanedMoveChar.Length)}"); } else { //MakeErrorMessage("Enemy indicatior not right"); } //remember player moves then enemy //ADD animations switch (this.PlanedMove.ToLower()) { case "dodge": //this.Dodging = true; System.Diagnostics.Debug.Write("D"); break; case "debuff": //do nothing break; case "move": //this.Position -= 1; not working Animate.ControlableEntityPlace(this.Position, Art.Enemy("blank")); bool spaceInfrontAvalible = true; foreach (Enemy spaceInfrontAvalibleToCheck in MainClass.GameMap.CurrentEnemies) { if (spaceInfrontAvalibleToCheck.Position == this.Position - 1) { spaceInfrontAvalible = false; } } if (MainClass.Player_1.Position != this.Position - 1 && spaceInfrontAvalible) { this.Position -= 1; } else /*System.Diagnostics.Debug.WriteLine("Can't move there player or enemy is there");*/ } { this.RenderEntity(); break;
/// <summary> /// Правило заполнения свойства ARTABCD. /// см. http://mp-ts-nwms/issue/wmsMLC-10817. /// </summary> public static string[] FillArtAbcd(Art art, string wrapperArtAbcd, string artName, ILog log) { if (art == null) { throw new ArgumentNullException("art"); } var messages = new List <string>(); if (string.IsNullOrEmpty(wrapperArtAbcd)) { if (string.IsNullOrEmpty(art.ARTABCD)) { art.ARTABCD = DefaultArtAbcd; } } else { //Проверяем, значение wrapperArtAbcd if (ExistsArtAbcd(wrapperArtAbcd)) { art.ARTABCD = wrapperArtAbcd; } else { var message = string.Format("Не найден ABCD-критерий '{0}' для артикула '{1}'.", wrapperArtAbcd, artName); if (string.IsNullOrEmpty(art.ARTABCD)) { art.ARTABCD = DefaultArtAbcd; message = string.Format("{0} Свойство ABCD-критерий артикула (ARTABCD) будет установлено в значение по-умолчанию '{1}'.", message, DefaultArtAbcd); } else { message = string.Format("{0} Значение свойства ABCD-критерий артикула (ARTABCD) '{1}' не будет изменено.", message, art.ARTABCD); } messages.Add(message); log.Error(message); } } return(messages.ToArray()); }
private void ExportToOffsetClicked(object sender, EventArgs e) { string fileName = Path.Combine(Options.OutputPath, "offset.cfg"); string inputMessage = "Do you want to export all items to offset.cfg?\r\n" + "It may take some time (around 10-20 seconds).\r\n\r\n" + "Export will replace existing file located at: " + fileName + "\r\n\r\nContinue?\r\n"; if (MessageBox.Show(inputMessage, "Export all items to offset.cfg?", MessageBoxButtons.YesNo) == DialogResult.No) { return; } ListView listView = Host.GetItemShowListView(); StringBuilder sb = new StringBuilder(); foreach (ListViewItem item in listView.Items) { int itemId = (int)item.Tag; if (itemId <= -1 || !Art.IsValidStatic(itemId)) { continue; } Art.Measure(Art.GetStatic(itemId), out int xMin, out int yMin, out int xMax, out int yMax); sb.AppendFormat("Item 0x{0:X4}", itemId).AppendLine(); sb.AppendLine("{"); sb.AppendFormat(" xMin {0}", xMin).AppendLine(); sb.AppendFormat(" yMin {0}", yMin).AppendLine(); sb.AppendFormat(" xMax {0}", xMax).AppendLine(); sb.AppendFormat(" yMax {0}", yMax).AppendLine(); sb.AppendLine("}").AppendLine(); } File.WriteAllText(fileName, sb.ToString()); MessageBox.Show("Done!"); }
private AnimDrawable LoadExtraImage(string extraImage, DrawProperties inheritProps) { string animSection = Art.ReadString(extraImage); if (animSection == "") { return(null); } IniFile.IniSection extraRules = OwnerCollection.Rules.GetOrCreateSection(animSection); IniFile.IniSection extraArt = OwnerCollection.Art.GetOrCreateSection(animSection); var anim = new AnimDrawable(extraRules, extraArt); anim.OwnerCollection = OwnerCollection; anim.LoadFromRules(); anim.NewTheater = this.NewTheater; if (extraArt.HasKey("YSortAdjust") || Art.HasKey(extraImage + "YSort") || extraArt.HasKey("ZAdjust") || Art.HasKey(extraImage + "ZAdjust")) { anim.Props.SortIndex = extraArt.ReadInt("YSortAdjust", Art.ReadInt(extraImage + "YSort")) - extraArt.ReadInt("ZAdjust", Art.ReadInt(extraImage + "ZAdjust")); } else { anim.Props.SortIndex = inheritProps.SortIndex; } if (Art.HasKey(extraImage + "X") || Art.HasKey(extraImage + "Y")) { anim.Props.Offset = this.Props.Offset + new Size(Art.ReadInt(extraImage + "X"), Art.ReadInt(extraImage + "Y")); } else { anim.Props.Offset = inheritProps.Offset; } anim.Props.ZAdjust = Art.ReadInt(extraImage + "ZAdjust"); anim.IsBuildingPart = true; anim.Shp = VFS.Open <ShpFile>(anim.GetFilename()); return(anim); }
private bool Compare(int index) { if (_mCompare.ContainsKey(index)) { return(_mCompare[index]); } Bitmap bitorg = Art.GetStatic(index); Bitmap bitsec = SecondArt.GetStatic(index); if (bitorg == null && bitsec == null) { _mCompare[index] = true; return(true); } if (bitorg == null || bitsec == null || bitorg.Size != bitsec.Size) { _mCompare[index] = false; return(false); } byte[] btImage1 = new byte[1]; btImage1 = (byte[])_ic.ConvertTo(bitorg, btImage1.GetType()); byte[] btImage2 = new byte[1]; btImage2 = (byte[])_ic.ConvertTo(bitsec, btImage2.GetType()); byte[] checksum1 = _shaM.ComputeHash(btImage1); byte[] checksum2 = _shaM.ComputeHash(btImage2); bool res = true; for (int j = 0; j < checksum1.Length; ++j) { if (checksum1[j] != checksum2[j]) { res = false; break; } } _mCompare[index] = res; return(res); }
public static Journal asd( ) { var assembly = Assembly.GetExecutingAssembly( ); var stream = assembly.GetManifestResourceStream(@"Our4LegendData.xml"); if (stream == null) { throw new Exception( ); } var Reader = new StreamReader(stream); var Doc = XDocument.Parse(Reader.ReadToEnd( )); var journal = (from Jou in Doc.Descendants("Journal") select new Journal { Name = ( string )Jou.Attribute("Name"), ListOfIssue = from Iss in Jou.Descendants("Issue") select new Issue { Number = ( long )Iss.Attribute("Number"), PublishTime = Convert.ToDateTime(Iss.Attribute("PublishTime")), Price = ( decimal )Iss.Attribute("Price"), ListOfArticle = from Art in Iss.Descendants("Article") select new Article { Title = ( string )Art.Attribute("Title"), Text = ( string )Art.Attribute("Text"), ListOfAuthor = from Aut in Art.Descendants("Author") select new Author { FirstName = ( string )Aut.Attribute("FirstName"), FamilyName = ( string )Aut.Attribute("FamilyName"), EmailAddress = ( string )Aut.Attribute("EmailAddress") } } } }).FirstOrDefault( ); return(journal); }
private void OnClickReplace(object sender, EventArgs e) { if (listView1.SelectedItems.Count != 1) { return; } using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Multiselect = false; dialog.Title = "Choose image file to replace"; dialog.CheckFileExists = true; dialog.Filter = "Image files (*.tif;*.tiff;*.bmp)|*.tif;*.tiff;*.bmp"; if (dialog.ShowDialog() != DialogResult.OK) { return; } Bitmap bmp = new Bitmap(dialog.FileName); if (bmp.Height != 44 || bmp.Width != 44) { MessageBox.Show("Height or Width Invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } if (dialog.FileName.Contains(".bmp")) { bmp = Utils.ConvertBmp(bmp); } int id = (int)listView1.SelectedItems[0].Tag; if (id == -1) { listView1.SelectedItems[0].Tag = id = listView1.SelectedItems[0].Index; } Art.ReplaceLand(id, bmp); ControlEvents.FireLandTileChangeEvent(this, id); listView1.Invalidate(); Options.ChangedUltimaClass["Art"] = true; } }
private void OnClickSave(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure? Will take a while", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (result != DialogResult.Yes) { return; } ProgressBarDialog barDialog = new ProgressBarDialog(Art.GetIdxLength(), "Save"); Cursor.Current = Cursors.WaitCursor; Art.Save(Options.OutputPath); barDialog.Dispose(); Cursor.Current = Cursors.Default; Options.ChangedUltimaClass["Art"] = false; MessageBox.Show($"Saved to {Options.OutputPath}", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); }
private void onTextChangeAdd(object sender, EventArgs e) { int index; if (Utils.ConvertStringToInt(AddTextBox.Text, out index, 0, Art.GetMaxItemID())) { if (Animdata.GetAnimData(index) != null) { AddTextBox.ForeColor = Color.Red; } else { AddTextBox.ForeColor = Color.Black; } } else { AddTextBox.ForeColor = Color.Red; } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { this.edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (this.edSvc != null) { NewStaticArtBrowser staticArtBrowser = new NewStaticArtBrowser(); staticArtBrowser.ItemID = Conversions.ToInteger(value); if (this.edSvc.ShowDialog((Form)staticArtBrowser) == DialogResult.OK) { if (Art.GetStatic(staticArtBrowser.ItemID) != null) { this.ReturnValue = staticArtBrowser.ItemID; staticArtBrowser.Dispose(); return((object)this.ReturnValue); } int num = (int)Interaction.MsgBox((object)"invalid ItemID", MsgBoxStyle.OkOnly, (object)null); } } return(value); }
private void onClickSave(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure? Will take a while", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; Art.Save(AppDomain.CurrentDomain.SetupInformation.ApplicationBase); Cursor.Current = Cursors.Default; Options.ChangedUltimaClass["Art"] = false; MessageBox.Show( String.Format("Saved to {0}", AppDomain.CurrentDomain.SetupInformation.ApplicationBase), "Save", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } }
public async Task <IViewComponentResult> InvokeAsync(Art art) { ApplicationUser user = await GetCurrentUserAsync(); if (user == null) { return(View("DisabledLikeButton", art)); } else { if (user.Id == art.ApplicationUser.Id) { return(View("DisabledLikeButton", art)); } else { return(View("LikableButton", art)); } } }
// GET api/Articles public IEnumerable <Art> GetArticles() { List <Art> listArt = new List <Art>(); var article = db.Article.Include(a => a.category1); foreach (var i in article) { Art art = new Art() { id = i.id, category = i.category1.id, category1 = i.category1.description, title = i.title }; listArt.Add(art); } return(listArt.AsEnumerable()); }
private void DetailSplitContainer_SizeChange(object sender, EventArgs e) { if (listView1.SelectedItems.Count <= 0) { return; } int id = (int)DetailPictureBox.Tag; if (id < 0) { return; } Bitmap bit = Art.GetStatic(id); splitContainer2.SplitterDistance = bit?.Size.Height + 10 ?? 10; DetailPictureBox.Invalidate(); }
private void onTextChangedArt(object sender, EventArgs e) { int index; if (Utils.ConvertStringToInt(TextBoxArt.Text, out index, 0, 0x3FFF)) { if (Art.IsValidStatic(index)) { TextBoxArt.ForeColor = Color.Black; } else { TextBoxArt.ForeColor = Color.Red; } } else { TextBoxArt.ForeColor = Color.Red; } }
// GET api/<controller> public Art Get() { var art = new Art { artId = "1", //唯一标识 artName = "none param", //名字 openId = "", //微信openid picKey = "lipper.jpg", //作品照片七牛key css = "", //css borderId = 7, //borderId signKey = "none param", //签名照片七牛key uploadDate = "1438629864464", //上传时间 score = "1888", //随机分数 scoreComment = "test", //随机分数 commentIdList = "2", //随机评语 dialogIdList = "5,2,6" //随机对话 }; return(art); }
void Start() { int randomArtIndex = Random.RandomRange(0, art.Length); Art randomArt = Instantiate(art[randomArtIndex]) as Art; randomArt.transform.position = transform.position; randomArt.transform.parent = transform; if (randomArt.randomRotation) { if (randomArt.specifyAngles) { int idx = Random.RandomRange(0, randomArt.angles.Length); randomArt.transform.rotation = Quaternion.Euler(new Vector3(0, randomArt.angles[idx], 0)); } else { randomArt.transform.rotation = Quaternion.Euler(new Vector3(0, Random.RandomRange(0, 360), 0)); } } }
private void onTextChangedInsert(object sender, EventArgs e) { int index; if (Utils.ConvertStringToInt(InsertText.Text, out index, 0, 0x3FFF)) { if (Art.IsValidLand(index)) { InsertText.ForeColor = Color.Red; } else { InsertText.ForeColor = Color.Black; } } else { InsertText.ForeColor = Color.Red; } }
private void OnIndexChangedOrg(object sender, EventArgs e) { if (listBoxOrg.SelectedIndex == -1 || listBoxOrg.Items.Count < 1) { return; } int i = int.Parse(listBoxOrg.Items[listBoxOrg.SelectedIndex].ToString()); if (listBoxSec.Items.Count > 0) { listBoxSec.SelectedIndex = listBoxSec.Items.IndexOf(i); } pictureBoxOrg.BackgroundImage = Art.IsValidLand(i) ? Art.GetLand(i) : null; listBoxOrg.Invalidate(); }
private void onTextChangedInsert(object sender, EventArgs e) { int index; if (Utils.ConvertStringToInt(InsertText.Text, out index, 0, Ultima.Art.GetMaxItemID())) { if (Art.IsValidStatic(index)) { InsertText.ForeColor = Color.Red; } else { InsertText.ForeColor = Color.Black; } } else { InsertText.ForeColor = Color.Red; } }
public int SaveArt(Art art) { art.Changed = DateTime.Now; if (art.ID <= 0) { art.ID = ArtList.Any() ? ArtList.Max(i => i.ID) + 1 : 1; art.Created = DateTime.Now; ArtList.Add(art); } else { var index = ArtList.FindIndex(x => x.ID == art.ID); ArtList[index] = art; } ArtList.Where(a => a.GroupId != 100).ToList().SaveToLocalStorage(FILE_ART); ArtList.Where(a => a.GroupId == 100).ToList().Save(FILE_MY_ART); return(art.ID); }
public void Draw(Art art, float x, float y, float width, float height) { DrawInternal(art, x, y, width, height, false, false); }
public ActionResult Edit([Bind(Include = "Art_ID,Title,Category_ID,Subject,Price,Location_ID,Size,Medium,Statement,Created,Modified,Status,Cover_Pic_Path,User_ID")] ArtsViewModel model) { Art item = new Art(); string Oldcoverpicpath = ""; if (ModelState.IsValid) { item = db.Arts.Where(x => x.Art_ID == model.Art_ID).FirstOrDefault(); Oldcoverpicpath = item.Cover_Pic_Path; TryUpdateModel(item); item.Modified = DateTime.Now; if (Request.Files["Cover_Pic_Path"].ContentLength != 0) { string folder = Path.Combine(Server.MapPath(Global.ArtImages), item.Art_ID.ToString()); string path = Path.Combine(folder, string.Format("Art_Cover_{0}_{1}.jpg", item.Art_ID, DateTime.Now.ToString("ddMMyyss"))); item.Cover_Pic_Path = ImageHelper.UploadImage(Request.Files["Cover_Pic_Path"], folder, path, false); } else { item.Cover_Pic_Path = Oldcoverpicpath; } db.SaveChanges(); return RedirectToAction("Index"); } return View(item); }
public bool InsertArt(Art art, bool replace = false) { return this.database.InsertObject<Art>(art, replace ? InsertType.Replace : InsertType.InsertOrIgnore) > 0; }
public void Draw(Art art) { DrawInternal(art, 0, 0, art.Width, art.Height, false, false); }
public bool CreateArt(IPhoto photo, Guid? showId) { bool final = false; var artId = Guid.NewGuid(); var artService = new ArtService(Ioc.GetInstance<IArtRepository>()); var myShowService = new MyShowService(Ioc.GetInstance<IMyShowRepository>()); var spService = new MyShowArtService(Ioc.GetInstance<IMyShowArtRepository>()); var userId = new Guid(Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString()); var myShowId = myShowService.GetMyShow(showId.Value, userId).MyShowId; var date = DateTime.UtcNow; Art p = new Art { CreatedDate = date, UpdatedDate = date, PhotoId = photo.PhotoId, ArtId = artId, Notes = photo.Notes, UserId = photo.UserId, ShowId = showId }; var combinedSuccess = true; bool success = false; var photoService = new PhotoService(Ioc.GetInstance<IPhotoRepository>()); photoService.Save(photo, out success); combinedSuccess = combinedSuccess && success; artService.Save(p, out success); combinedSuccess = combinedSuccess && success; var myShowArt = new MyShowArt { CreatedDate = date, UpdatedDate = date, MyShowId = myShowId, MyShowArtId = Guid.NewGuid(), ArtId = artId }; spService.Save(myShowArt, out success); combinedSuccess = combinedSuccess && success; return combinedSuccess; }
public void Draw(Art art, float x, float y) { DrawInternal(art, x, y, art.Width, art.Height, false, false); }
public void AlbumArtRepositorySelectByIArtExistingTest() { var fs = File.Open(Path.Combine("art", 1.ToString()), FileMode.Create); fs.Close(); var art = new Art{ ArtId = 1 }; var target = new AlbumArtRepository("art"); var actual = target.SelectBy(art).FirstOrDefault(); Assert.That(actual, Is.Not.Null); Assert.That(actual.AlbumId, Is.EqualTo(1)); Assert.That(actual.ArtStream.Length, Is.EqualTo(0)); // the empty file i just wrote }
public void Draw(Art art, Vector2 pos) { DrawInternal(art, pos.X, pos.Y, art.Width, art.Height, false, false); }
public void DrawFlipped(Art art, bool xflip, bool yflip) { DrawInternal(art, 0, 0, art.Width, art.Height, xflip, yflip); }
public void AlbumArtRepositorySelectByIArtNonExistingTest() { var art = new Art{ ArtId = 1, ArtUrl = "art://art" }; _request = Substitute.For<WebRequest>(); var mockRes = Substitute.For<WebResponse>(); _request.GetResponse().Returns(mockRes); var stream = new MemoryStream(); stream.WriteByte(0x34); stream.WriteByte(0x34); stream.Position = 0; mockRes.GetResponseStream().Returns(stream); var target = new AlbumArtRepository("art"); var actual = target.SelectBy(art).FirstOrDefault(); Assert.That(actual, Is.Not.Null); Assert.That(actual.AlbumId, Is.EqualTo(1)); Assert.That(actual.ArtStream.Length, Is.EqualTo(2)); // the empty file i just wrote }
unsafe void DrawInternal(Art art, float x, float y, float w, float h, bool fx, bool fy) { }