public ActionResult Edit(AccountVM.EditUserViewModel user, HttpPostedFileBase file) { if (ModelState.IsValid) { UserDTO userDTO = new UserDTO(); userDTO.Email = User.Identity.GetUserName(); userDTO.DisplayName = user.DisplayName; if (file == null) { if (ConvertString.ConvertToBool(_iapiResponse.Put <UserDTO>("users", userDTO))) { return(RedirectToAction("Index", "Home")); } } else if (file != null && ImageFunction.IsImage(file.InputStream)) { Image resizeImage = ImageFunction.ScaleImage(Image.FromStream(file.InputStream), 200, 200); userDTO.ImageUser = ImageFunction.imageToByteArray(resizeImage); if (ConvertString.ConvertToBool(_iapiResponse.Put <UserDTO>("users", userDTO))) { return(RedirectToAction("Index", "Home")); } } else { ModelState.AddModelError("", "Image is not correct file format"); return(View(user)); } } return(View(user)); }
private void SaveC(object obj) { BitmapSource save = ImageConverterFormat.ConvertToBitmapSource(this.Collage); Bitmap collageImage = (Bitmap)ImageConverterFormat.GetBitmapFromSource(save).Clone(); ImageFunction.SaveAsCurrentImage(collageImage); }
public ActionResult Create([Bind(Prefix = "post")] PostVM.PostCreateVM post, HttpPostedFileBase file) { if (ModelState.IsValid) { post.Email = User.Identity.GetUserName(); PostDTO postDTO = new PostDTO(); postDTO = _imapper.Map <PostVM.PostCreateVM, PostDTO>(post); if (file == null) { if (ConvertString.ConvertToBool(_iapiResponse.Post <PostDTO>("posts", postDTO))) { return(RedirectToAction("Index", "Home")); } } else if (file != null && ImageFunction.IsImage(file.InputStream)) { Image resizeImage = ImageFunction.ScaleImage(Image.FromStream(file.InputStream), (int)StatusCode.MAX_WIDTH, (int)StatusCode.MAX_HEIGHT); postDTO.Image = ImageFunction.imageToByteArray(resizeImage); if (ConvertString.ConvertToBool(_iapiResponse.Post <PostDTO>("posts", postDTO))) { return(RedirectToAction("Index", "Home")); } } else { ModelState.AddModelError("", "Image is not correct file format"); return(View(post)); } } ModelState.AddModelError("", "Can't upload your post"); return(View(post)); }
private void SaveThisC(object obj) { if (this.BaseImage != null) { ImageFunction.SaveAsCurrentImage(ImageConverterFormat.BitmapImageToBitmap(this.BaseImage)); } }
public void PasteC(object obj) { if (VisibilityProperties.Instance.FrameVisibility == true) { System.Windows.MessageBox.Show(Language.CurrentLanguage[95]); } else { VisibilityProperties.Instance.ImageCursor = System.Windows.Input.Cursors.Arrow; VisibilityProperties.Instance.SelectRectangleVisibility = false; VisibilityProperties.Instance.NotifyProperties(); var data = System.Windows.Forms.Clipboard.GetImage(); if (data != null) { if (Images.Instance.CurrentBitmap != null) { VisibilityProperties.Instance.PastePanelVisibility = true; VisibilityProperties.Instance.NotifyProperties(); Images.Instance.PasteBitmap = (Bitmap)ImageFunction.SetClipboardImageToBitmap().Clone(); Images.Instance.NotifyImages(); } else if (Images.Instance.CurrentBitmap == null) { Images.Instance.CurrentBitmap = (Bitmap)ImageFunction.SetClipboardImageToBitmap().Clone(); Images.Instance.NotifyImages(); } } } }
private void SaveAsImage(object obj) { if (Images.Instance.CurrentBitmap != null) { Images.Instance.DrawFrame(); ImageFunction.SaveAsCurrentImage(Images.Instance.CurrentBitmap); } }
/// <summary> /// Renders the single pixel of an image (using required super-sampling). /// </summary> /// <param name="x">Horizontal coordinate.</param> /// <param name="y">Vertical coordinate.</param> /// <param name="color">Computed pixel color.</param> public override void RenderPixel(int x, int y, double[] color) { Debug.Assert(color != null); Debug.Assert(MT.rnd != null); // !!!{{ TODO: this is exactly the code inherited from static sampling - make it adaptive! int bands = color.Length; int b; Array.Clear(color, 0, bands); double[] tmp = new double[bands]; int i, j; double step = 1.0 / superXY; double amplitude = Jittering * step; double origin = 0.5 * (step - amplitude); double x0, y0; MT.StartPixel(x, y, Supersampling); for (j = 0, y0 = y + origin; j++ < superXY; y0 += step) { for (i = 0, x0 = x + origin; i++ < superXY; x0 += step) { ImageFunction.GetSample(x0 + amplitude * MT.rnd.UniformNumber(), y0 + amplitude * MT.rnd.UniformNumber(), tmp); MT.NextSample(); for (b = 0; b < bands; b++) { color[b] += tmp[b]; } } } double mul = step / superXY; if (Gamma > 0.001) { // gamma-encoding and clamping double g = 1.0 / Gamma; for (b = 0; b < bands; b++) { color[b] = Arith.Clamp(Math.Pow(color[b] * mul, g), 0.0, 1.0); } } else { // no gamma, no clamping (for HDRI) for (b = 0; b < bands; b++) { color[b] *= mul; } } // !!!}} }
public void ApplyR(object obj) { if (ResizeHorizontal != 100 || ResizeVertival != 100 || SkewVertical != 0 || SkewHorizontal != 0) { Images.Instance.CurrentBitmap = ImageFunction.ResizeBitmap(Images.Instance.CurrentBitmap, (int)ResizeHorizontal, (int)ResizeVertival); Images.Instance.CurrentBitmap = ImageFunction.Skew(Images.Instance.CurrentBitmap, (int)SkewHorizontal, (int)SkewVertical); Images.Instance.NotifyImages(); } }
/// <summary> /// Show library /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Library_Open(object sender, RoutedEventArgs e) { Library lib; lib = new Library(); lib.DataContext = this.DataContext; lib.SetContent(ImageFunction.CreateListFromTwoStackAndBitmap(UndoRedoModel.Instance.UndoStack, UndoRedoModel.Instance.RedoStack, Images.Instance.CurrentBitmap)); lib.ShowDialog(); }
/// <summary> /// Draw frame to bitmap /// </summary> public void DrawFrame() { if (Images.Instance.Frame != null) { Bitmap f = ImageFunction.DrawFrameToBitmap(Images.Instance.CurrentBitmap, Images.Instance.Frame.Frame); Images.Instance.CurrentBitmap = (Bitmap)f.Clone(); Images.Instance.NotifyImages(); ChangeSum--; } }
public void CutC(object obj) { if (Images.Instance.SelectedBitmap != null) { System.Windows.Forms.Clipboard.SetImage(Images.Instance.SelectedBitmap); Images.Instance.CurrentBitmap = (Bitmap)ImageFunction.Clear_Selected_Area(Images.Instance.CurrentBitmap).Clone(); Images.Instance.SelectedBitmap = null; Images.Instance.NotifyImages(); VisibilityProperties.Instance.SelectRectangleVisibility = false; VisibilityProperties.Instance.NotifyProperties(); } }
public ActionResult Edit() { UserDTO userDTO = _iapiResponse.Get <UserDTO>("users?value=" + User.Identity.GetUserName()); AccountVM.EditUserViewModel userVM = new AccountVM.EditUserViewModel(); userVM.DisplayName = userDTO.DisplayName; userVM.ImageUser = ImageFunction.ConvertImage(userDTO.ImageUser); if (userDTO == null) { return(HttpNotFound()); } return(View(userVM)); }
private void OpenImage(object obj) { Bitmap a = (Bitmap)ImageFunction.OpenNewQuestion().Clone(); Images.Instance.CurrentBitmap = ImageFunction.OpenImage(); Images.Instance.OriginalBitmap = Images.Instance.CurrentBitmap; Images.Instance.Frame = null; VisibilityProperties.Instance.FrameVisibility = false; Images.Instance.NotifyImages(); UndoRedoModel.Instance.RedoStack.Clear(); UndoRedoModel.Instance.UndoStack.Clear(); Images.Instance.UndoBr = 0; }
public MainWindow() { InitializeComponent(); this.Closed += new System.EventHandler(WindowClose); Bitmap a = ImageFunction.NewImage(); a.SetPixel(0, 0, a.GetPixel(0, 0)); Images.Instance.CurrentBitmap = a; Images.Instance.NotifyImages(); StreamWriter writer = new StreamWriter("../../Resources/WindowColor.txt", false); writer.Write(6); writer.Close(); }
private List <CommentDTO> MappingComment(List <Comment> listComment) { List <CommentDTO> listCommentDto = new List <CommentDTO>(); foreach (Comment comment in listComment) { CommentDTO commentDto = Mapper.Map <Comment, CommentDTO>(comment); commentDto.DisplayName = comment.User.DisplayName; commentDto.ImageUser = ImageFunction.ConvertImage(comment.User.ImageUser); commentDto.Email = comment.User.Email; listCommentDto.Add(commentDto); } return(listCommentDto); }
/// <summary> /// Calculate start capture rectangle point /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CanvasMouseUp(object sender, MouseButtonEventArgs e) { if (CaptureCan.IsMouseCaptured) { CaptureCan.ReleaseMouseCapture(); } rectangle.Stroke = System.Windows.Media.Brushes.Red; rectangle.StrokeThickness = 2; captureHeight = (int)rectangle.ActualHeight; captureWidth = (int)rectangle.ActualWidth; System.Windows.Point up = new System.Windows.Point(); up = e.GetPosition(CaptureWin); startCapturePoint = ImageFunction.StartPointCalculate(up, startCapturePoint); }
/// <summary> /// Renders the single pixel of an image. /// </summary> /// <param name="x">Horizontal coordinate.</param> /// <param name="y">Vertical coordinate.</param> /// <param name="color">Computed pixel color.</param> /// <param name="rnd">Shared random generator.</param> public override void RenderPixel(int x, int y, double[] color, RandomJames rnd) { Debug.Assert(color != null); Debug.Assert(rnd != null); int bands = color.Length; int b; Array.Clear(color, 0, bands); double[] tmp = new double[bands]; int i, j, ord; double step = 1.0 / superXY; double amplitude = Jittering * step; double origin = 0.5 * (step - amplitude); double x0, y0; for (j = ord = 0, y0 = y + origin; j++ < superXY; y0 += step) { for (i = 0, x0 = x + origin; i++ < superXY; x0 += step) { ImageFunction.GetSample(x0 + amplitude * rnd.UniformNumber(), y0 + amplitude * rnd.UniformNumber(), ord++, Supersampling, rnd, tmp); for (b = 0; b < bands; b++) { color[b] += tmp[b]; } } } double mul = step / superXY; if (Gamma > 0.001) { // gamma-encoding and clamping double g = 1.0 / Gamma; for (b = 0; b < bands; b++) { color[b] = Arith.Clamp(Math.Pow(color[b] * mul, g), 0.0, 1.0); } } else // no gamma, no clamping (for HDRI) { for (b = 0; b < bands; b++) { color[b] *= mul; } } }
/// <summary> /// Renders the single pixel of an image. /// </summary> /// <param name="x">Horizontal coordinate.</param> /// <param name="y">Vertical coordinate.</param> /// <param name="color">Computed pixel color.</param> /// <param name="rnd">Shared random generator.</param> public virtual void RenderPixel(int x, int y, double[] color, RandomJames rnd) { ImageFunction.GetSample(x + 0.5, y + 0.5, color); // gamma-encoding: if (Gamma > 0.001) { // gamma-encoding and clamping double g = 1.0 / Gamma; for (int b = 0; b < color.Length; b++) { color[b] = Arith.Clamp(Math.Pow(color[b], g), 0.0, 1.0); } } // else: no gamma, no clamping (for HDRI) }
public void SaveImage(object obj) { if (Images.Instance.CurrentBitmap != null) { Images.Instance.DrawFrame(); if (Images.Instance.BitmapPath != null) { ImageFunction.SaveCurrentImage(Images.Instance.CurrentBitmap, Images.Instance.BitmapPath); } else { SaveAsImage(obj); } } }
/// <summary> /// Copy capture rectangle to bitmap /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Capture_Click(object sender, RoutedEventArgs e) { this.Hide(); if (this.captureHeight > 0 && this.captureWidth > 0) { Images.Instance.CurrentBitmap = ImageFunction.Capture(this.captureWidth, this.captureHeight, this.startCapturePoint); Images.Instance.NotifyImages(); rectangle.Visibility = Visibility.Hidden; VisibilityProperties.Instance.NewListBorder = false; VisibilityProperties.Instance.NotifyProperties(); UndoRedoModel.Instance.UndoStack = new Stack <System.Drawing.Bitmap>(); UndoRedoModel.Instance.RedoStack = new Stack <System.Drawing.Bitmap>(); Images.Instance.UndoBr = 0; } this.Close(); }
private void FlipV(object obj) { if (VisibilityProperties.Instance.FrameVisibility == true) { System.Windows.MessageBox.Show(Language.CurrentLanguage[95]); } else { if (Images.Instance.CurrentBitmap != null) { Bitmap a = (Bitmap)Images.Instance.CurrentBitmap.Clone(); Images.Instance.CurrentBitmap = ImageFunction.RotateFlip(RotateFlipType.Rotate180FlipY, a); Images.Instance.NotifyImages(); } } }
private void SetNewList(object obj) { Bitmap a = (Bitmap)ImageFunction.NewQuestion().Clone(); Images.Instance.Frame = null; VisibilityProperties.Instance.FrameVisibility = false; Images.Instance.OriginalBitmap = Images.Instance.CurrentBitmap; Images.Instance.BitmapPath = null; Images.Instance.CurrentBitmap = (Bitmap)a.Clone(); Images.Instance.NotifyImages(); VisibilityProperties.Instance.NewListBorder = true; VisibilityProperties.Instance.SelectRectangleVisibility = false; VisibilityProperties.Instance.NotifyProperties(); UndoRedoModel.Instance.RedoStack = new Stack <Bitmap>(); UndoRedoModel.Instance.UndoStack = new Stack <Bitmap>(); Images.Instance.UndoBr = 0; }
public WebMappingProfile() { CreateMap <AccountVM.RegisterViewModel, UserDTO>().ReverseMap(); CreateMap <UserDTO, AccountVM.RegisterViewModel>().ReverseMap(); CreateMap <AccountVM.LoginViewModel, UserDTO>().ReverseMap(); CreateMap <UserDTO, AccountVM.LoginViewModel>().ReverseMap(); CreateMap <PostVM.PostCreateVM, PostDTO>() .ForMember(d => d.ID, opt => opt.MapFrom(s => s.PostId)) .ReverseMap(); CreateMap <PostDTO, PostVM.PostCreateVM>() .ForMember(d => d.PostId, opt => opt.MapFrom(s => s.ID)) .ForMember(d => d.RowVersion, opt => opt.MapFrom(s => s.RowVersion)) .ReverseMap(); CreateMap <CommentVM, CommentDTO>().ReverseMap(); CreateMap <CommentDTO, CommentVM>() .ForMember(d => d.ImageUser, opt => opt.MapFrom(s => s.ImageUser)) .ReverseMap(); CreateMap <PostDTO, PostVM.PostDetailVM>() .ForMember(d => d.PostId, opt => opt.MapFrom(s => s.ID)) .ForMember(d => d.Image, opt => opt.MapFrom(s => ImageFunction.ConvertImage(s.Image))) .ForMember(d => d.ListComment, opt => opt.MapFrom(s => s.ListCommentDTO)) .ForMember(d => d.ListTag, opt => opt.MapFrom(s => s.ListTagDTO)) .ReverseMap(); CreateMap <PostDTO, PostVM.PostIndexVM>() .ForMember(d => d.PostId, opt => opt.MapFrom(s => s.ID)) .ForMember(d => d.Image, opt => opt.MapFrom(s => ImageFunction.ConvertImage(s.Image))) .ForMember(d => d.ImageUser, opt => opt.MapFrom(s => ImageFunction.ConvertImage(s.ImageUser))) .ForMember(d => d.ListTag, opt => opt.MapFrom(s => s.ListTagDTO)) .ForMember(d => d.UserId, opt => opt.MapFrom(s => s.UserId)) .ForMember(d => d.Email, opt => opt.MapFrom(s => s.Email)) .ReverseMap(); CreateMap <TagVM, TagDTO>().ReverseMap(); CreateMap <TagDTO, TagVM>() .ForMember(d => d.TagId, opt => opt.MapFrom(s => s.TagId)) .ForMember(d => d.Name, opt => opt.MapFrom(s => s.NameTag)) .ReverseMap(); //CreateMap<PostVM.PostCreateVM, PostDTO>().ReverseMap(); //CreateMap<PostDTO, PostVM.PostCreateVM>().ReverseMap(); }
public ActionResult Edit([Bind(Prefix = "post")] PostVM.PostCreateVM post, HttpPostedFileBase file) { int result = 0; if (ModelState.IsValid) { post.Email = User.Identity.GetUserName(); PostDTO postDTO = new PostDTO(); postDTO = _imapper.Map <PostVM.PostCreateVM, PostDTO>(post); if (file == null) { postDTO.Image = post.Image; result = ConvertString.ConvertToInt(_iapiResponse.Put <PostDTO>("posts", postDTO)).GetValueOrDefault(); if (result == (int)StatusCode.SUCCESS) { return(RedirectToAction("Details", "Posts", new { id = post.PostId, slug = TempData["SlugPost"] })); } } else if (file != null && ImageFunction.IsImage(file.InputStream)) { Image resizeImage = ImageFunction.ScaleImage(Image.FromStream(file.InputStream), (int)StatusCode.MAX_WIDTH, (int)StatusCode.MAX_HEIGHT); postDTO.Image = ImageFunction.imageToByteArray(resizeImage); result = ConvertString.ConvertToInt(_iapiResponse.Put <PostDTO>("posts", postDTO)).GetValueOrDefault(); if (result == (int)StatusCode.SUCCESS) { return(RedirectToAction("Details", "Posts", new { id = post.PostId, slug = TempData["SlugPost"] })); } } else { ModelState.AddModelError("", "Image is not correct file format"); return(View(post)); } if (result == (int)StatusCode.TITLEWASCHANGED || result == (int)StatusCode.CONTENTWASCHANGED || result == (int)StatusCode.TAGWASCHANGED) { ModelState.AddModelError("", "You need back to home page and refresh page again to edit"); return(View(post)); } } ModelState.AddModelError("", "Can't upload your post"); return(View(post)); }
public ActionResult Create([Bind(Include = "PostId,CommentContent")] CommentVM comment) { string url = TempData["Url"] as string; if (ModelState.IsValid) { CommentDTO commentDTO = _imapper.Map <CommentVM, CommentDTO>(comment); commentDTO.Email = User.Identity.GetUserName(); int? result = ConvertString.ConvertToInt(_iapiResponse.Post <CommentDTO>("comments", commentDTO)); UserDTO user = _iapiResponse.Get <UserDTO>("users?value=" + User.Identity.GetUserName()); comment.DisplayName = user.DisplayName; comment.CreateDate = DateTime.Now; comment.ImageUser = ImageFunction.ConvertImage(user.ImageUser); if (result == null) { ModelState.AddModelError("", "Can not sent your comment"); } return(PartialView("_CommentsPartial", comment)); } return(RedirectToAction("Details", "Posts", new { id = comment.PostId, slug = url })); }
private void ChangeRoundedCornersC(object obj) { Bitmap bmp = null; try { bmp = (Bitmap)this.Temporary.Clone(); } catch { } if (bmp != null) { bmp = ImageFunction.MakeRoundedCorners(bmp, roundercornersvalue); contrastFilter.ApplyInPlace(bmp); } Images.Instance.CurrentBitmap = bmp; Images.Instance.NotifyImages(); try { UndoRedoModel.Instance.UndoStack.Pop(); Images.Instance.UndoBr--; } catch { } }
private void CanvasMouseUp(object sender, MouseButtonEventArgs e) { if (VisibilityProperties.Instance.SelectCanvasVisibility == true && Images.Instance.CurrentBitmap != null) { if (SelectionCanvas.IsMouseCaptured) { SelectionCanvas.ReleaseMouseCapture(); } double x = 0; double y = 0; SelectedPoints.PointUp = e.GetPosition(ImageOp); if (SelectedPoints.PointUp.X >= 0) { x = SelectedPoints.PointUp.X; } else if (SelectedPoints.PointUp.X < 0) { x = 0; } if (SelectedPoints.PointUp.Y >= 0) { y = SelectedPoints.PointUp.Y; } else if (SelectedPoints.PointUp.Y < 0) { y = 0; } SelectedPoints.PointUp = new System.Windows.Point(x, y); rectangle.Stroke = System.Windows.Media.Brushes.Blue; rectangle.StrokeThickness = 2; if (index == 1 && rectangle.ActualHeight > 0 && rectangle.ActualWidth > 0) { ImageFunction.CopySelectedAreaToBitmap((int)rectangle.ActualWidth, (int)rectangle.ActualHeight, SelectedPoints.PointUp, SelectedPoints.PointDown); } index = 0; } }
private void BuildCard(Func.RecordSet rsData) { try { //oSheet2.get_Range("A1:B6",Missing.Value).Copy(Type.Missing); int rowSet1 = 2, colSet1 = 2, rowSet2 = 7, colSet2 = 3; for (int x = 1; x < rsData.rows + 1; x++) { //copy and paste oSheet2.get_Range("A1:B6", Missing.Value).Copy(oSheet.get_Range(oSheet.Cells[rowSet1, colSet1], oSheet.Cells[rowSet2, colSet2])); //set value to card BuildFooter(rowSet1 + 2, colSet1, colSet1, rsData.record(x - 1, 0)); // ten nv BuildFooter(rowSet1 + 3, colSet2, colSet2, rsData.record(x - 1, 1)); // ma nv BuildFooter(rowSet1 + 4, colSet2, colSet2, rsData.record(x - 1, 2)); // bo phan BuildFooter(rowSet1 + 5, colSet2, colSet2, rsData.record(x - 1, 3)); // chuc vu //set image object bimap = ImageFunction.LoadImageObjectFromSQL(string.Format("Select PIC_DR from FILB01AB where EMP_ID=N'{0}'", rsData.record(x - 1, 1))); if (bimap != null) { Bitmap bi = (Bitmap)bimap; Excel.Range r = oSheet.get_Range(oSheet.Cells[rowSet1 + 1, colSet2], oSheet.Cells[rowSet1 + 1, colSet2]); System.Windows.Forms.Clipboard.SetDataObject(bi, false); oSheet.Paste(r, bi); for (int y = 1; y < oSheet.Shapes.Count + 1; y++) { oSheet.Shapes.Item(y).LockAspectRatio = Microsoft.Office.Core.MsoTriState.msoFalse; oSheet.Shapes.Item(y).Width = 80; oSheet.Shapes.Item(y).Height = 103; } } rowSet1 = rowSet1; colSet1 += 3; rowSet2 = rowSet2; colSet2 += 3; if (x % 3 == 0) // x chia het cho 3 { rowSet1 += 7; //xuong dong` 1 card colSet1 = 2; rowSet2 += 7; colSet2 = 3; } if (x % 9 == 0) // x chia het cho 9 => break page { rowSet1 += 6; rowSet2 += 6; } //change row height oSheet.get_Range(oSheet.Cells[rowSet1, colSet1], oSheet.Cells[rowSet1, colSet1]).RowHeight = 43.5; oSheet.get_Range(oSheet.Cells[rowSet1 + 1, colSet1], oSheet.Cells[rowSet1 + 1, colSet1]).RowHeight = 42; oSheet.get_Range(oSheet.Cells[rowSet1 + 2, colSet1], oSheet.Cells[rowSet1 + 2, colSet1]).RowHeight = 61.5; oSheet.get_Range(oSheet.Cells[rowSet1 + 3, colSet1], oSheet.Cells[rowSet1 + 3, colSet1]).RowHeight = 33; oSheet.get_Range(oSheet.Cells[rowSet1 + 4, colSet1], oSheet.Cells[rowSet1 + 4, colSet1]).RowHeight = 33; oSheet.get_Range(oSheet.Cells[rowSet1 + 5, colSet1], oSheet.Cells[rowSet1 + 5, colSet1]).RowHeight = 33; } oSheet2.Application.DisplayAlerts = false; oSheet2.Delete(); //oSheet2.Application.DisplayAlerts = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void upload() { string [] f1 = Directory.GetFiles(textBox1.Text, "*.jpg"); //lb.Items.AddRange(f1); for (int i = 0; i < f1.Length; i++) { try { System.IO.FileInfo a = new FileInfo(f1[i]); if (PublicFunction.CUS_ID == "300") //KenYa { if (a.Length <= 100000) { string fn = f1[i]; string CRD_ID = "", EMP_I1 = ""; string EMP_ID = fn.Replace(".jpg", ""); EMP_ID = EMP_ID.Replace(".JPG", ""); EMP_ID = EMP_ID.Remove(0, EMP_ID.LastIndexOf("\\") + 1); if (EMP_ID.LastIndexOf("_") > 0) { EMP_I1 = EMP_ID.Substring(0, EMP_ID.LastIndexOf("_")); } CRD_ID = EMP_ID.Remove(0, EMP_ID.LastIndexOf("_") + 1); if (T_String.IsNullTo0(T_String.GetDataFromSQL("COUNT(EMP_I1)", "FILB01A", "EMP_I1=N'" + EMP_I1 + "' AND CRD_ID='" + CRD_ID + "'")) > 0) { lb.Items.Add(f1[i]); if (T_String.IsNullTo0(T_String.GetDataFromSQL("COUNT(EMP_ID)", "FILB01AB", "EMP_ID=N'" + T_String.GetDataFromSQL("EMP_ID", "FILB01A", "EMP_I1='" + EMP_I1 + "'AND CRD_ID='" + CRD_ID + "'") + "'")) <= 0) { PublicFunction.SQL_Execute("Insert Into FILB01AB(EMP_ID) values(N'" + T_String.GetDataFromSQL("EMP_ID", "FILB01A", "EMP_I1='" + EMP_I1 + "'AND CRD_ID='" + CRD_ID + "'") + "')"); } ImageFunction.UploadImageToSQL(fn, "PIC_DR", "FILB01AB", "EMP_ID=N'" + T_String.GetDataFromSQL("EMP_ID", "FILB01A", "EMP_I1='" + EMP_I1 + "'AND CRD_ID='" + CRD_ID + "'") + "'"); } } } else { if (a.Length <= 100000) { string fn = f1[i]; string EMP_ID = fn.Replace(".jpg", ""); EMP_ID = EMP_ID.Replace(".JPG", ""); EMP_ID = EMP_ID.Remove(0, EMP_ID.LastIndexOf("\\") + 1); if (T_String.IsNullTo0(T_String.GetDataFromSQL("COUNT(EMP_ID)", "FILB01A", "EMP_ID=N'" + EMP_ID + "'")) > 0) { lb.Items.Add(f1[i]); if (T_String.IsNullTo0(T_String.GetDataFromSQL("COUNT(EMP_ID)", "FILB01AB", "EMP_ID=N'" + EMP_ID + "'")) <= 0) { PublicFunction.SQL_Execute("Insert Into FILB01AB(EMP_ID) values(N'" + EMP_ID + "')"); } ImageFunction.UploadImageToSQL(fn, "PIC_DR", "FILB01AB", "EMP_ID=N'" + EMP_ID + "'"); } } } } catch (Exception ex) { MessageBox.Show(this, ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } progressBar1.Value = (int)(i * 100) / f1.Length; } MessageBox.Show(PublicFunction.L_Get_Msg("Staff", 1)); }
private void btn3_WriteTag_Click(object sender, EventArgs e) { ImageFunction.writeDataImages(txt3_folderName.Text, txt3_database.Text, txt3_IndexFrom.Text, txt3_IndexTo.Text); }