Ejemplo n.º 1
0
        protected void ButtonOK_Click(object sender, EventArgs e)
        {
            StringBuilder stringBuilder = new StringBuilder();

            DateTime now = DateTime.Now;
            DateTime beginDate = new DateTime(now.Year, now.Month, 1);
            DateTime endDate = beginDate.AddMonths(1).AddSeconds(-1);

            try
            {
                if (!string.IsNullOrEmpty(this.TextBoxBeginDate.Text))
                {
                    beginDate = DateTime.Parse(this.TextBoxBeginDate.Text);
                }
                if (!string.IsNullOrEmpty(this.TextBoxEndDate.Text))
                {
                    endDate = DateTime.Parse(this.TextBoxEndDate.Text);
                    endDate = endDate.AddDays(1).AddSeconds(-1);
                }
            }
            finally
            {
            }

            if (this.DropDownListMachines.SelectedValue != null)
            {
                string guid = this.DropDownListMachines.SelectedValue;
                if (!string.IsNullOrEmpty(guid))
                {
                    MachineBusiness machineBusiness = new MachineBusiness();
                    this.Machine = machineBusiness.QueryByGuid(guid);

                    if (this.Machine != null)
                    {
                        if (!string.IsNullOrEmpty(this.Machine.RoomId))
                        {
                            RoomBusiness roomBusiness = new RoomBusiness();
                            this.Room = roomBusiness.QueryByGuid(this.Machine.RoomId);
                        }

                        if (!string.IsNullOrEmpty(this.Machine.Guid))
                        {
                            DetectorBusiness detectorBusiness = new DetectorBusiness();
                            this.Detectors = detectorBusiness.QueryByMachine(this.Machine.Guid);

                            this.NormalDataCaches = detectorBusiness.QueryNormalDataCacheByMachine(this.Machine.Guid, beginDate, endDate);
                            this.AlarmDataCaches = detectorBusiness.QueryAlarmDataCacheByMachine(this.Machine.Guid, beginDate, endDate);

                            MessageCacheBusiness messageCacheBusiness = new MessageCacheBusiness();
                            this.MessageCaches = messageCacheBusiness.QueryByMachine(this.Machine.Guid, beginDate, endDate);
                        }
                    }
                }
                else
                {
                    stringBuilder.Append("没有选择检测仪!");
                }
            }

            this.LabelMessage.Text = stringBuilder.ToString();
        }