コード例 #1
0
ファイル: ObjectCheckOut.cs プロジェクト: injeetender/SQLSure
        private bool IsExistingObjectInProd()
        {
            string CopyFromServerConnString = string.Empty;
            string ReleaseFromObjectText    = string.Empty;

            using (DataStuff sn = new DataStuff())
            {
                DataTable dt = sn.GetCheckOutFromServersProduction(AliasName);

                if (dt.Rows.Count > 0)
                {
                    ProductionServerAlias = dt.Rows[0]["ServerAliasDesc"].ToString();
                }
            }

            if (!string.IsNullOrEmpty(ProductionServerAlias))
            {
                //Found the prod server, get the object text

                try
                {
                    CopyFromServerConnString = GetServerConnectionString(ProductionServerAlias);

                    if (CopyFromServerConnString.Trim() != "")
                    {
                        ReleaseFromObjectText = GetObjectText(CopyFromServerConnString, DatabaseName, ObjectName);
                    }

                    if (!string.IsNullOrEmpty(ReleaseFromObjectText))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

                catch
                {
                    return(false);
                }
            }

            return(false);
        }