public ActionResult SnapFilePost() { var urls = GetShareFileUrls(); foreach (var url in urls) { var owener = MachineUserMap.GetUseNameByIP(Request.UserHostName); var sharetolist = Request.Form["shareto"].Split(new string[] { ",", ";", " " }, StringSplitOptions.RemoveEmptyEntries).ToList(); var tag = Request.Form["taglist"]; var docid = Guid.NewGuid().ToString("N"); var now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); foreach (var s in sharetolist) { SnapFileVM.StoreData(docid, owener, s.Trim().ToUpper(), url, tag, now); } var sharefilename = Path.GetFileNameWithoutExtension(Server.MapPath("~" + url)); var towho = new List <string>(); foreach (var s in sharetolist) { towho.Add(s + "@II-VI.COM"); } SendShareDocEmail(towho, owener, sharefilename, docid); } return(RedirectToAction("SnapFile", "FileShare")); }
public ActionResult ReviewDocument(string docid) { var username = MachineUserMap.GetUseNameByIP(Request.UserHostName); if (string.IsNullOrEmpty(username)) { return(View("Welcome")); } if (string.IsNullOrEmpty(docid)) { return(View("ReviewError")); } var filelist = SnapFileVM.RetrieveFileByID(docid, username); if (filelist.Count == 0) { return(View("ReviewError")); } if (CheckIE()) { return(View("ReviewIEError")); } var url = filelist[0].FileAddr; ViewBag.DocTitle = Path.GetFileNameWithoutExtension(Server.MapPath("~" + url)); ViewBag.Url = url; return(View()); }
private void UserAuth() { string IP = Request.UserHostName; var compName = DetermineCompName(IP); ViewBag.compName = compName.ToUpper(); var glbcfg = CfgUtility.GetSysConfig(this); var usermap = MachineUserMap.RetrieveUserMap(); foreach (var item in usermap) { if (!glbcfg.ContainsKey(item.machine)) { glbcfg.Add(item.machine, item.username); } } if (glbcfg.ContainsKey(ViewBag.compName)) { ViewBag.username = glbcfg[ViewBag.compName].Trim().ToUpper(); } else { ViewBag.username = ViewBag.compName; } }
public JsonResult UpdateMachineUserName() { var compName = DetermineCompName(Request.UserHostName); var username = Request.Form["username"].ToUpper().Trim(); MachineUserMap.AddMachineUserMap(compName, username); var ret = new JsonResult(); ret.Data = new { sucess = true }; return(ret); }
public JsonResult ShareToList() { var dict = MachineUserMap.RetrieveUserMap(); var ret = new JsonResult(); ret.Data = new { sharetolist = dict.Values.ToList() }; return(ret); }
public JsonResult UpdateMachineUserName() { UserAuth(); var username = Request.Form["username"].ToUpper().Trim().Replace("@FINISAR.COM", ""); MachineUserMap.UpdateMachineUserMap(ViewBag.compName, username); var ret = new JsonResult(); ret.Data = new { sucess = true }; return(ret); }
public JsonResult RetrieveShareDocuments() { var username = MachineUserMap.GetUseNameByIP(Request.UserHostName); var doclist = SnapFileVM.RetrieveFileListByOwner(username); foreach (var item in doclist) { item.FileAddr = Path.GetFileNameWithoutExtension(Server.MapPath("~" + item.FileAddr)); } var ret = new JsonResult(); ret.Data = new { doclist = doclist }; return(ret); }
public ActionResult SnapFile() { var username = MachineUserMap.GetUseNameByIP(Request.UserHostName); if (string.IsNullOrEmpty(username)) { return(RedirectToAction("Welcome", "FileShare")); } if (CheckIE()) { return(View("ReviewIEError")); } var syscfg = CfgUtility.GetSysConfig(this); var tags = syscfg["SNAPFILETAGS"].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries).ToList(); ViewBag.taglist = CreateSelectList(tags, ""); return(View()); }
private void UserAuth() { string IP = Request.UserHostName; var compName = DetermineCompName(IP); ViewBag.compName = compName.ToUpper(); var glbcfg = CfgUtility.GetSysConfig(this); var usermap = MachineUserMap.RetrieveUserMap(); if (usermap.ContainsKey(ViewBag.compName)) { ViewBag.username = usermap[ViewBag.compName].Trim().ToUpper(); if (glbcfg["VideoAdmin"].ToUpper().Contains(ViewBag.username)) { ViewBag.VideoAdmin = true; } } else { ViewBag.username = ViewBag.compName; } }
// GET: SmartLinks public ActionResult All() { ViewBag.isie8 = false; ViewBag.showie8modal = false; var browse = Request.Browser; if (string.Compare(browse.Browser, "IE", true) == 0 && (string.Compare(browse.Version, "7.0", true) == 0 || string.Compare(browse.Version, "8.0", true) == 0)) { ViewBag.isie8 = true; } //var logonnames = Request.LogonUserIdentity.Name; //if (!string.IsNullOrEmpty(logonnames)) //{ // var splitnames = logonnames.Split(new string[] { "/", "\\" }, StringSplitOptions.RemoveEmptyEntries); // ViewBag.logonname = splitnames[splitnames.Length - 1]; //} var machine = string.Empty; var ckdict = CookieUtility.UnpackCookie(this); if (!ckdict.ContainsKey("reqmachine")) { string IP = Request.UserHostName; string compName = DetermineCompName(IP); if (!string.IsNullOrEmpty(compName)) { var tempdict = new Dictionary <string, string>(); tempdict.Add("reqmachine", compName); CookieUtility.SetCookie(this, tempdict); machine = compName.ToUpper(); } //end if } //end else { machine = ckdict["reqmachine"].ToUpper(); } ViewBag.logonname = machine; var mudict = MachineUserMap.RetrieveUserMap(machine); if (mudict.ContainsKey(machine)) { ViewBag.logonname = mudict[machine]; } if (!string.IsNullOrEmpty(machine)) { ViewBag.machine = machine; if (ViewBag.isie8) { if (!MachineLink.IsNeverShowIE8Modal(machine)) { ViewBag.showie8modal = true; } } } return(View()); }
public ActionResult RedirectToLink(string linkname) { var vm = new List <LinkVM>(); var machine = string.Empty; var ckdict = CookieUtility.UnpackCookie(this); if (!ckdict.ContainsKey("reqmachine")) { string IP = Request.UserHostName; string compName = DetermineCompName(IP); if (!string.IsNullOrEmpty(compName)) { var tempdict = new Dictionary <string, string>(); tempdict.Add("reqmachine", compName); machine = compName.ToUpper(); CookieUtility.SetCookie(this, tempdict); } //end if vm = LinkVM.RetrieveLinks(); } //end else { vm = RetrieveAllLinks(ckdict["reqmachine"]); machine = ckdict["reqmachine"].ToUpper(); } var validlink = string.Empty; foreach (var item in vm) { if (string.Compare(linkname, item.LinkName) == 0) { validlink = item.Link; if (!string.IsNullOrEmpty(machine)) { MachineLink.UpdateFrequence(item.LinkName, item.Link, item.Logo, item.Comment, machine); } break; } } if (!string.IsNullOrEmpty(validlink)) { //var logonnames = Request.LogonUserIdentity.Name; //if (!string.IsNullOrEmpty(logonnames)) //{ // var splitnames = logonnames.Split(new string[] { "/", "\\" }, StringSplitOptions.RemoveEmptyEntries); // ViewBag.logonname = splitnames[splitnames.Length - 1]; // LinkVM.UpdateSmartLinkLog(ViewBag.logonname,machine, validlink); //} ViewBag.logonname = machine; var mudict = MachineUserMap.RetrieveUserMap(machine); if (mudict.ContainsKey(machine)) { ViewBag.logonname = mudict[machine]; LinkVM.UpdateSmartLinkLog(ViewBag.logonname, machine, validlink); } if (validlink.Contains("wux-engsys01")) { var now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); var timestamp = now + "_joke"; using (MD5 md5Hash = MD5.Create()) { var smartkey1 = GetMd5Hash(md5Hash, timestamp) + "::" + now; var smartkey2 = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(smartkey1)); var smartkey = HttpUtility.UrlEncode(smartkey2); return(Redirect(validlink + "?smartkey=" + smartkey)); } } else { return(Redirect(validlink)); } } else { return(RedirectToAction("All", "SmartLinks")); } }