protected void btnМакеHistory_Click(object sender, EventArgs e)
        {
            if (!this.ownerPage.CheckUserActionPermission(ETEMEnums.SecuritySettings.PersonSave, false))
            {
                return;
            }

            PersonHistory newPersonHistory = new PersonHistory();

            this.currentEntity = this.ownerPage.AdminClientRef.GetPersonByPersonID(this.MasterKeyID);

            newPersonHistory.idPerson              = currentEntity.idPerson;
            newPersonHistory.FirstName             = currentEntity.FirstName;
            newPersonHistory.SecondName            = currentEntity.SecondName;
            newPersonHistory.LastName              = currentEntity.LastName;
            newPersonHistory.IdentityNumber        = currentEntity.IDCard;
            newPersonHistory.IdentityNumberDate    = currentEntity.IdentityNumberDate;
            newPersonHistory.IdentityNumberIssueBy = currentEntity.IdentityNumberIssueBy;

            newPersonHistory.idCreateUser = Int32.Parse(this.ownerPage.UserProps.IdUser);
            newPersonHistory.idModifyUser = Int32.Parse(this.ownerPage.UserProps.IdUser);
            newPersonHistory.CreationDate = DateTime.Now;
            newPersonHistory.ModifyDate   = DateTime.Now;


            this.ownerPage.CallContext.CurrentConsumerID = this.ownerPage.UserProps.IdUser;
            this.ownerPage.AdminClientRef.PersonHistorySave(newPersonHistory, this.ownerPage.CallContext);

            LoadPersonHistory();
        }
예제 #2
0
        public CallContext PersonHistorySave(PersonHistory entity, CallContext resultContext)
        {
            resultContext.securitySettings = ETEMEnums.SecuritySettings.PersonSave;
            CallContext resContext = new PersonHistoryBL().EntitySave <PersonHistory>(entity, resultContext);

            return(resContext);
        }
        public override bool PerformAction(Assignment assignment, Person currentPerson)
        {
            try
            {
                // Find the custom field, then load the person.
                CustomFieldValue customField = assignment.FieldValues.FindById(int.Parse(FieldSetting));
                if (customField != null && customField.SelectedValue.Trim() != string.Empty)
                {
                    int personID = int.Parse(customField.SelectedValue.Trim());

                    PersonHistory history = new PersonHistory();
                    history.PersonID      = personID;
                    history.HistoryType   = new Lookup(SystemLookup.PersonHistoryType_User);
                    history.Text          = assignment.ResolutionText;
                    history.SystemHistory = false;
                    history.Save(int.Parse(OrganizationIDSetting), assignment.Worker.FullName);

                    Person            person            = new Person(personID);
                    AssignmentHistory assignmentHistory = new AssignmentHistory();
                    assignmentHistory.AssignmentId = assignment.AssignmentId;
                    assignmentHistory.Action       = "Resolution copied to " + person.FullName + " as a note";
                    assignmentHistory.Save("AddResolutionToPersonNote");

                    // This will let the worker view the person note:
                    history.ApplyPersonSecurity(assignment.WorkerPersonId, assignment.Worker.FullName);

                    // Now, we'll apply the security template if one was selected.
                    if (SecurityTemplateSetting != string.Empty)
                    {
                        history.ApplyTemplateSecurity(int.Parse(SecurityTemplateSetting));
                    }
                }

                return(true);
            }
            catch (System.Exception ex)
            {
                assignment.AddNote("Exception", ex.Message, false, null, "AssignRequesterAsWorker");
                return(false);
            }
        }
예제 #4
0
        public IActionResult Post([FromBody] PersonHistory historyData)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(string.Join(Environment.NewLine, ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage))));
            }
            try
            {
                using (var connection = new SqlConnection(Connections.sqlConnection))
                {
                    using (var insertCommand = new SqlCommand("INSERT INTO History (Date, SourceFaceURL, SpottedFaceUrl, PersonId, CoordX, CoordY) " +
                                                              "VALUES (@Date, @SourceFaceUrl, @SpottedFaceUrl, @PersonId, @CoordX, @CoordY)", connection))
                    {
                        insertCommand.CommandType = CommandType.Text;

                        insertCommand.Parameters.AddWithValue("@PersonId", historyData.PersonId);

                        if (historyData.Date != null)
                        {
                            insertCommand.Parameters.AddWithValue("@Date", historyData.Date);
                        }
                        else
                        {
                            insertCommand.Parameters.AddWithValue("@Date", DBNull.Value);
                        }

                        if (string.IsNullOrEmpty(historyData.SourceFaceUrl))
                        {
                            insertCommand.Parameters.AddWithValue("@SourceFaceUrl", DBNull.Value);
                        }
                        else
                        {
                            insertCommand.Parameters.AddWithValue("@SourceFaceUrl", historyData.SourceFaceUrl);
                        }

                        if (string.IsNullOrEmpty(historyData.SpottedFaceUrl))
                        {
                            insertCommand.Parameters.AddWithValue("@SpottedFaceUrl", DBNull.Value);
                        }
                        else
                        {
                            insertCommand.Parameters.AddWithValue("@SpottedFaceUrl", historyData.SpottedFaceUrl);
                        }

                        insertCommand.Parameters.AddWithValue("@CoordX", historyData.CoordX);
                        insertCommand.Parameters.AddWithValue("@CoordY", historyData.CoordY);

                        using (var dataAdapter = new SqlDataAdapter("SELECT Id, Date, SourceFaceUrl, SpottedFaceUrl, PersonId, CoordX, CoordY FROM History", Connections.sqlConnection))
                        {
                            dataAdapter.InsertCommand = insertCommand;

                            DataTable dataTable = new DataTable();
                            dataAdapter.Fill(dataTable);

                            DataRow newRow = dataTable.NewRow();
                            newRow["PersonId"]       = historyData.PersonId;
                            newRow["CoordX"]         = historyData.CoordX;
                            newRow["CoordY"]         = historyData.CoordY;
                            newRow["SourceFaceUrl"]  = historyData.SourceFaceUrl;
                            newRow["SpottedFaceUrl"] = historyData.SpottedFaceUrl;
                            newRow["Date"]           = historyData.Date;

                            dataTable.Rows.Add(newRow);
                            dataAdapter.Update(dataTable);

                            return(Ok(newRow));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return(BadRequest("Error: " + ex.Message + Environment.NewLine + Environment.NewLine + ex.StackTrace + Environment.NewLine + Environment.NewLine + ex.Source));
            }
        }
예제 #5
0
 public async Task <IList <PersonHistoryData> > GetAllHistory(Guid id)
 {
     return(PersonHistory.ToJavaScriptCustomerHistory(await _eventStoreRepository.All(id)));
 }
예제 #6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string[] keys;
            keys = Request.QueryString.AllKeys;
            foreach (string key in keys)
            {
                switch (key.ToUpper())
                {
                case "GROUP":
                    try { group = new Group(Int32.Parse(Request.QueryString.Get(key))); }
                    catch { }
                    break;

                case "PERSON":
                    try { person = new Person(new Guid(Request.QueryString.Get(key))); }
                    catch { }
                    break;

                case "SPOUSE":
                    try { spouse = new Person(new Guid(Request.QueryString.Get(key))); }
                    catch { }
                    break;
                }
            }

            if (group != null && group.GroupID != -1 && person != null && person.PersonID != -1)
            {
                GroupMember gMember = new GroupMember(group.GroupID, person.PersonID);
                if (gMember.GroupID == -1)
                {
                    bool exists       = false;
                    bool spouseExists = false;
                    foreach (Registration registration in group.Registrations)
                    {
                        foreach (Person registrant in registration.Persons)
                        {
                            if (registrant.PersonID == person.PersonID)
                            {
                                exists = true;
                            }
                            if (spouse != null && registrant.PersonID == spouse.PersonID)
                            {
                                spouseExists = true;
                            }
                        }
                    }

                    if (!exists)
                    {
                        Registration registration = new Registration();
                        registration.OrganizationID = CurrentOrganization.OrganizationID;
                        registration.ClusterType    = group.ClusterType;
                        registration.GroupID        = group.GroupID;
                        registration.GroupType      = group.GroupType;
                        registration.Notes          = "User-Entered Registration";
                        registration.ClusterID      = group.GroupClusterID;

                        if (group.ClusterType.UnassignedRegistrationLevel >= 0)
                        {
                            GroupCluster gc = group.GroupCluster;
                            while (gc != null && gc.ParentClusterID != -1 && gc.ClusterLevel.Level > group.ClusterType.UnassignedRegistrationLevel)
                            {
                                gc = new GroupCluster(gc.ParentClusterID);
                            }
                            if (gc.ClusterLevel.Level == group.ClusterType.UnassignedRegistrationLevel)
                            {
                                registration.ClusterID = gc.GroupClusterID;
                            }
                        }

                        registration.Persons.Add(person);

                        // Add Spouse if specified
                        if (spouse != null && !spouseExists)
                        {
                            registration.Persons.Add(spouse);
                        }

                        registration.Save(CurrentOrganization.OrganizationID, CurrentUser.Identity.Name);

                        foreach (Person rPerson in registration.Persons)
                        {
                            PersonHistory history = new PersonHistory();
                            history.PersonID           = rPerson.PersonID;
                            history.HistoryType        = new Lookup(SystemLookup.PersonHistoryType_SmallGroupRegistration);
                            history.HistoryQualifierID = registration.RegistrationID;
                            history.Text = "User registered for group: " + group.Title;
                            history.Save(CurrentOrganization.OrganizationID);
                        }
                    }
                }
            }
            //else
            //{
            //    throw new ModuleException(CurrentPortalPage, CurrentModule, "The GroupRegistrationAdd module requires a valid Group and Person!");
            //}
        }
 public void Add(PersonHistory person)
 {
     _repositoryPersonHistory.Add(person);
     _repositoryPersonHistory.SaveChanges();
 }