コード例 #1
0
        void AddNewStoredProcedure()
        {
            string spname = txtspname.Text.Trim();
            StoredProcedureBusiness spData = new StoredProcedureBusiness();
            var splist = spData.GetStoredProcedureList(AppTimeConfiguration.MainServer);

            if (splist.Select(x => x.SPName.ToLower()).Contains(spname.ToLower()))
            {
                string         procname = splist.Where(x => x.SPName.ToLower() == spname.ToLower()).First().SPName;
                EntityBusiness edata    = new EntityBusiness();
                SPModel        sp       = new SPModel();
                sp.SPName      = procname;
                sp.SPDate      = dtpScriptDate.Value;
                sp.CreatedDate = DateTime.Now;
                long res = edata.AddNewSP(sp);
                if (res != -1)
                {
                    LoadStoredProcedures(dtpScriptDate.Value);
                    txtspname.Clear();
                }
                else
                {
                    MessageBox.Show("Stored Procedures already exists.", "Information", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Stored Procedures does not exists in current database.", "Information", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
        }
コード例 #2
0
        void LoadDatabaseStoredProcedures()
        {
            StoredProcedureBusiness spData = new StoredProcedureBusiness();
            var splist = spData.GetStoredProcedureList(AppTimeConfiguration.MainServer);

            if (splist != null)
            {
                txtspname.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
                txtspname.AutoCompleteSource = AutoCompleteSource.CustomSource;
                var autosource = new AutoCompleteStringCollection();
                autosource.AddRange(splist.Select(x => x.SPName).ToArray());
                txtspname.AutoCompleteCustomSource = autosource;
            }
        }