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();
    }
    protected void lnkDelete_Command(object sender, CommandEventArgs e)
    {
        if (e.CommandName == "select")
        {
            var node = treeOL.FindNodeByValue(e.CommandArgument.ToString()) ?? new RadTreeNode();

            cboTreeOL.SelectedValue = String.Empty;

            if (node.ParentNode != null)
                cboTreeOL.SelectedValue = node.ParentNode.Value;
          
            txtOL.Text = node.Text;
        }

        if (e.CommandName == "delete")
        {
            humanResourcesManager = new HumanResourcesManager(this);
            organizationLevel = humanResourcesManager.GetOrganizationLevel(Company.CompanyId,
                Convert.ToInt32(e.CommandArgument));

            if (organizationLevel != null)
            {
                IQueryable<OrganizationLevel> childOrganizationLevelList;
                childOrganizationLevelList = humanResourcesManager.GetChildOrganizationLevel(Company.CompanyId, organizationLevel.OrganizationlevelId);

                if (childOrganizationLevelList.Count() != 0)
                {
                    ShowError(Resources.Exception.DeletingRegisterWithForeignKey);
                    return;
                }
                else
                {
                    try
                    {
                        humanResourcesManager.DeleteOrganizationLevel(organizationLevel);
                        BindTree();
                    }
                    catch (Exception)
                    {
                        ShowError(Resources.Exception.DeletingRegisterWithForeignKey);
                    }
                }
            }
        }
    }
Exemple #3
0
 public int Add(OrganizationLevel entity)
 {
     context.SbAdd(entity);
     return(context.SaveChanges());
 }
Exemple #4
0
 public int Edit(OrganizationLevel entity)
 {
     context.SbEdit(entity);
     return(context.SaveChanges());
 }
 public AddNewObjectiveCommand(Guid objectiveKeyResultId, Guid objectiveId, string description, OrganizationLevel organizationLevel)
 {
     ObjectiveKeyResultId = objectiveKeyResultId;
     ObjectiveId          = objectiveId;
     Description          = description;
     OrganizationLevel    = organizationLevel;
 }