protected void Page_Load(object sender, EventArgs e)
        {
            _messageSender = (Person)Session["CurrentUser"];
            if (!IsPostBack)
            {
                var toList = new List<string>();

                if (_messageSender is Teacher)
                {
                    toList.Add("ילד ספציפי");
                    toList.Add("כל ילדי הגן");
                    toList.Add("מפקחת");
                }
                if (_messageSender is Supervisor)
                {
                    toList.Add("גננת");
                    toList.Add("ילדי המחוז");
                    toList.Add("גננות המחוז");
                }

                Who.DataSource = toList;
                Who.AutoPostBack = true;
                Who.DataBind();
                if (_messageSender is Child)
                {
                    Who.Visible = false;
                    WhoLable.Visible = true;
                }

            }
        }
        public void SendMessage(Person sender, string title, string body, List<Person> recipients)
        {
            var msg = new Message
            {
                Body = body,
                Sender = sender,
                Recipients = recipients,
                Title = title,
                SendTime = DateTime.Now
            };

            MessageEdit.Instance.Add(msg);
        }
        private void FillFields(Entities.Person current)
        {
            Id.Text        = current.IdNum;
            FirstName.Text = current.FirstName;
            LastName.Text  = current.LastName;
            BirthDate.Text = current.BirthDay.ToShortDateString();
            Phone.Text     = current.PhoneNum;

            if (current is Entities.Child)
            {
                var child = current as Entities.Child;
                PersonTypes.SelectedValue = "1";
                foreach (var sensitivity in child.Sensitivitieses)
                {
                    var sen = Sensetivities.Items.FindByValue(sensitivity.Id.ToString());
                    sen.Selected = true;
                }

                ChildData.Visible      = true;
                TeacherData.Visible    = false;
                SupervisorData.Visible = false;
            }
            else if (current is Entities.Teacher)
            {
                var teacher = current as Entities.Teacher;
                PersonTypes.SelectedValue = "2";
                Teachers.SelectedValue    = teacher.Substitute != null?teacher.Substitute.Id.ToString() : "";

                Sen.Text = teacher.Seniority.ToString();

                ChildData.Visible      = false;
                TeacherData.Visible    = true;
                SupervisorData.Visible = false;
            }
            else
            {
                var supervisor = current as Entities.Supervisor;
                PersonTypes.SelectedValue = "3";
                Cities.SelectedValue      = ((int)supervisor.City).ToString();

                ChildData.Visible      = false;
                TeacherData.Visible    = false;
                SupervisorData.Visible = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindList();

                var userCode = Request.QueryString["code"];
                if (userCode != null)
                {
                    var current = new PersonQuery().Get(int.Parse(userCode));
                    CurrentUser = current;
                    FillFields(current);
                    PersonTypes.Enabled = false;

                    InitByUser();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindList();

                var userCode = Request.QueryString["code"];
                if (userCode != null)
                {
                    var current = new PersonQuery().Get(int.Parse(userCode));
                    CurrentUser = current;
                    FillFields(current);
                    PersonTypes.Enabled = false;

                    InitByUser();
                }
            }
        }
 public List<Message> GetPersonMessages(Person recipient)
 {
     return new MessageQuery{Person = recipient}.GetByFilter().ToList();
 }
Beispiel #7
0
 protected bool Equals(Person other)
 {
     return Id == other.Id;
 }