private void btn_Add_Click(object sender, EventArgs e)
        {
            string authorizeendtime = "";

            string vehicleid = "";

            if (SelectVehicleGrid.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请选择要添加到设备的人员");
                return;
            }
            if (SelectVehicleGrid.SelectedRows != null)
            {
                if (MessageBox.Show("确定要将车辆" + SelectVehicleGrid.SelectedRows[0].Cells[1].Value.ToString() + "添加到设备" + lab_DeviceName.Text + "的权限中吗?", "添加权限", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
                if (SelectVehicleGrid.SelectedRows[0].Cells[1].Value.ToString() == "临时车辆")
                {
                    MessageBox.Show("临时车辆必须设定权限时间");
                    AuthorizeTimeForm _form = new AuthorizeTimeForm();
                    if (_form.ShowDialog() == DialogResult.OK)
                    {
                        authorizeendtime = _form.Selecttime.ToString();
                    }
                    else
                    {
                        return;
                    }
                }


                vehicleid = SelectVehicleGrid.SelectedRows[0].Cells[0].Value.ToString();
            }


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

            if (authorizedal.InsertVehicleAuthrize(vehicleid, this.deviceid, authorizeendtime))
            {
                MessageBox.Show("添加权限成功!");
                GetDeviceAuthrizeList("");
            }
            else
            {
                MessageBox.Show("添加权限失败!");
            }
        }
Beispiel #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("添加失败");
                    }
                }
            }
        }
Beispiel #3
0
        private void btn_UpdateAuthirizeTime_Click(object sender, EventArgs e)
        {
            if (AuthrizeGroupHave.SelectedRows != null)
            {
                AuthorizeTimeForm _from = new AuthorizeTimeForm();

                if (_from.ShowDialog() == DialogResult.OK)
                {
                    if ((new DAL.DAL_Authorize()).updateGroupAuthrizeTime(AuthrizeGroupHave.SelectedRows[0].Cells[0].Value.ToString(), _from.Selecttime.ToString()))
                    {
                        MessageBox.Show("修改成功");
                        GetGroupAuthrize();
                    }
                    else
                    {
                        MessageBox.Show("修改失败");
                    }
                }
            }
            else
            {
                MessageBox.Show("请选择权限!");
            }
        }