duheng
2025-03-07 467578cbe7f027c14ceba0aed16fb827b94e2c65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using PBS.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace PBS.WinFrmUI
{
    public partial class SchoolWizardForm : DevExpress.XtraEditors.XtraUserControl
    {
        public SchoolWizardForm()
        {
            InitializeComponent();
        }
 
        //基础验证
        public bool Valid()
        {
            bool isExist = true;
            this.dxErrorProvider1.ClearErrors();
            if (this.cbArea.Text == "请选择")
            {
                this.dxErrorProvider1.SetError(this.cbArea, "必填项");
                isExist = false;
            }
            if (this.cbCity.Text == "请选择")
            {
                this.dxErrorProvider1.SetError(this.cbCity, "必填项");
                isExist = false;
            }
            if (this.cbDist.Text == "请选择")
            {
                this.dxErrorProvider1.SetError(this.cbDist, "必填项");
                isExist = false;
            }
 
            return isExist;
        }
 
        public PlaceSchoolParasInfo GetData()
        {
            if (!Valid())
            {
                return null;
            }
            var m = new PlaceSchoolParasInfo()
            {
                /*Address = txtAddress.Text,
                Area = (long?)this.cbArea.EditValue,
                City = (long?)this.cbCity.EditValue,
                Dist = (long?)this.cbDist.EditValue,
                Name = txtName.Text,*/
                SchoolType = cbSchoolType.Text,
                Level = cbLevel.Text,
            };
 
            return m;
        }
 
        public void SetData(PlaceSchoolParasInfo model)
        {
            if (model == null) return;
            /*         txtAddress.Text = model.Address;
 
                     txtName.Text = model.Name.ToString();*/
            cbLevel.Text = model.Level;
            cbSchoolType.Text = model.SchoolType;
            /*   cbArea.EditValue = model.Area;
               cbCity.EditValue = model.City;
               cbDist.EditValue = model.Dist;*/
        }
 
        private void SchoolWizardForm_Load(object sender, EventArgs e)
        {
            /*     var allProvince = new BLL.Region().GetAll().Where(x => x.Type == eRegionType.Province).ToList();
                 foreach (var item in allProvince)
                 {
                     var imageItem = new ImageComboBoxItem(item.Name, item.ID);
                     cbArea.Properties.Items.Add(imageItem);
                     //城市添加省份只是为了临时用,后期会更改
                     cbCity.Properties.Items.Add(imageItem);
                 }
                 ValueChangeEvent(); //为了编辑页面的时候可以选中所选项*/
        }
 
        private void cbDist_SelectedIndexChanged(object sender, EventArgs e)
        {
            ValueChangeEvent();
        }
 
        private void ValueChangeEvent()
        {
            /*       if (cbArea.EditValue != null)
                   {
                       var AllDist = new BLL.Region().GetChildrenByID((long)cbArea.EditValue);
                       foreach (var item in AllDist)
                       {
                           var imageItem = new ImageComboBoxItem(item.Name, item.ID);
                           cbDist.Properties.Items.Add(imageItem);
                       }
                   }*/
        }
    }
}