/// <summary> /// 导出 /// </summary> private void MasterToolBar_DoExport_Click(object sender, EventArgs e) { _currentDt = bLocation.GetList(GetConduction()).Tables[0]; if (isSearch && _currentDt != null) { foreach (DataRow row in _currentDt.Rows) { try { if (row["CREATE_USER"] != null && bCommon.GetBaseMaster("USER", CConvert.ToString(row["CREATE_USER"])) != null) { row["CREATE_USER"] = bCommon.GetBaseMaster("USER", CConvert.ToString(row["CREATE_USER"])).Name; } if (row["LAST_UPDATE_USER"] != null && bCommon.GetBaseMaster("USER", CConvert.ToString(row["LAST_UPDATE_USER"])) != null) { row["LAST_UPDATE_USER"] = bCommon.GetBaseMaster("USER", CConvert.ToString(row["LAST_UPDATE_USER"])).Name; } } catch { } } int result = CExport.DataTableToExcel(_currentDt, CConstant.LOCATION_HEADER, CConstant.LOCATION_COLUMNS, "LOCATION", "LOCATION"); if (result == CConstant.EXPORT_SUCCESS) { MessageBox.Show("数据已经成功导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (result == CConstant.EXPORT_FAILURE) { MessageBox.Show("数据导出失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("没有可以导出的数据。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// /// </summary> private void initLocation() { if (!string.IsNullOrEmpty(txtWarehouseCode.Text.Trim()) && !string.IsNullOrEmpty(txtProductCode.Text.Trim())) { BLocation bLocation = new BLocation(); DataSet ds = bLocation.GetList(" WAREHOUSE_CODE='" + txtWarehouseCode.Text.Trim() + "' and PRODUCT_CODE='" + txtProductCode.Text.Trim() + "'"); if (ds.Tables[0].Rows.Count > 0) { txtProduct_Group_Code.Text = CConvert.ToString(ds.Tables[0].Rows[0]["CODE"]); txtProduct_Group_Name.Text = CConvert.ToString(ds.Tables[0].Rows[0]["NAME"]); } } else { txtProduct_Group_Code.Text = ""; txtProduct_Group_Name.Text = ""; } }