protected void btnAdd_Click(object sender, EventArgs e)
    {
        humanResourcesManager = new HumanResourcesManager(this);
        organizationLevel = new OrganizationLevel();

        if (treeOL.SelectedNode != null)
        {

            OrganizationLevel original_organizationLevel = humanResourcesManager.GetOrganizationLevel(Company.CompanyId,
                Convert.ToInt32(treeOL.SelectedNode.Value));
            organizationLevel.CopyPropertiesFrom(original_organizationLevel);

            organizationLevel.Parentid = null;
            organizationLevel.Name = txtOL.Text.ToUpper();

            if (!String.IsNullOrEmpty(cboTreeOL.SelectedValue))
                organizationLevel.Parentid = Convert.ToInt32(cboTreeOL.SelectedValue);

            humanResourcesManager.UpdateOrganizationLevel(original_organizationLevel, organizationLevel);
        }
        else
        {
            organizationLevel.CompanyId = Company.CompanyId;
            organizationLevel.Name = txtOL.Text.ToUpper();
            organizationLevel.Parentid = null;

            if (!String.IsNullOrEmpty(cboTreeOL.SelectedValue))
                organizationLevel.Parentid = Convert.ToInt32(cboTreeOL.SelectedValue);

            humanResourcesManager.InsertOrganizationLevel(organizationLevel);
        }
        BindTree();
    }
Esempio n. 2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        humanResourcesManager = new HumanResourcesManager(this);
        organizationLevel     = new OrganizationLevel();

        if (treeOL.SelectedNode != null)
        {
            OrganizationLevel original_organizationLevel = humanResourcesManager.GetOrganizationLevel(Company.CompanyId,
                                                                                                      Convert.ToInt32(treeOL.SelectedNode.Value));
            organizationLevel.CopyPropertiesFrom(original_organizationLevel);

            organizationLevel.Parentid = null;
            organizationLevel.Name     = txtOL.Text.ToUpper();

            if (!String.IsNullOrEmpty(cboTreeOL.SelectedValue))
            {
                organizationLevel.Parentid = Convert.ToInt32(cboTreeOL.SelectedValue);
            }

            humanResourcesManager.UpdateOrganizationLevel(original_organizationLevel, organizationLevel);
        }
        else
        {
            organizationLevel.CompanyId = Company.CompanyId;
            organizationLevel.Name      = txtOL.Text.ToUpper();
            organizationLevel.Parentid  = null;

            if (!String.IsNullOrEmpty(cboTreeOL.SelectedValue))
            {
                organizationLevel.Parentid = Convert.ToInt32(cboTreeOL.SelectedValue);
            }

            humanResourcesManager.InsertOrganizationLevel(organizationLevel);
        }
        BindTree();
    }