private bool disposedValue = false; // Pour détecter les appels redondants

        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: supprimer l'état managé (objets managés).
                    if (CurrentContact != null)
                    {
                        CurrentContact.Dispose();
                    }
                    if (TeacherTools != null)
                    {
                        TeacherTools.Dispose();
                    }
                }

                // TODO: libérer les ressources non managées (objets non managés) et remplacer un finaliseur ci-dessous.
                // TODO: définir les champs de grande taille avec la valeur Null.

                Messages       = null;
                MessageWritten = null;
                Send           = null;

                disposedValue = true;
            }
        }
Ejemplo n.º 2
0
        public void BlockContact()
        {
            if (CurrentContact == null)
            {
                return;
            }

            var confirmation = IsBot
                ? MessageBoxResult.OK
                : MessageBox.Show(AppResources.BlockContactConfirmation, AppResources.AppName, MessageBoxButton.OKCancel);

            if (confirmation == MessageBoxResult.OK)
            {
                IsWorking = true;
                MTProtoService.BlockAsync(CurrentContact.ToInputUser(),
                                          result => BeginOnUIThread(() =>
                {
                    IsWorking = false;
                    CurrentContact.Blocked = TLBool.True;
                    CacheService.Commit();
                    EventAggregator.Publish(new TLUpdateUserBlocked {
                        UserId = CurrentContact.Id, Blocked = TLBool.True
                    });
                }),
                                          error => BeginOnUIThread(() =>
                {
                    IsWorking = false;
                    Execute.ShowDebugMessage("contacts.block error " + error);
                }));
            }
        }
        public void DeleteContact()
        {
            if (CurrentContact == null)
            {
                return;
            }

            var messageBoxResult = MessageBox.Show(AppResources.ConfirmDeleteContact, AppResources.Confirm, MessageBoxButton.OKCancel);

            if (messageBoxResult != MessageBoxResult.OK)
            {
                return;
            }

            IsWorking = true;
            MTProtoService.DeleteContactAsync(
                CurrentContact.ToInputUser(),
                result =>
            {
                IsWorking = false;
                EventAggregator.Publish(result.User);
                RaiseImportStatusChanged(new ImportEventArgs {
                    Imported = false
                });

                ContactsHelper.DeleteContactAsync(StateService, CurrentContact.Id);
            },
                error =>
            {
                IsWorking = false;
                Execute.ShowDebugMessage("contacts.deleteContact error: " + error);
            });
        }
 internal async void ShareContact()
 {
     await Share.RequestAsync(new ShareTextRequest
     {
         Text  = CurrentContact.GetShareContactText(),
         Title = "Share Contact - " + CurrentContact.FullName
     });
 }
        internal bool UpdateContact()
        {
            Contact.ERROR error = CurrentContact.IsValid();
            if (error != Contact.ERROR.NONE)
            {
                Console.WriteLine(error.ToString());
                return(false);
            }

            OriginalContact.UpdateContact(CurrentContact);
            return(true);
        }
Ejemplo n.º 6
0
        private void UpdateNotifySettingsAsync()
        {
            if (CurrentContact == null)
            {
                return;
            }

            var notifySettings = new TLInputPeerNotifySettings78
            {
                Flags        = new TLInt(0),
                MuteUntil    = new TLInt(MuteUntil),
                ShowPreviews = TLBool.True,
                Sound        = string.IsNullOrEmpty(SelectedSound) ? new TLString("default") : new TLString(SelectedSound)
            };

            IsWorking = true;
            MTProtoService.UpdateNotifySettingsAsync(
                CurrentContact.ToInputNotifyPeer(), notifySettings,
                result =>
            {
                IsWorking = false;
                CurrentContact.NotifySettings = new TLPeerNotifySettings78
                {
                    Flags        = new TLInt(0),
                    MuteUntil    = new TLInt(MuteUntil),
                    ShowPreviews = notifySettings.ShowPreviews,
                    Sound        = notifySettings.Sound
                };

                var dialog = CacheService.GetDialog(new TLPeerUser {
                    Id = CurrentContact.Id
                });
                if (dialog != null)
                {
                    dialog.NotifySettings = CurrentContact.NotifySettings;
                    dialog.NotifyOfPropertyChange(() => dialog.NotifySettings);
                    dialog.NotifyOfPropertyChange(() => dialog.Self);
                    var settings = dialog.With as INotifySettings;
                    if (settings != null)
                    {
                        settings.NotifySettings = CurrentContact.NotifySettings;
                    }
                }

                CacheService.Commit();
            },
                error =>
            {
                IsWorking = false;
                Execute.ShowDebugMessage("account.updateNotifySettings error: " + error);
            });
        }
Ejemplo n.º 7
0
        public void DeleteContact()
        {
            if (CurrentContact == null)
            {
                return;
            }

            var messageBoxResult = MessageBox.Show(AppResources.ConfirmDeleteContact, AppResources.Confirm, MessageBoxButton.OKCancel);

            if (messageBoxResult != MessageBoxResult.OK)
            {
                return;
            }

            IsWorking = true;
            MTProtoService.DeleteContactAsync(
                CurrentContact.ToInputUser(),
                result =>
            {
                var link24 = result as TLLink24;
                if (link24 != null)
                {
                    EventAggregator.Publish(new TLUpdateContactLink24 {
                        UserId = link24.User.Id, MyLink = link24.MyLink, ForeignLink = link24.ForeignLink
                    });
                }

                RaiseImportStatusChanged(new ImportEventArgs {
                    Imported = false
                });

                ContactsHelper.DeleteContactAsync(StateService, CurrentContact.Id);

                BeginOnUIThread(() =>
                {
                    IsWorking = false;
                    NotifyOfPropertyChange(() => HasPhone);
                });
            },
                error => BeginOnUIThread(() =>
            {
                IsWorking = false;
                Execute.ShowDebugMessage("contacts.deleteContact error: " + error);
            }));
        }
Ejemplo n.º 8
0
        protected override void OnInitialize()
        {
            if (CurrentContact == null)
            {
                return;
            }

            UpdateNotificationSettings();
            UpdateSubtitles();

            NotifyOfPropertyChange(() => CurrentContact);

            if (CurrentContact == null)
            {
                return;
            }

            Subtitle = DialogDetailsViewModel.GetUserStatus(CurrentContact);

            Execute.BeginOnThreadPool(TimeSpan.FromSeconds(0.5), () =>
            {
                UpdateNotificationSettings();

                IsWorking = true;
                MTProtoService.GetFullUserAsync(
                    CurrentContact.ToInputUser(),
                    userFull =>
                {
                    IsWorking = false;
                    UpdateNotificationSettings();
                    Subtitle = DialogDetailsViewModel.GetUserStatus(CurrentContact);

                    RaiseBlockedStatusChanged(new BlockedEventArgs {
                        Blocked = userFull.Blocked.Value
                    });
                },
                    error =>
                {
                    IsWorking = false;
                    Execute.ShowDebugMessage("users.getFullUser error: " + error);
                });
            });

            base.OnInitialize();
        }
Ejemplo n.º 9
0
        void EditContactCore(ContactItemViewModel contact, bool isNew)
        {
            ContactEditViewModel editModel = ContactEditViewModel.Create(contact, Cities, States);

            if (this.GetService <IDialogService>().ShowDialog(MessageButton.OKCancel, isNew ? "New contact" : contact.Name.FullName, editModel) == MessageResult.OK)
            {
                if (isNew)
                {
                    Items.Add(editModel.Contact);
                    ItemsSource.Add(editModel.Contact);
                    CurrentContact = editModel.Contact;
                }
                else
                {
                    CurrentContact.Assign(editModel.Contact);
                }
            }
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MobileVer = ASC.Web.Core.Mobile.MobileDetector.IsRequestMatchesMobile(this.Context);

            if (UrlParameters.Action != "export")
            {
                InitEmptyScreenControls();

                Utility.RegisterTypeForAjax(typeof(AjaxProHelper));

                if (EntityID == 0 && CurrentContact == null)//the main page with tasks
                {
                    RegisterClientScriptForFilter();
                    GetDataFromCookie();
                }
                else // the tab with tasks
                {
                    if (CurrentContact != null)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "8adeda71-2ad7-43b7-9939-f69c776dfbc0",
                                                                    "contactForInitTaskActionPanel = "
                                                                    + JavaScriptSerializer.Serialize(new
                        {
                            id           = CurrentContact.ID,
                            displayName  = CurrentContact.GetTitle().HtmlEncode(),
                            smallFotoUrl = ContactPhotoManager.GetSmallSizePhoto(CurrentContact.ID, CurrentContact is Company)
                        })
                                                                    + "; ", true);
                    }
                    if (UserList != null && UserList.Count > 0)
                    {
                        _taskActionView.UserList = UserList;
                    }
                }
            }
            else // export to csv
            {
                if (!CRMSecurity.IsAdmin)
                {
                    Response.Redirect(PathProvider.StartURL());
                }

                var tasks = GetTasksByFilter();

                if (UrlParameters.View != "editor")
                {
                    Response.Clear();
                    Response.ContentType     = "text/csv; charset=utf-8";
                    Response.ContentEncoding = Encoding.UTF8;
                    Response.Charset         = Encoding.UTF8.WebName;

                    var fileName = "tasks.csv";

                    Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", fileName));


                    Response.Write(ExportToCSV.ExportTasksToCSV(tasks, false));
                    Response.End();
                }
                else
                {
                    var fileUrl = ExportToCSV.ExportTasksToCSV(tasks, true);
                    Response.Redirect(fileUrl);
                }
            }
        }
Ejemplo n.º 11
0
        public void Initialize(MisglbDbContext context)
        {
            context.Database.EnsureCreated();

            // Look for any applications
            if (context.Applications.Any())
            {
                Console.WriteLine("Applications exists.");
                return; // DB has been seeded
            }

            var applications = new Application[]
            {
                new Application
                {
                    UserId              = "111",
                    AcademicYearStart   = DateTime.Parse("2017-08-08"),
                    AcademicYearEnd     = DateTime.Parse("2018-01-08"),
                    IsSummerApplication = false,
                    ApplicationStatus   = ApplicationStatus.Ongoing,
                    LastName            = "Garcia",
                    FirstName           = "Victor",
                    // No nickname
                    SSN                     = "04-12345",
                    Gender                  = Gender.Male,
                    DOB                     = DateTime.Parse("1989-08-07"),
                    PlaceOfBirth            = "Jaluit",
                    Age                     = 28,
                    HomeAtoll               = "Jaluit",
                    EbeyeKwajResOrLandOwner = false,
                    MartialStatus           = MartialStatus.Single,
                    hasChildren             = false,
                    // No Children
                    ParentMartialStatus         = ParentsStatus.Married,
                    DegreeSought                = "M.A.",
                    CollegeStanding             = CollegeStanding.Senior,
                    FieldOfStudy                = "MIS",
                    DateOfGraduation            = DateTime.Parse("2012-05-01"),
                    DateFinAidNeeded            = DateTime.Parse("2017-11-01"),
                    SavingsDividendsInterests   = 0,
                    EmploymentIncome            = 0,
                    SpouseIncome                = 0,
                    GovernmentSalary            = 0,
                    Compensation                = 0,
                    OthersResources             = 0,
                    ReceivedFinAidBefore        = true,
                    ReceivedFinAidBeforeDate    = DateTime.Parse("2012-09-01"),
                    EducationExpenseTermType    = ExpenseType.One_Term,
                    ExpenseTermSemesterSpecific = Semester.Spring,
                    // no expensetermsemesterspecific
                    TuitionType        = TuitionType.NA,
                    Tuition            = 100.00m,
                    Supplies           = 100.00m,
                    RoomAndBoardMonths = 4,
                    RoomAndBoard       = 100.00m,
                    HealthInsurance    = 100.00m,
                    Miscellaneous      = 100.00m,
                    Transportation     = 100.00m,
                    Airfare            = 100.00m,
                    // total expenses automatically summed and set
                    FinancialExpenseTermType = ExpenseType.Per_Academic_Year,
                    // no financialtermsemesterspecific
                    PellGrant          = 0,
                    CollegeScholarship = 0,
                    OtherScholarship   = 0,
                    ParentalSupport    = 0,
                    // personalassets automatically set from assets
                    OthersFinancial = 0,
                    // totalfinancial auto summed and set
                    // totalfinassistanceneeded auto summed and set
                    HasFather   = true,
                    HasMother   = true,
                    HasGuardian = false
                },
                new Application
                {
                    UserId              = "123",
                    AcademicYearStart   = DateTime.Parse("2017-08-08"),
                    AcademicYearEnd     = DateTime.Parse("2018-01-08"),
                    IsSummerApplication = false,
                    ApplicationStatus   = ApplicationStatus.New,
                    LastName            = "Billy",
                    FirstName           = "Bob",
                    // No nickname
                    SSN                     = "04-11111",
                    Gender                  = Gender.Male,
                    DOB                     = DateTime.Parse("1989-09-07"),
                    PlaceOfBirth            = "Majuro",
                    Age                     = 21,
                    HomeAtoll               = "Majuro",
                    EbeyeKwajResOrLandOwner = false,
                    MartialStatus           = MartialStatus.Single,
                    hasChildren             = false,
                    // No Children
                    ParentMartialStatus       = ParentsStatus.Married,
                    DegreeSought              = "B.A.",
                    CollegeStanding           = CollegeStanding.Freshman,
                    DateFinAidNeeded          = DateTime.Parse("2017-11-01"),
                    SavingsDividendsInterests = 300.00M,
                    EmploymentIncome          = 0,
                    SpouseIncome              = 0,
                    GovernmentSalary          = 0,
                    Compensation              = 0,
                    OthersResources           = 0,
                    ReceivedFinAidBefore      = false,
                    // receivedFinAidBeforeDate not needed
                    EducationExpenseTermType = ExpenseType.Per_Academic_Year,
                    // No ExpenseTermSemesterSpecific
                    TuitionType        = TuitionType.NA,
                    Tuition            = 100.00m,
                    Supplies           = 200.00M,
                    RoomAndBoardMonths = 4,
                    RoomAndBoard       = 200.00M,
                    HealthInsurance    = 200.00M,
                    Miscellaneous      = 200.00M,
                    Transportation     = 200.00M,
                    Airfare            = 100.00M,
                    // Total expenses automatically summed and set
                    FinancialExpenseTermType = ExpenseType.Per_Academic_Year,
                    // No FinancialTermSemesterSpecific
                    PellGrant          = 0,
                    CollegeScholarship = 0,
                    OtherScholarship   = 0,
                    ParentalSupport    = 500.00M,
                    // PersonalAssets automatically set from assets
                    OthersFinancial = 0,
                    // TotalFinancial auto summed and set
                    // totalFinAssistanceNeeded auto summed and set
                    HasFather   = true,
                    HasMother   = true,
                    HasGuardian = false,
                }
            };

            foreach (Application a in applications)
            {
                context.Applications.Add(a);
            }
            context.SaveChanges();
            List <Application> apps1 = new List <Application>();

            apps1.Add(applications[0]);

            List <Application> apps2 = new List <Application>();

            apps2.Add(applications[1]);

            // Current Contacts
            var currentContacts = new CurrentContact[]
            {
                new CurrentContact
                {
                    Application = apps1,
                    Country     = "RMI",
                    State_Atoll = "Majuro",
                    Address     = "PO Box 123",
                    Zip         = "96960",
                    Phone       = "6924562596",
                    Email       = "*****@*****.**"
                },
                new CurrentContact
                {
                    Application = apps2,
                    Country     = "RMI",
                    State_Atoll = "Majuro",
                    Address     = "PO Box 111",
                    Zip         = "96960",
                    Phone       = "6924562596",
                    Email       = "*****@*****.**"
                }
            };

            foreach (CurrentContact c in currentContacts)
            {
                context.Contacts.Add(c);
            }
            context.SaveChanges();

            // Permanent Contacts
            var permanentContacts = new PermanentContact[]
            {
                new PermanentContact
                {
                    Application = apps1,
                    Country     = "RMI",
                    State_Atoll = "Majuro",
                    Address     = "PO Box 123",
                    Zip         = "96960",
                    Phone       = "6924562596"
                },
                new PermanentContact
                {
                    Application = apps2,
                    Country     = "RMI",
                    State_Atoll = "Majuro",
                    Address     = "PO Box 111",
                    Zip         = "96960",
                    Phone       = "6924562596"
                }
            };

            foreach (PermanentContact p in permanentContacts)
            {
                context.Contacts.Add(p);
            }
            context.SaveChanges();

            // Emergency Contacts
            var emergencyContacts = new EmergencyContact[]
            {
                new EmergencyContact
                {
                    Application  = applications[0],
                    LastName     = "Garcia",
                    FirstName    = "Leilani",
                    Phone        = "6924560277",
                    Email        = "*****@*****.**",
                    Relationship = "Mother"
                },
                new EmergencyContact
                {
                    Application  = applications[1],
                    LastName     = "Jane",
                    FirstName    = "Sue",
                    Phone        = "6924560277",
                    Email        = "*****@*****.**",
                    Relationship = "Mother"
                }
            };

            foreach (EmergencyContact e in emergencyContacts)
            {
                context.EmergencyContact.Add(e);
            }
            context.SaveChanges();

            // Fathers
            var fathers = new Father[]
            {
                new Father
                {
                    Application = apps1,
                    FirstName   = "Victor",
                    LastName    = "Garcia Sr.",
                    Alive       = true,
                    Age         = 60,
                    // no Employer
                    AnnualIncome = 0
                },
                new Father
                {
                    Application = apps2,
                    FirstName   = "Ken",
                    LastName    = "Joe",
                    Alive       = true,
                    Age         = 60,
                    // no Employer
                    AnnualIncome = 0
                }
            };

            foreach (Father f in fathers)
            {
                context.Parents.Add(f);
            }
            context.SaveChanges();

            // Mothers
            var mothers = new Mother[]
            {
                new Mother
                {
                    Application  = apps1,
                    FirstName    = "Lelani",
                    LastName     = "Garcia",
                    Alive        = true,
                    Age          = 50,
                    Employer     = "Polaris",
                    AnnualIncome = 3000.00M
                },
                new Mother
                {
                    Application  = apps2,
                    FirstName    = "Sara",
                    LastName     = "Joe",
                    Alive        = true,
                    Age          = 50,
                    Employer     = "KK",
                    AnnualIncome = 3000.00M
                }
            };

            foreach (Mother m in mothers)
            {
                context.Parents.Add(m);
            }
            context.SaveChanges();


            //Current Colleges
            var currentColleges = new CurrentCollege[]
            {
                new CurrentCollege
                {
                    Name        = "UH - Manoa",
                    Country     = "US",
                    State_Atoll = "HI",
                    Address     = "123 St.",
                    Zip         = "96822",
                    Application = apps1
                },
                new CurrentCollege
                {
                    Name        = "Chaminade",
                    Country     = "US",
                    State_Atoll = "HI",
                    Address     = "123 St.",
                    Zip         = "96822",
                    Application = apps2
                }
            };

            foreach (CurrentCollege c in currentColleges)
            {
                context.Schools.Add(c);
            }
            context.SaveChanges();

            //Prior Collegs
            var priorColleges = new PriorCollege[]
            {
                new PriorCollege
                {
                    Application    = apps1,
                    Name           = "UMN Duluth",
                    Country        = "US",
                    State_Atoll    = "MN",
                    Address        = "123 St.",
                    Zip            = "56751",
                    DegreeObtained = "B.A.A"
                }
            };

            foreach (PriorCollege p in priorColleges)
            {
                context.Schools.Add(p);
            }
            context.SaveChanges();

            // High Schools
            var highSchools = new HighSchool[]
            {
                new HighSchool
                {
                    Application         = apps1,
                    Name                = "Roseau High School",
                    Country             = "US",
                    State_Atoll         = "MN",
                    Address             = "123 St.",
                    Zip                 = "56751",
                    HighSchoolStartDate = DateTime.Parse("2012-09-01"),
                    HighSchoolEndDate   = DateTime.Parse("2013-05-01"),
                    HighSchoolGradDate  = DateTime.Parse("2013-05-01")
                },
                new HighSchool
                {
                    Application         = apps2,
                    Name                = "Baptist HS",
                    Country             = "RMI",
                    State_Atoll         = "Majuro",
                    Address             = "123 St.",
                    Zip                 = "96960",
                    HighSchoolStartDate = DateTime.Parse("2012-09-01"),
                    HighSchoolEndDate   = DateTime.Parse("2013-05-01"),
                    HighSchoolGradDate  = DateTime.Parse("2013-05-01")
                }
            };

            foreach (HighSchool h in highSchools)
            {
                context.Schools.Add(h);
            }
            context.SaveChanges();
        }
Ejemplo n.º 12
0
 private void lstSearchResult_SelectedIndexChanged(object sender, EventArgs e)
 {
     CurrentContact.ShowSearched(lstSearchResult.SelectedIndex);
     lstSearchResult.Hide();
 }
Ejemplo n.º 13
0
 private void btnCDelete_Click(object sender, EventArgs e)
 {
     CurrentContact.DeleteContact();
     CurrentContact.ClearCurrentContact();
     ContactList.UpdateContactList();
 }
Ejemplo n.º 14
0
 private void btnCSave_Click(object sender, EventArgs e)
 {
     CurrentContact.SaveChanges();
     ContactList.UpdateContactList();
 }
Ejemplo n.º 15
0
 private void lstContacts_SelectedIndexChanged(object sender, EventArgs e)
 {
     CurrentContact.ShowCurrent(lstContacts.SelectedIndex);
 }
Ejemplo n.º 16
0
 public void EditContact()
 {
     EditContactCore((ContactItemViewModel)CurrentContact.Clone(), false);
 }