Пример #1
0
        private void TsbRuleEditClick(object sender, EventArgs e)
        {
            using (RuleForm ruleForm = new RuleForm())
            {
                DataRowView currentRule = _bsRule.Current as DataRowView;
                ruleForm.tbName.Text        = currentRule["Name"].ToString();
                ruleForm.tbDescription.Text = currentRule["Description"].ToString();

                if (ruleForm.ShowDialog() == DialogResult.OK)
                {
                    currentRule["Name"]        = ruleForm.tbName.Text;
                    currentRule["Description"] = ruleForm.tbDescription.Text;

                    _bsRule.EndEdit();
                    _bsRule.ResetCurrentItem();

                    //
                    //
                    DataTable dtRl      = _dsSecurity.Tables["Rule"];
                    DataRow   currentRl = dtRl.Rows.Find(currentRule["Name"]);

                    currentRl["Name"]        = currentRule["Name"];
                    currentRl["Description"] = currentRule["Description"];
                }
            }
        }
Пример #2
0
        private void TsbRuleNewClick(object sender, EventArgs e)
        {
            using (RuleForm ruleForm = new RuleForm())
            {
                if (ruleForm.ShowDialog() == DialogResult.OK)
                {
                    DataRowView currentGroup = _bsGroup.Current as DataRowView;
                    DataRowView newRule      = _bsRule.AddNew() as DataRowView;

                    newRule["GroupName"]   = currentGroup["Name"];
                    newRule["Name"]        = ruleForm.tbName.Text;
                    newRule["Description"] = ruleForm.tbDescription.Text;

                    _bsRule.EndEdit();
                    _bsRule.ResetCurrentItem();

                    DataTable dtRl  = _dsSecurity.Tables["Rule"];
                    DataRow   newRl = dtRl.NewRow();

                    newRl["Name"]        = newRule["Name"];
                    newRl["Description"] = newRule["Description"];

                    dtRl.Rows.Add(newRl);

                    DataTable dtGrpRl  = _dsSecurity.Tables["GrpRl"];
                    DataRow   newGrpRl = dtGrpRl.NewRow();

                    newGrpRl["RuleName"]  = newRule["Name"];
                    newGrpRl["GroupName"] = newRule["GroupName"];

                    dtGrpRl.Rows.Add(newGrpRl);
                }
            }
        }
		private void TsbRuleEditClick(object sender, EventArgs e)
		{
			using (RuleForm ruleForm = new RuleForm())
			{
				DataRowView currentRule = _bsRule.Current as DataRowView;
				ruleForm.tbName.Text = currentRule["Name"].ToString();
				ruleForm.tbDescription.Text = currentRule["Description"].ToString();

				if (ruleForm.ShowDialog() == DialogResult.OK)
				{
					currentRule["Name"] = ruleForm.tbName.Text;
					currentRule["Description"] = ruleForm.tbDescription.Text;

					_bsRule.EndEdit();
					_bsRule.ResetCurrentItem();

					//
					//
					DataTable dtRl = _dsSecurity.Tables["Rule"];
					DataRow currentRl = dtRl.Rows.Find(currentRule["Name"]);

					currentRl["Name"] = currentRule["Name"];
					currentRl["Description"] = currentRule["Description"];
				}
			}
		}
		private void TsbRuleNewClick(object sender, EventArgs e)
		{
			using (RuleForm ruleForm = new RuleForm())
			{
				if (ruleForm.ShowDialog() == DialogResult.OK)
				{
					DataRowView currentGroup = _bsGroup.Current as DataRowView;
					DataRowView newRule = _bsRule.AddNew() as DataRowView;

					newRule["GroupName"] = currentGroup["Name"];
					newRule["Name"] = ruleForm.tbName.Text;
					newRule["Description"] = ruleForm.tbDescription.Text;

					_bsRule.EndEdit();
					_bsRule.ResetCurrentItem();

					DataTable dtRl = _dsSecurity.Tables["Rule"];
					DataRow newRl = dtRl.NewRow();

					newRl["Name"] = newRule["Name"];
					newRl["Description"] = newRule["Description"];

					dtRl.Rows.Add(newRl);

					DataTable dtGrpRl = _dsSecurity.Tables["GrpRl"];
					DataRow newGrpRl = dtGrpRl.NewRow();

					newGrpRl["RuleName"] = newRule["Name"];
					newGrpRl["GroupName"] = newRule["GroupName"];

					dtGrpRl.Rows.Add(newGrpRl);
				}
			}
		}