| | |
| | | } |
| | | |
| | | private BindingList<ElecPriceHourSetting> _allBindingList = null; //这就是输入进去立马就获取到的值 |
| | | |
| | | public event Func<Model.ElecPriceMonthSetting, bool> ReloadDataEvent; |
| | | |
| | | |
| | | |
| | | public void SetBindingData() |
| | | { |
| | | _allBindingList = new BindingList<Model.ElecPriceHourSetting>(); |
| | | this.bindingSource1.DataSource = _allBindingList; |
| | | } |
| | | |
| | | |
| | | //验证 |
| | | private bool verify() |
| | |
| | | this.dxErrorProvider1.SetError(this.txtEndMonth, "必填项"); |
| | | return false; |
| | | } |
| | | var AllHour =_allBindingList; |
| | | var hour = AllHour.OrderBy(x => x.EndHour).ToList(); |
| | | var AllHour = _allBindingList; |
| | | var hour = AllHour.OrderBy(x => x.EndHour).ToList(); |
| | | var HourCount = hour.Count; |
| | | if (hour.First().StartHour != 0 || hour.Last().EndHour != 24) |
| | | { |
| | | XtraMessageBox.Show("开始时间和结束时间有误"); |
| | | return false; |
| | | XtraMessageBox.Show("开始时间和结束时间有误"); |
| | | return false; |
| | | } |
| | | for (int x = 0; x < hour.Count - 1; x++) |
| | | { |
| | |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
| | | |
| | | //确定 |
| | | private void btnOk_Click(object sender, EventArgs e) |
| | |
| | | MessageBox.Show("输入有误"); |
| | | return; |
| | | } |
| | | if (Startmonth > 11) |
| | | { |
| | | MessageBox.Show("开始月小于12"); |
| | | return; |
| | | } |
| | | |
| | | /* if (Startmonth > 11) |
| | | { |
| | | MessageBox.Show("开始月小于12"); |
| | | return; |
| | | } |
| | | */ |
| | | Eleprice.StartMonth = Startmonth; |
| | | int Endmonth = 0; |
| | | if (!int.TryParse(this.txtEndMonth.Text, out Endmonth)) |
| | |
| | | MessageBox.Show("请输入不小于1且不大于12的数字"); |
| | | return; |
| | | } |
| | | if (Startmonth >=Endmonth) |
| | | { |
| | | MessageBox.Show("开始月不能小于或等于结束月"); |
| | | return; |
| | | } |
| | | /* if (Startmonth >=Endmonth) |
| | | { |
| | | MessageBox.Show("开始月不能小于或等于结束月"); |
| | | return; |
| | | }*/ |
| | | Eleprice.EndMonth = Endmonth; |
| | | Eleprice.HourList = _allBindingList.ToList(); //把绑定列表的值赋给hourlist |
| | | var isok = this.ReloadDataEvent.Invoke(Eleprice); |
| | |
| | | this.DialogResult = System.Windows.Forms.DialogResult.OK; //确定ok,然后关闭 |
| | | this.Close(); |
| | | } |
| | | |
| | | //行删除 |
| | | private void gridView2_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) |
| | | { |
| | |
| | | _allBindingList.Remove(row); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |