public void llenaUnidadNegocio()
 {
     NegocioService oNegocioService = new NegocioService();
     System.Object[] ItemObject = new System.Object[oNegocioService.GetUnidadesNegocioId().Length];
     for (int i = 0; i < oNegocioService.GetUnidadesNegocioId().Length; i++)
     {
         ItemObject[i] = oNegocioService.GetUnidadesNegocioId()[i];
     }
     cmbUnidadNegocio.Items.AddRange(ItemObject);
     List<int> lst = ItemObject.OfType<int>().ToList();
     cmbUnidadNegocio.Text = lst.Min().ToString();
 }
 public void llenaUnidadNegocio()
 {
     lblUnidadesNegocio.Text = oNegocioService.GetUnidadesNegocio().Length.ToString();
     System.Object[] ItemObject = new System.Object[oNegocioService.GetUnidadesNegocioDescripcion().Length];
     for (int i = 0; i < oNegocioService.GetUnidadesNegocioDescripcion().Length; i++)
     {
         ItemObject[i] = oNegocioService.GetUnidadesNegocioDescripcion()[i];
     }
     cmbUnidadesNegocioNombre.Items.AddRange(ItemObject);
     List<String> lst = ItemObject.OfType<String>().ToList();
     cmbUnidadesNegocioNombre.Text = lst.Min().ToString();
 }
Esempio n. 3
0
        /// <summary>
        /// Call an intrastage query for each station where Intrastage is enabled. 
        /// </summary>
        /// <param name="thisCell"></param>
        /// <param name="i"></param>
        /// <param name="j"></param>
        /// <returns></returns>
        public override StationData eachStation(StationData thisCell, int i, int j)
        {
            //Check if intrastage is enabled (bool)
            if (thisCell.Intrastage)
            {
                List<String> newData = new List<String>();
                //Perform the multiple queries
                myConnection = new SqlConnection("Data Source=BHX4SQ01;Initial Catalog=IS_Main;User ID=is_viewer;Password=is!viewer");
                //Try to open the connection, otherwise log the error.
                try
                {
                    myConnection.Open();
                }
                catch (Exception e)
                {

                    ConsolePost newPost = new ConsolePost();
                    newPost.type = 4;
                    newPost.issue = "Could not connect to Intrastage";
                    newPost.trace = e.ToString();
                    Program.updates.Add(newPost);
                }
                //try to read the data and parse it appropriately.
                try
                {
                    SqlDataReader myReader = null;
                    String thisQuery = queryPartOne +
                thisCell.Station_Name +
                queryPartTwo;

                    SqlCommand myCommand = new SqlCommand(thisQuery, myConnection);
                    myReader = myCommand.ExecuteReader();
                    while (myReader.Read())
                    {

                        Object[] thisData = new Object[myReader.FieldCount];

                        myReader.GetValues(thisData);

                        switch (thisData[1].ToString())
                        {
                            case "Passed":
                                thisData[1] = "#AAD178";
                                break;
                            case "Error":
                                thisData[1] = "#F7BE64";
                                break;
                            case "Aborted":
                                thisData[1] = "#6AD2EB";
                                break;
                            case "Terminated":
                                thisData[1] = "#6AD2EB";
                                break;
                            case "Failed":
                                thisData[1] = "#EF8A80";
                                break;
                            default:
                                thisData[1] = "#808080";
                                break;
                        }

                        newData = thisData.OfType<String>().ToList();
                    }
                    myReader.Close();
                    myConnection.Close();
                }
                catch (Exception e)
                {
                    ConsolePost newPost = new ConsolePost();
                    newPost.type = 4;
                    newPost.issue = "Could not read data";
                    newPost.trace = e.ToString();
                    Program.updates.Add(newPost);
                }

                thisCell.cellData = newData;

            }
            return thisCell;
        }
Esempio n. 4
0
          public void PythonLinqGenericArgs()
          {
              var start = new Object[] {1, "string", 4, Guid.Empty, 6};
              var expected = start.OfType<int>().Skip(1).First();
              var actual = RunPythonHelper(Impromptu.Linq(start), @"
import System
result = linq.OfType[System.Int32]().Skip(1).First()

");
              Assert.AreEqual(expected,actual);
          }