Ejemplo n.º 1
0
        public static DataTable GetDevByProperty(int PropertyID)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("txt");
            dt.Columns.Add("val");
            try
            {
                DeviceDefineGetByDevpropertIDRequest DeviceDefineRequest = new DeviceDefineGetByDevpropertIDRequest();
                DeviceDefineRequest.DevpropertID = PropertyID;
                var result = deviceDefineService.GetDeviceDefineCacheByDevpropertID(DeviceDefineRequest).Data;
                if (result.Count > 0)
                {
                    foreach (Jc_DevInfo tempdev in result)
                    {
                        object[] obj = new object[dt.Columns.Count];
                        obj[0] = tempdev.Name;
                        obj[1] = tempdev.Devid;
                        dt.Rows.Add(obj);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error("ClientAlarmServer-GetClassByProperty-发生异常 " + ex.Message);
            }
            return(dt);
        }
Ejemplo n.º 2
0
        public void LoadData()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("devid");
            dt.Columns.Add("devName");
            dt.Columns.Add("MultipleText");
            //加载已定义倍数关系
            DeviceDefineGetByDevpropertIDRequest DeviceDefineRequest = new DeviceDefineGetByDevpropertIDRequest();

            DeviceDefineRequest.DevpropertID = 1;
            deviceInfos         = deviceDefineService.GetDeviceDefineCacheByDevpropertID(DeviceDefineRequest).Data;
            multiplesettingList = multiplesettingService.GetAllMultiplesettingList().Data;
            if (multiplesettingList != null)
            {
                foreach (JC_MultiplesettingInfo multiplesetting in multiplesettingList)
                {
                    object[] obj = new object[dt.Columns.Count];
                    obj[0] = multiplesetting.Devid;
                    Jc_DevInfo tempDev = deviceInfos.Find(a => a.Devid == multiplesetting.Devid);
                    obj[1] = "";
                    if (tempDev != null)
                    {
                        obj[1] = tempDev.Name;
                    }
                    obj[2] = "";
                    string   multipleTextString = "";
                    string[] multipleTextArray  = multiplesetting.MultipleText.Split('|');
                    for (int i = 0; i < multipleTextArray.Length; i++)
                    {
                        string[] tempsonmultipleTextArr = multipleTextArray[i].Split(',');
                        if (float.Parse(tempsonmultipleTextArr[2]) != 0)
                        {
                            multipleTextString += string.Format("条件{3}:范围({0}至{1}),倍数:{2}倍)\r\n",
                                                                tempsonmultipleTextArr[0], tempsonmultipleTextArr[1], tempsonmultipleTextArr[2], (i + 1).ToString());
                        }
                        else
                        {
                            multipleTextString += string.Format("条件{0}:未设置\r\n", (i + 1).ToString());
                        }
                    }
                    obj[2] = multipleTextString;
                    dt.Rows.Add(obj);
                }
            }
            gridControl1.DataSource = dt;
        }
Ejemplo n.º 3
0
 public BasicResponse <List <Jc_DevInfo> > GetDeviceDefineCacheByDevpropertID(Sys.Safety.Request.DeviceDefine.DeviceDefineGetByDevpropertIDRequest DeviceDefineRequest)
 {
     return(_DeviceDefineService.GetDeviceDefineCacheByDevpropertID(DeviceDefineRequest));
 }