Esempio n. 1
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);
        }
Esempio n. 2
0
        }       //	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