public ParamValue(DateTime StartDate, BonusParameters Params, CardCounters Counters, bool Editable)
 {
     this.StartDate = StartDate;
     this.Params = Params;
     this.Counters = Counters;
     this.Editable = Editable;
 }
    // Anti Froad
    private void SetAntiFraudPanel(Anthem.Panel Container, CardCounters Counters, AntiFraudParameter Value)
    {
        CardCounter Counter = Counters[Value.CounterName];
        int Index = 0;

        for (int i = 0; i < Container.Controls.Count; i++)
          if (Container.Controls[i] is Anthem.CheckBox)
          {
        // ���� ������ TextBox
        for (int j = i; j < Container.Controls.Count; j++)
          if ((Container.Controls[j] is Anthem.TextBox) && (Container.Controls[j] as Anthem.TextBox).TextMode == TextBoxMode.SingleLine)
          {
            // ���� ������� TextBox
            for (int k = j; k < Container.Controls.Count; k++)
              if ((Container.Controls[k] is Anthem.TextBox) && (Container.Controls[k] as Anthem.TextBox).TextMode == TextBoxMode.MultiLine)
              {
                Anthem.CheckBox InfoCheck = Container.Controls[i] as Anthem.CheckBox;
                Anthem.TextBox LimitText = Container.Controls[j] as Anthem.TextBox;
                Anthem.TextBox MessageText = Container.Controls[k] as Anthem.TextBox;

                InfoCheck.Checked = Index == 0 ? Value.CheckMaximumValue : Value.CheckMinimumValue;
                LimitText.Text = Index == 0 ? Counter.ValueToString(Value.MaximumValue) : Counter.ValueToString(Value.MinimumValue);
                MessageText.Text = Index == 0 ? Value.MaximumMessage : Value.MinimumMessage;

                Index++;
                break;
              }
            break;
          }
          }
    }
    private void GetAntiFroadPanel(Anthem.Panel Container, CardCounters Counters, AntiFraudParameter Value)
    {
        CardCounter Counter = Counters[Value.CounterName];
        int Index = 0;

        for (int i = 0; i < Container.Controls.Count; i++)
          if (Container.Controls[i] is Anthem.CheckBox)
          {
        // ���� ������ TextBox
        for (int j = i; j < Container.Controls.Count; j++)
          if ((Container.Controls[j] is Anthem.TextBox) && (Container.Controls[j] as Anthem.TextBox).TextMode == TextBoxMode.SingleLine)
          {
            // ���� ������� TextBox
            for (int k = j; k < Container.Controls.Count; k++)
              if ((Container.Controls[k] is Anthem.TextBox) && (Container.Controls[k] as Anthem.TextBox).TextMode == TextBoxMode.MultiLine)
              {
                Anthem.CheckBox InfoCheck = Container.Controls[i] as Anthem.CheckBox;
                Anthem.TextBox LimitText = Container.Controls[j] as Anthem.TextBox;
                Anthem.TextBox MessageText = Container.Controls[k] as Anthem.TextBox;

                if (MessageText.Text.Length > 0 && MessageText.Text[MessageText.Text.Length-1] != '\n')
                  MessageText.Text += "\n";

                double LimitValue = 0;
                if (!double.TryParse(LimitText.Text, out LimitValue))
                  throw new Exception("�������� ������ ��� ��������� '" + Value.Name + "' ������ �������: " + LimitText.Text);

                if (Index == 0)
                {
                  Value.CheckMaximumValue = InfoCheck.Checked;
                  Value.MaximumValue = Counter.ObjectToValue(LimitValue);
                  Value.MaximumMessage = MessageText.Text;
                }
                else
                {
                  Value.CheckMinimumValue = InfoCheck.Checked;
                  Value.MinimumValue = Counter.ObjectToValue(LimitValue);
                  Value.MinimumMessage = MessageText.Text;
                }

                Index++;
                break;
              }
            break;
          }
          }
    }
    protected void SetsList_SelectedIndexChanged(object sender, EventArgs e)
    {
        UpdateVariables();
        if (SetsList.SelectedItem != null)
        {
          Session["SelectedParamSet"] = ParamSets[SetsList.SelectedIndex];
          UpdateVariables();
          try
          {
        Connection.Open();
        current.PrepareAudit(Connection);
        QueryResult ValuesQR = Query.Execute(Connection, @"select DateStart, Params, case when datestart > sysdate then 1 else 0 end as Editable from ActionParams p where SetID = :1 order by DateStart desc",
          new string[] { "1" }, new object[] { SelectedParamSet.ID });
        SelectedParamSet.Values.Clear();
        DatesList.Items.Clear();
        for (int i = 0; i < ValuesQR.Rows.Count; i++)
        {
          DateTime DateStart = Convert.ToDateTime(Functions.nvl(ValuesQR[i, "DateStart"], DateTime.MinValue));
          BonusParameters Params = null;
          bool Editable = Functions.ConvertToBool(ValuesQR[i, "Editable"]);

          byte[] Buffer = ValuesQR.Rows[i]["Params"] as byte[];
          try
          {
            Params = (BonusParameters)(new BinaryFormatter()).Deserialize(new MemoryStream(Buffer));
          }
          catch
          { }

          if (Params == null)
            Params = new BonusParameters();

          BonusScript Script = new BonusScript(Connection, Products, null, null);
          Script.Params = Params;
          CardCounters Counters = new CardCounters(new CardInfo(Script.Transaction));
          Counters.LoadFromDatabase();

          SelectedParamSet.Values.Add(new ParamValue(DateStart, Params, Counters, Editable));

          ListItem li = new ListItem(DateStart.ToString("dd.MM.yyyy")); // HH:mm:ss
          DatesList.Items.Add(li);
        }

        DatesList.SelectedIndex = ValuesQR.Rows.Count > 0 ? 0 : -1;
        DatesList_SelectedIndexChanged(sender, e);
          }
          finally
          {
        Connection.Close();
          }
        }
    }