Пример #1
0
        private void DisableStatus()
        {
            string ObjectTypeReturned = string.Empty;

            //tsbCheckInOut.Enabled = false;
            tsbHistory.Enabled = false;

            try
            {
                using (DataStuff sn = new DataStuff())
                {
                    DataTable dt = sn.GetObjectType(ConnectionString, DatabaseName, ObjectName);

                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            ObjectTypeReturned = row[0].ToString();
                        }
                    }

                    if ((ObjectTypeReturned.Trim() == "P") || (ObjectTypeReturned.Trim() == "FN") || (ObjectTypeReturned.Trim() == "TF") || (ObjectTypeReturned.Trim() == "IF"))
                    {
                        //if (!AvailableForEdit)
                        //{
                        //    tsbCheckInOut.Enabled = false;
                        //}
                        //else
                        //{
                        //    tsbCheckInOut.Enabled = true;
                        //}

                        tsbHistory.Enabled = true;
                    }

                    /*
                     * FN = Scalar function
                     * P = Stored procedure
                     * TF = Table function
                     * TR = SQL DML Trigger
                     * V = View
                     * IF = In-lined table-function
                     * D = Default or DEFAULT constraint
                     */

                    switch (ObjectTypeReturned.Trim())
                    {
                    case "P":
                        tObjectType.Text = "Stored Procedure";
                        break;

                    case "FN":
                        tObjectType.Text = "Scalar Function";
                        break;

                    case "TF":
                        tObjectType.Text = "Table Function";
                        break;

                    case "IF":
                        tObjectType.Text = "In-Line Table Function";
                        break;

                    case "U":
                        tObjectType.Text = "User Table";
                        break;

                    case "TR":
                        tObjectType.Text = "SQL DML Trigger";
                        break;

                    case "V":
                        tObjectType.Text = "View";
                        break;

                    default:
                        break;
                    }
                }
            }

            catch
            {
                return;
            }
        }