Esempio n. 1
0
        private void btn_Add_Click(object sender, EventArgs e)
        {
            string selectgroupid    = "";
            string authorizeendtime = "";

            if (SelectGroupGrid.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请选择要添加到设备权限的群组");
                return;
            }
            if (SelectGroupGrid.SelectedRows != null)
            {
                if (MessageBox.Show("确定要将群组" + SelectGroupGrid.SelectedRows[0].Cells[1].Value.ToString() + "添加到设备" + lab_DeviceName.Text + "的权限中吗?", "添加权限", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
                selectgroupid = this.SelectGroupGrid.SelectedRows[0].Cells[0].ToString();
            }

            DAL.DAL_Authorize authorizedal = new DAL.DAL_Authorize();

            if (authorizedal.InsertGroupAuthrize(selectgroupid, this.deviceid, authorizeendtime))
            {
                MessageBox.Show("添加权限成功!");
                GetDeviceAuthorizeList("");
            }
            else
            {
                MessageBox.Show("添加权限失败!");
            }
        }
Esempio n. 2
0
        private void btn_AddAuthrize_Click(object sender, EventArgs e)
        {
            if (AuthrizeCanGive.SelectedRows != null)
            {
                if (MessageBox.Show("你确定要为分组" + lab_groupname.Text + "添加设备:" + AuthrizeCanGive.SelectedRows[0].Cells[1].Value + "的权限吗?", "添加权限", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    string authorizeendtime = "";

                    if (usertype == "临时用户")
                    {
                        MessageBox.Show("临时用户必须设定权限时间");
                        AuthorizeTimeForm _form = new AuthorizeTimeForm();
                        if (_form.ShowDialog() == DialogResult.OK)
                        {
                            authorizeendtime = _form.Selecttime.ToString();
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        authorizeendtime = "";
                    }

                    DAL.DAL_Authorize authorizedal = new DAL.DAL_Authorize();

                    if (authorizedal.InsertGroupAuthrize(this.groupid, AuthrizeCanGive.SelectedRows[0].Cells[0].Value.ToString(), authorizeendtime))
                    {
                        MessageBox.Show("添加成功");
                        GetGroupAuthrize();
                    }
                    else
                    {
                        MessageBox.Show("添加失败");
                    }
                }
            }
        }