Example #1
0
    protected void SpecailtyDropDownList_SelectedIndexChanged(object sender, EventArgs e)
    {
        /*
         * לעשות שאילתה שלפי הקטגוריה שנבחרה מציגה את הרופאים
         * לעשות feedback
         * לשמור בענן את הקטגוריה שנבחרה
         */

        //init

        int    docSpec = Convert.ToInt32(SpecailtyDropDownList.SelectedValue);
        string s       = " where DoctorIsOnVacation=false and DoctorSpecailty=" + docSpec;

        DoctorService docser = new DoctorService();
        DataSet       ds     = docser.GetDoctorName(s);

        if (ds.Tables[0].Rows.Count > 0)
        {
            DoctorDropDownList.Visible = true;
            Label4.Visible             = true;
            List <ListItem> list = GetAllData.getListItemsForDDL(ds, "Doctor");
            DoctorDropDownList.Items.Clear();
            foreach (ListItem l in list)
            {
                DoctorDropDownList.Items.Add(l);
            }
            DoctorDropDownList.DataBind();
            Session["Spec"] = docSpec;
        }
        else
        {
            SpecalityValid.Visible = true;
            AppHour.Visible        = false;
            SubmitButton.Visible   = false;
            ResetButton.Visible    = false;
            DateTB.Visible         = false;
            Label6.Visible         = false;
            Response.Write("<script>alert('אין רופאים תחת התמחות זו')</script>");
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            var builder = new MySqlConnectionStringBuilder
            {
                Server   = "undcsmysql.mysql.database.azure.com",
                Database = "micah_j_nelson",
                UserID   = "micah.j.nelson@undcsmysql",
                Password = "******",
                SslMode  = MySqlSslMode.Required,
            };

            if (!IsPostBack)
            {
                string   iDate = Session["Date"].ToString();
                DateTime oDate = Convert.ToDateTime(iDate);
                DateTextBox.Text = oDate.ToString("yyyy-MM-dd");
                DateTextBox.DataBind();
                using (var connection = new MySqlConnection(builder.ConnectionString))
                {
                    connection.Open();
                    using (var command = connection.CreateCommand())
                    {
                        using (MySqlDataAdapter dataAdapter = new MySqlDataAdapter())
                        {
                            command.CommandText       = "SELECT id, CONCAT( fname, ' ', lname ) as name FROM db455_staff WHERE position like 'Medical Doctor'";
                            dataAdapter.SelectCommand = command;
                            ds = new DataSet();
                            dataAdapter.Fill(ds);
                            DoctorDropDownList.DataTextField  = ds.Tables[0].Columns["name"].ToString();
                            DoctorDropDownList.DataValueField = ds.Tables[0].Columns["id"].ToString();
                            DoctorDropDownList.DataSource     = ds.Tables[0];
                            DoctorDropDownList.DataBind();
                        }
                    }
                }
            }
        }