ningshuxia
2025-03-20 d1807075581920a8c94a409b11a9c88dd869be1e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using DevExpress.XtraEditors;
 
namespace PBS.WinFrmUI
{
    public partial class ElecPriceMgr : Yw.WinFrmUI.DocumentPage
    {
        public ElecPriceMgr()
        {
            InitializeComponent();
        }
 
        private void BtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            AddElePrice();
        }
 
        //添加电费
        public void AddElePrice()
        {
            var dlg = new AddElectricDlg();
            dlg.SetBindingData();
            dlg.ReloadDataEvent += (price) =>
            {
                /*var bll = new BLL.ElecPrice();
                _elecPrice.Settings.MonthList.Add(price);
                var bol = bll.Update(_elecPrice);
                if (bol)
                {
                    this.SetBindingData();
                    this.currentViewModelBindingSource.ResetBindings(false);
                    return true;
                }*/
                return false;
            };
            dlg.ShowDialog();
        }
 
        //  var oldbelongName= _allBindingList.Where(e=>e.BelongName==belongName).FirstOrDefault();
        //if (oldbelongName == null)
 
        //编辑电费
        /*       public void EditElePrice()
               {
                   var row = gridView1.GetCurrentViewModel(_allBindingList);
                   if (row == null)
                       return;
                   var editTime = _elecPrice.Settings;  //提问:这句话点不到hourlist   new一个monthsetting就能.到hourlist
                   var FindMonth = editTime.MonthList.Find(x => x.StartMonth == row.StartMonth && x.EndMonth == row.EndMonth);
                   var addHour = _elecPrice.Settings.MonthList.IndexOf(FindMonth);
                   var editHour = editTime.MonthList[addHour];
                   var dlg = new EditElectricDlg();
                   dlg.SetBindingData(editHour.HourList);
                   dlg.ReLoadDataevent += (price) =>
                   {
                       editHour.HourList.Clear();
                       editHour.HourList = price;
                       var bll = new BLL.ElecPrice();
                       var isok = bll.Update(_elecPrice);
                       if (isok)
                       {
                           this.currentViewModelBindingSource.ResetBindings(false);
                           this.SetBindingData();
                           return true;
                       }
                       return false;
                   };
                   dlg.ShowDialog();
               }*/
 
        /// <summary>
        /// 删除电费
        /// </summary>
        /*  public void DeletePrice()
          {
              var row = this.gridView1.GetCurrentViewModel(_allBindingList);
              if (row == null)
                  return;
              if (XtraMessageBox.Show("确定要删除所选中?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) != DialogResult.OK)
                  return;
 
              _elecPrice.Settings.MonthList.RemoveAll(x => x.StartMonth == row.StartMonth && x.EndMonth == row.EndMonth);
 
              var isok = new BLL.ElecPrice().Update(_elecPrice);
              if (isok)
              {
                  this.currentViewModelBindingSource.ResetBindings(false);
              }
              this.SetBindingData();
              this.currentViewModelBindingSource.ResetBindings(false);
              MessageBox.Show("删除成功", "提示");
          }*/
    }
}