/// <summary>
    /// Adds a new crew record to the database.
    /// </summary>
    /// <param name="bhv1">The behavior to add</param>
    /// <returns>string of an error or a string.Empty if the action is completed</returns>
    public static string AddCrew(ch_crew crw1)
    {
        string strSql = "INSERT INTO ch_crew(usr_id, job_id) ";

        strSql += "VALUES(" + crw1.usr_Id + ", " + crw1.job_Id + ")";
        Connect.DoAction(strSql, "ch_crew");
        return("");
    }
    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   = txtCrwIdentity.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   = txtCrwIdentity.Text.Trim() + "c";
        usr1.lvl_Id         = Convert.ToInt32(ddlLevels.SelectedValue);

        ch_crew crw1 = new ch_crew();

        crw1.job_Id = Convert.ToInt32(ddlJobs.SelectedValue);

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

        crw1.usr_Id = ch_usersSvc.GetMaxId();

        ch_crewSvc.AddCrew(crw1);

        //אם אין שגיאות בהרשמה
        if (lblErr.Text == "")
        {
            //Response.Write("<script>alert('המשתמש נרשם בהצלחה');</script>");
            Response.Redirect("CrewData.aspx");
        }
    }
    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");
    }
    /// <summary>
    /// Update a crew record in the database
    /// </summary>
    /// <param name="newCrw1">new crew info to update</param>
    public static void UpdateCrwById(ch_crew newCrw1)
    {
        string strSql = "UPDATE ch_crew SET job_id=" + newCrw1.job_Id + " WHERE usr_id=" + newCrw1.usr_Id;

        Connect.DoAction(strSql, "ch_crew");
    }