public ParamValue(DateTime StartDate, BonusParameters Params, CardCounters Counters, bool Editable)
 {
     this.StartDate = StartDate;
     this.Params = Params;
     this.Counters = Counters;
     this.Editable = Editable;
 }
示例#2
0
 public MinigameParameters(BonusParameters bonusParameters)
 {
     BonusParameters = bonusParameters;
 }
    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();
          }
        }
    }