Ejemplo n.º 1
0
        private void BingGv()
        {
            try
            {
                var list = new NoticeManageBL().SearchRecord(new NoticeManage_Info());

                _showDataList = list as List<NoticeManage_Info>;

                List<NoticeManage_Info> infoList = list as List<NoticeManage_Info>;

                foreach (NoticeManage_Info info in infoList)
                {
                    switch (info.not_iPeriodType)
                    {
                        case 0:
                            info.periodType_CN = "一次";
                            break;
                        case 1:
                            info.periodType_CN = "每天";
                            break;
                        case 2:
                            info.periodType_CN = "每周";
                            break;
                        default:
                            break;
                    }

                }

                this.lvInfo.Clear();

                initColoum();

                this.lvInfo.SetDataSource(infoList);

            }
            catch
            {

            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 設置控件值
        /// </summary>
        private void SetControlValue()
        {
            if(this.BaseParam != null )
            {
                try
                {
                    NoticeManage_Info noticeInfo = this.BaseParam as NoticeManage_Info;

                    this.rtbContent.Text = noticeInfo.not_cContent;
                    this.dtpValidFrom.Value = noticeInfo.not_dValidFrom;
                    this.dtpValidTo.Value = noticeInfo.not_dValidTo;
                    this.nudScrollSpeed.Value = noticeInfo.not_iScrollSpeed;
                    this.dtpStartDate.Value = (DateTime)noticeInfo.not_dStartDate;
                    this.dtpEndDate.Value = (DateTime)noticeInfo.not_dEndDate;
                    this.chbSync.Checked = noticeInfo.not_lSync;
                    this.chbValid.Checked = noticeInfo.not_lValid;

                    switch(noticeInfo.not_iPeriodType)
                    {
                        case 0:
                            this.rbtOnce.Checked = true;
                            ModuleStatus(1);
                            break;
                        case 1:
                            this.rbtDate.Checked = true;
                            ModuleStatus(2);
                            break;
                        case 2:
                            this.rbtWeek.Checked = true;
                            ModuleStatus(3);
                            break;
                        default:
                            break;
                    }

                    if(!String.IsNullOrEmpty(noticeInfo.not_cDateIndex))
                    {
                        string[] dates = noticeInfo.not_cDateIndex.Split(',');

                        List<CheckBox> checkBoxList = GetWeekList();

                        for (int index = 0; index < dates.Length ; index++)
                        {
                            if (Int32.Parse(dates[index]) > 0 && Int32.Parse(dates[index]) < 8)
                            {
                                checkBoxList[Int32.Parse(dates[index])-1].Checked = true;
                            }
                        }
                    }

                    if (noticeInfo.not_RecordID !=null)
                    {
                        NoticeManageBL noticeBL = new NoticeManageBL();

                        List<NoticeToMachine> ntmList = noticeBL.GetNoticeMachineList(noticeInfo.not_RecordID.ToString());

                        if (ntmList != null)
                        {
                            InitMachineTree();//初始選擇列表
                            for (int index = this.lbxMachineList.Items.Count-1; index >=0 ;index-- )
                            {
                                for (int n = 0; n < ntmList.Count;n++ )
                                {
                                    MachineMaster_mmt_Info machine = this.lbxMachineList.Items[index] as MachineMaster_mmt_Info;
                                    if (machine.mmt_cMachineID == ntmList[n].notm_cMMTID)
                                    {
                                        this.lbxSelectedMachine.Items.Add(this.lbxMachineList.Items[index]);
                                        this.lbxMachineList.Items.Remove(this.lbxMachineList.Items[index]);

                                       // ntmList.Remove(ntmList[n]);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (noticeInfo.NoticeMachineList != null && noticeInfo.NoticeMachineList.Count > 0)
                        {

                        }
                    }

                }
                catch
                {

                }
            }
        }
Ejemplo n.º 3
0
        private void SaveData(object sender, EventArgs evArgs)
        {
            NoticeManage_Info noticeInfo = CheckData();
            if(noticeInfo != null )
            {
                NoticeManageBL noticeBLL = new NoticeManageBL();

                if (MessageBox.Show("通告通行情況:\n\n" + GetRunningContent() + " \n\n确定保存?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    ReturnValueInfo returnInfo;
                    switch (this.EditState)
                    {
                        case Common.DefineConstantValue.EditStateEnum.OE_Update:
                            if (this.BaseParam != null)
                            {
                                NoticeManage_Info info = this.BaseParam as NoticeManage_Info;

                                noticeInfo.not_RecordID = info.not_RecordID;
                                returnInfo = noticeBLL.UpdateRecord(noticeInfo);

                                if (returnInfo.boolValue)
                                {
                                    noticeBLL.InsertNoticeMessage(noticeInfo);

                                    //this.Close();
                                }
                            }

                            break;
                        case Common.DefineConstantValue.EditStateEnum.OE_Insert:
                            returnInfo = noticeBLL.InsertRecord(noticeInfo);

                            MessageBox.Show(this, returnInfo.messageText);

                            if (returnInfo.boolValue)
                            {
                                noticeBLL.InsertNoticeMessage(noticeInfo);

                                //this.Close();
                            }
                            break;
                        default:
                            break;
                    }

                }

            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 刪除通告
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="evArgs"></param>
        private void DeleteNot(object sender, EventArgs evArgs)
        {
            if(_noticeInfo == null)
            {
                MessageBox.Show("請選擇一條通告記錄!","提示");
                return;
            }

            if (MessageBox.Show("是否刪除通告?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                NoticeManageBL noticeBLL = new NoticeManageBL();

                noticeBLL.DeleteRecord(_noticeInfo.not_RecordID);

                RefreshForm(null,null);
                return;
            }
        }