コード例 #1
0
 //used to retrieve a full project screen object
 private void btnLoad_Click(object sender, EventArgs e)
 {
     myScreen = myPMService.getScreenByProjectID(tbProject.Text.Trim());
     if (myScreen.errorMessage != "")
     {
         MessageBox.Show("Error: " + myScreen.errorMessage);
         return;
     }
     btnUpdate.Enabled = true;
     tbScreen.Text = ctStandardLib.ctHelper.serializeObject(myScreen).Replace("><", ">" + Environment.NewLine + "<");
 }
コード例 #2
0
        //Creates an empty new generic project
        private void btnNew_Click(object sender, EventArgs e)
        {
            myScreen = myPMService.getNewscreen(null);

            //cpnyID required
            myScreen.myPJPROJ.CpnyId = System.Configuration.ConfigurationManager.AppSettings["CPNYID"];

            {
                String projectID = tbProject.Text.Trim();
                if (projectID == "")
                {
                    //projectID required, using our builtin counter table as example
                    projectID = myCommonService.getNextCounterAsString("PROJECTID");
                }
                myScreen.myPJPROJ.project = projectID;
               // myScreen.myPJPROJEX.project = projectID;
            }

            myScreen.myPJPROJ.project_desc = "my test project: " + myScreen.myPJPROJ.project;

            //myScreen.myPJPROJ.manager1 = myPMService.getEmployeesByID("")[0].employee; //not required, just picking first employee for example

            ctDynamicsSL.project.projectController.maintenance.projectMaintenance.Snote projectNote = new ctDynamicsSL.project.projectController.maintenance.projectMaintenance.Snote();
            projectNote.sNoteText = "test project note";
            myScreen.projectNote = projectNote;
            /*
            {
                var validate = myPMService.editScreen("VALIDATEONLY", myScreen);
                if (validate.errorMessage.Trim() != "")
                {
                    MessageBox.Show("Validation Error: " + validate.errorMessage);
                    return;
                }
            }
            */
            myScreen.myPJPROJ.lupd_prog = "MYTEST";
            myScreen = myPMService.editScreen("ADD", myScreen);
            if (myScreen.errorMessage != "")
            {
                MessageBox.Show("Error: " + myScreen.errorMessage);
                return;
            }
            else
            {
                tbProject.Text = myScreen.myPJPROJ.project;
                btnLoad.PerformClick();
                btnUpdate.Enabled = true;
            }
        }
コード例 #3
0
        //Used to save a project
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (myScreen == null)
            {
                MessageBox.Show("You must load a project first!");
                return;
            }

            try
            {//get our screen xml in case any manual changes were made
                myScreen = (ctDynamicsSL.project.projectController.maintenance.projectMaintenance.screen)ctStandardLib.ctHelper.deSerializeObject(myScreen.GetType(), tbScreen.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error deserializing textbox data: " + ex.Message);
            }

            var validate = myPMService.editScreen("VALIDATEONLY", myScreen);
            if (validate.errorMessage.Trim() != "")
            {
                MessageBox.Show("Validation Error: " + validate.errorMessage);
                return;
            }

            myScreen.myPJPROJ.lupd_prog = "test";
            myScreen = myPMService.editScreen("UPDATE", myScreen);
            if (myScreen.errorMessage != "")
            {
                MessageBox.Show("Error: " + myScreen.errorMessage);
            }
            else
            {
                tbScreen.Text = ctStandardLib.ctHelper.serializeObject(myScreen).Replace("><", ">" + Environment.NewLine + "<");
                MessageBox.Show("Save complete!");
            }
        }