| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraEditors.Controls; |
| | | using ISupply.Model; |
| | | using ISupply.Model.Basic; |
| | | 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; |
| | | using PBS.Model; |
| | | |
| | | namespace PBS.WinFrmUI |
| | | { |
| | |
| | | public ShopWizardForm() |
| | | { |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | //基础验证 |
| | | public bool Valid() |
| | |
| | | this.dxErrorProvider1.SetError(this.cbDist, "必填项"); |
| | | isExist = false; |
| | | } |
| | | if (string.IsNullOrEmpty(this.txtName.Text.Trim())) |
| | | { |
| | | this.dxErrorProvider1.SetError(this.txtName, "必填项"); |
| | | isExist = false; |
| | | } |
| | | return isExist; |
| | | } |
| | | |
| | | public ShopFormModel GetData() |
| | | public PlaceShopParasInfo GetData() |
| | | { |
| | | if (!Valid()) |
| | | { |
| | | return null; |
| | | } |
| | | var m = new ShopFormModel() |
| | | 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, |
| | | /* 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), |
| | |
| | | return m; |
| | | } |
| | | |
| | | public void SetData(ShopFormModel model) |
| | | 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; |
| | | /* 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(); |
| | |
| | | |
| | | 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(); //为了编辑页面的时候可以选中所选项 |
| | | /* 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) |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | /* 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); |
| | | } |
| | | }*/ |
| | | } |
| | | } |
| | | } |