Beispiel #1
0
    public building(int id)
    {
        try{
            SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["mainconn"].ConnectionString);
            conn.Open();
            SqlCommand cmd = new SqlCommand("select * FROM building WHERE id = @id", conn);
            cmd.Parameters.AddWithValue("id", id);
            SqlDataReader dr = cmd.ExecuteReader();
            dr.Read();
            ID = new dataObject(id);
            Name = new dataObject(dr["Name"].ToString());
            Address1 = new dataObject(dr["Address1"].ToString());
            Address2 = new dataObject(dr["Address2"].ToString());
            Address3 = new dataObject(dr["Address3"].ToString());
            City = new dataObject(dr["City"].ToString());
            State = new dataObject(dr["State"].ToString());
            ZipCode = new dataObject(dr["ZipCode"].ToString());
            PhoneNumber = new dataObject(dr["PhoneNumber"].ToString());
            PhoneNumberExtension = new dataObject(dr["PhoneNumberExtension"].ToString());
            FaxNumber = new dataObject(dr["FaxNumber"].ToString());
            MobilePhoneNumber = new dataObject(dr["MobilePhoneNumber"].ToString());
            EmailAddress = new dataObject(dr["EmailAddress"].ToString());
            Contact = new dataObject(dr["Contact"].ToString());
            Active = new dataObject(Convert.ToBoolean(dr["Active"]));
            Comment = new dataObject(dr["Comment"].ToString());
            InputDate = new dataObject(Convert.ToDateTime(dr["InputDate"]));
            InputEmploee = new dataObject(new employee(Convert.ToInt32(dr["InputEmployeeID"])));

        }catch(Exception e){
            throw e;
        }
    }
Beispiel #2
0
        private static int GetDocumentedFileCount(Archive archive)
        {
            string archiveExtractionXmlFile =
                archive.WorkingDirectory.Content().WithFile(ArkadeConstants.ArkivuttrekkXmlFileName).FullName;

            var archiveExtractionXml = SerializeUtil.DeserializeFromFile <addml>(archiveExtractionXmlFile);

            dataObject archiveExtractionElement = archiveExtractionXml.dataset[0].dataObjects.dataObject[0];
            property   infoElement           = archiveExtractionElement.properties[0];
            property   additionalInfoElement = infoElement.properties[1];
            property   documentCountProperty =
                additionalInfoElement.properties.FirstOrDefault(p => p.name == "antallDokumentfiler");

            return(int.Parse(documentCountProperty.value));
            // Throws exception if documentCountProperty is null or value could not be parsed

            // TODO: Add "antallDokumentfiler" to ArcadeConstants?
        }
Beispiel #3
0
        private string GetArchiveStandardVersion()
        {
            try
            {
                dataObject archiveExtractionElement = _addml.dataset[0].dataObjects.dataObject[0];

                string archiveExtractionTypeVersion = archiveExtractionElement.properties
                                                      .FirstOrDefault(property => property.name == "info")?.properties
                                                      .FirstOrDefault(property => property.name == "type")?.properties
                                                      .FirstOrDefault(property => property.name == "version")?.value;

                return($"{archiveExtractionTypeVersion}");
            }
            catch (Exception)
            {
                return(string.Empty);
            }
        }
Beispiel #4
0
    // Update is called once per frame
    void Update()
    {
        if (reconnectedFlag)
        {
            StartClient();
        }
        int Count = 0;
        int maxPacketProcessCount = Instance.packetProcessPerSec;

        for (Count = 0; Count < maxPacketProcessCount; Count++)
        {
            float nowTime = Time.time;
            if (packetQueue.Count == 0)
            {
                break;
            }
            dataObject data = dequeue();
            completeRecv(data.data);
        }
    }
    public void TrainNN()
    {
        nn = new NeuralNetwork(2, int.Parse(m_hiddenNeurons.text), 1);

        // XOR training data set

        trainingData    = new dataObject[4];
        trainingData[0] = new dataObject(new float[] { 0, 1 }, new float[] { m_01.isOn ? 1 : 0 });
        trainingData[1] = new dataObject(new float[] { 1, 0 }, new float[] { m_10.isOn ? 1 : 0 });
        trainingData[2] = new dataObject(new float[] { 1, 1 }, new float[] { m_11.isOn ? 1 : 0 });
        trainingData[3] = new dataObject(new float[] { 0, 0 }, new float[] { m_00.isOn ? 1 : 0 });

        // train the neural network
        for (int i = 0; i < int.Parse(m_itterations.text); ++i)
        {
            int randIndex = Random.Range(0, trainingData.Length);
            nn.train(trainingData[randIndex].inputs, trainingData[randIndex].targets);

            if (i == 1)
            {
                m_errorInit.text = "Error " + i.ToString() + " : " + (nn.cumError / i).ToString();
            }
            else if (i == int.Parse(m_itterations.text) - 1)
            {
                m_errorFinal.text = "Error " + i.ToString() + " : " + (nn.cumError / i).ToString();
            }
            else if (i > 1)
            {
                int thirdIndex = (int)(int.Parse(m_itterations.text) / 3.0f);

                if (i % thirdIndex == 0)
                {
                    m_errorThird.text = "Error " + i.ToString() + " : " + (nn.cumError / i).ToString();
                }
                if (i % (thirdIndex * 2) == 0)
                {
                    m_errorTwoThird.text = "Error " + i.ToString() + " : " + (nn.cumError / i).ToString();
                }
            }
        }
    }
Beispiel #6
0
    public order(int id)
    {
        attr = new Hashtable();
        SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["mainconn"].ConnectionString);
        conn.Open();

        SqlCommand cmd = new SqlCommand("Select * FROM workOrder where id=@id", conn);
        cmd.Parameters.AddWithValue("id",id);

        SqlDataReader dr = cmd.ExecuteReader();

        while (dr.Read())
        {
            for(int i=0;i<dr.FieldCount;i++){
                dataObject field = new dataObject(dr[i]);
                field.dataType = dr.GetFieldType(i).ToString();
                attr[dr.GetName(i)] = field;
            }
        }
    }
Beispiel #7
0
    public order()
    {
        attr = new Hashtable();
        SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["mainconn"].ConnectionString);
        conn.Open();

        SqlCommand cmd = new SqlCommand("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_name = 'workorder' order by ordinal_position", conn);

        SqlDataReader dr = cmd.ExecuteReader();

        while (dr.Read())
        {
            dataObject field = new dataObject(dr["column_name"]);
            field.dataType = dr["data_type"].ToString(); ;
            attr[dr["column_name"]] = field;
        }
    }
Beispiel #8
0
    public material(int id)
    {
        SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["mainconn"].ConnectionString);
        conn.Open();

        SqlCommand cmd = new SqlCommand("select id,MaterialCategoryID,MaterialUnitTypeID,Code,Quantity,UnitPrice,Taxable,TaxRate from WorkOrderMaterial where ID = @id", conn);
        cmd.Parameters.AddWithValue("id", id);

        SqlDataReader dr = cmd.ExecuteReader();
        dr.Read();
        ID = new dataObject(id);
        Code = new dataObject(dr["Code"].ToString());
        UnitQuantity = new dataObject(convertToDouble(dr["quantity"]));
        Taxable = new dataObject(convertToBoolean(dr["Taxable"]));

        SqlCommand cmd2 = new SqlCommand("select * from materialCategory where id=@id", conn);
        cmd2.Parameters.AddWithValue("id", dr["MaterialCategoryID"].ToString());
        SqlDataReader dr2 = cmd2.ExecuteReader();
        dr2.Read();
        MaterialCategory = new dataObject(new MaterialCategory { Code = new dataObject(dr2["code"].ToString()), ID = new dataObject(Convert.ToInt32(dr2["id"])), Description = new dataObject(dr2["description"].ToString()), SequenceNumber = new dataObject(Convert.ToInt32(dr2["sequenceNumber"])) });
        dr2.Close();
        cmd2.Parameters.Clear();

        if (!dr["MaterialUnitTypeID"].Equals(DBNull.Value))
        {
            cmd2 = new SqlCommand("select * from materialUnitType where id=@id", conn);
            cmd2.Parameters.AddWithValue("id", dr["MaterialUnitTypeID"].ToString());
            dr2 = cmd2.ExecuteReader();
            dr2.Read();
            MaterialUnitType = new dataObject(new MaterialUnitType { Code = new dataObject(dr2["code"].ToString()), ID = new dataObject(Convert.ToInt32(dr["ID"])) });
            dr2.Close();
            cmd2.Parameters.Clear();
        }
    }
Beispiel #9
0
 public floor(int id)
 {
     try{
         SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["mainconn"].ConnectionString);
         conn.Open();
         SqlCommand cmd = new SqlCommand("select * FROM buildingFloor WHERE id = @id", conn);
         cmd.Parameters.AddWithValue("id", id);
         SqlDataReader dr = cmd.ExecuteReader();
         dr.Read();
         ID = new dataObject(id);
         Building = new dataObject(new building(Convert.ToInt32(dr["BuildingID"])));
         Code = new dataObject(dr["Code"].ToString());
         FloorNumber = new dataObject(Convert.ToInt32(dr["FloorNumber"]));
         FootageTotal = new dataObject(Convert.ToDouble(dr["FootageTotal"]));
         FootageRental = new dataObject(Convert.ToDouble(dr["FootageRental"]));
         InputDate = new dataObject(Convert.ToDateTime(dr["InputDate"]));
         InputEmployee = new dataObject(new employee(Convert.ToInt32(dr["InputEmployeeID"])));
         NonRentalSpaceDescription = new dataObject(dr["NonRentalSpaceDescription"].ToString());
     }catch(Exception e){
         return;
     }
 }
Beispiel #10
0
 public employee(int id)
 {
     try{
         SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["mainconn"].ConnectionString);
         conn.Open();
         SqlCommand cmd = new SqlCommand("select * FROM employee WHERE id = @id", conn);
         cmd.Parameters.AddWithValue("id", id);
         SqlDataReader dr = cmd.ExecuteReader();
         dr.Read();
         ID = new dataObject(id);
         FirstName = new dataObject(dr["Firstname"].ToString());
         LastName = new dataObject(dr["LastName"].ToString());
         dr.Close();
         conn.Close();
     }catch(Exception e){
         throw e;
     }
 }