/// <summary> /// Executes SQL statement and wraps database object to .NET object. /// </summary> /// <param name="Sp">Bussines logic command object instance.</param> /// <returns>Instance of bussines logic object.</returns> protected static TObject GetApplicationObject(SpBase Sp) { TObject _object; TStore _db = (TStore)Activator.CreateInstance(typeof(TStore)); using (IDataReader _dr = Sp.ExecuteReader()) { if (_dr.Read()) { _object = (TObject)Activator.CreateInstance(typeof(TObject)); _object.Load(_dr); } else { _object = (TObject)Activator.CreateInstance(typeof(TObject)); } if (_dr != null) { _dr.Close(); } Sp.Close(); } return((TObject)_object); }
public SharePointTest() { _sp = new SpBase(new SpCredential() { IpAddress = Settings.SharePoint.ServerIpAddress, Domain = Settings.SharePoint.ServerDomain, UserName = Settings.SharePoint.ServerUserName, Password = Settings.SharePoint.ServerPassword }); }
private void Initialize() { DisposeObject(); _unitOfWork = new UnitOfWork(Settings.MsSql.ConnectionString); _sp = new SpBase(new SpCredential { IpAddress = Settings.SharePoint.ServerIpAddress, Domain = Settings.SharePoint.ServerDomain, UserName = Settings.SharePoint.ServerUserName, Password = Settings.SharePoint.ServerPassword }); }
public void InitializeElements(int n) { for (var k = 0; k < NumPlayers; k++) { lstPlayers.Add(new Player()); } // Create Controls StackPanel formSpCtrl = new StackPanel // Create base panel for each player { Name = "Ctrlpanel", Orientation = Orientation.Horizontal, Margin = new Thickness(10), Background = new SolidColorBrush(Colors.Gray) }; SpBase.Children.Add(formSpCtrl); // Add control SP // Add buttons along the top Button formBtnGo = new Button { Name = "btnGo", MinHeight = 17, MinWidth = 35, Margin = new Thickness(5), Content = " Start Gameplay " }; // Setup button event handler formBtnGo.Click += (s, e) => { Click_handler(s, e); }; formSpCtrl.Children.Add(formBtnGo); formBtnConfirm = new Button { Name = "btnConfirm", MinHeight = 17, MinWidth = 35, Margin = new Thickness(5), IsEnabled = false, Content = " Confirm Dialog " }; // Setup button event handler formBtnConfirm.Click += (s, e) => { Click_handler(s, e); }; formSpCtrl.Children.Add(formBtnConfirm); //Button formBtnClock = new Button //{ // Name = "btnclock", // MinHeight = 17, // MinWidth = 35, // Margin = new Thickness(5), // Content = "Clock Civs" //}; //// Setup button event handler //formBtnClock.Click += (s, e) => //{ // Click_handler(s, e); //}; //formSpCtrl.Children.Add(formBtnClock); formLabIndicator = new Label { Content = "Please enter information and click Start!", FontSize = 20, MinWidth = 25 }; formSpCtrl.Children.Add(formLabIndicator); // Create Elements for Players / Civs for (var i = 1; i <= n; i++) { //Generate elements StackPanel formSp = new StackPanel // Create base panel for each player { Name = "panel" + i, Orientation = Orientation.Horizontal, Margin = new Thickness(10), Background = new SolidColorBrush(Colors.Gray) }; CheckBox formChk = new CheckBox { Name = "inpChk" + i, Content = "Player " + i, Margin = new Thickness(10) }; if (i <= 9) // Let's line everything up... { formChk.Content = "Player " + i + " "; } lstEnabled.Add(formChk); TextBox formInpName = new TextBox { Name = "inpName" + i, Text = "Player Name", Margin = new Thickness(10), Width = 100, }; lstNames.Add(formInpName); TextBox formInpCiv = new TextBox { Name = "inpCiv" + i, Text = "Current Player Civilization " + i, Width = 150, Margin = new Thickness(10), MinWidth = 100 }; lstCivs.Add(formInpCiv); Label formSep = new Label { Content = "→", FontSize = 20, Width = 25 }; TextBox formOutCiv = new TextBox { Name = "outCiv" + i, Text = "", Width = 150, Margin = new Thickness(10), IsEnabled = false, MinWidth = 100 }; lstCivsOut.Add(formOutCiv); SpBase.Children.Add(formSp); // Add the panel to the GUI formSp.Children.Add(formChk); // Then add the elements to the panel formSp.Children.Add(formInpName); formSp.Children.Add(formInpCiv); formSp.Children.Add(formSep); formSp.Children.Add(formOutCiv); SpBase.RegisterName("panel" + i, formSp); formSp.RegisterName("inpChk" + i, formChk); formSp.RegisterName("inpName" + i, formInpName); formSp.RegisterName("inpCiv" + i, formInpCiv); formSp.RegisterName("outCiv" + i, formOutCiv); } }