public void Edit(string resid, string name)
        {
            lblTitle.Text = "Edit " + name;
            txtName.Text  = name;

            string title      = parent.getkey(parent.dtResources, "ResourceTitle", "ResourceID", resid);
            string mgrid      = parent.getkey(parent.dtResources, "ResourceManagerID", "ResourceID", resid);
            string department = parent.getkey(parent.dtResources, "ResourceDepartment", "ResourceID", resid);
            string ismgr      = parent.getkey(parent.dtResources, "IsManager", "ResourceID", resid);
            string isres      = parent.getkey(parent.dtResources, "IsResource", "ResourceID", resid);
            string ispm       = parent.getkey(parent.dtResources, "IsPM", "ResourceID", resid);

            if (mgrid != null)
            {
                string mgrname = parent.getkey(parent.dtResources, "ResourceName", "ResourceID", mgrid);
                parent.setDropdownFromValue(cbManager, "ResourceName", mgrname);
            }

            txtTitle.Text = title;

            parent.setDropdownFromValue(cbDepartment, "DepartmentName", department);

            rectManager.Opacity  = (ismgr == "True") ? 1d : .2d;
            rectResource.Opacity = (isres == "True") ? 1d : .2d;
            rectPM.Opacity       = (ispm == "True") ? 1d : .2d;
            eMode            = mode.edit;
            ResourceID       = resid;
            gridOuter.Height = 300d;
            btnAD.Visibility = System.Windows.Visibility.Visible;
        }
        private void Save()
        {
            ////// Make sure the name is unique //////
            DataTable dtResourceUpdate = new DataTable("Project");

            dtResourceUpdate.Columns.Add("ProjectID");
            dtResourceUpdate.Columns.Add("ProjectName");
            dtResourceUpdate.Columns.Add("ProjectDescription");
            dtResourceUpdate.Columns.Add("ProjectRank");
            dtResourceUpdate.Columns.Add("ProjectPriority");
            dtResourceUpdate.Columns.Add("ProjectApproach");
            dtResourceUpdate.Columns.Add("ProjectTiming");
            dtResourceUpdate.Columns.Add("WorkstreamID");
            dtResourceUpdate.Columns.Add("ProjectManager");
            dtResourceUpdate.Columns.Add("Operation");

            string workstreamid = ((System.Data.DataRowView)cbWorkstream.SelectedItem).Row["WorkstreamID"].ToString();

            string pmid = "0";

            if (cbProjectManager.SelectedIndex >= 0)
            {
                pmid = ((System.Data.DataRowView)cbProjectManager.SelectedItem).Row["ResourceID"].ToString();
            }
            string pmanager = parent.getkey(parent.dtResources, "ResourceName", "ResourceID", pmid);



            DataRow drRPI = dtResourceUpdate.NewRow();

            drRPI["ProjectID"]          = (eMode == mode.add) ? "" : s_projid;
            drRPI["ProjectName"]        = txtName.Text;
            drRPI["ProjectDescription"] = txtDescription.Text;
            drRPI["ProjectRank"]        = "";
            drRPI["ProjectPriority"]    = "";
            drRPI["ProjectApproach"]    = "";
            drRPI["ProjectTiming"]      = "";
            drRPI["WorkstreamID"]       = workstreamid;
            drRPI["ProjectManager"]     = pmanager;
            drRPI["Operation"]          = (eMode == mode.add) ? "I" : "U";
            dtResourceUpdate.Rows.Add(drRPI);

            parent.dtProject = ScriptEngine.script.runScript(ScriptEngine.envCurrent, dtResourceUpdate, "RP_CRUD_PROJECTS", "OPSCONSOLE").Tables["WS"];
            // parent.refreshScreen();
            parent.reloadProjects();
            Visibility = System.Windows.Visibility.Collapsed;
        }
Ejemplo n.º 3
0
        public void Load(ResourcePlanning prnt, string rid, string resname, string pid, string roleid, string comment)
        {
            parent = prnt;
            resid  = rid;
            projid = pid;
            cbRole.SelectedIndex = -1;

            ////// POPULATE TITLE //////
            lblTitle.Text = "Edit Project Resource Info for " + resname;

            ////// POPULATE ROLES //////
            cbRole.ItemsSource = parent.dtRole.DefaultView;

            ////// SELECT ROLE IF THERE IS ONE //////
            if ((roleid != null) && (roleid != "") && (roleid != "0"))
            {
                string rolename = parent.getkey(parent.dtRole, "RoleName", "RoleID", roleid);
                parent.setDropdownFromValue(cbRole, "RoleName", rolename);
            }

            ////// PUT IN TEXT //////
            txtComments.Text = comment;
        }