public ActionResult ReviewOtherCodeMethod(OtherCode otherCode) { try { otherCode.ReviewFlag = true; _extensionCodeService.EditOtherCode(otherCode); return(RedirectToAction("ShowOtherCodeMethodDetail", new { id = otherCode.Id })); } catch (DbUpdateException ex) { ViewBag.message = "Category Name already exists"; return(View(ex)); } catch { return(View()); } }
public ActionResult EditOtherUsefullCode(OtherCode otherCode) { try { otherCode.CreationDate = System.DateTime.Now; _extensionCodeService.EditOtherCode(otherCode); return(RedirectToAction("ShowOtherCodeMethodDetail", new { id = otherCode.Id })); } catch (DbUpdateException ex) { ViewBag.message = "Category Name already exists"; return(View(ex)); } catch { return(View()); } }
public GCodeCommand ParseLine(string line, int lineIndex) { var cleanedLine = CleanupLine(line, lineIndex); if (!string.IsNullOrWhiteSpace(cleanedLine)) { if (cleanedLine.StartsWith("G")) { var motionLine = ParseMotionLine(cleanedLine.ToUpper(), lineIndex); if (motionLine != null) { motionLine.SetComment(GetComment(line)); return(motionLine); } } else if (cleanedLine.StartsWith("T") || cleanedLine.StartsWith("M06") || cleanedLine.StartsWith("M6 ")) { var machineLine = ParseToolChangeCommand(cleanedLine.ToUpper(), lineIndex); if (machineLine != null) { machineLine.SetComment(GetComment(line)); return(machineLine); } } else if (cleanedLine.StartsWith("M")) { var machineLine = ParseMachineCommand(cleanedLine.ToUpper(), lineIndex); if (machineLine != null) { machineLine.SetComment(GetComment(line)); return(machineLine); } } else if (cleanedLine.StartsWith("S")) { var machineLine = new OtherCode(); machineLine.LineNumber = lineIndex; machineLine.OriginalLine = cleanedLine; return(machineLine); } } return(null); }
public void EditOtherCode(OtherCode otherCode) { _FrameworxProjectDatabaseContext.Update <OtherCode>(otherCode); }
public void AddOtherCode(OtherCode otherCode) { _FrameworxProjectDatabaseContext.Add <OtherCode>(otherCode); }
public void OtherCodeFrequentSearchedCountUpdate(OtherCode otherCode) { _FrameworxProjectDatabaseContext.Update <OtherCode>(otherCode); }
public ActionResult AddOtherUsefullCode(OtherCode otherCode) { try { var userEmailAddress = User.Identity.Name; User user = new User(); user = _commonDataBaseContext.Query <User>().Where(u => u.EmailAddress == userEmailAddress).FirstOrDefault(); otherCode.UserDisplayName = user.DisplayName; otherCode.userid = user.ID; otherCode.CreationDate = System.DateTime.Now; otherCode.FrequentSearchedCount = 0; List <UtilityUserRoles> Reviewers = new List <UtilityUserRoles>(); Reviewers = _commonDataBaseContext.Query <UtilityUserRoles>().Where(u => u.UtilityId == 4 && u.RoleId == 371).ToList(); List <OtherCode> OtherCodeList = new List <OtherCode>(); OtherCodeList = _extensionCodeService.GetAllOtherCodeList(); var lastItem = OtherCodeList.LastOrDefault(); UtilityUserRoles SelectedReviewer = new UtilityUserRoles(); for (int i = 0; i < Reviewers.Count(); i++) { if (i == Reviewers.Count - 1 || lastItem.reviewerid == 0) { SelectedReviewer = Reviewers[0]; break; } else { if (lastItem.reviewerid == Reviewers[i].UserId) { i = i + 1; SelectedReviewer = Reviewers[i]; break; } } } User reviewer = new User(); reviewer = _commonDataBaseContext.Query <User>().Where(u => u.ID == SelectedReviewer.UserId).FirstOrDefault(); otherCode.reviewerid = SelectedReviewer.UserId; _extensionCodeService.AddOtherCode(otherCode); var reviewerEmailAddresses = reviewer.EmailAddress; var subject = "Review Request for the Other Usefull Code."; var userName = user.DisplayName; var codeType = "Other Usefull Code"; var link = "https://reusable.azurewebsites.net/Extension/ReviewOtherCodeList"; //_extensionCodeService.SendEmail(userName, reviewerEmailAddresses, subject, codeType ,link); Task.Factory.StartNew(() => { _extensionCodeService.SendEmail(userName, reviewerEmailAddresses, subject, codeType, link); }); return(RedirectToAction("ShowMyOtherCode")); } catch (DbUpdateException ex) { ViewBag.message = "Category Name already exists"; return(View(ex)); } catch (Exception e) { ViewBag.message = "there is a problem" + e; return(View()); } }