Exemplo n.º 1
0
        private void cmd与会资源_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmd与会资源.SelectedIndex > 0)
            {
                if (!dtpkBeginTime.Checked || !dtpkEndTime.Checked)
                {
                    MessageDialog.ShowPromptMessage("请先确定会议起止时间后再选择会议资源");
                    cmd与会资源.SelectedIndex = 0;
                    return;
                }

                FormQueryInfo dialog = QueryInfoDialog.GetMeetingResourceDialog(dtpkBeginTime.Value, dtpkEndTime.Value);

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    if (!(bool)dialog.GetDataItem("是共享类资源") && dialog["资源空闲"] == "使用中")
                    {
                        MessageDialog.ShowPromptMessage(
                            string.Format("【{0}】资源已经被占用,只允许选择状态为“空闲”的资源", dialog["资源名称"]));

                        cmd与会资源.SelectedIndex = 0;

                        return;
                    }

                    StringBuilder sb = new StringBuilder();

                    sb.Append(dialog["资源名称"]);

                    cmd与会资源.Items[0]      = sb.ToString(0, sb.Length);
                    cmd与会资源.SelectedIndex = 0;

                    m_meetingData.会议资源 = cmd与会资源.Items[0].ToString();

                    View_PRJ_Resource resource = new View_PRJ_Resource();

                    resource.资源编号   = (int)dialog.GetDataItem("资源编号");
                    resource.资源类别名称 = dialog["资源类别名称"];
                    resource.资源名称   = dialog["资源名称"];

                    m_meetingData.会议资源对象集 = new List <View_PRJ_Resource>();
                    m_meetingData.会议资源对象集.Add(resource);
                }
            }
        }