Пример #1
0
        private void buildTable()
        {
            if (DisciplineList.SelectedIndex == -1 || GroupList.SelectedIndex == -1)
            {
                return;
            }

            Table.SuspendLayout();

            Table.Controls.Clear();

            string group      = GroupList.SelectedItem.ToString();
            string discipline = DisciplineList.SelectedItem.ToString();

            this.currObj = new ObjSurveyRes_Layout3();

            if (ObjSurveyRes_Layout3.isExists(new ObjSurveyRes_Layout3()
            {
                group = group, discipline = discipline
            }))
            {
                string data = ObjSurveyRes_Layout3.getData(group, discipline);

                if (!string.IsNullOrEmpty(data))
                {
                    this.currObj = JsonConvert.DeserializeObject <ObjSurveyRes_Layout3>(data);

                    foreach (var t in this.currObj.subGroups)
                    {
                        SubGroupList.Items.Add(t.Key);
                    }
                }
            }

            List <ObjSurveyRes_Layout3> list = ObjSurveyRes_Layout3.getList(GroupList.SelectedItem.ToString(), DisciplineList.SelectedItem.ToString());

            for (int i = 0; i < list.Count; i++)
            {
                ObjSurveyRes_Layout3 obj = list[i];

                string[] args = prepareArray(obj.result);

                Utils.fillRow(Table, new Control[] {
                    Utils.buildLabel(obj.date.Replace("0:00:00", string.Empty)),
                    Utils.buildLabel(args[0]),
                    Utils.buildLabel(args[1]),
                    Utils.buildLabel(args[2]),
                    Utils.buildLabel(args[3])
                }, i);
            }

            Table.ResumeLayout();
        }
Пример #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            string sub = SubGroupList.SelectedItem.ToString();

            this.currObj.subGroups[sub] = new Tuple <List <string>, string>(this.currObj.subGroups[sub].Item1, textBox2.Text);
            this.currObj.group          = GroupList.SelectedItem.ToString();
            this.currObj.discipline     = DisciplineList.SelectedItem.ToString();

            if (ObjSurveyRes_Layout3.isExists(this.currObj))
            {
                ObjSurveyRes_Layout3.update(this.currObj);
            }
            else
            {
                ObjSurveyRes_Layout3.insert(this.currObj);
            }

            MessageBox.Show("Сохранено");

            buildTable();
        }