public StageItem StageValue(string name, object value)
        {
            IDictionary dictionaries = value as IDictionary;
            int         count        = dictionaries.Count;
            StageList   stageList    = new StageList(name);

            foreach (object key in dictionaries.Keys)
            {
                stageList.Add(new StageElement(string.Empty, new StageItem[] { SerializationMaster.Stage("key", key), SerializationMaster.Stage("value", dictionaries[key]) }));
            }
            return(stageList);
        }
        public StageItem StageValue(string name, object value)
        {
            IList     lists     = value as IList;
            int       count     = lists.Count;
            StageList stageList = new StageList(name);

            for (int i = 0; i < count; i++)
            {
                StageItem stageItem = SerializationMaster.Stage("Item", lists[i]);
                stageList.Add(stageItem);
            }
            return(stageList);
        }
        /// <summary>
        /// Stages the value.
        /// </summary>
        /// <param name="name">The name to give the resulting <see cref="StageItem" />.</param>
        /// <param name="value">The value to stage</param>
        /// <returns>
        /// The element containing the staged value.
        /// </returns>
        public StageItem StageValue(string name, object value)
        {
            var list        = value as IList;
            var count       = list.Count;
            var listElement = new StageList(name);

            for (int i = 0; i < count; i++)
            {
                var item = SerializationMaster.Stage("Item", list[i]);
                listElement.Add(item);
            }

            return(listElement);
        }
Exemple #4
0
 public void SaveStage()
 {
     try
     {
         string      sql = "INSERT INTO Stages(Name) VALUES (@Stage)";
         DbParameter par = Database.AddParameter("@Stage", NewStage.Name);
         Database.ModifyData(sql, par);
         StageList.Add(NewStage);
         StageList = Stage.GetStages();
         MessageBox.Show("Podium werd succesvol toegevoegd");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #5
0
        /// <summary>
        /// Stages the value.
        /// </summary>
        /// <param name="name">The name to give the resulting <see cref="StageItem" />.</param>
        /// <param name="value">The value to stage</param>
        /// <returns>
        /// The element containing the staged value.
        /// </returns>
        public StageItem StageValue(string name, object value)
        {
            var dic         = value as IDictionary;
            var count       = dic.Count;
            var listElement = new StageList(name);

            foreach (var key in dic.Keys)
            {
                var item = new StageElement(
                    string.Empty,
                    SerializationMaster.Stage("key", key),
                    SerializationMaster.Stage("value", dic[key]));

                listElement.Add(item);
            }

            return(listElement);
        }
        private void button_StageAdd_Click(object sender, EventArgs e)
        {
            Stage  stage = new Stage();
            string msg   = SLDValidate(out stage);

            if (msg != "")
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(msg, "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                BindingList <Stage> StageList = null;
                StageList = dataGridView3.DataSource as BindingList <Stage>;

                if (StageList == null)
                {
                    StageList = new BindingList <Stage>();
                }

                //验证该水位是否存在
                var list = from d in StageList where stage.WaterLevel == d.WaterLevel select d;
                if (list.Count() > 0)
                {
                    DevComponents.DotNetBar.MessageBoxEx.Show("该水位数据已经存在,请核实!", "[提示]", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    StageList.Add(stage);
                    textBox_WaterLevel.Text = "";
                    textBox_kA.Text         = "";
                }
                //排序,重新绑定
                List <Stage> sl = StageList.OrderBy(i => i.WaterLevel).ToList();
                StageList = new BindingList <Stage>();
                foreach (var item in sl)
                {
                    Stage s = new Stage();
                    s.kA         = item.kA;
                    s.WaterLevel = item.WaterLevel;
                    StageList.Add(s);
                }
                dataGridView3.DataSource = StageList;
            }
        }