public ActionResult UploadPhoto(string name, string refno, DateTime tran_date, int id, HttpPostedFileBase file) { if (file != null) { if (file.FileName.Contains(".jpg") == false) { Session["err"] = "Please Upload .JPG file Only"; return(RedirectToAction("Print", "Documents", new { id = id })); } else { string path = Server.MapPath("~/photo/Documents"); file.SaveAs(path + "/" + id + ".jpg"); ViewData["path"] = id + ".jpg"; using (var db = new SameSoftWeb.Models.SameSoftwareWebEntities()) { var x = db.TblDocuments.Add(new Models.TblDocument { Documents = "/Photo/Documents/" + id + ".jpg", Cust_Name = name, RefNo = refno, Tran_Date = tran_date }); db.SaveChanges(); } } } else { Session["err"] = "No File Selected"; return(RedirectToAction("Print", "Documents", new { id = id })); } return(RedirectToAction("Print", "Documents", new { id = id })); }
public static void addlog(string title, string details, int userid) { SameSoftWeb.Models.SameSoftwareWebEntities db = new SameSoftWeb.Models.SameSoftwareWebEntities(); DateTime dt = DateTime.UtcNow.AddHours(3); db.TblLogs.Add(new Models.TblLog { LogDate = dt, Title = title, Details = details, UserID = userid }); db.SaveChanges(); }
public bool Get_user_Access(int userid) { int UserID = 0; var db = new SameSoftWeb.Models.SameSoftwareWebEntities(); //menulist = db.Get_User_Menu_By_UserID(UserID) // .Select(tc => new Menu_list // { // MenuID = tc.MenuID, // Menu_Name = tc.Menu_Name // }) // .ToList(); return(true); }