Пример #1
0
        private void UpdateCoachPhone()
        {
            if (cmbCoach.SelectedItem.Value != "")
            {
                Session["CoachID"] = cmbCoach.SelectedItem.Value;
                var coachId = Convert.ToInt32(cmbCoach.SelectedItem.Value);
                if (!(String.IsNullOrEmpty((string)Session["CoachID"])))
                {
                    var rep = new CoachRepository(new CSBCDbContext());
                    var coach = rep.GetCoach(coachId);
                    try
                    {
                        if (coach != null)
                        {
                            if (coach.CoachPhone.Length > 0)
                                lblCHPhone.Text = "(H) " + coach.CoachPhone;
                            else
                                lblCHPhone.Text = "";
                            if (coach.Cellphone.Length > 0)
                                lblCCPhone.Text = "(C) " + coach.Cellphone;
                            else
                                lblCHPhone.Text = "";

                        }
                    }
                    catch (Exception ex)
                    {
                        lblError.Text = "cmbCoach::" + ex.Message;
                    }
                }
            }
        }
Пример #2
0
        protected void cmbAsstCoach_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            lblCAsstPhone.Text = "";
            lblHAsstPhone.Text = "";
            Session["AsstCoachID"] = cmbCoach.SelectedItem.Value;

            var coachId = Convert.ToInt32(cmbAsstCoach.SelectedItem.Value);
            if (!(String.IsNullOrEmpty((string)Session["AsstCoachID"])))
            {
                var rep = new CoachRepository(new CSBCDbContext());
                var coach = rep.GetCoach(coachId);
                try
                {
                    if (coach != null)
                    {
                        if (coach.CoachPhone.Length > 0)
                            lblHAsstPhone.Text = "(H) " + coach.CoachPhone;
                        else
                            lblHAsstPhone.Text = "";
                        if (coach.Cellphone.Length > 0)
                            lblCAsstPhone.Text = "(C) " + coach.Cellphone;
                        else
                            lblCAsstPhone.Text = "";

                    }
                }
                catch (Exception ex)
                {
                    lblError.Text = "cmbAsstCoach::" + ex.Message;
                }
            }
        }