Пример #1
0
 public ActionResult Create(Election Model)
 {
     ViewData["ElectionTypes"] = Globals.GetElectionTypes();
     if (Model != null)
     {
         if (!string.IsNullOrEmpty(Model.Name))
         {
             if (!m_merkezDC.Elections.Any(x => x.Name == Model.Name))
             {
                 Model.CreatedAt = DateTime.Now;
                 Model.CreatedBy = User.Identity.Name;
                 m_merkezDC.Elections.InsertOnSubmit(Model);
                 m_merkezDC.SubmitChanges();
                 for (int i = 1; i < 5; i++)
                 {
                     var process = new ElectionDetail();
                     process.StartDate = Convert.ToDateTime(Request.Form["StartDate"]);
                     process.FinishDate = Convert.ToDateTime(Request.Form["FinishDate"]);
                     process.ElectionId = Model.ElectionId;
                     process.StatusId = i;
                     process.StartedBy = User.Identity.Name;
                     process.FinishedBy = User.Identity.Name;
                     process.ActionDate = DateTime.Now;
                     m_merkezDC.ElectionDetails.InsertOnSubmit(process);
                 }
                 m_merkezDC.SubmitChanges();
                 ViewData["Message"] = "Seçim Başarıyla Eklendi Süreçlerinin Yönetmek İçin Lütfen Aşağıdaki Ekranı Kullanınız.";
                 return RedirectToAction("ManageElectionProcess", new { Model.ElectionId });
             }
             else
             {
                 ViewData["Message"] = "Aynı İsimle Yalnızca Bir Adet Seçim Eklenebilir.";
             }
         }
     }
     return View();
 }
Пример #2
0
 partial void DeleteElectionDetail(ElectionDetail instance);
Пример #3
0
 partial void UpdateElectionDetail(ElectionDetail instance);
Пример #4
0
 partial void InsertElectionDetail(ElectionDetail instance);
Пример #5
0
		private void detach_ElectionDetails(ElectionDetail entity)
		{
			this.SendPropertyChanging();
			entity.Election = null;
		}
Пример #6
0
		private void attach_ElectionDetails(ElectionDetail entity)
		{
			this.SendPropertyChanging();
			entity.ElectionStatus = this;
		}
Пример #7
0
        public ActionResult ManageElectionProcess(ElectionDetail Model)
        {
            if (Model != null)
            {
                ViewData["ElectionStatus"] = Globals.GetElectionStatusById(Model.ElectionId.Value);
                Model.ActionDate = DateTime.Now;
                Model.FinishedBy = User.Identity.Name;
                Model.StartedBy = User.Identity.Name;

                m_merkezDC.ElectionDetails.InsertOnSubmit(Model);
                m_merkezDC.SubmitChanges();
                var electionDetials = m_merkezDC.VElectionDetails.Where(x => x.ElectionId == Model.ElectionId).ToList();
                ViewData["ElectionDetails"] = electionDetials;
                ViewData["MinDate"] = electionDetials[4].FinishDate.Value.ToString("yyyy-MM-dd HH:mm");

            }
            return View(Model);
        }
Пример #8
0
        public ActionResult ManageElectionProcess(int ElectionId = 0)
        {
            if (ElectionId != 0)
            {
                try
                {
                    var model = new ElectionDetail();
                    model.ElectionId = ElectionId;
                    var electionDetials = m_merkezDC.VElectionDetails.Where(x => x.ElectionId == ElectionId).ToList();
                    ViewData["ElectionDetails"] = electionDetials;
                    ViewData["ElectionStatus"] = Globals.GetElectionStatusById(ElectionId);
                    ViewData["MinDate"] = electionDetials.Last().FinishDate.Value.ToString("yyyy-MM-dd HH:mm");
                    return View(model);
                }
                catch (Exception)
                {
                }

            }
            return View();
        }