Ejemplo n.º 1
0
        public ActionResult VoterLogin(VoterInfo model)
        {
            var dataItem = db.VoterInfoes.FirstOrDefault(x => x.VoterId == model.VoterId && x.VFirstName == model.VFirstName && x.VLastName == model.VLastName);

            if (dataItem != null)
            {
                var DBModel = new LogUpdate();
                DBModel.Date       = DateTime.Today.ToString("G");
                DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
                DBModel.Access     = "UCVoterLogin";
                DBModel.Actual_SQL = "Select * from VoterInfo where VoterID and Last Name and First name match search";
                DBModel.TableName  = "VoterInfo";
                db.LogUpdates.Add(DBModel);
                db.SaveChanges();

                Session["voterName"] = dataItem.VFirstName;
                Session["voterID"]   = dataItem.VoterId;

                return(RedirectToAction("Index", "VoterContactInfoes", new { search = (int)Session["voterID"] }));
            }
            else
            {
                ModelState.AddModelError("", "Invalid login information");
                return(View());
            }
        }
Ejemplo n.º 2
0
        public static string GetPercentage(LogUpdate i)
        {
            var total = i.LogUpdateSteps.Count();
            var count = i.LogUpdateSteps.Where(x => x.Progress == "Done" || x.Progress == "Skip").Count();

            return(string.Format("{0:0.0%}", (float)count / total));
        }
Ejemplo n.º 3
0
        private async Task UpdateLogFromMessage(FahClientMessage message)
        {
            bool messageIsLogRestart = message.Identifier.MessageType == FahClientMessageType.LogRestart;

            if (messageIsLogRestart)
            {
                SetupLogAssetsForLogRestart();
            }

            var logUpdate = LogUpdate.Load(message.MessageText);

            if (LogIsRetrieved)
            {
                await UpdateLogAssetsFromStringBuilder(logUpdate.Value, FileMode.Append).ConfigureAwait(false);
            }
            else
            {
                AppendToLogBuffer(logUpdate.Value);
                if (message.MessageText.Length < UInt16.MaxValue)
                {
                    await UpdateLogAssetsFromStringBuilder(LogBuffer, FileMode.Create).ConfigureAwait(false);

                    LogBuffer = null;
                }
            }
        }
Ejemplo n.º 4
0
        public ActionResult Index(string searchString)
        {
            string        test            = (string)Session["userRole"];
            List <string> acceptableRoles = new List <string> {
                "DBA"
            };

            if (!acceptableRoles.Contains(test))
            {
                Response.Redirect("~/Login/Login");
            }

            var content = from a in db.LogUpdates
                          select a;

            var DBModel = new LogUpdate();

            DBModel.Date       = DateTime.Today.ToString("G");
            DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
            DBModel.Access     = "UCViewLog";
            DBModel.Actual_SQL = "Select * from LogUpdate";
            DBModel.TableName  = "Audit Log Table";
            db.LogUpdates.Add(DBModel);
            db.SaveChanges();

            if (!String.IsNullOrEmpty(searchString))
            {
                content = content.Where(s => s.Date.Contains(searchString));
            }

            return(View(content));
        }
Ejemplo n.º 5
0
        public async Task <ActionResult> Create([Bind(Include = "UserId,FirstName,LastName,MiddleName,Role,County,District,Email,Phone,Party,AssignedUsername,AssignedPassword")] User user)
        {
            string        test            = (string)Session["userRole"];
            List <string> acceptableRoles = new List <string> {
                "DBA"
            };

            if (!acceptableRoles.Contains(test))
            {
                Response.Redirect("~/Login/Login");
            }
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                await db.SaveChangesAsync();

                var DBModel = new LogUpdate();
                DBModel.Date       = DateTime.Today.ToString("G");
                DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
                DBModel.Access     = "UCCreateUser";
                DBModel.Actual_SQL = "Insert into users Values";
                DBModel.TableName  = "Users Table";
                db.LogUpdates.Add(DBModel);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
Ejemplo n.º 6
0
        // GET: Users/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            string        test            = (string)Session["userRole"];
            List <string> acceptableRoles = new List <string> {
                "DBA"
            };

            if (!acceptableRoles.Contains(test))
            {
                Response.Redirect("~/Login/Login");
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            User user = await db.Users.FindAsync(id);

            if (user == null)
            {
                return(HttpNotFound());
            }

            var DBModel = new LogUpdate();

            DBModel.Date       = DateTime.Today.ToString("G");
            DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
            DBModel.Access     = "UCUpdateUsers";
            DBModel.Actual_SQL = "Select * from users where id = search id";
            DBModel.TableName  = "Users Table";
            db.LogUpdates.Add(DBModel);
            db.SaveChanges();

            return(View(user));
        }
Ejemplo n.º 7
0
        protected virtual LogUpdate ToUpdateModel(TimerBaseInformation info, int maxLength)
        {
            var model = new LogUpdate
            {
                Identifier = info.Identifier,
                Elapsed    = info.GetElapsed()
            };

            if (IncludeHigh)
            {
                foreach (var(key, value) in info.HighProperties)
                {
                    model.Other.Add(key, value.ShortenWithEllipses(maxLength));
                }
            }

            if (IncludeMed)
            {
                foreach (var(key, value) in info.MedProperties)
                {
                    model.Other.Add(key, value.ShortenWithEllipses(maxLength));
                }
            }

            // ReSharper disable once InvertIf
            if (IncludeLow)
            {
                foreach (var(key, value) in info.LowProperties)
                {
                    model.Other.Add(key, value.ShortenWithEllipses(maxLength));
                }
            }

            return(model);
        }
        public async Task <ActionResult> Edit([Bind(Include = "contactId,Phone,VoteEmail,PublicEmail")] VoterContactInfo voterContactInfo)
        {
            if (ModelState.IsValid)
            {
                VoterContactInfo v = new VoterContactInfo {
                    contactId = voterContactInfo.contactId
                };
                db.VoterContactInfoes.Attach(v);

                v.Phone       = voterContactInfo.Phone;
                v.VoteEmail   = voterContactInfo.VoteEmail;
                v.PublicEmail = voterContactInfo.PublicEmail;

                await db.SaveChangesAsync();

                var DBModel = new LogUpdate();
                DBModel.Date       = DateTime.Today.ToString("G");
                DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
                DBModel.Access     = "UCUpdateVoter";
                DBModel.Actual_SQL = "Insert into table values where voterID = searchID";
                DBModel.TableName  = "VoterContactInfo List";
                db.LogUpdates.Add(DBModel);
                db.SaveChanges();

                return(RedirectToAction("Index", new { search = Session["voterIDSearch"] }));
            }
            return(View(voterContactInfo));
        }
Ejemplo n.º 9
0
        public async Task <ActionResult> StartUpdate(LogUpdate updateChecklist)
        {
            var checklist = await _repo.UpdateExists(updateChecklist);

            if (checklist != null)
            {
                return(BadRequest($"{updateChecklist.Process} {updateChecklist.SiteKml} already exists. Please Try again"));
            }
            updateChecklist.StartTime = DateTime.Now;
            updateChecklist.Status    = "In Progress";
            _repo.Add(updateChecklist);
            var steps = await _repo.GetSteps(updateChecklist.Idchecklist, updateChecklist.Version);

            foreach (var s in steps)
            {
                var step = new LogUpdateSteps
                {
                    Step     = s.Step,
                    StepText = s.StepText,
                    Title    = s.Title,
                    Idupdate = updateChecklist.Idupdate
                };

                _repo.Add(step);
            }
            if (await _repo.SaveAll())
            {
                return(CreatedAtAction("GetUpdate", new { id = updateChecklist.Idupdate }, updateChecklist));
            }

            return(BadRequest("Failed to Create Update"));
        }
Ejemplo n.º 10
0
 public void CBLogInvoke(LogUpdate LogDelegate)//委托器
 {
     if (this.InvokeRequired)
     {
         this.Invoke(LogDelegate);
     }
     else
     {
         LogUpdateWindow();
     }
 }
Ejemplo n.º 11
0
        public ActionResult Index(string party, string race)
        {
            string        test            = (string)Session["userRole"];
            List <string> acceptableRoles = new List <string> {
                "PA", "BCC", "SO", "SE", "DSB", "V", "CC", "TC", "SS", "DBA"
            };

            if (!acceptableRoles.Contains(test))
            {
                Response.Redirect("~/Login/Login");
            }

            var content = from a in db.VoterPhoneLists
                          select a;

            var DBModel = new LogUpdate();

            DBModel.Date       = DateTime.Today.ToString("G");
            DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
            DBModel.Access     = "UCVoterPhoneList";
            DBModel.Actual_SQL = "Select * from view (where criteria are met)";
            DBModel.TableName  = "VoterPhone List";
            db.LogUpdates.Add(DBModel);
            db.SaveChanges();

            if (!String.IsNullOrEmpty(party) && !String.IsNullOrEmpty(race))
            {
                content = content.Where(
                    s =>
                    (s.party.Contains(party)) &&
                    (s.description.Contains(race))
                    );
            }
            else if (!String.IsNullOrEmpty(party) && String.IsNullOrEmpty(race))
            {
                content = content.Where(
                    s =>
                    (s.party.Contains(party))
                    );
            }
            else if (String.IsNullOrEmpty(party) && !String.IsNullOrEmpty(race))
            {
                content = content.Where(
                    s =>
                    (s.description.Contains(race))
                    );
            }

            Session["content"] = content.ToList <VoterPhoneList>();


            return(View(content));
        }
Ejemplo n.º 12
0
        protected override Task DoUpdate(LogUpdate model, TimerBaseInformation info, int maxLength)
        {
            var subject = $"[{model.Identifier}] Completed";
            var body    = $@"
{info.Type} Complete!
{info.IdentifierStr}
{info.GetElapsedStr()}
{string.Join("\r\n", model.Other)}
";

            return(Email.SendAsync(EmailImpl, EmailType.Logging, subject, body));
        }
        public ActionResult Index(string search)
        {
            Session["voterIDSearch"] = search;
            string        test            = null;
            List <string> acceptableRoles = new List <string> {
                "V", "DBA"
            };
            int?voterid = null;

            if (Session["userRole"] != null)
            {
                test = (string)Session["userRole"];
            }
            if (Session["voterID"] != null)
            {
                voterid = (int)Session["voterID"];
            }

            if (!acceptableRoles.Contains(test) && voterid == null)
            {
                Response.Redirect("~/Login/VoterLogin");
            }

            var content = from a in db.VoterContactInfoes
                          select a;

            var DBModel = new LogUpdate();

            DBModel.Date       = DateTime.Today.ToString("G");
            DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
            DBModel.Access     = "UCVoterContactInfo";
            DBModel.Actual_SQL = "Select * from table";
            DBModel.TableName  = "VoterContactInfo List";
            db.LogUpdates.Add(DBModel);
            db.SaveChanges();

            if (!String.IsNullOrEmpty(search))
            {
                int searchInt = Int32.Parse(search);
                content = content.Where(s => s.VoterId == searchInt);
            }
            else
            {
                content = null;
            }


            return(View(content));
        }
        // GET: VoterContactInfoes/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            string        test            = null;
            List <string> acceptableRoles = new List <string> {
                "V", "DBA"
            };
            int?voterid = null;

            if (Session["userRole"] != null)
            {
                test = (string)Session["userRole"];
            }
            if (Session["voterID"] != null)
            {
                voterid = (int)Session["voterID"];
            }

            if (!acceptableRoles.Contains(test) && voterid == null)
            {
                Response.Redirect("~/Login/VoterLogin");
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VoterContactInfo voterContactInfo = await db.VoterContactInfoes.FindAsync(id);

            var DBModel = new LogUpdate();

            DBModel.Date       = DateTime.Today.ToString("G");
            DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
            DBModel.Access     = "UCUpdateVoter";
            DBModel.Actual_SQL = "Select * from table where voterId is searchID";
            DBModel.TableName  = "VoterContactInfo List";
            db.LogUpdates.Add(DBModel);
            db.SaveChanges();

            if (voterContactInfo == null)
            {
                return(HttpNotFound());
            }

            return(View(voterContactInfo));
        }
Ejemplo n.º 15
0
        public ActionResult Index(string party, string race)
        {
            var content = from a in db.VoterEmailLists
                          select a;

            var DBModel = new LogUpdate();

            DBModel.Date       = DateTime.Today.ToString("G");
            DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
            DBModel.Access     = "UCVoterEmailList";
            DBModel.Actual_SQL = "Select * from view (where criteria are met)";
            DBModel.TableName  = "VoterEmail List";
            db.LogUpdates.Add(DBModel);
            db.SaveChanges();

            if (!String.IsNullOrEmpty(party) && !String.IsNullOrEmpty(race))
            {
                content = content.Where(
                    s =>
                    (s.party.Contains(party)) &&
                    (s.description.Contains(race))
                    );
            }
            else if (!String.IsNullOrEmpty(party) && String.IsNullOrEmpty(race))
            {
                content = content.Where(
                    s =>
                    (s.party.Contains(party))
                    );
            }
            else if (String.IsNullOrEmpty(party) && !String.IsNullOrEmpty(race))
            {
                content = content.Where(
                    s =>
                    (s.description.Contains(race))
                    );
            }

            Session["content"] = content.ToList <VoterEmailList>();

            return(View(content));
        }
Ejemplo n.º 16
0
        public async Task <ActionResult> Create([Bind(Include = "T_ID,T_Date,T_Content")] Testimonial testimonial)
        {
            if (ModelState.IsValid)
            {
                db.Testimonials.Add(testimonial);
                await db.SaveChangesAsync();

                var DBModel = new LogUpdate();
                DBModel.Date       = DateTime.Today.ToString("G");
                DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
                DBModel.Access     = "UCAddTestimonial";
                DBModel.Actual_SQL = "Insert into testimonials Values";
                DBModel.TableName  = "Testimonials Table";
                db.LogUpdates.Add(DBModel);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(testimonial));
        }
Ejemplo n.º 17
0
        // GET: Testimonials
        public ActionResult Index(string searchString)
        {
            var content = from a in db.Testimonials
                          select a;

            var DBModel = new LogUpdate();

            DBModel.Date       = DateTime.Today.ToString("G");
            DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
            DBModel.Access     = "UCSearchTestimonials";
            DBModel.Actual_SQL = "Select * from testimonials table";
            DBModel.TableName  = "Testimonials";
            db.LogUpdates.Add(DBModel);
            db.SaveChanges();

            if (!String.IsNullOrEmpty(searchString))
            {
                content = content.Where(s => s.T_Content.Contains(searchString));
            }

            return(View(content));
        }
Ejemplo n.º 18
0
        // GET: Users
        public async Task <ActionResult> Index()
        {
            string        test            = (string)Session["userRole"];
            List <string> acceptableRoles = new List <string> {
                "DBA"
            };

            if (!acceptableRoles.Contains(test))
            {
                Response.Redirect("~/Login/Login");
            }

            var DBModel = new LogUpdate();

            DBModel.Date       = DateTime.Today.ToString("G");
            DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"]: (string)Session["userRole"];
            DBModel.Access     = "UCViewUsers";
            DBModel.Actual_SQL = "Select * From Users";
            DBModel.TableName  = "Users Table";
            db.LogUpdates.Add(DBModel);
            db.SaveChanges();

            return(View(await db.Users.ToListAsync()));
        }
Ejemplo n.º 19
0
 protected override Task DoUpdate(LogUpdate model, TimerBaseInformation info, int maxLength)
 {
     Debug.WriteLine(info.Message, $"{info.CategoryStr} {info.GetElapsedStr()}");
     WriteOther(model.Other);
     return(Task.CompletedTask);
 }
Ejemplo n.º 20
0
        private void _logWrapper_OnLoggingEvent(object sender, LogEventArgs e)
        {
            var del = new LogUpdate(UpdateLogList);

            Dispatcher.Invoke(del, e.Level, e.Name, e.Text);
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Actual implementation of updating a logged record
 /// </summary>
 /// <param name="model">The model containing everything to be logged</param>
 /// <param name="info">The log information class</param>
 /// <param name="maxLength">When to truncate items</param>
 protected abstract Task DoUpdate(LogUpdate model, TimerBaseInformation info, int maxLength);
Ejemplo n.º 22
0
        public async Task <LogUpdate> UpdateExists(LogUpdate update)
        {
            var updateExist = await _ctx.LogUpdate.Where(x => x.ProdLine == update.ProdLine && x.SiteKml == update.SiteKml && x.UpdateNum == update.UpdateNum && x.System == update.System && x.Process == update.Process && x.Idchecklist == update.Idchecklist && x.Status != "Cancelled").FirstOrDefaultAsync();

            return(updateExist);
        }
Ejemplo n.º 23
0
        public ActionResult Login(User model)
        {
            var dataItem = db.Users.FirstOrDefault(x => x.AssignedUsername == model.AssignedUsername && x.AssignedPassword == model.AssignedPassword);

            if (dataItem != null)
            {
                var DBModel = new LogUpdate();
                DBModel.Date       = DateTime.Today.ToString("G");
                DBModel.Who        = !String.IsNullOrEmpty((string)Session["userName"]) ? (string)Session["UserName"] : (string)Session["userRole"];
                DBModel.Access     = "UCLogin";
                DBModel.Actual_SQL = "Select * from users table where username and password match";
                DBModel.TableName  = "Users Table";
                db.LogUpdates.Add(DBModel);
                db.SaveChanges();

                Session["userFirstName"]  = dataItem.FirstName;
                Session["userMiddleName"] = dataItem.MiddleName;
                Session["userLastName"]   = dataItem.LastName;
                Session["userRole"]       = dataItem.Role;
                switch (dataItem.Role)
                {
                case "CC":
                    Session["userTitle"] = "Clerk Of Court";
                    break;

                case "PA":
                    Session["userTitle"] = "Property Appraiser";
                    break;

                case "SO":
                    Session["userTitle"] = "Sherriff's Office";
                    break;

                case "SE":
                    Session["userTitle"] = "Supervisor of Elections";
                    break;

                case "TC":
                    Session["userTitle"] = "Tax Collector";
                    break;

                case "SS":
                    Session["userTitle"] = "School Superintendent";
                    break;

                case "BCC":
                    Session["userTitle"] = "Board of County Commissioners";
                    break;

                case "DSB":
                    Session["userTitle"] = "District School Board";
                    break;

                case "CS":
                    Session["userTitle"] = "Customer Service";
                    break;

                case "V":
                    Session["userTitle"] = "Volunteer";
                    break;

                case "DBA":
                    Session["userTitle"] = "Database Administrator";
                    break;
                }
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("", "Invalid user or password");
                return(View());
            }
        }