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("删除成功", "提示");
|
}*/
|
}
|
}
|