protected void btnSave_Click(object sender, EventArgs e) { try { SortedList SQLlist = new SortedList(new MySort()); if (!string.IsNullOrEmpty(dictlabId)) { Hashtable ht = new Hashtable(); DictlabandtestService dictlabandtestSerivce = new DictlabandtestService(); ht.Add("Dictlabid", dictlabId); bool flag = false; flag = dictlabandtestSerivce.BatchInsert(ht); if (flag) { MessageBoxShow("操作成功!", MessageBoxIcon.Information); CacheHelper.RemoveAllCache("daan.GetDictlabandtest"); BindGrid(); } else { MessageBoxShow("没有需要导入的数据", MessageBoxIcon.Information); } } else { MessageBoxShow("您还没选择分点!", MessageBoxIcon.Information); } } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
protected void btnExcel_Click(object sender, EventArgs e) { try { if (gvList.Rows.Count == 0) { MessageBoxShow("没有导出的数据", MessageBoxIcon.Information); return; } Hashtable ht = new Hashtable(); ht.Add("DictlabId", dictlabId); ht.Add("strKey", TextUtility.ReplaceText(btSearch.Text.Trim()) == "" ? null : TextUtility.ReplaceText(btSearch.Text.Trim())); ht.Add("IsActive", chkActive.Checked ? "1" : "0"); List <Dictlabandtest> dictlabandtestIList = new DictlabandtestService().GetDictlabandtestByDictlabId(ht); if (dictlabandtestIList.Count > 0) { String sheetname = DateTime.Now.ToString("yyyy-MM-dd"); String filename = DateTime.Now.ToString("yyyyMMdd_hhmmss"); SortedList sortlist = new SortedList(new MySort()); sortlist.Add("Labname", "分点名称"); sortlist.Add("Testname", "套餐名称"); sortlist.Add("Createdate", "创建时间"); sortlist.Add("Issendouttest", "是否外包"); sortlist.Add("Isactive", "是否可用"); List <Dictlabandtest> dictlabandtestIListTo = new List <Dictlabandtest>(); for (int i = 0; i < dictlabandtestIList.Count; i++) { Dictlabandtest dictlaband = new DictlabandtestService().GetDictDictlabandtestById(Convert.ToDouble(dictlabandtestIList[i].Dictlabandtestid)); if (dictlaband.BoolIsactive == true) { dictlaband.Isactive = "是"; } else { dictlaband.Isactive = "否"; } if (dictlaband.BoolIssendouttest == true) { dictlaband.Issendouttest = "是"; } else { dictlaband.Issendouttest = "否"; } dictlaband.Labname = dictlabandtestIList[i].Labname; dictlaband.Testname = dictlabandtestIList[i].Testname; dictlabandtestIListTo.Add(dictlaband); } ExcelOperation <Dictlabandtest> .ExportListToExcel(dictlabandtestIListTo, sortlist, filename, sheetname); } else { MessageBoxShow("没有导出的数据", MessageBoxIcon.Information); } } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
protected void btnDelAll_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtTestItemName.Text.Trim())) { MessageBoxShow("请选择要操作的项", MessageBoxIcon.Information); return; } try { SortedList SQLlist = new SortedList(new MySort()); string dictLabandtestid = gvList.DataKeys[gvList.SelectedRowIndexArray[0]][0].ToString(); Dictlabandtest oldDictLabandtest = new DictlabandtestService().GetDictDictlabandtestById(Convert.ToDouble(dictLabandtestid)); Dictlabandtestprice dictLabandtestprice = new Dictlabandtestprice(); dictLabandtestprice.Dictlabid = oldDictLabandtest.Dictlabid; dictLabandtestprice.Dicttestitemid = oldDictLabandtest.Dicttestitemid; SQLlist.Add(new Hashtable() { { "DELETE", "Dict.DeleteDictlabandtestpriceByWhere" } }, dictLabandtestprice); var library = new DictlabandtestService(); SQLlist.Add(new Hashtable() { { "DELETE", "Dict.DeleteDictlabandtest" } }, dictLabandtestid); if (library.ExecuteSqlTran(SQLlist)) { MessageBoxShow("所选项已成功删除", MessageBoxIcon.Information); BindGrid(); this.radlIsactive.SelectedValue = "1"; this.radlIssendouttest.SelectedValue = "0"; } CacheHelper.RemoveAllCache("daan.GetDictlabandtest"); } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } BindGrid(); }