Exemple #1
0
        }       //	setResponseText

        /// <summary>
        ///     Process Request.
        /// </summary>
        /// <returns>answer</returns>
        public String Process()
        {
            MIssueProject.Get(this);            //	sets also Asset
            MIssueSystem.Get(this);
            MIssueUser.Get(this);
            //
            //	setR_IssueKnown_ID(0);
            //	setR_Request_ID(0);
            return(CreateAnswer());
        }       //	process
        /// <summary>
        /// Get/Set Project
        /// </summary>
        /// <param name="issue">issue</param>
        /// <returns>project</returns>
        static public MIssueProject Get(MIssue issue)
        {
            if (issue.GetName() == null)
            {
                return(null);
            }
            MIssueProject pj  = null;
            String        sql = "SELECT * FROM R_IssueProject WHERE Name=@param";

            SqlParameter[] param = new SqlParameter[1];
            IDataReader    idr   = null;

            try
            {
                //pstmt = DataBase.prepareStatement (sql, null);
                //pstmt.setString (1, issue.getName());
                param[0] = new SqlParameter("@param", issue.GetName());
                idr      = DataBase.DB.ExecuteReader(sql, param, null);
                if (idr.Read())
                {
                    pj = new MIssueProject(issue.GetCtx(), idr, null);
                }
                idr.Close();
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                }
                _log.Log(Level.SEVERE, sql, e);
            }
            //	New
            if (pj == null)
            {
                pj = new MIssueProject(issue.GetCtx(), 0, null);
                pj.SetName(issue.GetName());
                pj.SetA_Asset_ID(issue);
            }
            pj.SetSystemStatus(issue.GetSystemStatus());
            pj.SetStatisticsInfo(issue.GetStatisticsInfo());
            pj.SetProfileInfo(issue.GetProfileInfo());
            if (!pj.Save())
            {
                return(null);
            }

            //	Set
            issue.SetR_IssueProject_ID(pj.GetR_IssueProject_ID());
            if (pj.GetA_Asset_ID() != 0)
            {
                issue.SetA_Asset_ID(pj.GetA_Asset_ID());
            }
            return(pj);
        }       //	get