/// <summary>
        /// Save Limit Times.
        /// </summary>
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try {
                var node = NodeTreeView.SelectedNode;
                if (node == null)
                {
                    MessageBox.Show("请选择需要应用参数的设备", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                var devIds = new List <Int32>();
                var tag    = (IDValuePair <Int32, EnmNodeType>)node.Tag;
                if (tag.Value == EnmNodeType.Dev)
                {
                    devIds.Add(tag.ID);
                }
                else
                {
                    CheckDevTreeView(node.Nodes, devIds);
                    if (devIds.Count == 0)
                    {
                        MessageBox.Show(String.Format("请勾选[{0}]节点下需要应用参数的设备", node.Text), "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        NodeTreeView.Focus();
                        return;
                    }
                }

                var limitIds = new List <EnmLimitID>();
                if (AllCB.Checked || RightTabControl.SelectedIndex == 0)
                {
                    limitIds.Add(EnmLimitID.DTM);
                    limitIds.Add(EnmLimitID.NDTM);
                }

                if (AllCB.Checked || RightTabControl.SelectedIndex == 1)
                {
                    limitIds.Add(EnmLimitID.WTMG);
                }

                if (AllCB.Checked || RightTabControl.SelectedIndex == 2)
                {
                    limitIds.Add(EnmLimitID.IRTM);
                }

                if (AllCB.Checked || RightTabControl.SelectedIndex == 3)
                {
                    limitIds.Add(EnmLimitID.SHD);
                }

                if (AllCB.Checked || RightTabControl.SelectedIndex == 4)
                {
                    limitIds.Add(EnmLimitID.SWD);
                }

                var times = CurTimes.FindAll(t => limitIds.Any(l => t.LimitId == l));
                if (times.Count == 0)
                {
                    MessageBox.Show("未设置任何参数,请先设置参数。", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (!AllCB.Checked || MessageBox.Show("您确定要对设备应用全部时段吗?", "确认对话框", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                {
                    var result = Common.ShowWait(() => {
                        new LimitTime().SaveLimitTimes(devIds, limitIds, times);
                    }, default(String), "正在保存,请稍后...", default(Int32), default(Int32));

                    if (result == DialogResult.OK)
                    {
                        foreach (var devId in devIds)
                        {
                            foreach (var limitId in limitIds)
                            {
                                Common.WriteLog(DateTime.Now, EnmMsgType.Info, Common.CurUser.UserName, "Delta.MPS.AccessSystem.SetLimitTimeForm.SaveBtn.Click", String.Format("配置设备[ID:{0}]准进时段[{1}]", devId, ComUtility.GetLimitIDText(limitId)), null);
                            }
                        }
                        MessageBox.Show("数据保存完成", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("数据保存失败", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            } catch (Exception err) {
                Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.SetLimitTimeForm.SaveBtn.Click", err.Message, err.StackTrace);
                MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// Combobox SelectedIndex Changed Event.
        /// </summary>
        private void SWDWeekCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            try {
                if (ValueChangedLocked)
                {
                    return;
                }
                if (SWDTime == null)
                {
                    SWDTime            = new LimitTimeInfo();
                    SWDTime.ID         = 0;
                    SWDTime.DevId      = 0;
                    SWDTime.LimitId    = EnmLimitID.SWD;
                    SWDTime.LimitIndex = 0;
                    SWDTime.LimitDesc  = "周末时段";
                    SWDTime.WeekIndex  = ComUtility.DefaultInt32;
                    SWDTime.EndTime1   = ComUtility.DefaultString;
                    SWDTime.StartTime2 = ComUtility.DefaultString;
                    SWDTime.EndTime2   = ComUtility.DefaultString;
                    SWDTime.StartTime3 = ComUtility.DefaultString;
                    SWDTime.EndTime3   = ComUtility.DefaultString;
                    SWDTime.StartTime4 = ComUtility.DefaultString;
                    SWDTime.EndTime4   = ComUtility.DefaultString;
                    SWDTime.StartTime5 = ComUtility.DefaultString;
                    SWDTime.EndTime5   = ComUtility.DefaultString;
                    SWDTime.StartTime6 = ComUtility.DefaultString;
                    SWDTime.EndTime6   = ComUtility.DefaultString;
                    CurTimes.Add(SWDTime);
                }

                SWDTime.StartTime1 = String.Empty;
                if (SWDWeekCB1.SelectedIndex == 0)
                {
                    SWDTime.StartTime1 += SWDWeekCB1.Tag.ToString();
                }

                if (SWDWeekCB2.SelectedIndex == 0)
                {
                    SWDTime.StartTime1 += SWDWeekCB2.Tag.ToString();
                }

                if (SWDWeekCB3.SelectedIndex == 0)
                {
                    SWDTime.StartTime1 += SWDWeekCB3.Tag.ToString();
                }

                if (SWDWeekCB4.SelectedIndex == 0)
                {
                    SWDTime.StartTime1 += SWDWeekCB4.Tag.ToString();
                }

                if (SWDWeekCB5.SelectedIndex == 0)
                {
                    SWDTime.StartTime1 += SWDWeekCB5.Tag.ToString();
                }

                if (SWDWeekCB6.SelectedIndex == 0)
                {
                    SWDTime.StartTime1 += SWDWeekCB6.Tag.ToString();
                }

                if (SWDWeekCB7.SelectedIndex == 0)
                {
                    SWDTime.StartTime1 += SWDWeekCB7.Tag.ToString();
                }

                if (SWDTime.StartTime1.Length >= 4)
                {
                    SWDTime.StartTime1 = SWDTime.StartTime1.Substring(0, 4);
                }
                else if (SWDTime.StartTime1.Length == 2)
                {
                    SWDTime.StartTime1 += "FF";
                }
                else
                {
                    SWDTime.StartTime1 = "0000";
                }
            } catch (Exception err) {
                Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.SetLimitTimeForm.SWDWeekCB.SelectedIndexChanged", err.Message, err.StackTrace);
                MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }