public int UpdateImageView(ImageViewObject imageView) { try { if (imageView == null) { return(-2); } var duplicates = _repository.Count(m => m.Name.Trim().ToLower() == imageView.Name.Trim().ToLower() && (m.ImageViewId != imageView.ImageViewId)); if (duplicates > 0) { return(-3); } var imageViewEntity = ModelCrossMapper.Map <ImageViewObject, ImageView>(imageView); if (imageViewEntity == null || imageViewEntity.ImageViewId < 1) { return(-2); } _repository.Update(imageViewEntity); _uoWork.SaveChanges(); return(5); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(-2); } }
public long AddImageView(ImageViewObject imageView) { try { if (imageView == null) { return(-2); } var duplicates = _repository.Count(m => m.Name.Trim().ToLower() == imageView.Name.Trim().ToLower() && (m.ImageViewId != imageView.ImageViewId)); if (duplicates > 0) { return(-3); } var imageViewEntity = ModelCrossMapper.Map <ImageViewObject, ImageView>(imageView); if (imageViewEntity == null || string.IsNullOrEmpty(imageViewEntity.Name)) { return(-2); } var returnStatus = _repository.Add(imageViewEntity); _uoWork.SaveChanges(); return(returnStatus.ImageViewId); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
protected override void OnDataInitialize(VisualObject vObject) { ImageViewObject imageViewObject = vObject as ImageViewObject; if (imageViewObject == null || (!((ResourceData)this.FileData != (ResourceData)null) || imageViewObject.FileData.GetResourceData().Type == this.FileData.Type)) { return; } imageViewObject.FileData = (ResourceFile)null; }
public ActionResult EditImageView(ImageViewObject imageView) { var gVal = new GenericValidator(); try { if (ModelState.IsValid) { var valStatus = ValidateImageView(imageView); if (valStatus.Code < 1) { gVal.Code = -1; gVal.Error = valStatus.Error; return(Json(gVal, JsonRequestBehavior.AllowGet)); } if (Session["_imageView"] == null) { gVal.Code = -5; gVal.Error = message_Feedback.Session_Time_Out; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var oldImageView = Session["_imageView"] as ImageViewObject; if (oldImageView == null || oldImageView.ImageViewId < 1) { gVal.Code = -5; gVal.Error = message_Feedback.Session_Time_Out; return(Json(gVal, JsonRequestBehavior.AllowGet)); } oldImageView.Name = imageView.Name.Trim(); var k = new ImageViewServices().UpdateImageView(oldImageView); if (k < 1) { gVal.Error = k == -3 ? message_Feedback.Item_Duplicate : message_Feedback.Update_Failure; gVal.Code = 0; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = k; gVal.Error = message_Feedback.Model_State_Error; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = -5; gVal.Error = message_Feedback.Model_State_Error; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch { gVal.Code = 0; gVal.Error = message_Feedback.Process_Failed; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public int UpdateImageView(ImageViewObject imageView) { try { return(_imageViewRepository.UpdateImageView(imageView)); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(-2); } }
public long AddImageView(ImageViewObject imageViewAccount) { try { return(_imageViewRepository.AddImageView(imageViewAccount)); } catch (Exception ex) { ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
protected override void OnDataInitialize(VisualObject vObject) { ImageViewObject imageViewObject = vObject as ImageViewObject; if (imageViewObject != null) { if (this.FileData != null && imageViewObject.FileData.GetResourceData().Type != this.FileData.Type) { imageViewObject.FileData = null; } } }
private GenericValidator ValidateImageView(ImageViewObject imageView) { var gVal = new GenericValidator(); if (imageView == null) { gVal.Code = -1; gVal.Error = message_Feedback.Fatal_Error; return(gVal); } if (string.IsNullOrEmpty(imageView.Name)) { gVal.Code = -1; gVal.Error = message_Feedback.ImageView_Name_Error; return(gVal); } gVal.Code = 5; return(gVal); }
public ActionResult AddImageView(ImageViewObject imageView) { var gVal = new GenericValidator(); try { if (ModelState.IsValid) { var valStatus = ValidateImageView(imageView); if (valStatus.Code < 1) { gVal.Code = -1; gVal.Error = valStatus.Error; return(Json(gVal, JsonRequestBehavior.AllowGet)); } var k = new ImageViewServices().AddImageView(imageView); if (k < 1) { gVal.Error = k == -3 ? message_Feedback.Item_Duplicate : message_Feedback.Insertion_Failure; gVal.Code = 0; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = k; gVal.Error = message_Feedback.Insertion_Success; return(Json(gVal, JsonRequestBehavior.AllowGet)); } gVal.Code = -5; gVal.Error = message_Feedback.Model_State_Error; return(Json(gVal, JsonRequestBehavior.AllowGet)); } catch { gVal.Code = 0; gVal.Error = message_Feedback.Process_Failed; return(Json(gVal, JsonRequestBehavior.AllowGet)); } }
public IEnumerator FixedParamBinderUpdatePasses() { yield return(null); var image = ImageViewObject.Create(); ////@@ Packages/com.tositeru.hinode/Editor/Assets/MVC/Views/ImageViewObject/TestFixedParamBinderPasses.asset {//Color var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.Color = Color.red; paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.Color, image.Image.color); } {//FillAmount var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.FillAmount = 0.75f; paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.FillAmount, image.Image.fillAmount); } {//FillCenter var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.FillCenter = true; paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.FillCenter, image.Image.fillCenter); } {//FillClockwise var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.FillClockwise = true; paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.FillClockwise, image.Image.fillClockwise); } {//FillMethod var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.FillMethod = Image.FillMethod.Radial180; paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.FillMethod, image.Image.fillMethod); } {//FillOrigin var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.FillOrigin = 3; paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.FillOrigin, image.Image.fillOrigin); } {//PixelsPerUnitMultiplier var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.PixelsPerUnitMultiplier = 1.2f; paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.PixelsPerUnitMultiplier, image.Image.pixelsPerUnitMultiplier); } {//PreserveAspect var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.PreserveAspect = true; paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.PreserveAspect, image.Image.preserveAspect); } {//Sprite var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.Sprite = Sprite.Create(Texture2D.whiteTexture, new Rect(0, 0, 4, 4), Vector2.zero); paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.Sprite, image.Image.sprite); } {//Type var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.Type = Image.Type.Sliced; paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.Type, image.Image.type); } {//UseSpriteMesh var paramBinder = new ImageViewObject.FixedParamBinder(); paramBinder.UseSpriteMesh = true; paramBinder.Update(null, image); yield return(null); Assert.AreEqual(paramBinder.UseSpriteMesh, image.Image.useSpriteMesh); } ////-- Finish Packages/com.tositeru.hinode/Editor/Assets/MVC/Views/ImageViewObject/TestFixedParamBinderPasses.asset }