protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["usr_id"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            if (Session["usr_id"].ToString() == "")
            {
                Response.Redirect("Login.aspx");
            }
        }

        int usr_id = Convert.ToInt32(Session["usr_id"]);

        if (!IsPostBack)
        {
            //DDL Schools
            DataSet dsSchools = ch_schoolsSvc.GetSchools();

            DDLSchools.DataSource     = dsSchools;
            DDLSchools.DataValueField = "sc_id";
            dsSchools.Tables[0].Columns.Add("school", typeof(string), "sc_name + ' - ' + cty_name");
            DDLSchools.DataTextField = "school";
            DDLSchools.DataBind();

            DDLSchools.Items.Add("-בחר בית ספר-");
            DDLSchools.SelectedIndex = DDLSchools.Items.Count - 1;

            //DDL cities
            Cities.Cities cty = new Cities.Cities();

            DDLCity.DataSource    = cty.GetCities();
            DDLCity.DataTextField = "שם_ישוב";
            DDLCity.DataBind();

            DDLCity.Items.Add("-בחר עיר-");
            DDLCity.SelectedIndex = DDLCity.Items.Count - 1;

            //DDL Jobs
            DataSet dsJobs = ch_jobsSvc.GetJobs();

            ddlJobs.DataSource     = dsJobs;
            ddlJobs.DataValueField = "job_id";
            ddlJobs.DataTextField  = "job_name";
            ddlJobs.DataBind();

            ddlJobs.Items.Add("-בחר תפקיד-");
            ddlJobs.SelectedIndex = ddlJobs.Items.Count - 1;


            DataRow drUser = ch_usersSvc.GetUserById(usr_id);
            DDLSchools.SelectedValue  = drUser["usr.sc_id"].ToString();
            txtAddress.Text           = drUser["usr_address"].ToString();
            DateTextBox.Text          = Convert.ToDateTime(drUser["usr_birth_date"].ToString()).ToShortDateString();
            DDLCity.SelectedItem.Text = drUser["cty_name"].ToString();
            txtEmail.Text             = drUser["usr_email"].ToString();
            txtFirstName.Text         = drUser["usr_first_name"].ToString();
            rbtGender.SelectedValue   = drUser["usr_gender"].ToString();
            txtHomePhone.Text         = drUser["usr_home_phone"].ToString();
            txtCellphone.Text         = drUser["usr_cellphone"].ToString();
            txtIdentity.Text          = drUser["usr_identity"].ToString();
            txtLastName.Text          = drUser["usr_last_name"].ToString();

            if (ch_usersSvc.GetUsrType(usr_id) == "tch")
            {
                DataSet pro     = ch_professionsSvc.GetProfessions();
                DataSet tch_pro = ch_teachers_professionsSvc.GetProfessionsByTch(usr_id);

                int i = 0;
                foreach (DataRow dr_pro in pro.Tables[0].Rows)
                {
                    ListItem li = new ListItem(dr_pro["pro_name"].ToString(), dr_pro["pro_id"].ToString());
                    lbProfessions.Items.Add(li);

                    foreach (DataRow dr_tch_pro in tch_pro.Tables[0].Rows)
                    {
                        if (dr_tch_pro["pro_id"].ToString() == dr_pro["pro_id"].ToString())
                        {
                            li.Selected = true;
                        }
                    }
                    i++;
                }
                pnlTch.Visible = true;
            }
            if (ch_usersSvc.GetUsrType(usr_id) == "crw")
            {
                DataRow drCrew = ch_crewSvc.GetCrw(Convert.ToInt32(Session["usr_id"]));
                ddlJobs.SelectedValue = drCrew["job_id"].ToString();

                pnlCrw.Visible = true;
            }
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["lvl_id"] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            if (Convert.ToInt32(Session["lvl_id"]) < 3)
            {
                Response.Redirect("Default.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    if (Convert.ToInt32(Session["lvl_id"]) == 3)  // if editor
                    //DDL Schools
                    {
                        int     sc_id     = Convert.ToInt32(Session["sc_id"]);
                        DataSet dsSchools = ch_schoolsSvc.GetSchool(sc_id);

                        DDLSchools.DataSource     = dsSchools;
                        DDLSchools.DataValueField = "sc_id";
                        dsSchools.Tables[0].Columns.Add("school", typeof(string), "sc_name + ' - ' + cty_name");
                        DDLSchools.DataTextField = "school";
                        DDLSchools.DataBind();

                        //DDL Rooms
                        DataSet dsRooms = ch_roomsSvc.GetRooms(Convert.ToInt32(Session["sc_id"]));

                        ddlRooms.DataSource     = dsRooms;
                        ddlRooms.DataValueField = "rm_id";
                        ddlRooms.DataTextField  = "rm_name";
                        ddlRooms.DataBind();

                        ddlRooms.Items.Add("-בחר כיתה-");
                        ddlRooms.SelectedIndex = ddlRooms.Items.Count - 1;
                    }
                    else if (Convert.ToInt32(Session["lvl_id"]) >= 4)   // if vice_manager and up
                    //DDL Schools
                    {
                        DataSet dsSchools = ch_schoolsSvc.GetSchools();

                        DDLSchools.DataSource     = dsSchools;
                        DDLSchools.DataValueField = "sc_id";
                        dsSchools.Tables[0].Columns.Add("school", typeof(string), "sc_name + ' - ' + cty_name");
                        DDLSchools.DataTextField = "school";
                        DDLSchools.DataBind();

                        DDLSchools.Items.Add("-בחר בית ספר-");
                        DDLSchools.SelectedIndex = DDLSchools.Items.Count - 1;
                    }

                    //DDL cities
                    Cities.Cities cty = new Cities.Cities();

                    DDLCity.DataSource    = cty.GetCities();
                    DDLCity.DataTextField = "שם_ישוב";
                    DDLCity.DataBind();

                    DDLCity.Items.Add("-בחר עיר-");
                    DDLCity.SelectedIndex = DDLCity.Items.Count - 1;
                }
            }
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["lvl_id"] == null)
        {
            Response.Redirect("Default.aspx");
        }
        else
        {
            if (Convert.ToInt32(Session["lvl_id"]) < 3)
            {
                Response.Redirect("Default.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    if (Convert.ToInt32(Session["lvl_id"]) == 3)  // if editor
                    //DDL Schools
                    {
                        int     sc_id     = Convert.ToInt32(Session["sc_id"]);
                        DataSet dsSchools = ch_schoolsSvc.GetSchool(sc_id);

                        DDLSchools.DataSource     = dsSchools;
                        DDLSchools.DataValueField = "sc_id";
                        dsSchools.Tables[0].Columns.Add("school", typeof(string), "sc_name + ' - ' + cty_name");
                        DDLSchools.DataTextField = "school";
                        DDLSchools.DataBind();
                    }
                    else if (Convert.ToInt32(Session["lvl_id"]) == 4)   // if vice_manager
                    //DDL Schools
                    {
                        DataSet dsSchools = ch_schoolsSvc.GetSchools();

                        DDLSchools.DataSource     = dsSchools;
                        DDLSchools.DataValueField = "sc_id";
                        DDLSchools.DataTextField  = "sc_name";
                        DDLSchools.DataBind();

                        DDLSchools.Items.Add("-בחר בית ספר-");
                        DDLSchools.SelectedIndex = DDLSchools.Items.Count - 1;
                    }
                    else if (Convert.ToInt32(Session["lvl_id"]) >= 5)   // if manager and up
                    //DDL Levels
                    {
                        DataSet dsLevels = ch_levelsSvc.GetLevels();

                        ddlLevels.DataSource     = dsLevels;
                        ddlLevels.DataValueField = "lvl_id";
                        ddlLevels.DataTextField  = "lvl_name";
                        ddlLevels.DataBind();

                        ddlLevels.Items.Add(new ListItem("-בחר רמה-", "-1"));
                        ddlLevels.SelectedValue = "2";
                    }

                    //DDL cities
                    Cities.Cities cty = new Cities.Cities();
                    DDLCity.DataSource    = cty.GetCities();
                    DDLCity.DataTextField = "שם_ישוב";
                    DDLCity.DataBind();

                    DDLCity.Items.Add("-בחר עיר-");
                    DDLCity.SelectedIndex = DDLCity.Items.Count - 1;

                    //DDL Jobs
                    DataSet dsJobs = ch_jobsSvc.GetJobs();

                    ddlJobs.DataSource     = dsJobs;
                    ddlJobs.DataValueField = "job_id";
                    ddlJobs.DataTextField  = "job_name";
                    ddlJobs.DataBind();

                    ddlJobs.Items.Add("-בחר תפקיד-");
                    ddlJobs.SelectedIndex = ddlJobs.Items.Count - 1;
                }
            }
        }
    }