using PBS.Model;
|
|
namespace PBS.WinFrmUI
|
{
|
public partial class ShopWizardForm : DevExpress.XtraEditors.XtraUserControl
|
{
|
public ShopWizardForm()
|
{
|
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 PlaceShopParasInfo GetData()
|
{
|
if (!Valid())
|
{
|
return null;
|
}
|
var m = new PlaceShopParasInfo()
|
{
|
/* Address = txtAddress.Text,
|
Area = (long?)this.cbArea.EditValue,
|
City = (long?)this.cbCity.EditValue,
|
Dist = (long?)this.cbDist.EditValue,
|
Name = txtName.Text,*/
|
AreaSquare = string.IsNullOrEmpty(txtAreaSquare.Text) ? decimal.Zero : decimal.Parse(txtAreaSquare.Text),
|
BusinessType = cbBusinessType.Text,
|
Floor = string.IsNullOrEmpty(txtFloor.Text) ? 0 : int.Parse(txtFloor.Text),
|
Nature = cbNature.Text,
|
PropertyCompany = txtPropertyCompany.Text,
|
PropertyRight = string.IsNullOrEmpty(txtPropertyRight.Text) ? 0 : int.Parse(txtPropertyRight.Text),
|
};
|
|
return m;
|
}
|
|
public void SetData(PlaceShopParasInfo model)
|
{
|
if (model == null) return;
|
/* txtAddress.Text = model.Address;
|
txtName.Text = model.Name.ToString();
|
cbArea.EditValue = model.Area;
|
cbCity.EditValue = model.City;
|
cbDist.EditValue = model.Dist;*/
|
txtAreaSquare.Text = model.AreaSquare.ToString();
|
cbBusinessType.Text = model.BusinessType.ToString();
|
txtFloor.Text = model.Floor.ToString();
|
cbNature.Text = model.Nature.ToString();
|
txtPropertyCompany.Text = model.PropertyCompany.ToString();
|
txtPropertyRight.Text = model.PropertyRight.ToString();
|
}
|
|
private void ShopWizardForm_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);
|
}
|
}*/
|
}
|
}
|
}
|