コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string rms_record_id = Request.QueryString["rms_record_id"];
            string rms_audit_id  = Request.QueryString["rms_audit_id"];

            //If rms_record_id was passed, then set the RecordID variable and make sure the WSCID and OfficeID are changed to match the RecordIDs office and WSC
            if (!string.IsNullOrEmpty(rms_record_id))
            {
                RecordID   = Convert.ToInt32(rms_record_id);
                currRecord = db.Records.Where(p => p.rms_record_id == RecordID).FirstOrDefault();
                if (currRecord.RecordAltOffice == null)
                {
                    OfficeID = (int)currRecord.Site.office_id;
                }
                else
                {
                    OfficeID = (int)currRecord.RecordAltOffice.alt_office_id;
                }
                WSCID = (int)db.Offices.Where(p => p.office_id == OfficeID).FirstOrDefault().wsc_id;
            }
            else
            {
                RecordID = 0;
            }

            if (!string.IsNullOrEmpty(rms_audit_id))
            {
                AuditID   = Convert.ToInt32(rms_audit_id);
                currAudit = db.Audits.Where(p => p.rms_audit_id == AuditID).FirstOrDefault();
                WSCID     = (int)currAudit.wsc_id;
                OfficeID  = db.Offices.FirstOrDefault(p => p.wsc_id == WSCID).office_id;
            }
            else
            {
                AuditID = 0;
            }

            UserControlSetup();

            if (!Page.IsPostBack)
            {
                //If the user belongs to this site's WSC (or has an exception to work in the WSC), or is a SuperUser, then allow them to edit the page
                if (user.WSCID.Contains(WSCID) || user.IsSuperUser)
                {
                    pnlHasAccess.Visible = true;
                    pnlNoAccess.Visible  = false;

                    InitialView();
                }
                else
                {
                    pnlHasAccess.Visible = false;
                    pnlNoAccess.Visible  = true;
                }
            }
        }
コード例 #2
0
 public static string GetEntryForm(int ShowId, int UserId)
 {
     String moduleSettings = ModuleConfig.GetSettings();
     Data.Audit c = new Data.Audit(moduleSettings);
     DataSet ds = c.GetEntryForm(ShowId, UserId);
     var entryForm = "";
     foreach(DataRow row in ds.Tables[0].Rows)
     {
         entryForm += string.Format("<h2>Entry Created on the {0:dd MMM yyyy}</h2><br>", row["CreatedDate"]);
         entryForm += row[0].ToString();
         entryForm += "<hr />";
     }
     return entryForm;
 }
コード例 #3
0
ファイル: AuditEntry.cs プロジェクト: fphgov/varolista
        public Data.Audit ToAudit()
        {
            var audit = new Data.Audit
            {
                UserId          = UserId,
                Type            = AuditType.ToString(),
                TableName       = TableName,
                DateTime        = DateTime.Now,
                PrimaryKey      = JsonConvert.SerializeObject(KeyValues),
                OldValues       = OldValues.Count == 0 ? null : JsonConvert.SerializeObject(OldValues),
                NewValues       = NewValues.Count == 0 ? null : JsonConvert.SerializeObject(NewValues),
                AffectedColumns = ChangedColumns.Count == 0 ? null : JsonConvert.SerializeObject(ChangedColumns)
            };

            return(audit);
        }
コード例 #4
0
        public static List<TrackUserDto> GetUserEntries(int UserId)
        {
            List<TrackUserDto> trackUserEvents = new List<TrackUserDto>();

            String moduleSettings = ModuleConfig.GetSettings();
            Data.Audit c = new Data.Audit(moduleSettings);
            DataSet ds = c.GetUserEntries(UserId);
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                trackUserEvents.Add(new TrackUserDto {
                    CreatedDate = Convert.ToDateTime(row["CreatedDate"]),
                    AuditText = Convert.ToString(row["AuditText"]),
                    Event = Convert.ToString(row["Event"])
                });
            }
            return trackUserEvents;
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string rms_record_id = Request.QueryString["rms_record_id"];
            string rms_audit_id  = Request.QueryString["rms_audit_id"];
            string office_id     = Request.QueryString["office_id"];

            if (!string.IsNullOrEmpty(office_id))
            {
                OfficeID = Convert.ToInt32(office_id);
                WSCID    = Convert.ToInt32(db.Offices.FirstOrDefault(p => p.office_id == OfficeID).wsc_id);
            }
            else
            {
                //If rms_record_id was passed, then set the RecordID variable and make sure the WSCID and OfficeID are changed to match the RecordIDs office and WSC
                if (!string.IsNullOrEmpty(rms_record_id))
                {
                    RecordID   = Convert.ToInt32(rms_record_id);
                    currRecord = db.Records.Where(p => p.rms_record_id == RecordID).FirstOrDefault();
                    if (currRecord.RecordAltOffice == null)
                    {
                        OfficeID = (int)currRecord.Site.office_id;
                    }
                    else
                    {
                        OfficeID = (int)currRecord.RecordAltOffice.alt_office_id;
                    }
                    WSCID = (int)db.Offices.Where(p => p.office_id == OfficeID).FirstOrDefault().wsc_id;
                }
                else
                {
                    RecordID = 0;
                }

                if (!string.IsNullOrEmpty(rms_audit_id))
                {
                    AuditID   = Convert.ToInt32(rms_audit_id);
                    currAudit = db.Audits.Where(p => p.rms_audit_id == AuditID).FirstOrDefault();
                    WSCID     = (int)currAudit.wsc_id;
                    OfficeID  = db.Offices.FirstOrDefault(p => p.wsc_id == WSCID).office_id;
                }
                else
                {
                    AuditID = 0;
                }
            }

            if (OfficeID == 0 || WSCID == 0)
            {
                OfficeID = user.OfficeID;
                WSCID    = (int)db.Offices.FirstOrDefault(p => p.office_id == OfficeID).wsc_id;
            }
            else if (OfficeID == 0 && WSCID > 0)
            {
                OfficeID = db.Offices.FirstOrDefault(p => p.wsc_id == WSCID).office_id;
            }
            else if (OfficeID > 0 && WSCID == 0)
            {
                WSCID = (int)db.Offices.FirstOrDefault(p => p.office_id == OfficeID).wsc_id;
            }

            if (!Page.IsPostBack)
            {
                UserControlSetup();
            }
        }
コード例 #6
0
ファイル: EntityAccessBase.cs プロジェクト: jochemstoel/EPONS
 internal void WriteManualAudit(SADFMEntities context, Data.Audit audit)
 {
     context.Audits.Add(audit);
 }
コード例 #7
0
        protected void CreateEditAudit(object sender, CommandEventArgs e)
        {
            int audit_type_id, audit_results_id;

            if (!string.IsNullOrEmpty(rddlAuditType.SelectedValue))
            {
                audit_type_id = Convert.ToInt32(rddlAuditType.SelectedValue);
            }
            else
            {
                audit_type_id = 0;
            }
            if (!string.IsNullOrEmpty(rddlAuditResults.SelectedValue))
            {
                audit_results_id = Convert.ToInt32(rddlAuditResults.SelectedValue);
            }
            else
            {
                audit_results_id = 0;
            }
            string audit_reason   = rtbAuditReason.Text;
            string audit_data     = rtbDataAudited.Text;
            string audit_findings = rtbAuditFindings.Text;

            if (audit_type_id == 0 || audit_results_id == 0 || string.IsNullOrEmpty(audit_reason) || string.IsNullOrEmpty(audit_data) || string.IsNullOrEmpty(audit_findings))
            {
                pnlError.Visible = true;
                ltlError.Text    = "You must complete all form fields under the 'Audit the Period' section!";
            }
            else
            {
                DateTime?beg_dt, end_dt;
                if (rdpBeginDt1.SelectedDate != null && hfAuditType.Value == "single")
                {
                    beg_dt = rdpBeginDt1.SelectedDate;
                    end_dt = rdpEndDt1.SelectedDate;
                }
                else if (rdpBeginDt2.SelectedDate != null)
                {
                    beg_dt = rdpBeginDt2.SelectedDate;
                    end_dt = rdpEndDt2.SelectedDate;
                }
                else
                {
                    beg_dt = PeriodDate("begin");
                    end_dt = PeriodDate("end");
                }

                if (e.CommandArgument.ToString() == "Add")
                {
                    Data.Audit new_audit = new Data.Audit()
                    {
                        audit_beg_dt     = beg_dt,
                        audit_end_dt     = end_dt,
                        audit_by         = user.ID,
                        audit_dt         = DateTime.Now,
                        audit_type_id    = audit_type_id,
                        audit_results_id = audit_results_id,
                        audit_reason     = audit_reason,
                        audit_data       = audit_data,
                        audit_findings   = audit_findings,
                        wsc_id           = Convert.ToInt32(WSCID)
                    };
                    db.Audits.InsertOnSubmit(new_audit);
                    db.SubmitChanges();

                    foreach (RadListBoxItem item in rlbViewRecords.Items)
                    {
                        Data.AuditRecord new_audit_rec = new Data.AuditRecord()
                        {
                            rms_audit_id  = new_audit.rms_audit_id,
                            rms_record_id = Convert.ToInt32(item.Value)
                        };
                        db.AuditRecords.InsertOnSubmit(new_audit_rec);
                        db.SubmitChanges();
                    }

                    rbSubmit.CommandArgument = new_audit.rms_audit_id.ToString();

                    //Send out emails to analysts and approvers
                    SendEmail("new", new_audit.rms_audit_id);
                    //Setup the rest of the page
                    pnlError.Visible       = false;
                    pnlNotice.Visible      = false;
                    pnlAuditPeriod.Visible = false;
                    ltlConfirm.Text        = "Audit Period Created!";
                    ltlDone.Text           = "To return and create a new audit period, click the 'Done' button at the bottom of the page.";
                    rbDone.CommandArgument = "stay";
                    pnlUploadDocs.Visible  = true;
                    rlvAuditDocs.Visible   = false;
                    ltlAlert.Text          = "";
                }
                else
                {
                    currAudit.audit_beg_dt     = beg_dt;
                    currAudit.audit_end_dt     = end_dt;
                    currAudit.audit_dt         = DateTime.Now;
                    currAudit.audit_type_id    = audit_type_id;
                    currAudit.audit_results_id = audit_results_id;
                    currAudit.audit_reason     = audit_reason;
                    currAudit.audit_data       = audit_data;
                    currAudit.audit_findings   = audit_findings;
                    currAudit.wsc_id           = Convert.ToInt32(WSCID);

                    db.AuditRecords.DeleteAllOnSubmit(currAudit.AuditRecords);
                    db.SubmitChanges();

                    foreach (RadListBoxItem item in rlbViewRecords.Items)
                    {
                        Data.AuditRecord new_audit_rec = new Data.AuditRecord()
                        {
                            rms_audit_id  = currAudit.rms_audit_id,
                            rms_record_id = Convert.ToInt32(item.Value)
                        };
                        db.AuditRecords.InsertOnSubmit(new_audit_rec);
                        db.SubmitChanges();
                    }

                    rbSubmit.CommandArgument = currAudit.rms_audit_id.ToString();

                    //Send out emails to analysts and approvers
                    SendEmail("edit", currAudit.rms_audit_id);
                    //Setup the rest of the page
                    pnlError.Visible       = false;
                    pnlNotice.Visible      = false;
                    pnlAuditPeriod.Visible = false;
                    ltlConfirm.Text        = "Audit Period Updated!";
                    ltlDone.Text           = "When finished uploading documents, clicking the 'Done' button below will return you to the Audit Report.";
                    rbDone.CommandArgument = "leave";
                    pnlUploadDocs.Visible  = true;
                    //Create the list of uploaded documents
                    rlvAuditDocs.Visible    = true;
                    rlvAuditDocs.DataSource = currAudit.AuditDocuments.Select(p => new { rms_audit_document_id = p.rms_audit_document_id, document_nm = p.document_nm }).OrderBy(p => p.document_nm);
                    rlvAuditDocs.DataBind();
                    ltlAlert.Text = "";
                }
            }
        }
コード例 #8
0
 public static void TrackUserEntry(int UserId, string Event, string AuditText)
 {
     String moduleSettings = ModuleConfig.GetSettings();
     Data.Audit c = new Data.Audit(moduleSettings);
     c.TrackUserEntry(UserId, Event, AuditText);
 }
コード例 #9
0
 public static void Entry(int ShowId, int UserId, string EntryDetails)
 {
     String moduleSettings = ModuleConfig.GetSettings();
     Data.Audit c = new Data.Audit(moduleSettings);
     c.Entry(ShowId, UserId, EntryDetails);
 }