using iWareCommon.Common.Entity; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using iWareDataCore.DEV.Service; using iWareCommon.Common.EnumType; using iWareExcel.EXCEL.Service; using iWareWms.Code.Excel.Service; using iWareWms; using FineUIPro; namespace iWareWms.View.DEV { public partial class Equipment :PageBase { protected override Grid GetGrid() { return EquipmentGrid; } protected override DropDownList GetPageSizeDropDownList() { return ddlPageSize; } protected override List GetDataSource(int pageIndex, int pageSize, out string msg, out int totalNum, out int currentPage) { var equipments = EquipmentViewService.GetInstance().QueryByParam(new QueryParam { Search = new Dictionary { { "EquipName", tbEquipName.Text.Trim() }}, Filter = new Dictionary { { "TypeId", ddlType.SelectedValue }, { "Status", ddlStatus.SelectedValue } }, PageIndex = pageIndex, PageSize = pageSize }, out msg, out totalNum, out currentPage); var res = new List(); equipments.ForEach(x => res.Add(x)); return res; } protected override void ChangeStatus(List ids, int status, out string msg) { EquipmentService.GetInstance().ChangeStatus(ids, status, out msg); } // /// 改变设备状态的显示信息 /// /// /// protected string GetStatus(object status) { if (status == null) { status = 0; } return ((EYesOrNo)status).ToString(); } protected override void Delete(int id, out string msg) { EquipmentService.GetInstance().Delete(id, out msg); } protected override void Delete(List ids, out string msg) { EquipmentService.GetInstance().Delete(ids, out msg); } protected void Page_Load(object sender, EventArgs e) { string msg; if (!IsPostBack) { //判断删除复选框是否选择了至少一项纪录 ResolveDeleteButtonForGrid(Button3, EquipmentGrid); var types = EquipmentTypeService.GetInstance().QueryByParam(new QueryParam(), out msg); types.ForEach(x => ddlType.Items.Add(x.Name, x.Id.ToString())); Button1.OnClientClick = types.Count >0 ? Window1.GetShowReference("~/View/DEV/Equipment/EquipmentDetail.aspx", "新增设备") : "alert('请先添加设备类型');"; Query(1); } } protected override Window GetWindow() { return Window2; } //protected override void GetPath(object userName) //{ // string msg; // var equipments = EquipmentViewService.GetInstance().QueryByParam(new QueryParam // { // Search = new Dictionary { { "EquipName", tbEquipName.Text.Trim() } }, // Filter = new Dictionary { { "TypeId", ddlType.SelectedValue }, { "Status", ddlStatus.SelectedValue } }, // }, out msg); // var datas = new List(); // equipments.ForEach(x => datas.Add(x)); // var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary { { "Name", "设备" } } }, out msg); // var path = ExcelService.GetInstance().ToExcelByEPPlus(workBooks[0], new Dictionary> { { "设备", datas } }, out msg); // Session["ExcelPath"] = path; //} protected override FineUIPro.Timer GetTimer() { return timer1; } } }