示例#1
0
        public ActionResult SubjectEdit1(Subject model)
        {
            var customeraddress = new MessagingContacts();
            var transDesc = _repository.Find<TransactionType>(Guid.Parse(model.TransactionDescription));
            try
            {
                Subject editSubject = _repository.Find<Subject>(model.Id);
                if (ModelState.IsValid)
                {
                    editSubject.Description = model.Description;
                    editSubject.Intro = model.Intro;
                    editSubject.Salutation = model.Salutation;
                    editSubject.Footer = model.Footer;
                    editSubject.TransactionTypeId = transDesc.Id;
                    editSubject.TransactionDescription = transDesc.TransactionDescription;
                    editSubject.Maker = User.Identity.GetUserName();
                    editSubject.Status = MyEnums.StatusOptions.Added;
                    _repository.SaveUpdate(editSubject);
                    getVals.LogAudit(User.Identity.GetUserName(), "Edited", Request.UserHostName, "Edited Notification Email Structure" + model.Description, "Edit", "Messaging");
                }

                return RedirectToAction("SubjectIndex", new { id = editSubject.ProductTypeId });
            }
            catch (Exception ex)
            {
                _logs.LogError(User.Identity.GetUserName(), "SubjectEdit", "Error: " + ex.Message,
                Request.ServerVariables["REMOTE_ADDR"], HttpContext.Server.MapPath("."), "Messaging");

                System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath("~/errorLOG.txt"), System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
                System.IO.StreamWriter s = new System.IO.StreamWriter(fs);
                s.BaseStream.Seek(0, System.IO.SeekOrigin.End);
                s.WriteLine("ERROR DATE: " + System.DateTime.Now.ToString(System.Globalization.CultureInfo.InvariantCulture) + " \nERROR MESSAGE: " + ex.Message + "\nSOURCE: " + ex.Source + "\nFORM NAME: " + System.Web.HttpContext.Current.Request.Url.ToString() + "\nQUERYSTRING: " + Request.QueryString.ToString() + "\nTARGETSITE: " + ex.TargetSite.ToString() + "\nSTACKTRACE: " + ex.StackTrace + System.Diagnostics.EventLogEntryType.Error);
                s.WriteLine("-------------------------------------------------------------------------------------------------------------");
                s.Close();

                return View();
            }
        }
示例#2
0
 public ActionResult SubjectEdit(Guid id)
 {
     //Get the User to Edit
     var editAddresses = _repository.Find<Subject>(id); ;
     var editViewModel = new Subject();
     editViewModel.Description = editAddresses.Description;
     editViewModel.Intro = editAddresses.Intro;
     editViewModel.Salutation = editAddresses.Salutation;
     editViewModel.Footer = editAddresses.Footer;
     editViewModel.Id = editAddresses.Id;
     editViewModel.ProductTypeId = editAddresses.ProductTypeId;
     return View(editViewModel);
 }
示例#3
0
 public ActionResult SubjectEdit1(Guid id)
 {
     var listSelectListItems = new List<SelectListItem>();
     var trans = _repository.Fetch<TransactionType>();
     foreach (var n in trans)
     {
         var selectList = new SelectListItem()
         {
             Text = n.TransactionDescription,
             Value = n.Id.ToString()
         };
         listSelectListItems.Add(selectList);
     }
     //Get the User to Edit
     var editAddresses = _repository.Find<Subject>(id); ;
     var editViewModel = new Subject();
     editViewModel.Description = editAddresses.Description;
     editViewModel.Intro = editAddresses.Intro;
     editViewModel.Salutation = editAddresses.Salutation;
     editViewModel.Footer = editAddresses.Footer;
     editViewModel.Id = editAddresses.Id;
     editViewModel.ProductTypeId = editAddresses.ProductTypeId;
     editViewModel.TransDesc = listSelectListItems;
     editViewModel.TransactionTypeId = editAddresses.TransactionTypeId;
     editViewModel.TransactionDescription = editAddresses.TransactionDescription;
     return View(editViewModel);
 }
示例#4
0
 public ActionResult SubjectCreate1()
 {
     var listSelectListItems = new List<SelectListItem>();
     var trans = _repository.Fetch<TransactionType>();
     foreach (var n in trans)
     {
         var selectList = new SelectListItem()
         {
             Text = n.TransactionDescription,
             Value = n.Id.ToString()
         };
         listSelectListItems.Add(selectList);
     }
     var desc = new Subject();
     desc.TransDesc = listSelectListItems;
     return View(desc);
 }