Ejemplo n.º 1
0
    protected void Send_Click(object sender, EventArgs e)
    {
        //בדיקה אם קיים בWS
        Cities.Cities ctyWs = new Cities.Cities();
        if (!ctyWs.IsExist(DDLCity.SelectedItem.Text))
        {
            lblErr.Text = "העיר כבר לא קיימת במאגר הנתונים הארצי";
            return;
        }
        //add cty to db
        ch_cities cty = new ch_cities();

        cty.cty_Name = DDLCity.SelectedItem.Text;

        ch_citiesSvc.AddCity(cty);

        ch_users usr1 = new ch_users();

        usr1.usr_Identity   = txtStuIdentity.Text.Trim();
        usr1.usr_First_Name = txtFirstName.Text.Trim();
        usr1.usr_Last_Name  = txtLastName.Text.Trim();
        DateTime dt = Convert.ToDateTime(DateTextBox.Text);

        usr1.usr_Birth_Date = dt.ToString("yyyy/MM/dd");
        usr1.usr_Gender     = rbtGender.SelectedValue;
        usr1.cty_Id         = ch_citiesSvc.GetIdByCtyName(cty.cty_Name);
        usr1.usr_Address    = txtAddress.Text.Trim();
        usr1.usr_Home_Phone = txtHomePhone.Text.Trim();
        usr1.usr_Cellphone  = txtCellphone.Text.Trim();
        usr1.sc_Id          = Convert.ToInt32(DDLSchools.SelectedValue);
        usr1.usr_Email      = txtEmail.Text.Trim();
        usr1.usr_Password   = txtStuIdentity.Text.Trim() + "s";
        usr1.lvl_Id         = 0;

        ch_students stu1 = new ch_students();

        stu1.usr_Id             = ch_usersSvc.GetMaxId();
        stu1.rm_Id              = Convert.ToInt32(ddlRooms.SelectedValue);
        stu1.stu_Mom_Identity   = txtMomIdentity.Text.Trim();
        stu1.stu_Mom_First_Name = txtMomFirstName.Text.Trim();
        stu1.stu_Mom_Cellphone  = txtMomCellphone.Text;
        stu1.stu_Dad_Identity   = txtDadIdentity.Text;
        stu1.stu_Dad_First_Name = txtDadFirstName.Text;
        stu1.stu_Dad_Cellphone  = txtDadCellphone.Text;


        // ביצוע הרשמה וכתיבת השגיאות אם יש!
        lblErr.Text = ch_usersSvc.AddUser(usr1);

        stu1.usr_Id = ch_usersSvc.GetMaxId();

        lblErr.Text = ch_studentsSvc.AddStudent(stu1);

        //אם אין שגיאות בהרשמה
        if (lblErr.Text == "")
        {
            //Response.Write("<script>alert('המשתמש נרשם בהצלחה');</script>");
            Response.Redirect("StudentsData.aspx");
        }
    }
Ejemplo n.º 2
0
    protected void Send_Click(object sender, EventArgs e)
    {
        //add cty to db
        ch_cities cty = new ch_cities();

        cty.cty_Name = DDLCity.SelectedItem.Text;

        //בדיקה אם קיים בWS
        Cities.Cities ctyWs = new Cities.Cities();
        if (!ctyWs.IsExist(cty.cty_Name))
        {
            lblErr.Text = "העיר כבר לא קיימת במאגר הנתונים הארצי";
            return;
        }
        ch_citiesSvc.AddCity(cty);


        ch_users usr1 = new ch_users();

        usr1.usr_Identity   = txtTchIdentity.Text.Trim();
        usr1.usr_First_Name = txtFirstName.Text.Trim();
        usr1.usr_Last_Name  = txtLastName.Text.Trim();
        DateTime dt = Convert.ToDateTime(DateTextBox.Text);

        usr1.usr_Birth_Date = dt.ToString("yyyy/MM/dd");
        usr1.usr_Gender     = rbtGender.SelectedValue;
        usr1.cty_Id         = ch_citiesSvc.GetIdByCtyName(cty.cty_Name);
        usr1.usr_Address    = txtAddress.Text.Trim();
        usr1.usr_Home_Phone = txtHomePhone.Text.Trim();
        usr1.usr_Cellphone  = txtCellphone.Text.Trim();
        usr1.sc_Id          = Convert.ToInt32(DDLSchools.SelectedValue);
        usr1.usr_Email      = txtEmail.Text.Trim();
        usr1.usr_Password   = txtTchIdentity.Text.Trim() + "t";
        usr1.lvl_Id         = Convert.ToInt32(ddlLevels.SelectedValue);

        // ביצוע הרשמה וכתיבת השגיאות אם יש!
        lblErr.Text = ch_usersSvc.AddUser(usr1);

        ch_teachers tch1 = new ch_teachers();

        tch1.usr_Id = ch_usersSvc.GetMaxId();

        lblErr.Text = ch_teachersSvc.AddTeacher(tch1);

        foreach (ListItem li in lbProfessions.Items)
        {
            if (li.Selected)
            {
                ch_teachers_professions tch_pro = new ch_teachers_professions(Convert.ToInt32(li.Value), tch1.usr_Id);
                ch_teachers_professionsSvc.AddTeacherProfessions(tch_pro);
            }
        }
        //אם אין שגיאות בהרשמה
        if (lblErr.Text == "")
        {
            //Response.Write("<script>alert('המשתמש נרשם בהצלחה');</script>");
            Response.Redirect("TeachersData.aspx");
        }
    }
Ejemplo n.º 3
0
    protected void btn_insert_sc_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton btn = (ImageButton)sender;
        GridViewRow gvr = (GridViewRow)btn.NamingContainer;

        TextBox      txt_insert_sc_symbol    = (TextBox)gvr.FindControl("txt_insert_sc_symbol");
        TextBox      txt_insert_sc_name      = (TextBox)gvr.FindControl("txt_insert_sc_name");
        DropDownList txt_insert_ddlCities    = (DropDownList)gvr.FindControl("txt_insert_ddlCities");
        TextBox      txt_insert_sc_address   = (TextBox)gvr.FindControl("txt_insert_sc_address");
        TextBox      txt_insert_sc_telephone = (TextBox)gvr.FindControl("txt_insert_sc_telephone");

        //all vars to one object
        //add cty to db
        ch_cities cty = new ch_cities();

        cty.cty_Name = txt_insert_ddlCities.SelectedItem.Text;

        //בדיקה אם קיים בWS
        Cities.Cities ctyWs = new Cities.Cities();
        if (!ctyWs.IsExist(cty.cty_Name))
        {
            lblErrGV.Text = "העיר כבר לא קיימת במאגר הנתונים הארצי";
            return;
        }
        ch_citiesSvc.AddCity(cty);

        //all vars to one object
        ch_schools sc1 = new ch_schools();

        sc1.sc_Symbol    = txt_insert_sc_symbol.Text.Trim();
        sc1.sc_Name      = txt_insert_sc_name.Text.Trim();
        sc1.cty_Id       = ch_citiesSvc.GetIdByCtyName(cty.cty_Name);
        sc1.sc_Address   = txt_insert_sc_address.Text.Trim();
        sc1.sc_Telephone = txt_insert_sc_telephone.Text.Trim();

        if ((lblErrGV.Text = Validation(sc1)) != "")
        {
            return;
        }
        string err = ch_schoolsSvc.AddSchool(sc1);

        if (err == "")//אם ההכנסה התבצע
        {
            lblErrGV.Text        = "";
            gvSchools.ShowFooter = false;
            btnInsert.Enabled    = true;

            //Bind data to GridView
            gvBind();
        }
        else
        {
            lblErrGV.Text           = err;
            txt_insert_sc_name.Text = "";
            //Bind data to GridView
            gvBind();
        }
    }
Ejemplo n.º 4
0
    protected void btn_update_sc_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton btn = (ImageButton)sender;
        GridViewRow gvr = (GridViewRow)btn.NamingContainer;

        int          sc_id = Convert.ToInt32(gvSchools.DataKeys[gvr.RowIndex].Value.ToString());
        TextBox      txt_edit_sc_symbol    = (TextBox)gvr.FindControl("txt_edit_sc_symbol");
        TextBox      txt_edit_sc_name      = (TextBox)gvr.FindControl("txt_edit_sc_name");
        DropDownList txt_edit_ddlCities    = (DropDownList)gvr.FindControl("txt_edit_ddlCities");
        TextBox      txt_edit_sc_address   = (TextBox)gvr.FindControl("txt_edit_sc_address");
        TextBox      txt_edit_sc_telephone = (TextBox)gvr.FindControl("txt_edit_sc_telephone");

        //all vars to one object
        //add cty to db
        ch_cities cty = new ch_cities();

        cty.cty_Name = txt_edit_ddlCities.SelectedItem.Text;

        //בדיקה אם קיים בWS
        Cities.Cities ctyWs = new Cities.Cities();
        if (!ctyWs.IsExist(cty.cty_Name))
        {
            lblErrGV.Text = "העיר כבר לא קיימת במאגר הנתונים הארצי";
            return;
        }
        ch_citiesSvc.AddCity(cty);

        //all vars to one object
        ch_schools sc1 = new ch_schools();

        sc1.sc_Symbol    = txt_edit_sc_symbol.Text.Trim();
        sc1.sc_Name      = txt_edit_sc_name.Text.Trim();
        sc1.cty_Id       = ch_citiesSvc.GetIdByCtyName(cty.cty_Name);
        sc1.sc_Address   = txt_edit_sc_address.Text.Trim();
        sc1.sc_Telephone = txt_edit_sc_telephone.Text.Trim();

        if ((lblErrGV.Text = Validation(sc1)) == "")
        {
            string err = ch_schoolsSvc.UpdateSchoolById(sc_id, sc1);
            if (err == "")//אם העדכון התבצע
            {
                lblErrGV.Text       = string.Empty;
                gvSchools.EditIndex = -1;

                //Bind data to GridView
                gvBind();
            }
            else
            {
                lblErrGV.Text = err;

                //Bind data to GridView
                gvBind();
            }
        }
    }
Ejemplo n.º 5
0
    protected void gvSchools_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //check if is in edit mode
            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                DropDownList  txt_edit_ddlCities = (DropDownList)e.Row.FindControl("txt_edit_ddlCities");
                Cities.Cities cty = new Cities.Cities();
                txt_edit_ddlCities.DataSource = cty.GetCities();

                //Bind subcategories data to dropdownlist
                txt_edit_ddlCities.DataTextField = "שם_ישוב";
                txt_edit_ddlCities.DataBind();
                GridViewRow gvr = (GridViewRow)txt_edit_ddlCities.NamingContainer;

                DataRowView dr = e.Row.DataItem as DataRowView;
                txt_edit_ddlCities.SelectedItem.Text = dr["cty_name"].ToString();
            }
        }
    }
Ejemplo n.º 6
0
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        gvSchools.ShowFooter   = true;
        this.btnInsert.Enabled = false;

        //Bind data to GridView
        gvBind();

        //DDL cities
        Cities.Cities cty = new Cities.Cities();
        DropDownList  txt_insert_ddlCities = (DropDownList)gvSchools.FooterRow.FindControl("txt_insert_ddlCities");

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

        ListItem li = new ListItem();

        li.Text  = "-בחר עיר-";
        li.Value = "-1";
        txt_insert_ddlCities.Items.Add(li);
        txt_insert_ddlCities.SelectedIndex = txt_insert_ddlCities.Items.Count - 1;
    }
Ejemplo n.º 7
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;
                }
            }
        }
    }
    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;
            }
        }
    }
    protected void Send_Click(object sender, EventArgs e)
    {
        //add cty to db
        ch_cities cty = new ch_cities();

        cty.cty_Name = DDLCity.SelectedItem.Text;

        //בדיקה אם קיים בWS
        Cities.Cities ctyWs = new Cities.Cities();
        if (!ctyWs.IsExist(cty.cty_Name))
        {
            lblErr.Text = "העיר כבר לא קיימת במאגר הנתונים הארצי";
            return;
        }
        ch_citiesSvc.AddCity(cty);



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

        newUsr1.sc_Id          = Convert.ToInt32(DDLSchools.SelectedValue);
        newUsr1.usr_Address    = txtAddress.Text;
        newUsr1.usr_Birth_Date = DateTextBox.Text;
        newUsr1.cty_Id         = ch_citiesSvc.GetIdByCtyName(cty.cty_Name);
        newUsr1.usr_Email      = txtEmail.Text;
        newUsr1.usr_First_Name = txtFirstName.Text;
        newUsr1.usr_Gender     = rbtGender.SelectedValue;
        newUsr1.usr_Home_Phone = txtHomePhone.Text;
        newUsr1.usr_Cellphone  = txtCellphone.Text;
        newUsr1.usr_Identity   = txtIdentity.Text;
        newUsr1.usr_Last_Name  = txtLastName.Text;

        if (ch_usersSvc.GetUsrType(usr_id) == "tch")
        {
            if (ValidateTch())
            {
                foreach (ListItem li in lbProfessions.Items)
                {
                    ch_teachers_professions tch_pro = new ch_teachers_professions(Convert.ToInt32(li.Value), usr_id);

                    if (!ch_teachers_professionsSvc.IsExist(tch_pro) && li.Selected)
                    {
                        ch_teachers_professionsSvc.AddTeacherProfessions(tch_pro);
                    }
                    else if (ch_teachers_professionsSvc.IsExist(tch_pro) && !li.Selected)
                    {
                        ch_teachers_professionsSvc.DeleteTeacherProfessions(tch_pro);
                    }
                }
            }
            else
            {
                lblErr.Text = "הכנס מקצועות עליהם עברת הכשרה";
            }
        }
        if (ch_usersSvc.GetUsrType(usr_id) == "crw")
        {
            ch_crew newCrw1 = new ch_crew();
            newCrw1.job_Id = Convert.ToInt32(ddlJobs.SelectedValue);
            newCrw1.usr_Id = usr_id;
            ch_crewSvc.UpdateCrwById(newCrw1);
        }

        ch_usersSvc.UpdateUserById(usr_id, newUsr1);

        //update sessions
        Session["sc_id"]    = newUsr1.sc_Id;
        Session["gender"]   = newUsr1.usr_Gender;
        Session["fullName"] = newUsr1.usr_First_Name + " " + newUsr1.usr_Last_Name;

        Response.Redirect("UsrProfile.aspx");
    }
Ejemplo n.º 10
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;
                }
            }
        }
    }