Beispiel #1
0
    objADCPortConfig GetPortType(int id, int port_id)
    {
        string dType = "";
        string pType = "";

        //
        DataRow[] dr = DTADCPort.Select("port_id=" + id);
        if (dr.Length > 0)
        {
            dType = dr[0][0].ToString().Split(' ')[0].Trim();
            pType = dr[0][0].ToString().Split(' ')[1].Trim().Replace("(", "").Replace(")", "").Replace("RS", "RS-");
        }
        //
        objADCPortConfig obj = new objADCPortConfig();

        //
        obj.ADC_PortDeviceType = dType;
        obj.ADC_PortType       = pType;
        obj.ADC_PortID         = port_id;
        obj.ADC_PortBaudRate   = "";
        obj.ADC_PortDatabit    = 8;
        obj.ADC_PortParity     = "";
        //
        obj.ADC_PortEnable = id == 0 ? 0 : 1;
        //
        return(obj);
    }
 objADCPortConfig GetPortType(int id, int port_id)
 {
     string dType = "";
     string pType = "";
     //
     DataRow[] dr = DTADCPort.Select("port_id=" + id);
     if (dr.Length > 0)
     {
         dType = dr[0][0].ToString().Split(' ')[0].Trim();
         pType = dr[0][0].ToString().Split(' ')[1].Trim().Replace("(", "").Replace(")", "").Replace("RS", "RS-");
     }
     //
     objADCPortConfig obj = new objADCPortConfig();
     //
     obj.ADC_PortDeviceType = dType;
     obj.ADC_PortType = pType;
     obj.ADC_PortID = port_id;
     obj.ADC_PortBaudRate = "";
     obj.ADC_PortDatabit = 8;
     obj.ADC_PortParity = "";
     //
     obj.ADC_PortEnable = id == 0 ? 0 : 1;
     //
     return obj;
 }