Exemplo n.º 1
0
        }       //	get

        /// <summary>
        /// Get Client Info
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="AD_Client_ID">id</param>
        /// <param name="trxName">optional trx</param>
        /// <returns>Client Info</returns>
        public static MClientInfo Get(Ctx ctx, int AD_Client_ID, Trx trxName)
        {
            int         key  = AD_Client_ID;
            MClientInfo info = (MClientInfo)s_cache[key];

            if (info != null)
            {
                return(info);
            }
            //
            String  sql = "SELECT * FROM AD_ClientInfo WHERE AD_Client_ID=" + AD_Client_ID;
            DataSet ds  = null;

            try
            {
                VConnection vcon = VConnection.Get();
                ds = DataBase.DB.ExecuteDataset(sql, null, trxName);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    info = new MClientInfo(ctx, dr, null);
                    if (trxName == null)
                    {
                        s_cache.Add(key, info);
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Log(Level.SEVERE, sql, ex);
            }
            ds = null;
            return(info);
        }
Exemplo n.º 2
0
        }                                                                            //	isMultiLingualDocument

        /// <summary>
        ///Get Header info (connection, org, user)
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="WindowNo"></param>
        /// <returns></returns>
        public static String GetHeader(Ctx ctx, int windowNo)
        {
            StringBuilder sb = new StringBuilder();

            if (windowNo > 0)
            {
                sb.Append(ctx.GetContext(windowNo, "WindowName", false)).Append("  ");
            }
            sb.Append(ctx.GetContext("##AD_User_Name")).Append("@")
            .Append(ctx.GetContext("#AD_Org_Name")).Append(".")
            .Append(ctx.GetContext("#AD_Client_Name"))
            .Append(" [").Append(VConnection.Get().ToString()).Append("]");    //                   CConnection.get().toString()).append("]");
            return(sb.ToString());
        }
        public string CreateJDBCDataSourceXml(Ctx ctx, string DBResourceName, int RecordID)
        {
            List <Document> obj     = new List <Document>();
            string          orgName = "Org Name";

            if (RecordID > 0)
            {
                MVA009Batch            batch        = new MVA009Batch(ctx, RecordID, null);
                MVA009BatchLineDetails batchDetails = null;
                MVA009PaymentMethod    paymthd      = null;
                string  sql = @"SELECT bd.VA009_BatchLineDetails_ID
                                FROM VA009_BatchLineDetails bd
                                INNER JOIN va009_batchlines bl
                                ON bl.va009_batchlines_id= bd.va009_batchlines_id
                                WHERE VA009_Batch_ID =" + RecordID;
                DataSet dsb = DB.ExecuteDataset(sql);
                if (dsb != null && dsb.Tables[0].Rows.Count > 0)
                {
                    DataSet dsbnk = null;
                    for (int x = 0; x < dsb.Tables[0].Rows.Count; x++)
                    {
                        batchDetails = new MVA009BatchLineDetails(ctx, Util.GetValueOfInt(dsb.Tables[0].Rows[x]["VA009_BatchLineDetails_ID"]), null);
                        paymthd      = new MVA009PaymentMethod(ctx, batchDetails.GetVA009_PaymentMethod_ID(), null);
                        Document dataobj = new Document();
                        dataobj.PaymentID     = Util.GetValueOfInt(batchDetails.GetVA009_BatchLineDetails_ID());
                        dataobj.PaymentMethod = paymthd.GetVA009_Name();
                        dataobj.DueAmt        = batchDetails.GetDueAmt();
                        dataobj.currency      = Util.GetValueOfString(DB.ExecuteScalar("SELECT iso_code FROM c_currency WHERE c_currency_id = " + batchDetails.GetC_Currency_ID()));
                        dataobj.Org           = Util.GetValueOfString(DB.ExecuteScalar("SELECT name FROM ad_org WHERE ad_org_id = " + batchDetails.GetAD_Org_ID()));
                        dsbnk = DB.ExecuteDataset("SELECT b.RoutingNo,  ac.IBAN FROM C_Bank b INNER JOIN C_bankaccount ac ON b.c_bank_id= ac.c_bank_id where ac.c_bankaccount_id =" + batch.GetC_BankAccount_ID());
                        if (dsbnk != null && dsbnk.Tables[0].Rows.Count > 0)
                        {
                            dataobj.IBAN = Util.GetValueOfString(dsbnk.Tables[0].Rows[0]["IBAN"]);
                            dataobj.BIC  = Util.GetValueOfString(dsbnk.Tables[0].Rows[0]["RoutingNo"]);
                        }
                        orgName = dataobj.Org;
                        obj.Add(dataobj);
                    }
                }
            }
            //Get DataBase Details of Vienna Advantage Framework
            string      filePath = "";
            VConnection conn     = new VConnection();

            conn.SetAttributes(DBConn.CreateConnectionString());
            DataSet ds = new DataSet();

            if (conn.Db_Type == "Oracle")
            {
                #region commented
                //Document obj = new Document();
                //obj.AccountName = "Manjot";
                //obj.AccountNo = "1001";
                //objJDBC.exportedWithPermissions = "false";
                //objJDBC.folder = "/organizations";
                //objJDBC.name = DBResourceName;
                //objJDBC.version = "0";
                //objJDBC.label = DBResourceName;
                //objJDBC.creationDate = DateTime.Now.ToString("O");
                //objJDBC.updateDate = DateTime.Now.ToString("O");
                //objJDBC.driver = "tibcosoftware.jdbc.oracle.OracleDriver";
                //objJDBC.connectionUrl = "jdbc:tibcosoftware:oracle://" + conn.Db_host + ";SID=" + conn.Db_name;
                //objJDBC.connectionUser = conn.Db_uid;
                //objJDBC.connectionPassword = conn.Db_pwd;
                //objJDBC.timezone = "";
                #endregion

                filePath = XmlCreater(obj, true, DBResourceName, orgName);
                return(filePath);
            }
            return(filePath);
        }
Exemplo n.º 4
0
        } // setStage

        /// <summary>
        /// Update Elements in Container from Stage
        /// </summary>
        /// <param name="project">project</param>
        /// <param name="stage">stage</param>
        /// <param name="trxName">trx</param>
        protected void UpdateElements(MWebProject project, MCStage stage,
                                      Trx trxName)
        {
            vcon = new VConnection();
            VAdvantage.CM.CacheHandler thisHandler = new VAdvantage.CM.CacheHandler(
                VAdvantage.CM.CacheHandler.ConvertJNPURLToCacheURL(vcon.Apps_host), log, GetCtx(),
                Get_Trx());
            // First update the new ones...
            int[] tableKeys = X_CM_CStage_Element.GetAllIDs("CM_CStage_Element",
                                                            "CM_CStage_ID=" + stage.Get_ID(), trxName);
            if (tableKeys != null && tableKeys.Length > 0)
            {
                for (int i = 0; i < tableKeys.Length; i++)
                {
                    X_CM_CStage_Element thisStageElement = new X_CM_CStage_Element(
                        project.GetCtx(), tableKeys[i], trxName);
                    int[] thisContainerElementKeys = X_CM_Container_Element
                                                     .GetAllIDs("CM_Container_Element", "CM_Container_ID="
                                                                + stage.Get_ID() + " AND Name LIKE '"
                                                                + thisStageElement.GetName() + "'", trxName);
                    X_CM_Container_Element thisContainerElement;
                    if (thisContainerElementKeys != null &&
                        thisContainerElementKeys.Length > 0)
                    {
                        thisContainerElement = new X_CM_Container_Element(project
                                                                          .GetCtx(), thisContainerElementKeys[0], trxName);
                    }
                    else
                    {
                        thisContainerElement = new X_CM_Container_Element(project
                                                                          .GetCtx(), 0, trxName);
                    }
                    thisContainerElement.SetCM_Container_ID(stage.Get_ID());
                    X_CM_CStage_Element stageElement = new X_CM_CStage_Element(
                        project.GetCtx(), tableKeys[i], trxName);
                    thisContainerElement.SetName(stageElement.GetName());
                    thisContainerElement.SetDescription(stageElement.GetDescription());
                    thisContainerElement.SetHelp(stageElement.GetHelp());
                    thisContainerElement.SetIsActive(stageElement.IsActive());
                    thisContainerElement.SetIsValid(stageElement.IsValid());
                    String contentHTML = thisStageElement.GetContentHTML();
                    thisContainerElement.SetContentHTML(contentHTML);
                    // PO.copyValues(new
                    // X_CM_CStage_Element(project.getCtx(),tableKeys[i],trxName),
                    // thisContainerElement);
                    thisContainerElement.Save(trxName);
                    // Remove Container from cache
                    thisHandler.CleanContainerElement(thisContainerElement
                                                      .Get_ID());
                }
            }
            // Now we are checking the existing ones to delete the unneeded ones...
            tableKeys = X_CM_Container_Element.GetAllIDs("CM_Container_Element",
                                                         "CM_Container_ID=" + stage.Get_ID(), trxName);
            if (tableKeys != null && tableKeys.Length > 0)
            {
                for (int i = 0; i < tableKeys.Length; i++)
                {
                    X_CM_Container_Element thisContainerElement = new X_CM_Container_Element(
                        project.GetCtx(), tableKeys[i], trxName);
                    int[] thisCStageElementKeys = X_CM_CStage_Element
                                                  .GetAllIDs("CM_CStage_Element", "CM_CStage_ID="
                                                             + stage.Get_ID() + " AND Name LIKE '"
                                                             + thisContainerElement.GetName() + "'", trxName);
                    // If we cannot find a representative in the Stage we will delete from production
                    if (thisCStageElementKeys == null ||
                        thisCStageElementKeys.Length < 1)
                    {
                        // First delete it from cache, then delete the record itself
                        thisHandler.CleanContainerElement(thisContainerElement
                                                          .Get_ID());
                        thisContainerElement.Delete(true);
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Retrieves Database Metadata information about Columns
        /// of the specific database exposed to this user
        /// </summary>
        public DataSet GetIndexInfo(string catalog, string schema, string indexName)
        {
            DataSet ds = null;

            try
            {
                ds = new DataSet();
                //DataTable tables1 = this.connection_1.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[] { null, schema, "VIENNA_2", null });
                DataTable tables = null;
                if (DatabaseType.IsPostgre)
                {
                    tables = this.connection_.GetSchema("IndexColumns", new string[] { schema, VConnection.Get().Db_searchPath, indexName.ToLower(), null });
                }
                else
                {
                    tables = this.connection_.GetSchema("IndexColumns", new string[] { null, indexName.ToUpper(), schema });
                }

                ds.Tables.Add(tables);
            }
            catch
            {
            }
            return(ds);
        }
Exemplo n.º 6
0
        }       //	prepare

        /// <summary>
        /// Process
        /// </summary>
        /// <returns>info</returns>
        protected override String DoIt()
        {
            _apps_host = new VConnection();
            CacheHandler thisHandler = new CacheHandler
                                       //(CacheHandler.ConvertJNPURLToCacheURL(GetCtx().GetContext("java.naming.provider.url")), log, GetCtx(), Get_Trx());
                                           (CacheHandler.ConvertJNPURLToCacheURL((String)_apps_host.Apps_host), log, GetCtx(), Get_Trx());

            log.Info("CM_WebProject_ID=" + _CM_WebProject_ID);
            _project = new MWebProject(GetCtx(), _CM_WebProject_ID, Get_Trx());
            if (_project.Get_ID() != _CM_WebProject_ID)
            {
                throw new Exception("@NotFound@ @CM_WebProject_ID@ " + _CM_WebProject_ID);
            }
            log.Log(Level.INFO, "Starting media deployment");
            //	Deploy Media
            MMediaServer[] mserver = MMediaServer.GetMediaServer(_project);

            for (int i = 0; i < mserver.Length; i++)
            {
                log.Log(Level.INFO, "Media Server deployment started on: " + mserver.ToString());
                if (_isRedeploy)
                {
                    mserver[i].ReDeployAll();
                }
                mserver[i].Deploy();
                log.Log(Level.INFO, "Media Server deployment finished on: " + mserver.ToString());
            }

            //	Stage
            MCStage[] stages = MCStage.GetStages(_project);
            for (int i = 0; i < stages.Length; i++)
            {
                _map.Add(Utility.Util.GetValueOfInt(stages[i].GetCM_CStage_ID()), stages[i]);
            }

            //	Copy Stage Tree
            MTree     treeS = new MTree(GetCtx(), _project.GetAD_TreeCMS_ID(), false, false, Get_Trx());
            VTreeNode root  = treeS.GetRootNode();

            CopyStage(root, "/", _isRedeploy);

            //	Delete Inactive Containers
            MContainer[] containers = MContainer.GetContainers(_project);
            for (int i = 0; i < containers.Length; i++)
            {
                MContainer container = containers[i];
                if (!_idList.Contains(Utility.Util.GetValueOfInt(container.GetCM_Container_ID())))
                {
                    String name = container.GetName();
                    if (container.Delete(true))
                    {
                        log.Fine("Deleted: " + name);
                    }
                    else        //	e.g. was referenced
                    {
                        log.Warning("Failed Delete: " + name);
                        AddLog(0, null, null, "@Error@ @Delete@: " + name);
                    }
                }
                // Remove Container from cache
                thisHandler.CleanContainer(container.Get_ID());
            }   //	Delete Inactive

            //	Sync Stage & Container Tree
            MTreeNodeCMS[] nodesCMS = MTreeNodeCMS.GetTree(GetCtx(), _project.GetAD_TreeCMS_ID(), Get_Trx());
            MTreeNodeCMC[] nodesCMC = MTreeNodeCMC.GetTree(GetCtx(), _project.GetAD_TreeCMC_ID(), Get_Trx());
            for (int s = 0; s < nodesCMS.Length; s++)
            {
                MTreeNodeCMS nodeCMS = nodesCMS[s];
                int          Node_ID = nodeCMS.GetNode_ID();
                for (int c = 0; c < nodesCMC.Length; c++)
                {
                    MTreeNodeCMC nodeCMC = nodesCMC[c];
                    if (nodeCMC.GetNode_ID() == Node_ID)
                    {
                        //if (nodeCMS.getParent_ID()!=0)
                        nodeCMC.setParent_ID(nodeCMS.GetParent_ID());
                        nodeCMC.SetSeqNo(nodeCMS.GetSeqNo());
                        nodeCMC.Save();
                        break;
                    }
                }
            }   //	for all stage nodes
            // Clean ContainerTree Cache
            thisHandler.CleanContainerTree(_CM_WebProject_ID);

            return("@Copied@ @CM_Container_ID@ #" + _idList.Count);
        }       //	doIt