using PBS.Model;
|
|
namespace PBS.WinFrmUI
|
{
|
public partial class SchoolPlaceInfoCtrl : DevExpress.XtraEditors.XtraUserControl, IPlaceInfo
|
{
|
public SchoolPlaceInfoCtrl()
|
{
|
InitializeComponent();
|
}
|
|
|
private PlaceSchoolParasInfo _model = null;
|
|
public void Set(string info)
|
{
|
_model = PlaceSchoolParasInfo.ToModel(info);
|
_model ??= new();
|
|
|
}
|
|
public bool Valid()
|
{
|
|
this.dxErrorProvider1.ClearErrors();
|
|
return true;
|
}
|
|
public string Get()
|
{
|
|
return _model.ToJson();
|
}
|
|
//基础验证
|
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);
|
}
|
}*/
|
}
|
}
|
}
|