public ActionResult UploadSozluk() { if (Request.Files.Count > 0) { HttpFileCollectionBase files = Request.Files; string filename = Path.GetFileName(Request.Files[0].FileName); HttpPostedFileBase file = files[0]; string fname; if (Request.Browser.Browser.ToUpper() == "IE" || Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER") { string[] testfiles = file.FileName.Split(new char[] { '\\' }); fname = testfiles[testfiles.Length - 1]; } else { fname = file.FileName; } List <EWSWord> listOfWord = new List <EWSWord>(); if ((file != null) && (file.ContentLength > 0) && !string.IsNullOrEmpty(file.FileName)) { string fileName = file.FileName; string fileContentType = file.ContentType; byte[] fileBytes = new byte[file.ContentLength]; var data = file.InputStream.Read(fileBytes, 0, Convert.ToInt32(file.ContentLength)); using (var package = new ExcelPackage(file.InputStream)) { var currentSheet = package.Workbook.Worksheets; ExcelWorksheet workSheet = currentSheet.First(); var noOfCol = workSheet.Dimension.End.Column; var noOfRow = workSheet.Dimension.End.Row; string word; string mean; for (int rowIterator = 2; rowIterator <= noOfRow; rowIterator++) { word = (workSheet.Cells[rowIterator, 1].Value == null) ? "" : workSheet.Cells[rowIterator, 1].Value.ToString(); mean = ((workSheet.Cells[rowIterator, 2].Value == null) ? "" : workSheet.Cells[rowIterator, 2].Value.ToString()).ToUpper(); EWSWord w = new EWSWord(); w.WordBody = word.ToLowerInvariant(); w.Description = mean.ToLowerInvariant(); listOfWord.Add(w); } // for end } //using end } //if end IWord iWord = new BsWord(); iWord.SaveWordMultiple(listOfWord, "", GetCurrentUser().ID); } return(Script("Message('Sözlük Kayıt Edildi','success');")); }
public ActionResult NewWordAsListMember(string wordbody, string description, Guid ListUN) { IWord iword = new BsWord(); ViewBag.Title = "New Word"; //kelime var mı kontrol et.varsa ekleme. EWSWord word = iword.GetWordByBody(wordbody); if (word != null) { return(Script("Message('Bu Kelime Zaten Var.','info');")); } EWSWord wrd = new EWSWord() { UN = new Guid(), Description = description, WordBody = wordbody, UserID = GetCurrentUser().ID, }; EWSListWord listWord = new EWSListWord() { UN = Guid.NewGuid(), isPublic = false, ListUN = ListUN, WordUN = wrd.UN }; iword.WordSaveAsListMember(wrd, listWord); return(Script("Message('Kelime Eklendi','success');")); }
public ActionResult TranslateText(string TranslateText) { IWord iword = new BsWord(); Translator t = new Translator(); TranslateText = TranslateText.Trim(); TranslateText = TranslateText.Replace("\n", ""); TranslateText = TranslateText.Replace("\r", ""); string result = t.Translate(TranslateText, "English", "Turkish"); //varsa kelimeyi getir. Yoksa yeni yaratıp gönder. EWSWord word = iword.GetWordByBody(TranslateText); if (word != null) { //word.Description = result; return(PartialView("WordDetail", word)); } EWSWord w = new EWSWord() { Description = result, WordBody = TranslateText, }; return(PartialView("WordDetail", w)); }
public ActionResult PreviewMultiple(Guid UN) { IEWSList ilist = new BsEWSList(); IWord iword = new BsWord(); CurrentList = ilist.GetList(UN, GetCurrentUser().ID, true); foreach (var item in CurrentList.EWSListWord) { if (item.EWSWord.Description == null) { EWSWord word = new EWSWord(); Translator t = new Translator(); string TranslateText = item.EWSWord.WordBody.Trim(); string result = t.Translate(TranslateText, "English", "Turkish"); word.UN = item.EWSWord.UN; word.UserID = item.EWSWord.UserID; word.Description = result; word.WordBody = item.EWSWord.WordBody; item.EWSWord.Description = result; word = iword.WordSave(word); } item.EWSWord.CurrentSequence = CurrentSequence; } return(PartialView(CurrentList)); }
public JsonResult TranslateTextJson(string TranslateText) { IWord iword = new BsWord(); Translator t = new Translator(); TranslateText = TranslateText.Trim(); TranslateText = TranslateText.Replace("\n", ""); TranslateText = TranslateText.Replace("\r", ""); string result = t.Translate(TranslateText, "English", "Turkish"); EWSWord w = new EWSWord(); //varsa kelimeyi getir. Yoksa yeni yaratıp gönder. EWSWord word = iword.GetWordByBody(TranslateText); if (word != null) { w.UN = word.UN; w.WordBody = word.WordBody; w.Description = result; } else { w.Description = result; w.WordBody = TranslateText; } return(Json(w, JsonRequestBehavior.AllowGet)); }
public ActionResult NewSentence(string body, string mean, Guid wordUN) { IWord iword = new BsWord(); //kelime var mı kontrol et.varsa ekleme. EWSSampleSentence sent = iword.GetSampleSentenceByBody(body); if (sent != null) { return(Script("Message('Bu cümle zaten ekli.','info');")); } EWSSampleSentence sentence = new EWSSampleSentence() { UN = Guid.NewGuid(), Sentence = body, SentenceMean = mean, UserID = GetCurrentUser().ID, WordUN = wordUN, }; iword.SaveSampleSentence(sentence); return(Script("Message('Cümle Eklendi','success');")); }
public ActionResult GetEWSListGrid(Guid wordUN) { IWord iword = new BsWord(); List <EWSList> result = iword.GetWordListByWordUN(wordUN, GetCurrentUser().ID); return(PartialView("ListGrid", result)); }
public ActionResult GlobalSearchWord(string wordBody) { IWord iword = new BsWord(); List <EWSWord> words = iword.GetWords(wordBody); return(PartialView(words)); }
public ActionResult GetWordByUN(Guid UN) { IWord iword = new BsWord(); EWSWord w = iword.GetWordById(UN, GetCurrentUser().ID, false); return(PartialView("Word", w)); }
public ActionResult AddWordToList(Guid listUN, Guid wordUN) { IWord iword = new BsWord(); iword.AddWordToList(listUN, wordUN); return(Content("")); }
public ActionResult DeleteComment(Guid ID) { IWord iword = new BsWord(); iword.DeleteComment(ID); return(Content("")); }
public ActionResult SearchGenel(string searchSentence) { IWord iword = new BsWord(); List <EWSWord> words = iword.GetWords(searchSentence); return(PartialView(words)); }
public JsonResult GetWordByListID(Guid listID, int rownumber, string type) { IWord iword = new BsWord(); EWSWord w = iword.GetWordByEWSListWordID(listID, rownumber, type, GetCurrentUser().ID); return(Json(w, JsonRequestBehavior.AllowGet)); }
public ActionResult GetEkledigimKelimeler() { IWord iword = new BsWord(); List <EWSWord> words = iword.GetWordsByUserID(GetCurrentUser().ID, (int)AddType.extension.GetHashCode()); return(PartialView("MyAddedWords", words)); }
public ActionResult GetWordSamples(Guid wordID) { IWord iword = new BsWord(); List <EWSSampleSentence> samps = new List <EWSSampleSentence>(); samps = iword.GetSampleSentences(wordID, GetCurrentUser().ID); return(PartialView("WordSamples", samps)); }
public ActionResult GetSentencesByWordUN(Guid wordUN) { IWord iword = new BsWord(); List <EWSSampleSentence> samps = new List <EWSSampleSentence>(); samps = iword.GetSampleSentences(wordUN, GetCurrentUser().ID); return(PartialView("SentenceGrid", samps)); }
public JsonResult GetListWordBySequenceNo(string leftright) { try { IWord iword = new BsWord(); if (leftright == "") { CurrentSequence = 1; } if (leftright == "left") { CurrentSequence--; } else if (leftright == "right") { CurrentSequence++; } if (CurrentSequence <= 0) { CurrentSequence++; // eski değerine getir return(null); } if (CurrentSequence > CurrentList.EWSListWord.Count()) { CurrentSequence--; // eski değerine getir return(null); } EWSWord word = iword.GetWordById(((Guid)CurrentList.EWSListWord.Where(p => p.Number == CurrentSequence).FirstOrDefault().WordUN), GetCurrentUser().ID, false); if (word != null) { if (word.Description == null) { Translator t = new Translator(); string TranslateText = word.WordBody.Trim(); string result = t.Translate(TranslateText, "English", "Turkish"); word.Description = result; word = iword.WordSave(word); } word.CurrentSequence = CurrentSequence; } return(Json(word, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { throw ex; } }
public ActionResult RemoveIWillLearn(Guid wordID) { IEWSList ilist = new BsEWSList(); ilist.RemoveIWillLearn(wordID, GetCurrentUser().ID); IWord iword = new BsWord(); EWSWord w = iword.GetWordById(wordID, GetCurrentUser().ID, false); ViewBag.FromDetail = true; return(PartialView("../EWSWords/Word", w)); }
public ActionResult SaveComment(Guid wordID, string comment, string commentMean) { IWord iword = new BsWord(); EWSSampleSentence ewsSamp = new EWSSampleSentence() { Sentence = comment, UN = Guid.NewGuid(), UserID = GetCurrentUser().ID, WordUN = wordID, SentenceMean = commentMean, }; iword.SaveComment(ewsSamp); return(GetWordSamples(wordID)); }
public ActionResult UpdateWord(Guid UN, string wordbody, string description) { IWord iword = new BsWord(); EWSWord wrd = new EWSWord() { UN = UN, Description = description, //WordBody = wordbody, }; wrd = iword.WordSave(wrd); return(Script("Message('Kelime Güncellendi','success');")); }
public ActionResult GetIKnownWords(bool?partial = false) { IWord iword = new BsWord(); List <EWSKnownWords> model = iword.GetKnownWords(GetCurrentUser().ID); if (partial == false) { return(View("KnownWords", model)); } else { return(PartialView("KnownWords", model)); } }
public ActionResult GetWordDetailByUN(Guid UN) { IWord iword = new BsWord(); EWSWord word = iword.GetWordById(UN, GetCurrentUser().ID); if (word.Description == null) { Translator t = new Translator(); string TranslateText = word.WordBody.Trim(); string result = t.Translate(TranslateText, "English", "Turkish"); word.Description = result; //word = iword.WordSave(word); } return(PartialView("WordDetail", word)); }
public ActionResult SetIKnow(Guid wordID) { IEWSList ilist = new BsEWSList(); IWord iword = new BsWord(); ilist.SetIKnowWord(wordID, GetCurrentUser().ID); EWSWord word = iword.GetWordById(wordID, GetCurrentUser().ID); if (word.Description == null) { Translator t = new Translator(); string TranslateText = word.WordBody.Trim(); string result = t.Translate(TranslateText, "English", "Turkish"); word.Description = result; //word = iword.WordSave(word); } ViewBag.FromDetail = true; return(PartialView("../EWSWords/Word", word)); }
public ActionResult WordSave(string wordbody, string description) { IWord iword = new BsWord(); ViewBag.Title = "New Word"; //kelime var mı kontrol et.varsa ekleme. EWSWord wrd = iword.GetWordByBody(wordbody); if (wrd != null) { wrd.WordBody = wordbody; wrd.Description = description; ViewBag.Message = "Kelime zaten kayıtlıydı Güncellendi."; ViewBag.MessageType = "info"; return(PartialView()); } if (wrd == null) { wrd = new EWSWord() { UN = new Guid(), Description = description, WordBody = wordbody, UserID = GetCurrentUser().ID, AddType = 2 } } ; iword.WordSave(wrd); ViewBag.Message = "Kelime Kayıt Edildi"; ViewBag.MessageType = "success"; return(PartialView()); }
public ActionResult NewWord(string wordbody, string description) { IWord iword = new BsWord(); ViewBag.Title = "New Word"; //kelime var mı kontrol et.varsa ekleme. EWSWord word = iword.GetWordByBody(wordbody); if (word != null) { return(Script("Message('Bu Kelime Zaten Var.','info');")); } EWSWord wrd = new EWSWord() { UN = new Guid(), Description = description, WordBody = wordbody, UserID = GetCurrentUser().ID, }; //EWSSampleSentence sentence = new EWSSampleSentence() //{ // Sentence = samplesentence, // WordUN=wrd.UN, // UserID=CurrentUser.ID, // SentenceMean=samplesentenceMean, //}; //wrd.EWSSampleSentence.Add(sentence); wrd = iword.WordSave(wrd); return(Script("Message('Kelime Eklendi','success');")); }