public static List <ArtifactModel> GetPersonsNames() { List <ArtifactModel> personsNames = new List <ArtifactModel>(); SqlConnection con = new SqlConnection(GetConnectionString()); string sel = "SELECT * " + "FROM tblPersons"; SqlCommand cmd = new SqlCommand(sel, con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection); int i = 0; while (rdr.Read()) { ArtifactModel a = new ArtifactModel(); //Person p = new Person(); a.Id = i++; a.Name = rdr["Name"].ToString(); a.IfChecked = false; //p.Mother = rdr["Mother"].ToString(); //p.Father = rdr["Father"].ToString(); //p.MaidenName = rdr["MaidenName"].ToString(); //p.BloodLine = rdr["BloodLine"].ToString(); //p.Description = rdr["Description"].ToString(); personsNames.Add(a); } rdr.Close(); return(personsNames); }
/// <summary> /// Edit is for Admin or Relase Officer only, otherwise go through Index to /// determain which view they should see. /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Edit(int?id) { if (!id.HasValue || !Current.IsReleaseOfficer) { return(RedirectToAction("Index", new { id })); } var model = new ArtifactModel(id.Value, string.Empty); return(View(model)); }
public ActionResult Index(int?id) { if (!id.HasValue) { return(RedirectToAction("Index", "Home")); } var model = new ArtifactModel(id.Value, string.Empty); return(View(model)); }
/// <summary> /// /// </summary> /// <param name="id">Sort Main Id</param> /// <param name="st">Selected Tab</param> /// <returns></returns> public ActionResult Edit(int?id, string st) { if (!id.HasValue) { return(RedirectToAction("Index", "Home")); } var model = new ArtifactModel(id.Value, st); if (!model.UserHasWriteAccess) { return(RedirectToAction("Index", "Artifact", new { id })); } return(View(model)); }
public ActionResult Index(int?id) { if (id.HasValue && id.Value > 0) { var model = new ArtifactModel(id.Value, string.Empty); if (model.Main != null && (model.Main.StatusEnum == StatusEnum.New || model.Main.StatusEnum == StatusEnum.InPeerReview || model.Main.StatusEnum == StatusEnum.ReviewNotRequired) && model.Main.UserHasWriteAccess()) { return(View("Edit", model)); } return(View(model)); } return(View("Add", new ArtifactModel())); }