예제 #1
0
 public SubCategoriesController(ApplicationDbContext context, IMapper mapper, UploadImages uploadImages)
 {
     _context            = context;
     this.mapper         = mapper;
     this.uploadImages   = uploadImages;
     uploadImages.Folder = "SubCategory";
 }
예제 #2
0
 public MembersController(ApplicationDbContext context, IMapper mapper, UploadImages uploadImages)
 {
     _context            = context;
     this.mapper         = mapper;
     this.uploadImages   = uploadImages;
     uploadImages.Folder = "Members";
 }
 private void Btnaddimage_Clicked(object sender, EventArgs e)
 {
     try
     {
         btnaddimage.IsVisible = false;
         UploadImages upload   = new UploadImages();
         var          response = upload.uploadimadinamic(localpathimg1);
         if (response.IsSuccessful)
         {
             localpathimg1.Text      = null;
             btnadddinamic.IsVisible = true;
             DisplayAlert("Correcto", "Se agrego material dinamico correctamente!", "OK");
             pickertipodinamic.IsEnabled  = true;
             pickertipoestruct.IsEnabled  = true;
             sipop1.IsEnabled             = true;
             sipop2.IsEnabled             = true;
             sipop3.IsEnabled             = true;
             pckcantidad.IsEnabled        = true;
             pckcantidaddinamic.IsEnabled = true;
             btnshowpop.IsEnabled         = true;
             btnadd.IsEnabled             = true;
         }
         else
         {
             DisplayAlert("Error!", "No se agrego material dinamico!", "OK");
             App.Current.MainPage = new Comunicacion();
         }
     }
     catch (Exception)
     {
         DisplayAlert("Oops!", "Algo ocurrio mal!", "OK");
         App.Current.MainPage = new Comunicacion();
     }
 }
 private void Terminado_Clicked(object sender, EventArgs e)
 {
     try
     {
         terminado.IsEnabled = false;
         terminado.IsVisible = false;
         UploadImages upload   = new UploadImages();
         var          response = upload.uploadcoolerpicture(localpathimg1);
         if (response.IsSuccessful)
         {
             pbar.ProgressTo(1, 300, Easing.Linear);
             localpathimg1.Text            = null;
             btnimagenenfriador2.IsEnabled = true;
             DisplayAlert("Correcto!", "Imagen Subida!", "OK");
         }
         else
         {
             DisplayAlert("Error!", "Imagen no subida!", "OK");
             App.Current.MainPage = new photosenfriador();
         }
     }
     catch (Exception)
     {
         DisplayAlert("Oops!", "Algo ocurrio mal!", "OK");
         App.Current.MainPage = new photosenfriador();
     }
 }
예제 #5
0
 public CategoriesController(ApplicationDbContext context, UploadImages uploadImages, IMapper mapper)
 {
     _context            = context;
     this.uploadImages   = uploadImages;
     this.mapper         = mapper;
     uploadImages.Folder = "categories";
 }
        public ActionResult Create([Bind(Include = "Id,Poid,Introduction,Details")] Products products, HttpPostedFileBase[] files)
        {
            if (ModelState.IsValid)
            {
                // products.Poid =Convert.ToInt32( TempData["OwnerId"]);
                db.Productses.Add(products);
                db.SaveChanges();

                if (files != null)
                {
                    UploadImages ui = new UploadImages();
                    foreach (HttpPostedFileBase file in files)
                    {
                        string filename = System.IO.Path.GetFileName(file.FileName);
                        file.SaveAs(Server.MapPath("~/Images/" + filename));
                        ui.ImageName = filename;
                        ui.ProductId = products.Id;
                        db.UploadImageses.Add(ui);
                        db.SaveChanges();
                    }

                    //  db.SaveChanges();
                    ViewBag.Message = "File Uploaded successfully.";
                }
                return(RedirectToAction("Index"));
            }

            // ViewBag.Poid = new SelectList(db.ProductOwners, "Id", "CompanyName", products.Poid);
            return(View(products));
        }
예제 #7
0
        protected string SaveImage()
        {
            string strDBImagePath = string.Empty;

            try
            {
                string strServerPath    = Server.MapPath(CommonFn.Image_Save_Path);
                string strSaveImagePath = string.Empty;
                string fileName         = Path.GetFileName(UploadImages.PostedFile.FileName);

                string FolderName = CommonFn.BannerFolder;
                if (!CommonFn.folderExists(strServerPath, FolderName))
                {
                    try
                    {
                        CommonFn.CreateFolder(strServerPath, FolderName);
                    }
                    catch { }
                }
                string strFileNameOnly = CommonFn.GetFileName(fileName);

                strSaveImagePath = strServerPath + FolderName + "\\" + strFileNameOnly;

                UploadImages.SaveAs(strSaveImagePath);

                strDBImagePath = CommonFn.DbSave + CommonFn.DbBannerFolder;
                strDBImagePath = strDBImagePath + strFileNameOnly;
            }
            catch
            {
                ;
            }
            return(strDBImagePath);
        }
예제 #8
0
 private void Terminado_Clicked(object sender, EventArgs e)
 {
     try
     {
         terminado.IsEnabled = false;
         terminado.IsVisible = false;
         UploadImages upload   = new UploadImages();
         var          response = upload.uploadimaenty(localpathimg1);
         if (response.IsSuccessful)
         {
             localpathimg1.Text  = null;
             finalizar.IsVisible = true;
             DisplayAlert("Correcto!", "Imagen Subida!", "OK");
         }
         else
         {
             DisplayAlert("Error!", "Imagen no subida!", "OK");
             App.Current.MainPage = new requireentryphoto();
         }
     }
     catch (Exception)
     {
         DisplayAlert("Oops!", "Algo ocurrio mal!", "OK");
         App.Current.MainPage = new requireentryphoto();
     }
 }
        public IHttpActionResult PostProducts(ProductsList productsList)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Products productes = new Products();

            //productes. = productsList.Poid;
            productes.MProductId   = productsList.MProductId;
            productes.Introduction = productsList.Introduction;
            productes.Details      = productsList.Details;
            productes.VideoLink    = productsList.VideoLink;
            db.Productses.Add(productes);
            db.SaveChanges();
            var          images = productsList.UploadImagesName.Split(',');
            UploadImages ui     = new UploadImages();

            for (int i = 0; i < images.Length; i++)
            {
                if (images[i] == "" || images[i] == null)
                {
                }
                else
                {
                    ui.ProductId = productes.Id;
                    ui.ImageName = images[i];
                    db.UploadImageses.Add(ui);
                    db.SaveChanges();
                }
            }
            return(Ok(productes));
        }
예제 #10
0
        public async Task <bool> NewUploadImageAsync(UploadImagesCmd cmd, string currentMemberId)
        {
            var timeNow = DateTime.Now;

            foreach (var item in cmd.Images)
            {
                var id        = ObjectId.NewId();
                var extension = item.Name.Split('.').LastOrDefault();

                var fileFullName = id + "." + extension;
                var path         = Path.Combine(GetUploadDirectory(), fileFullName);
                using FileStream destinationStream = File.Create(path);
                await item.Value.CopyToAsync(destinationStream).ConfigureAwait(false);

                using (var conn = CreateConnection())
                {
                    var farmInfo = new UploadImages
                    {
                        Name        = cmd.Name.IsNullOrWhiteSpace()?id.ToString():(cmd.Name + "_" + id),
                        Extension   = extension,
                        Description = cmd.Description,
                        Remark      = cmd.Remark,
                        Type        = cmd.Type,
                        Status      = cmd.Status,
                        RefereeId   = cmd.RefereeId,
                        CreatedBy   = currentMemberId,
                        CreatedOn   = timeNow,
                    };
                    await conn.InsertAsync <FarmInfo>(farmInfo).ConfigureAwait(false);
                };
            }
            return(true);
        }
예제 #11
0
        public IActionResult UploadVideo(UploadImages model)
        {
            if (ModelState.IsValid)
            {
                model.OwnerId = userService.GetUserId();
                PostImages postImages = new PostImages();
                postImages.Id      = model.Id;
                postImages.OwnerId = userService.GetUserId();
                if (model.files != null)
                {
                    foreach (IFormFile image in model.files)
                    {
                        Image  path           = new Image();
                        var    uploadFolder   = Path.Combine(environment.WebRootPath, "videos");
                        string uniqueFileName = Guid.NewGuid().ToString() + "_" + image.FileName;
                        string filePath       = Path.Combine(uploadFolder, uniqueFileName);
                        image.CopyTo(new FileStream(filePath, FileMode.Create));
                        path.FilePath = uniqueFileName;
                        path.PostId   = model.Id;
                        postImages.files.Add(path);
                    }

                    if (videoManager.UploadVideo(postImages))
                    {
                        return(RedirectToAction("Edit", "Posts", new { id = model.Id }));
                    }
                }

                return(RedirectToAction("Edit", "Posts", new { id = model.Id }));
            }
            return(View());
        }
예제 #12
0
        public void SetSharedImageDetailsToUpload(UploadImages uploadImages)
        {
            this.UploadImages = uploadImages;
            this._actions.Enqueue(WebViewAction.shareImage);

            // Make sure browser has navigated first.
            this.Browser.Navigated += Browser_Navigated;
        }
        //[ValidateAntiForgeryToken]
        public ActionResult Remove(int?id, int?productid)
        {
            UploadImages uploadImages = db.UploadImageses.Find(id);

            db.UploadImageses.Remove(uploadImages);
            db.SaveChanges();
            return(RedirectToAction("Edit", new { id = productid }));
        }
예제 #14
0
        public EscritorioController()
        {
            ImageHelper = new UploadImages();
            List <ConfiguracionesModel> config = new ConfigurationsController().GetListConfiguraciones();

            usuario_imagen_path       = config.Find(parametro => parametro.Parametro_Descripcion == "RUTA DE IMAGENES DE PERFILES DE USUARIOS").Parametro_Varchar_1;
            publicaciones_imagen_path = config.Find(parametro => parametro.Parametro_Descripcion == "RUTA DE IMAGENES DE PUBLICACIONES").Parametro_Varchar_1;
        }
예제 #15
0
    protected string SaveImage(string UpFileName, int flcontrolId)
    {
        string strDBImagePath = string.Empty;

        try
        {
            if (UpFileName.Length < 1035000)
            {
                string strServerPath    = Server.MapPath(CommonFn.Image_Save_Path);
                string strSaveImagePath = string.Empty;
                string fileName         = Path.GetFileName(UpFileName);

                string FileNameWEx = Path.GetFileNameWithoutExtension(fileName);

                FileNameWEx = objDAEntities.RemoveBadCharForFolder(FileNameWEx);

                String FileExtension = System.IO.Path.GetExtension(fileName);
                // listofuploadedfiles.Text = fileName;
                string FolderName = CommonFn.SeminarGalleryFolder;
                if (!CommonFn.folderExists(strServerPath, FolderName))
                {
                    try
                    {
                        CommonFn.CreateFolder(strServerPath, FolderName);
                    }
                    catch { }
                }
                string strFileNameOnly = CommonFn.GetFileName(FileNameWEx);
                strSaveImagePath = strServerPath + FolderName + "\\" + strFileNameOnly + FileExtension;

                if (flcontrolId == 1)
                {
                    UploadImages.SaveAs(strSaveImagePath);
                }
                else
                {
                    FileUploadTOPIC.SaveAs(strSaveImagePath);
                }
                strDBImagePath = CommonFn.DbSave + CommonFn.DbSeminarGalleryFolder;
                strDBImagePath = strDBImagePath + strFileNameOnly;
            }
            else
            {
                lblMessage.CssClass = "errorlbl";
                lblMessage.Text     = "Images size is more than 1.035 mb!!!";
                ViewState["optype"] = "INSERT";
            }
        }
        catch
        {
            lblMessage.CssClass = "errorlbl";
            lblMessage.Text     = "Something worng!!!!";
            ViewState["optype"] = "INSERT";
        }
        return(strDBImagePath);
    }
 public PurchaseRequestController(BalimoonBMLContext bmlContext,
                                  MainSystemDevelopContext mainSysCtx,
                                  UserManager <Microsoft.AspNetCore.Identity.IdentityUser> userManager)
 {
     _bmlContext     = bmlContext;
     _mainSysContext = mainSysCtx;
     _userManager    = userManager;
     _uploadImages   = new UploadImages();
     _deleteImages   = new DeleteImages();
 }
예제 #17
0
 void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(_instance);
     }
     else
     {
         _instance = this;
     }
 }
        private async Task UploadFileFromFilePicker(bool multiSelect)
        {
            await CrossMedia.Current.Initialize();

            var files = new List <MediaFile>();

            if (multiSelect)
            {
                files = await CrossMedia.Current.PickPhotosAsync(
                    new PickMediaOptions
                {
                    RotateImage = false,
                },
                    new MultiPickerOptions
                {
                    MaximumImagesCount = 100,
                });
            }
            else
            {
                var file = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions
                {
                    RotateImage = false
                });

                if (file != null)
                {
                    files = new List <MediaFile> {
                        file
                    };
                }
            }

            if (files != null && files.Any())
            {
                var uploadImages = new List <UploadImage>();

                this._mediaPickerImageResolver = new MediaImageResolver(files);
                this.UploadImages = _mediaPickerImageResolver.GetImageDetails();

                if (!multiSelect)
                {
                    this.UploadImages[0].Data = _mediaPickerImageResolver.GetImageData(0).Data;
                }

                Device.BeginInvokeOnMainThread(async() =>
                {
                    var cmd = $"viewModel.uploadAndroidImageDetails({this.UploadImages});";
                    await this.browser.EvaluateJavaScriptAsync(cmd);
                });
            }
        }
예제 #19
0
        public IActionResult UpdateAvatar(IFormFile file)
        {
            var claimsIdentity = User.Identity as ClaimsIdentity;
            var userid         = Convert.ToInt32(claimsIdentity.FindFirst(ClaimTypes.Name)?.Value);
            var man            = _usersRepository.GetUserByID(userid);

            var    upload = new UploadImages(_environment);
            string avatar = upload.Upload(file);

            man.Avatar = avatar;
            _usersRepository.ModifyUser(man);
            return(Ok());
        }
예제 #20
0
        public static UploadImages CreateUploadImagesNoData(Context context, IList parcelableContent)
        {
            var result = new UploadImages(UploadImages.ImageSource.AndroidShare);
            int index  = 0;

            foreach (var obj in parcelableContent)
            {
                var image = CreateUploadImageNoData(index, context, (Android.Net.Uri)obj);
                result.Add(image);
                index++;
            }

            return(result);
        }
예제 #21
0
        protected void uploadFile_Click(object sender, EventArgs e)
        {
            if (UploadImages.HasFile)
            {
                string schoolNo = txtSchoolCode.Text;
                string admNo    = txtAdmNo.Text;
                UploadImages.SaveAs(System.IO.Path.Combine(Server.MapPath("~/Images/"), UploadImages.FileName));

                string fileName = System.IO.Path.Combine(Server.MapPath("~/Images/")) + "\\" + UploadImages.FileName;

                SaveFileDetails(schoolNo, admNo, fileName);
                listofuploadedfiles.Text += String.Format("{0}", "Uploaded Sucessfully (For: " + admNo + ") " + UploadImages.FileName);
            }
        }
예제 #22
0
    protected string SaveImage()
    {
        string strDBImagePath = string.Empty;

        try
        {
            if (UploadImages.PostedFile.FileName != null)
            {
                string strServerPath    = Server.MapPath(CommonFn.Image_Save_Path);
                string strSaveImagePath = string.Empty;
                string fileName         = Path.GetFileName(UploadImages.PostedFile.FileName);

                string FileNameWEx = Path.GetFileNameWithoutExtension(fileName);

                FileNameWEx = objDAEntities.RemoveBadCharForFolder(FileNameWEx);

                String FileExtension = System.IO.Path.GetExtension(fileName);
                //listofuploadedfiles.Text = fileName;
                if ((FileExtension.ToLower() == ".jpg" || FileExtension.ToLower() == ".png" || FileExtension.ToLower() == ".jpeg" || FileExtension.ToLower() == ".tiff" || FileExtension.ToLower() == ".gif"))
                {
                    string FolderName = CommonFn.PhotoGalleryFolder;
                    if (!CommonFn.folderExists(strServerPath, FolderName))
                    {
                        try
                        {
                            CommonFn.CreateFolder(strServerPath, FolderName);
                        }
                        catch { }
                    }

                    //string strFileNameOnly = CommonFn.GetFileName(fileName);
                    strSaveImagePath = strServerPath + FolderName + "\\" + FileNameWEx + FileExtension;
                    UploadImages.SaveAs(strSaveImagePath);

                    strDBImagePath = CommonFn.DbSave + CommonFn.DbPhotoGalleryFolder;
                    strDBImagePath = strDBImagePath + FileNameWEx + FileExtension;
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Images size is more than 1.035 mb!!!');", true);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(strDBImagePath);
    }
 protected void HaberekleBtn_Click(object sender, EventArgs e)
 {
     try
     {
         string strFileExt = System.IO.Path.GetExtension(UploadImages.FileName);
         if (strFileExt.ToUpper() == ".JPG" || strFileExt.ToUpper() == ".GIF" || strFileExt.ToUpper() == ".PNG")
         {
             string KaydedilecekLogo = Guid.NewGuid().ToString() + UploadImages.FileName;
             UploadImages.SaveAs(Server.MapPath("../HaberResim/" + KaydedilecekLogo));
             string Kayit_ResimAd = "HaberResim/" + KaydedilecekLogo;
             int    sira          = 1;
             if (HaberSlider_Grid.Rows.Count != 0)
             {
                 sira = HaberSlider_Grid.Rows.Count + 1;
             }
             if (H.Kayit(BaslikBox.Text, Kayit_ResimAd, LinkBox.Text, sira) == true)
             {
                 KayitTamam.Visible = true;
                 KayitTamamLbl.Text = BaslikBox.Text + " haberi başarı ile kayıt edildi.";
                 HataVar.Visible    = false;
                 BaslikBox.Text     = "";
                 LinkBox.Text       = "";
                 GelListe();
             }
             else
             {
                 KayitTamam.Visible = false;
                 HataVar.Visible    = true;
             }
         }
         else
         {
             KayitTamam.Visible = false;
             HataLbl.Text       = "Uygun formatda  (.jpg, .gif ve .png) resim yükleyiniz.";
             HataVar.Visible    = true;
         }
     }
     catch (Exception)
     {
         //   BilgilerDiv.Visible = false;
         KayitTamam.Visible = false;
         HataVar.Visible    = true;
     }
 }
예제 #24
0
        public bool UpdateUsuarioEmpresaPerfil(string empresa_id, string miembro_id, string territorio_id, string nombre, string correo, string web, string puesto, byte[] logo)
        {
            try
            {
                string fotoNombre = null;
                if (logo.Length != 0)
                {
                    fotoNombre = Guid.NewGuid().ToString() + ".png";
                    string empresa_imagen_path = (new ConfigurationsController().GetListConfiguraciones() != null) ? new ConfigurationsController().GetListConfiguraciones().Find(parametro => parametro.Parametro_Descripcion == "RUTA DE IMAGENES DE PERFILES DE EMPRESAS").Parametro_Varchar_1 : "";
                    var    result = new UploadImages().UploadBitmapAsync(fotoNombre, logo, empresa_imagen_path);
                    if (!result)
                    {
                        return(false);
                    }
                }
                conn.Open();
                //transaction = conn.BeginTransaction();
                command             = CreateCommand();
                command.Connection  = conn;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "sp_cat_Usuarios_Empresas_Perfil";
                command.Parameters.AddWithValue("@Empresa_Miembro_Id", empresa_id);
                command.Parameters.AddWithValue("@Miembro_Id", miembro_id);
                command.Parameters.AddWithValue("@Territorio_Id", territorio_id);
                command.Parameters.AddWithValue("@Empresa_Miembro_Nombre", nombre);
                command.Parameters.AddWithValue("@Empresa_Miembro_Correo_Electronico", correo);
                command.Parameters.AddWithValue("@Empresa_Miembro_Pagina_Web", web);
                command.Parameters.AddWithValue("@Empresa_Miembro_Logotipo", fotoNombre);
                command.Parameters.AddWithValue("@Miembro_Puesto", puesto);

                //command.Transaction = transaction;
                command.ExecuteNonQuery();
                //transaction.Commit();
            }
            catch (Exception e)
            {
                SlackLogs.SendMessage(e.Message, GetType().Name, "UpdateUsuarioEmpresaPerfil");
                //transaction.Rollback();
                return(false);
            }
            finally { conn.Close(); }
            return(true);
        }
예제 #25
0
        protected string SaveImage()
        {
            string strDBImagePath = string.Empty;

            try
            {
                if (UploadImages.PostedFile.ContentLength > 0)
                {
                    string strServerPath    = Server.MapPath(CommonFn.Image_Save_Path);
                    string strSaveImagePath = string.Empty;
                    string fileName         = Path.GetFileName(UploadImages.PostedFile.FileName);

                    string FileNameWEx = Path.GetFileNameWithoutExtension(fileName);

                    FileNameWEx = objDAEntities.RemoveBadCharForFolder(FileNameWEx);
                    String FileExtension = System.IO.Path.GetExtension(fileName);

                    string FolderName = CommonFn.HomeSliderGalleryFolder;



                    string strFileNameOnly = FileNameWEx + FileExtension;
                    strSaveImagePath = strServerPath + FolderName + "\\" + strFileNameOnly;

                    if (!File.Exists(strSaveImagePath))
                    {
                        UploadImages.SaveAs(strSaveImagePath);
                        strDBImagePath = CommonFn.DbSave + CommonFn.DbHomeSliderGalleryFolder;
                        strDBImagePath = strDBImagePath + strFileNameOnly;
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Images size too small!!!');", false);
                }
            }
            catch
            {
                ;
            }
            return(strDBImagePath);
        }
예제 #26
0
        public AccountController(
            SignInManager <Microsoft.AspNetCore.Identity.IdentityUser> signInManager,
            MainSystemDevelopContext dbContext,
            ILogger <RegisterViewModel> logger,
            BalimoonBMLContext bMLContext,
            UserManager <Microsoft.AspNetCore.Identity.IdentityUser> userManager,
            IEmailSender emailSender

            )
        {
            _signInManager = signInManager;
            _dbContext     = dbContext;
            _logger        = logger;
            _userManager   = userManager;
            _emailSender   = emailSender;
            _bmlContext    = bMLContext;
            _uploadImages  = new UploadImages();
            _deleteImages  = new DeleteImages();
            _uploadPDF     = new UploadPDF();
            _deletePDF     = new PDFDelete();
        }
    //protected void dgSpecialty_PageIndexChanging(object source, DataGridPageChangedEventArgs e)
    //{
    //
    //}
    protected string SaveImage()
    {
        string strDBImagePath = string.Empty;

        try
        {
            if (UploadImages.PostedFile.ContentLength > 0)
            {
                string strServerPath    = Server.MapPath(CommonFn.Image_Save_Path);
                string strSaveImagePath = string.Empty;
                string fileName         = Path.GetFileName(UploadImages.PostedFile.FileName);

                string FileNameWEx = Path.GetFileNameWithoutExtension(fileName);

                FileNameWEx = objDAEntities.RemoveBadCharForFolder(FileNameWEx);

                String FileExtension = System.IO.Path.GetExtension(fileName);
                //listofuploadedfiles.Text = fileName;
                if ((FileExtension.ToLower() == ".jpg" || FileExtension.ToLower() == ".png" || FileExtension.ToLower() == ".jpeg" || FileExtension.ToLower() == ".tiff" || FileExtension.ToLower() == ".gif"))
                {
                    string FolderName      = CommonFn.SpecialtiesFolder;
                    string strFileNameOnly = CommonFn.GetFileName(fileName);
                    strSaveImagePath = strServerPath + FolderName + "\\" + strFileNameOnly;
                    UploadImages.SaveAs(strSaveImagePath);

                    strDBImagePath = CommonFn.DbSave + CommonFn.DbSpecialtiesFolder;
                    strDBImagePath = strDBImagePath + "/" + strFileNameOnly;
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Images size is more than 1.03 mb=1035000!!!');", true);
            }
        }
        catch
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Something worng!!!');", true);
        }
        return(strDBImagePath);
    }
        public IHttpActionResult DeleteImage(int id)
        {
            UploadImages images = db.UploadImageses.Find(id);

            if (images == null)
            {
                return(NotFound());
            }
            var pid = images.ProductId;

            db.UploadImageses.Remove(images);
            db.SaveChanges();

            var productses = db.Productses.Include(p => p.UploadImages);
            var products   = productses.FirstOrDefault(x => x.Id == pid);

            if (products == null)
            {
                return(NotFound());
            }
            return(Ok(products));
        }
    protected string SaveImage()
    {
        string strDBImagePath = string.Empty;

        try
        {
            string strServerPath    = Server.MapPath(CommonFn.Image_Save_Path);
            string strSaveImagePath = string.Empty;
            string fileName         = Path.GetFileName(UploadImages.PostedFile.FileName);
            String FileExtension    = System.IO.Path.GetExtension(fileName);
            string FolderName       = CommonFn.DoctorFolder;
            if ((FileExtension.ToLower() == ".jpg" || FileExtension.ToLower() == ".png" || FileExtension.ToLower() == ".jpeg" || FileExtension.ToLower() == ".tiff" || FileExtension.ToLower() == ".gif"))
            {
                if (!CommonFn.folderExists(strServerPath, FolderName))
                {
                    try
                    {
                        CommonFn.CreateFolder(strServerPath, FolderName);
                    }
                    catch { }
                }
                string strFileNameOnly = CommonFn.GetFileName(fileName);
                strSaveImagePath = strServerPath + FolderName + "\\" + strFileNameOnly;
                UploadImages.SaveAs(strSaveImagePath);
                strDBImagePath = CommonFn.DbSave + CommonFn.DbDoctorFolder;
                strDBImagePath = strDBImagePath + strFileNameOnly;
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Only Image file allowed!!!');", true);
            }
        }
        catch
        {
            //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Only Image file allowed!!!');", true);
        }
        return(strDBImagePath);
    }
예제 #30
0
        public void FillMemberCard(ref string nombre, ref byte[] foto, ref string puesto, ref string empresa)
        {
            DataUsuario = new UsuariosController().GetMemberName(localStorage.Get("Usuario_Id"), localStorage.Get("Usuario_Tipo"));
            nombre      = DataUsuario[(int)CamposMiembro.Usuario_Nombre];
            foto        = new UploadImages().DownloadFileFTP(DataUsuario[(int)CamposMiembro.Usuario_Fotografia], usuario_imagen_path);
            puesto      = DataUsuario[(int)CamposMiembro.Usuario_Puesto];
            empresa     = DataUsuario[(int)CamposMiembro.Usuario_Empresa_Nombre];
            ImageView imgFoto = context.FindViewById <ImageView>(Resource.Id.imgProfileMenu);

            if (foto.Length != 0)
            {
                imgFoto.SetImageBitmap(ImagesHelper.GetRoundedShape(BitmapFactory.DecodeByteArray(foto, 0, foto.Length)));
            }
            else
            {
                imgFoto.SetImageResource(Resource.Mipmap.ic_profile_empty);
            }
            TextView NombreUsuario = context.FindViewById <TextView>(Resource.Id.lblNombreMenu);

            NombreUsuario.Text = nombre;
            NombreUsuario.SetMaxWidth(context.Resources.DisplayMetrics.WidthPixels - 110);
            context.FindViewById <TextView>(Resource.Id.lblEmpresaMenu).Text = empresa;
            context.FindViewById <GridLayout>(Resource.Id.glPerfil).Click   += (sender, e) => ShowPerfilCard(new UsuariosController().GetMemberData(localStorage.Get("Usuario_Id"), localStorage.Get("Usuario_Tipo")));
        }