示例#1
0
        public static List <CorporateData> OrgChart()
        {
            List <CorporateData> result  = new List <CorporateData>();
            CorporateData        antonio = new CorporateData("Antonio", "Moreno", "antonio.jpg", "Team Lead", "#1696d3");

            result.Add(antonio);

            CorporateData elizabeth = new CorporateData("Elizabeth", "Brown", "elizabeth.jpg", "Design Lead", "#ef6944");

            antonio.Items.Add(elizabeth);

            CorporateData ann = new CorporateData("Ann", "Devon", "ann.jpg", "UI Designer", "#ef6944");

            elizabeth.Items.Add(ann);

            CorporateData diego = new CorporateData("Diego", "Roel", "diego.jpg", "QA Engineer", "#ee587b");

            antonio.Items.Add(diego);

            CorporateData fran = new CorporateData("Fran", "Wilson", "fran.jpg", "QA Intern", "#ee587b");

            diego.Items.Add(fran);

            CorporateData felipe = new CorporateData("Felipe", "Izquiedro", "felipe.jpg", "Senior Developer", "#75be16");

            antonio.Items.Add(felipe);

            CorporateData daniel = new CorporateData("Daniel", "Tonini", "daniel.jpg", "Developer", "#75be16");

            felipe.Items.Add(daniel);

            return(result);
        }
示例#2
0
        public void TestCorporateSaveManagerAccount()
        {
            // arrange
            CorporateData CorpData = new CorporateData(DBServer, DBName, DBUser, DBPassword);
            bool          expected = true;

            //Act
            bool actual = CorpData.CorporateSaveManagerAccount("SAm", "Test", "STest", "123", "1");

            //Assert
            Assert.AreEqual(expected, actual, "Manager could not be saved");
        }
示例#3
0
        public void TestInitializer_WithParameters()
        {
            // arrange
            bool loadExpected = true;

            //act - initalize
            CorporateData CorpData = new CorporateData(DBServer, DBName, DBUser, DBPassword);

            // assert
            bool actual = CorpData.Connected();

            Assert.AreEqual(loadExpected, actual, "Should be connected bute is not. Server " + DBServer + " using nsa-database with user root and no password");
        }
示例#4
0
        public void TestStoresData()
        {
            // arrange
            CorporateData CorpData = new CorporateData(DBServer, DBName, DBUser, DBPassword);

            List <string>[] Stores;
            int             StoresCount = -1;
            bool            expected    = true;

            //Act
            StoresCount = CorpData.StoresData(out Stores);

            //Assert
            bool actual = StoresCount > 0;

            Assert.AreEqual(expected, actual, "Number of stores is not expected");
        }
示例#5
0
        public ActionResult Edit(CorporateData.AssetUpdate newInstance)
        {
            if (ModelState.IsValid)
            {
                Console.WriteLine("Done");
            }

            try
            {
                bool hasLocationContentChanged = false;

                if (newInstance.Location != null && newInstance.Location.ID > 0)
                {
                    string serialized = (Server.HtmlDecode(Request["originalModel"]));

                    /*
                    // Test that Request["originalModel"] is actually a serialized Location instance 
                    System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
                    xml.LoadXml(serialized);
                    BusinessObjects.WorkManagement.Location originalContent = null;
                    originalContent = (BusinessObjects.WorkManagement.Location)BusinessObjects.Base.Deserialize(typeof(BusinessObjects.WorkManagement.Location),xml);
                    */

                    hasLocationContentChanged = (serialized != newInstance.Location.Serialize());
                }

                newInstance.HasLocationChanged = hasLocationContentChanged;
                _modelContext.SaveAsset(newInstance);

                return RedirectToAction("Index");
            }
            catch
            {
                return View("Edit", new {id=newInstance.AssetID});
            }
        }
示例#6
0
        public ActionResult Create(CorporateData.AssetUpdate newInstance)
        {
             if (ModelState.IsValid)
             {
                 Console.WriteLine("Done");
             }

            try
            {
                // Save logic HERE
                _modelContext.SaveAsset(newInstance);
                
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
示例#7
0
        private static CorporateData ProcessCorporationSheetResponse(XElement results)
        {
            if (results == null)
            {
                return(null); // return null... no data.
            }

            var data = new CorporateData();


            data.CorporationId   = results.Element("corporationID").Value.ToInt32();
            data.CorporationName = results.Element("corporationName").Value;
            data.Ticker          = results.Element("ticker").Value;
            data.CeoId           = results.Element("ceoID").Value.ToInt32();
            data.CeoName         = results.Element("ceoName").Value;
            data.StationId       = results.Element("stationID").Value.ToInt32();
            data.StationName     = results.Element("stationName").Value;
            data.Description     = results.Element("description").Value;
            data.Url             = results.Element("url").Value;
            data.AllianceId      = results.Element("allianceID").Value.ToInt32();
            if (results.Element("allianceName") != null)
            {
                data.AllianceName = results.Element("allianceName").Value;
            }
            data.TaxRate     = results.Element("taxRate").Value;
            data.MemberCount = results.Element("memberCount").Value.ToInt32();
            data.MemberLimit = results.Element("memberLimit").Value.ToInt32();
            data.Shares      = results.Element("shares").Value.ToInt32();
            data.Divisions   = from rowsets in results.Elements("rowset")
                               from rows in rowsets.Descendants()
                               where rowsets.Attribute("name").Value == "divisions"
                               select
                               new CorporateDivision
            {
                AccountKey  = rows.Attribute("accountKey").Value.ToInt32(),
                Description = rows.Attribute("description").Value
            };

            data.WalletDivisions = from rowsets in results.Elements("rowset")
                                   from rows in rowsets.Descendants()
                                   where rowsets.Attribute("name").Value == "walletDivisions"
                                   select
                                   new CorporateDivision
            {
                AccountKey  = rows.Attribute("accountKey").Value.ToInt32(),
                Description = rows.Attribute("description").Value
            };

            XElement logoXml = results.Element("logo");
            var      logo    = new CorporateLogo
            {
                GraphicId = logoXml.Element("graphicID").Value.ToInt32(),
                Color1    = logoXml.Element("color1").Value.ToInt32(),
                Color2    = logoXml.Element("color2").Value.ToInt32(),
                Color3    = logoXml.Element("color3").Value.ToInt32(),
                Shape1    = logoXml.Element("shape1").Value.ToInt32(),
                Shape2    = logoXml.Element("shape2").Value.ToInt32(),
                Shape3    = logoXml.Element("shape3").Value.ToInt32()
            };

            data.Logo = logo;


            return(data);
        }
示例#8
0
        public CorporateData.AssetCollection SaveAsset(CorporateData.AssetUpdate assetUpdate)
        {
            CorporateData.AssetCollection assets = null;

            CorporateData.ExternalDataServiceClient serviceProxy = new CorporateData.ExternalDataServiceClient();
            assets = serviceProxy.UploadAssetData(assetUpdate);
            serviceProxy.Close();

            return assets;
        }
示例#9
0
 public void TestInitializer_WithParameters_InvalidPass()
 {
     // Act
     CorporateData NSADB = new CorporateData(DBServer, DBName, DBUser, "BADPASS");
 }
示例#10
0
 public void TestInitializer_WithParameters_InvalidUser()
 {
     // Act
     CorporateData NSADB = new CorporateData(DBServer, DBName, "BAD-USER", DBPassword);
 }
示例#11
0
 public void TestInitializer_WithParameters_InvalidServer()
 {
     // Act
     CorporateData CorpData = new CorporateData("Bad Server", DBName, DBUser, DBPassword);
 }