コード例 #1
0
        /// <summary>
        /// Get Media Server
        /// </summary>
        /// <param name="project">proeject</param>
        /// <returns>server list</returns>
        public static MMediaServer[] GetMediaServer(MWebProject project)
        {
            List <MMediaServer> list = new List <MMediaServer>();
            IDataReader         idr  = null;

            SqlParameter[] param = new SqlParameter[1];
            String         sql   = "SELECT * FROM CM_Media_Server WHERE CM_WebProject_ID=@param ORDER BY CM_Media_Server_ID";

            try
            {
                //pstmt = DataBase.prepareStatement (sql, project.get_TrxName());
                //pstmt.setInt (1, project.getCM_WebProject_ID());
                param[0] = new SqlParameter("@param", project.GetCM_WebProject_ID());
                idr      = DataBase.DB.ExecuteReader(sql, param, project.Get_TrxName());
                //DataTable dt = new DataTable();
                //dt.Load(idr);
                while (idr.Read())
                {
                    list.Add(new MMediaServer(project.GetCtx(), idr, project.Get_TrxName()));
                }
                idr.Close();
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                }
                _log.Log(Level.SEVERE, sql, e);
            }
            MMediaServer[] retValue = new MMediaServer[list.Count];
            retValue = list.ToArray();
            return(retValue);
        }       //	getMediaServer
コード例 #2
0
 /// <summary>
 /// getServer getCurrentMediaServer
 /// </summary>
 /// <returns>return media server</returns>
 public MMediaServer GetServer()
 {
     if (_mserver == null)
     {
         _mserver = new MMediaServer(GetCtx(), GetCM_Media_Server_ID(), Get_TrxName());
     }
     return(_mserver);
 }
コード例 #3
0
 /// <summary>
 /// Deployment Parent Constructor
 /// </summary>
 /// <param name="server">server</param>
 /// <param name="media">media</param>
 public MMediaDeploy(MMediaServer server, MMedia media)
     : this(server.GetCtx(), 0, server.Get_TrxName())
 {
     SetCM_Media_Server_ID(server.GetCM_Media_Server_ID());
     SetCM_Media_ID(media.GetCM_Media_ID());
     SetClientOrg(server);
     //
     SetIsDeployed(true);
     SetLastSynchronized(DateTime.Now); // new Timestamp(System.currentTimeMillis()));
 }                                      //	MMediaDeploy
コード例 #4
0
        private static VLogger _log = VLogger.GetVLogger(typeof(MMedia).FullName);//.class);

        /// <summary>
        /// getByMediaAndProject Get All deployers by Media ID and WebProject
        /// </summary>
        /// <param name="ctx">Context</param>
        /// <param name="CM_Media_ID">id</param>
        /// <param name="thisProject">web project</param>
        /// <param name="createIfMissing">createIfMissing Whether we create or not</param>
        /// <param name="trxName">trx</param>
        /// <returns> Array of MediaDeploy</returns>
        public static MMediaDeploy[] GetByMediaAndProject(Ctx ctx, int CM_Media_ID, MWebProject thisProject, bool createIfMissing, Trx trxName)
        {
            List <MMediaDeploy> list = new List <MMediaDeploy>();

            MMediaServer[] theseServers = MMediaServer.GetMediaServer(thisProject);
            if (theseServers != null && theseServers.Length > 0)
            {
                for (int i = 0; i < theseServers.Length; i++)
                {
                    list.Add(GetByMedia(ctx, CM_Media_ID, theseServers[i].Get_ID(), createIfMissing, trxName));
                }
            }
            MMediaDeploy[] retValue = new MMediaDeploy[list.Count];// .size ()];
            retValue = list.ToArray();
            return(retValue);
        }
コード例 #5
0
ファイル: MMedia.cs プロジェクト: vuongthai91/ERP-CMR-DMS
        }       //	beforeSave

        /// <summary>
        /// after save
        /// </summary>
        /// <param name="newRecord">new</param>
        /// <param name="success">success</param>
        /// <returns>true if saved</returns>
        protected override bool AfterSave(bool newRecord, bool success)
        {
            if (!success)
            {
                return(success);
            }
            if (newRecord)
            {
                StringBuilder sb = new StringBuilder("INSERT INTO AD_TreeNodeCMM "
                                                     + "(AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, "
                                                     + "AD_Tree_ID, Node_ID, Parent_ID, SeqNo) "
                                                     + "VALUES (")
                                   .Append(GetAD_Client_ID()).Append(",0, 'Y', SysDate, 0, SysDate, 0,")
                                   .Append(GetAD_Tree_ID()).Append(",").Append(Get_ID())
                                   .Append(", 0, 999)");
                int no = DataBase.DB.ExecuteQuery(sb.ToString(), null, Get_TrxName());
                if (no > 0)
                {
                    log.Fine("#" + no + " - TreeType=CMM");
                }
                else
                {
                    log.Warning("#" + no + " - TreeType=CMM");
                }
                return(no > 0);
            }
            // Construct / Update Deployment Procedure
            MMediaServer[] theseServers = MMediaServer.GetMediaServer(_project);
            if (theseServers != null && theseServers.Length > 0)
            {
                for (int i = 0; i < theseServers.Length; i++)
                {
                    MMediaDeploy thisDeploy = MMediaDeploy.GetByMedia(GetCtx(), Get_ID(), theseServers[i].Get_ID(), true, Get_TrxName());
                    if (thisDeploy.IsDeployed())
                    {
                        thisDeploy.SetIsDeployed(false);
                        thisDeploy.Save();
                    }
                }
            }
            return(success);
        }       //	afterSave