예제 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataTable dt = bllScreen.GetScreenInfo($" and ScreenID = '{cmbLEDId.Text}'");

            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("该屏幕已匹配区域!");
                return;
            }
            if (!string.IsNullOrEmpty(cmbArea.Text) && !string.IsNullOrEmpty(cmbLEDId.Text))
            {
                try
                {
                    ScreensToArea screens = new ScreensToArea();
                    screens.ID       = Id;
                    screens.ScreenID = cmbLEDId.Text;
                    screens.AreaID   = Convert.ToInt32(cmbArea.SelectedValue);
                    if (bllScreen.InsertOrModifyScreen(screens))
                    {
                        MessageBox.Show("保存成功!");
                        cmbArea.SelectedIndex  = -1;
                        cmbLEDId.SelectedIndex = -1;
                    }
                    else
                    {
                        MessageBox.Show("保存失败,重试!");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 修改添加区域编号
        /// </summary>
        /// <param name="showInfo"></param>
        /// <returns></returns>
        public bool InsertOrModifyScreen(ScreensToArea screen)
        {
            string sSql = $@"
declare @OrderNum int
select @OrderNum =ISNULL(MAX(OrderNum)+1,1) from ScreenToArea where AreaID = '{screen.AreaID}'
IF NOT EXISTS(Select * from ScreenToArea where ID = '{screen.ID}')
BEGIN
Insert into ScreenToArea(AreaID,ScreenID,OrderNum) values('{screen.AreaID}','{screen.ScreenID}',@OrderNum)
END
ELSE
BEGIN
Update ScreenToArea set ScreenID ='{screen.ScreenID}'  where  ID  = '{screen.ID}'
END";

            return(server.ExecuteNonQuery(sSql) > 0);
        }
예제 #3
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvContent.CurrentRow != null)
         {
             if (_OperateType.Equals("区域"))
             {
                 AreaInfo areaInfo = new AreaInfo();
                 areaInfo.AreaName = dgvContent.CurrentRow.Cells["AreaName"].Value.ToString();
                 areaInfo.AreaId   = Convert.ToInt32(dgvContent.CurrentRow.Cells["AreaId"].Value);
                 FrmAddArea frmAddArea = new FrmAddArea(areaInfo);
                 FrmExample frmExample = new FrmExample()
                 {
                     Size = new System.Drawing.Size(frmAddArea.Size.Width, frmAddArea.Size.Height)
                 };
                 frmExample.Controls.Add(frmAddArea);
                 frmExample.ShowDialog();
             }
             else if (_OperateType.Equals("屏幕"))
             {
                 ScreensToArea screens = new ScreensToArea();
                 screens.ID       = Convert.ToInt32(dgvContent.CurrentRow.Cells["ID"].Value);
                 screens.ScreenID = dgvContent.CurrentRow.Cells["ScreenID"].Value.ToString();
                 screens.AreaID   = Convert.ToInt32(dgvContent.CurrentRow.Cells["AreaID"].Value);
                 FrmSreenToArea frmSreen   = new FrmSreenToArea(screens);
                 FrmExample     frmExample = new FrmExample()
                 {
                     Size = new System.Drawing.Size(frmSreen.Size.Width, frmSreen.Size.Height)
                 };
                 frmExample.Controls.Add(frmSreen);
                 frmExample.ShowDialog();
             }
         }
         else
         {
             MessageBox.Show("请选中修改!");
         }
         btnSearch_Click(null, null);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #4
0
        public FrmSreenToArea(ScreensToArea screens)
        {
            InitializeComponent();
            DataTable dtInfo = bllAreaInfo.GetAreaInfo(string.Empty);

            cmbArea.ValueMember   = "AreaId";
            cmbArea.DisplayMember = "AreaName";
            cmbArea.DataSource    = dtInfo;
            cmbArea.SelectedIndex = -1;

            //屏幕信息
            DataTable dtScreen = bllScreeenSetting.GetScreenSetting(string.Empty);

            cmbLEDId.ValueMember   = "AddressNum";
            cmbLEDId.DisplayMember = "ScreenID";
            cmbLEDId.DataSource    = dtScreen;
            if (screens != null)
            {
                Id = screens.ID;
                cmbArea.SelectedValue = screens.AreaID;
                cmbLEDId.Text         = screens.ScreenID.ToString();
                cmbArea.Enabled       = false;
            }
        }
예제 #5
0
 public bool InsertOrModifyScreen(ScreensToArea screen)
 {
     return(dalScreen.InsertOrModifyScreen(screen));
 }