public ActionResult UrunDuzenle(UrunViewModel uvm, HttpPostedFileBase file) { var filename = ImageNameGenerator.ProfilFotoIsmiUret(file); var path = "null"; uvm.Fotograf = filename; UrunYonetici uy = new UrunYonetici(); BusinessLayerResult <Urun> res = new BusinessLayerResult <Urun>(); if (file != null) { //filename = Path.GetFileName(file[0].FileName); path = Path.Combine(Server.MapPath("~/Content/Image/Urun"), filename); Image imgnew = ResizeImage.Resize(Image.FromStream(file.InputStream), 0, 473); //son eklediğim alan //file[0].SaveAs(path); imgnew.Save(path); } if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(uvm)); } if (ModelState.IsValid) { Urun urnyeni = uy.Find(x => x.ilanId == uvm.IlanId); RenkYonetici ry = new RenkYonetici(); SehirYonetici sy = new SehirYonetici(); KategoriYonetici ky = new KategoriYonetici(); if (uvm.takasdegeri == "UYGUN") { uvm.Takas = true; } else { uvm.Takas = false; } //Burayı düzelt... urnyeni.ilanId = uvm.IlanId; urnyeni.urunBaslik = uvm.UrunBaslik; urnyeni.urunFiyati = uvm.UrunFiyat; urnyeni.renkId = ry.Find(x => x.renkAdi == uvm.UrunRenkAdi).renkId; urnyeni.urunKonum = uvm.UrunKonum; urnyeni.ilPlaka = sy.Find(x => x.ilAdi == uvm.SehirAlani).ilPlaka; urnyeni.kategoriId = ky.Find(x => x.kategoriAdi == uvm.KategoriAdi).kategoriId; urnyeni.takasyapilirmi = uvm.Takas; urnyeni.durumu = uvm.durumu; urnyeni.urunAciklama = uvm.UrunAciklama; urnyeni.halasatilikmi = true; urnyeni.kullaniciId = App.Common.GetCurrentUsernameId(); //urnyeni.satistarihsaat = DateTime.Now; //Ürün güncellendiği zaman yükleme tarihi aynı kalsın if (file != null) { urnyeni.urunFotosu = filename; } uy.Update(urnyeni); return(RedirectToAction("Sattiklarim", "Profil")); } return(View(uvm)); }
private static void CommonPart <T1, T2, T3, T4>(Func <CommonOperation <T1> > changeapp, MethodBase method, Func <CommonOperation <T2> > checkapp1, Func <CommonOperation <T3> > checkapp2, Func <CommonOperation <T4> > checkapp3) { var g = new ImageNameGenerator(method); var e = changeapp(); var k1 = checkapp1(); var k2 = checkapp2(); var k3 = checkapp3(); void ShotE() => e.GetSession().ShotScreen(g.Gen()); void ShotK1() => k1.GetSession().ShotScreen(g.Gen()); void ShotK2() => k1.GetSession().ShotScreen(g.Gen()); void ShotK3() => k1.GetSession().ShotScreen(g.Gen()); //enable e.OpenFileTab().ViewOption().CheckedLinkedInOption().ExecuteExternalAction(ShotE).ClickOkButton(); k1.OpenFileTab().ViewOption().ExecuteExternalAction(ShotK1).ClickCancelButton(); k2.OpenFileTab().ViewOption().ExecuteExternalAction(ShotK2).ClickCancelButton(); k2.OpenFileTab().ViewOption().ExecuteExternalAction(ShotK3).ClickCancelButton(); //disable e.OpenFileTab().ViewOption().UncheckedLinkedInOption().ExecuteExternalAction(ShotE).ClickOkButton(); k1.OpenFileTab().ViewOption().ExecuteExternalAction(ShotK1).ClickCancelButton(); k2.OpenFileTab().ViewOption().ExecuteExternalAction(ShotK2).ClickCancelButton(); k2.OpenFileTab().ViewOption().ExecuteExternalAction(ShotK3).ClickCancelButton(); // changeapp enable e.OpenFileTab().ViewOption().UncheckedLinkedInOption().ClickOkButton(); }
private static CommonOperation <T> CommonPart <T>(CommonOperation <T> openedApp, MethodBase method) { var g = new ImageNameGenerator(method); void Shot() => openedApp.GetSession().ShotScreen(g.Gen()); return(openedApp.OpenFileTab().ViewOption().CheckText().ExecuteExternalAction(Shot) .CheckTip().ExecuteExternalAction(Shot) .CheckLink1().ExecuteExternalAction(Shot) .CheckLink2().ExecuteExternalAction(Shot)); }
public ActionResult Upload(VideoViewModel model, HttpPostedFileBase file) { if (model != null && file != null) { var filename = ImageNameGenerator.VideoIsmiUret(file); var imgname = ImageNameGenerator.FotoIsmiUret(file); StringBuilder sBuilder = new StringBuilder(); sBuilder.Append(imgname); sBuilder.Append(".jpeg"); imgname = sBuilder.ToString(); model.videoName = filename; model.frameName = imgname; var path = "null"; if (file != null) { path = Path.Combine(Server.MapPath("~/Content/Videos/"), filename); file.SaveAs(path); imgname = Path.Combine(Server.MapPath("~/Content/Images/"), imgname); var ffMpeg = new NReco.VideoConverter.FFMpegConverter(); ffMpeg.GetVideoThumbnail(path, imgname, 5); ShellFile so = ShellFile.FromFilePath(path); double nanoseconds; double.TryParse(so.Properties.System.Media.Duration.Value.ToString(), out nanoseconds); if (nanoseconds > 0) { double seconds = Convert100NanosecondsToMilliseconds(nanoseconds) / 1000; int ttl_seconds = Convert.ToInt32(seconds); model.duration = TimeSpan.FromSeconds(ttl_seconds); } } res = vManager.VideoYukle(model); if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); foreach (ErrorMessageObj obj in res.Errors) { if (obj.Code == ErrorMessageCode.VideoDurationLimit) { System.IO.File.Delete(path); System.IO.File.Delete(imgname); } } return(View()); } else { vtManager.SplitTagsAndSave(model.videoTag, res.Result.videoNo); } return(RedirectToAction("Index", "Home")); } return(View()); }
private static CommonOperation <T> CommonPart <T>(CommonOperation <T> openedApp, MethodBase method) { var g = new ImageNameGenerator(method); void Shot() => Word.Session.ShotScreen(g.Gen()); void Shot2() => openedApp.GetSession().ShotScreen(g.Gen()); var res = openedApp.OpenFileTab().ViewOption().UncheckedLinkedInOption().ExecuteExternalAction(Shot2).ClickOkButton(); Word.Open().OpenFileTab().NewBluegreyResume().ExecuteExternalAction(Shot).ResumeAssistant().ExecuteExternalAction(Shot).Close(); return(res); }
// Specific for Outlook public static void CommonPartForOutlook <T1, T2>(Func <CommonOperation <T1> > openConditionApp, Func <CommonOperation <T2> > openNeedCheckApp, MethodBase methodForGenImgName) { var g = new ImageNameGenerator(methodForGenImgName); var c = openConditionApp(); var t = openNeedCheckApp(); void CShot() => c.GetSession().ShotScreen(g.Gen()); void TShot() => t.GetSession().ShotScreen(g.Gen()); c.OpenFileTab().ViewOption().UncheckedLinkedInOption().ExecuteExternalAction(CShot).ClickOkButton().Dispose(); t.ViewContact().ExecuteExternalAction(TShot); }
private static void CommonPart <T1, T2>(Func <CommonOperation <T1> > openConditionApp, MethodBase method, Func <CommonOperation <T2> > openTestApp) { var g = new ImageNameGenerator(method); var c = openConditionApp(); var t = openTestApp(); void CShot() => c.GetSession().ShotScreen(g.Gen()); // should set two shot void TShot() => t.GetSession().ShotScreen(g.Gen()); // should set two shot c.OpenFileTab().ViewOption().UncheckedLinkedInOption().ExecuteExternalAction(CShot).ClickOkButton().Dispose(); t.OpenFileTab().AddAuthor().ExecuteExternalAction(TShot).Dispose(); }
public static void CommonPartForWordExcelPpt <T1, T2>(Func <CommonOperation <T1> > openConditionApp, Func <CommonOperation <T2> > openNeedCheckApp, MethodBase methodForGenImgName) { var g = new ImageNameGenerator(methodForGenImgName); //var c = openConditionApp(); //void CShot() => c.GetSession().ShotScreen(g.Gen()); //// Dispose to solve same app conflict //c.OpenFileTab().ViewOption().UncheckedLinkedInOption().ExecuteExternalAction(CShot).ClickOkButton().Dispose(); var t = openNeedCheckApp(); void TShot() => t.GetSession().ShotScreen(g.Gen()); t.OpenFileTab().AddAuthor().ExecuteExternalAction(TShot); }
public ActionResult Hesabim(KullaniciViewModel kvm, List <HttpPostedFileBase> file) { var filename = ImageNameGenerator.ProfilFotoIsmiUret(file[0]); var path = "null"; kvm.fotograf = filename; KullaniciYönetici ky = new KullaniciYönetici(); Kullanici klnc = Session["giris"] as Kullanici; BusinessLayerResult <Kullanici> res = new BusinessLayerResult <Kullanici>(); if (klnc != null) { kvm.KullaniciId = klnc.kullaniciId; } res = ky.KullaniciGuncelle(kvm, file[0]); if (file[0] != null) { //filename = Path.GetFileName(file[0].FileName); path = Path.Combine(Server.MapPath("~/Content/Image/Profil"), filename); Image imgnew = ResizeImage.Resize(Image.FromStream(file[0].InputStream), 0, 473); //son eklediğim alan //file[0].SaveAs(path); imgnew.Save(path); } if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(kvm)); } if (file != null && file.Count > 1) { for (int i = 1; i <= file.Count - 1; i++) { if (file != null && file[i].ContentLength > 0) { filename = Path.GetFileName(file[i].FileName); path = Path.Combine(Server.MapPath("~/Content/Image/Profil"), filename); kvm.fotograf = file[i].FileName; KullaniciYönetici ky1 = new KullaniciYönetici(); BusinessLayerResult <KullaniciFoto> res1 = ky1.KullaniciFotosuYukle(kvm.Username, file[i]); file[i].SaveAs(path); } } } return(RedirectToAction("Index", "Home")); }
public ActionResult Yukle(UrunViewModel model, List <HttpPostedFileBase> file) { if (model.takasdegeri == "0") { model.Takas = false; } if (model.takasdegeri == "1") { model.Takas = true; } if (model.durumdegeri == "0") { model.durumu = false; } if (model.durumdegeri == "1") { model.durumu = true; } if (ModelState.IsValid && file.Count > 0) { UrunYonetici uy = new UrunYonetici(); var filename = ImageNameGenerator.UrunFotoIsmiUret(file[0]); //filename += Path.GetExtension(file[0].FileName); model.Fotograf = filename; var path = "null"; BusinessLayerResult <Urun> res = new BusinessLayerResult <Urun>(); res = uy.UrunKayit(model, file[0]); if (file[0] != null) { //filename = Path.GetFileName(file[0].FileName); path = Path.Combine(Server.MapPath("~/Content/Image/Urun"), filename); Image imgnew = ResizeImage.Resize(Image.FromStream(file[0].InputStream), 0, 473); //son eklediğim alan //file[0].SaveAs(path); imgnew.Save(path); } if (res.Errors.Count > 0) { res.Errors.ForEach(x => ModelState.AddModelError("", x.Message)); return(View(model)); } if (file != null && file.Count > 1) { for (int i = 1; i <= file.Count - 1; i++) { if (file != null && file[i].ContentLength > 0) { filename = ImageNameGenerator.UrunFotoIsmiUret(file[i]); //filename = Path.GetFileName(file[i].FileName); model.Fotograf = filename; path = Path.Combine(Server.MapPath("~/Content/Image/Urun"), filename); UrunYonetici uy1 = new UrunYonetici(); BusinessLayerResult <UrunFoto> res1 = uy1.UrunFotosuYukle(model.UrunBaslik, file[i]); Image imgnew = ResizeImage.Resize(Image.FromStream(file[i].InputStream), 0, 473); //son eklediğim alan imgnew.Save(path); } } } Session["urun"] = res.Result; return(RedirectToAction("Index", "Home")); } return(View(model)); //return RedirectToAction("Index","Home"); }