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();
|
|
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);
|
}
|
}*/
|
}
|
}
|
}
|