/// <summary> /// 获取下拉json数据 /// </summary> /// <returns></returns> public string getComboboxJson() { DataSet ds = BLL.GetList(" 1=1 order by OrderBy asc"); if (ds != null && ds.Tables.Count > 0) { return(JsonHelper.CreateComboboxJson(ds.Tables[0], "CustomerId", "CustomerName")); } else { return(JsonHelper.CreateComboboxJson(null, "", "")); } }
private void TreeBind(string strWhere) { BLL.Haulway haulwayBll = new BLL.Haulway(); DataTable haulwayDT = haulwayBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlHaulway.Items.Clear(); ddlHaulway.Items.Add(new ListItem("请选择运输路线", "")); foreach (DataRow dr in haulwayDT.Rows) { this.ddlHaulway.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.Customer customerBll = new BLL.Customer(); DataTable customerDT = customerBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlShipper.Items.Clear(); ddlShipper.Items.Add(new ListItem("请选择托运方", "")); ddlReceiver.Items.Clear(); ddlReceiver.Items.Add(new ListItem("请选择收货方", "")); foreach (DataRow dr in customerDT.Rows) { if (!dr["Category"].ToString().Equals("托运方")) { this.ddlReceiver.Items.Add(new ListItem(dr["ShortName"].ToString(), dr["Id"].ToString())); } if (!dr["Category"].ToString().Equals("收货方")) { this.ddlShipper.Items.Add(new ListItem(dr["ShortName"].ToString(), dr["Id"].ToString())); } } BLL.Address addressBll = new BLL.Address(); DataTable addressDT = addressBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlLoadingAddress.Items.Clear(); ddlLoadingAddress.Items.Add(new ListItem("请选择装货地址", "")); ddlUnloadingAddress.Items.Clear(); ddlUnloadingAddress.Items.Add(new ListItem("请选择卸货地址", "")); foreach (DataRow dr in addressDT.Rows) { if (!dr["CategoryName"].ToString().Equals("卸货地址")) { this.ddlLoadingAddress.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } if (!dr["CategoryName"].ToString().Equals("装货地址")) { this.ddlUnloadingAddress.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } } BLL.Goods goodsBll = new BLL.Goods(); DataTable goodsDT = goodsBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlGoods.Items.Clear(); ddlGoods.Items.Add(new ListItem("请选择承运货物", "")); foreach (DataRow dr in goodsDT.Rows) { this.ddlGoods.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } }
private void TreeBind(string strWhere) { BLL.Vehicle goodsBll = new BLL.Vehicle(); DataTable goodsDT = goodsBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlCarNumber.Items.Clear(); ddlCarNumber.Items.Add(new ListItem("车号不限", "")); foreach (DataRow dr in goodsDT.Rows) { this.ddlCarNumber.Items.Add(new ListItem(dr["CarCode"].ToString(), dr["CarCode"].ToString())); } BLL.Customer customerBll = new BLL.Customer(); DataTable customerDT = customerBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlCustomer1.Items.Clear(); ddlCustomer1.Items.Add(new ListItem("托运方不限", "")); ddlCustomer2.Items.Clear(); ddlCustomer2.Items.Add(new ListItem("收货方不限", "")); foreach (DataRow dr in customerDT.Rows) { if (!dr["Category"].ToString().Equals("托运方")) { this.ddlCustomer2.Items.Add(new ListItem(dr["ShortName"].ToString(), dr["ShortName"].ToString())); } if (!dr["Category"].ToString().Equals("收货方")) { this.ddlCustomer1.Items.Add(new ListItem(dr["ShortName"].ToString(), dr["ShortName"].ToString())); } } }
private void TreeBind(string strWhere) { BLL.Customer customerBLL = new BLL.Customer(); DataTable customerDT = customerBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlCustomer.Items.Clear(); this.ddlCustomer.Items.Add(new ListItem("所属客户", "")); foreach (DataRow dr in customerDT.Rows) { this.ddlCustomer.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.Goods goodsBLL = new BLL.Goods(); DataTable goodsDT = goodsBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlGoods.Items.Clear(); this.ddlGoods.Items.Add(new ListItem("货物", "")); foreach (DataRow dr in goodsDT.Rows) { this.ddlGoods.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.Store storeBLL = new BLL.Store(); DataTable storeDT = storeBLL.GetAllList().Tables[0]; storeOptions += "<option value='0'>选择仓库</option>"; foreach (DataRow dr in storeDT.Rows) { storeOptions += "<option value='" + dr["Id"] + "'>" + dr["Name"] + "</option>"; } }
private void TreeBind(string strWhere) { BLL.Customer customerBLL = new BLL.Customer(); DataTable customerDT = customerBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlCustomer.Items.Clear(); this.ddlCustomer.Items.Add(new ListItem("客户", "")); foreach (DataRow dr in customerDT.Rows) { this.ddlCustomer.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.Goods goodsBLL = new BLL.Goods(); DataTable goodsDT = goodsBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlGoods.Items.Clear(); this.ddlGoods.Items.Add(new ListItem("货物", "")); foreach (DataRow dr in goodsDT.Rows) { this.ddlGoods.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.Vehicle vehicleBLL = new BLL.Vehicle(); DataTable vehicleDT = vehicleBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlVehicle.Items.Clear(); this.ddlVehicle.Items.Add(new ListItem("车辆", "")); foreach (DataRow dr in vehicleDT.Rows) { this.ddlVehicle.Items.Add(new ListItem(dr["PlateNumber"].ToString(), dr["Id"].ToString())); } }
private void TreeBind(string strWhere) { BLL.Customer customerBLL = new BLL.Customer(); DataTable customerDT = customerBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlCustomer.Items.Clear(); this.ddlCustomer.Items.Add(new ListItem("选择客户", "")); foreach (DataRow dr in customerDT.Rows) { this.ddlCustomer.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } this.ddlGoods.Items.Clear(); this.ddlGoods.Items.Add(new ListItem("选择货物", "")); BLL.Vehicle vehicleBLL = new BLL.Vehicle(); DataTable vehicleDT = vehicleBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlVehicle.Items.Clear(); this.ddlVehicle.Items.Add(new ListItem("选择车辆", "")); foreach (DataRow dr in vehicleDT.Rows) { this.ddlVehicle.Items.Add(new ListItem(dr["PlateNumber"].ToString(), dr["Id"].ToString())); } BLL.HandlingMode handlingModeBLL = new BLL.HandlingMode(); DataTable handlingModeDT = handlingModeBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlHandlingMode.Items.Clear(); this.ddlHandlingMode.Items.Add(new ListItem("选择装卸方式", "")); foreach (DataRow dr in handlingModeDT.Rows) { this.ddlHandlingMode.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } }
private void TreeBind(string strWhere) { BLL.Customer customerBLL = new BLL.Customer(); DataTable customerDT = customerBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlCustomer.Items.Clear(); this.ddlCustomer.Items.Add(new ListItem("所属客户", "")); foreach (DataRow dr in customerDT.Rows) { this.ddlCustomer.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.StoreMode storeModeBLL = new BLL.StoreMode(); DataTable storeModeDT = storeModeBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlStoreMode.Items.Clear(); this.ddlStoreMode.Items.Add(new ListItem("存储方式", "")); foreach (DataRow dr in storeModeDT.Rows) { this.ddlStoreMode.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.HandlingMode handlingModeBLL = new BLL.HandlingMode(); DataTable handlingModeDT = handlingModeBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlHandlingMode.Items.Clear(); this.ddlHandlingMode.Items.Add(new ListItem("装卸方式", "")); foreach (DataRow dr in handlingModeDT.Rows) { this.ddlHandlingMode.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } }
/// <summary> /// 绑定客户下拉列表 /// </summary> void BindCustomer() { DataSet ds = bllCustomer.GetList(0, "ParentId=0 and StateInfo=1", "AddTime asc,Id asc"); foreach (DataRow item in ds.Tables[0].Rows) { ddlCustomer.Items.Add(new ListItem(item["CompanyName"].ToString(), item["Id"].ToString())); } }
private void TreeBind(string strWhere) { BLL.Goods goodsBll = new BLL.Goods(); DataTable goodsDT = goodsBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlGoods.Items.Clear(); ddlGoods.Items.Add(new ListItem("承运货物", "")); foreach (DataRow dr in goodsDT.Rows) { this.ddlGoods.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.Customer customerBll = new BLL.Customer(); DataTable customerDT = customerBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlCustomer1.Items.Clear(); ddlCustomer1.Items.Add(new ListItem("托运方", "")); ddlCustomer2.Items.Clear(); ddlCustomer2.Items.Add(new ListItem("收货方", "")); foreach (DataRow dr in customerDT.Rows) { if (!dr["Category"].ToString().Equals("托运方")) { this.ddlCustomer2.Items.Add(new ListItem(dr["ShortName"].ToString(), dr["Id"].ToString())); } if (!dr["Category"].ToString().Equals("收货方")) { this.ddlCustomer1.Items.Add(new ListItem(dr["ShortName"].ToString(), dr["Id"].ToString())); } } BLL.Address addressBll = new BLL.Address(); DataTable addressDT = addressBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlLoadingAddress.Items.Clear(); ddlLoadingAddress.Items.Add(new ListItem("请选择装货地址", "")); ddlUnloadingAddress.Items.Clear(); ddlUnloadingAddress.Items.Add(new ListItem("请选择卸货地址", "")); foreach (DataRow dr in addressDT.Rows) { if (!dr["CategoryName"].ToString().Equals("卸货地址")) { this.ddlLoadingAddress.Items.Add(new ListItem(dr["Name"].ToString(), dr["Name"].ToString())); } if (!dr["CategoryName"].ToString().Equals("装货地址")) { this.ddlUnloadingAddress.Items.Add(new ListItem(dr["Name"].ToString(), dr["Name"].ToString())); } } ddlIsAllot.Items.Clear(); ddlIsAllot.Items.Add(new ListItem("是否调拨单", "0")); ddlIsAllot.Items.Add(new ListItem("是", "1")); ddlIsAllot.Items.Add(new ListItem("否", "2")); }
/// <summary> /// 绑定客户下拉列表 /// </summary> void BindCustomer() { DataSet ds = bllCustomer.GetList(0, "ParentId=0 and StateInfo=1", "AddTime asc,Id asc"); foreach (DataRow item in ds.Tables[0].Rows) { DataSet dsSub = bllCustomer.GetList(0, "ParentId=" + item["Id"].ToString() + " and StateInfo=1", "AddTime asc,Id asc"); if (dsSub.Tables[0].Rows.Count > 0) { ddlCustomer.Items.Add(new ListItem(item["CompanyName"].ToString(), "")); foreach (DataRow item1 in dsSub.Tables[0].Rows) { ddlCustomer.Items.Add(new ListItem(" |--" + item1["CompanyName"].ToString(), item1["Id"].ToString())); } } else { ddlCustomer.Items.Add(new ListItem(item["CompanyName"].ToString(), item["Id"].ToString())); } } }
private void TreeBind(string strWhere) { BLL.Customer customerBLL = new BLL.Customer(); DataTable customerDT = customerBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlCustomer.Items.Clear(); this.ddlCustomer.Items.Add(new ListItem("所属客户", "")); foreach (DataRow dr in customerDT.Rows) { this.ddlCustomer.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } }
/// <summary> /// 绑定直接客户 /// </summary> void BindParentCompany() { DataSet ds = bll.GetList(0, "ParentId=0 and StateInfo=1", "AddTime asc"); foreach (DataRow item in ds.Tables[0].Rows) { ListItem list = new ListItem(); list.Text = item["CompanyName"].ToString(); list.Value = item["Id"].ToString(); ddlParentID.Items.Add(list); } }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); if (this.status > 0) { this.ddlStatus.SelectedValue = this.status.ToString(); } this.txtKeywords.Text = this.keywords; BLL.Customer bll = new BLL.Customer(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("customer_list.aspx", "status={0}&keywords={1}&page={2}", this.status.ToString(), this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
/// <summary> /// 绑定客户下拉列表 /// </summary> void BindCustomer(int fid) { Model.FatherOrder model = bllFathrt.GetModel(fid); Model.Customer modelcustomer = bllCustomer.GetModel(int.Parse(model.CustomerId.ToString())); DataSet ds = bllCustomer.GetList(0, "ParentId=" + modelcustomer.Id + " and StateInfo=1", "AddTime asc,Id asc"); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow item in ds.Tables[0].Rows) { ddlCustomer.Items.Add(new ListItem(item["CompanyName"].ToString(), item["Id"].ToString())); } } else { ddlCustomer.Items.Add(new ListItem(modelcustomer.CompanyName, modelcustomer.Id.ToString())); } }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); BLL.Customer bll = new BLL.Customer(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, manager, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = backUrl(); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); txtCusName.Text = _cusName; hCusId.Value = _cid; ddlcheck1.SelectedValue = _check1; ddltype.SelectedValue = _type; ddlisUse.SelectedValue = _isUse; txtOwner1.Text = _owner1; }
private void TreeBind(string strWhere) { BLL.Customer customerBLL = new BLL.Customer(); DataTable customerDT = customerBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlCustomer.Items.Clear(); this.ddlCustomer.Items.Add(new ListItem("选择客户", "")); foreach (DataRow dr in customerDT.Rows) { this.ddlCustomer.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.StoreInOrder storeInOrderBLL = new BLL.StoreInOrder(); DataTable storeInOrderDT = storeInOrderBLL.GetList(0, "Status > 1", "Id desc").Tables[0]; this.ddlStoreInOrder.Items.Clear(); this.ddlStoreInOrder.Items.Add(new ListItem("选择入库单", "")); foreach (DataRow dr in storeInOrderDT.Rows) { this.ddlStoreInOrder.Items.Add(new ListItem(dr["AccountNumber"].ToString(), dr["Id"].ToString())); } }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); if (!string.IsNullOrEmpty(_typeName)) { ddlTypeName.SelectedValue = _typeName; } if (!string.IsNullOrEmpty(_categoryName)) { ddlCategory.SelectedValue = _categoryName; } this.txtKeywords.Text = this.keywords; BLL.Customer bll = new BLL.Customer(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("customer_list.aspx", "typeName={0}&categoryName={1}&keywords={2}&page={3}", _typeName, _categoryName, this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void TreeBind(string strWhere) { BLL.Customer customerBLL = new BLL.Customer(); DataTable customerDT = customerBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlCustomer.Items.Clear(); this.ddlCustomer.Items.Add(new ListItem("所属客户", "")); foreach (DataRow dr in customerDT.Rows) { this.ddlCustomer.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.StoreMode storeModeBLL = new BLL.StoreMode(); DataTable storeModeDT = storeModeBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlStoreMode.Items.Clear(); this.ddlStoreMode.Items.Add(new ListItem("存储方式", "")); foreach (DataRow dr in storeModeDT.Rows) { this.ddlStoreMode.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.HandlingMode handlingModeBLL = new BLL.HandlingMode(); DataTable handlingModeDT = handlingModeBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlHandlingMode.Items.Clear(); this.ddlHandlingMode.Items.Add(new ListItem("装卸方式", "")); foreach (DataRow dr in handlingModeDT.Rows) { this.ddlHandlingMode.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.Unit unitBLL = new BLL.Unit(); DataTable unitDT = unitBLL.GetList(0, strWhere, "Id desc").Tables[0]; this.ddlUnit.Items.Clear(); this.ddlUnit.Items.Add(new ListItem("计量单位", "")); foreach (DataRow dr in unitDT.Rows) { this.ddlUnit.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } }
protected void btnExcel_Click(object sender, EventArgs e) { _cusName = DTRequest.GetFormString("txtCusName"); _cid = DTRequest.GetFormString("hCusId"); _check1 = DTRequest.GetFormString("ddlcheck1"); _type = DTRequest.GetFormString("ddltype"); _isUse = DTRequest.GetFormString("ddlisUse"); BLL.Customer bll = new BLL.Customer(); DataTable dt = bll.GetList(this.pageSize, this.page, "c_id>0" + CombSqlTxt(), "c_isUse desc,c_addDate desc,c_id desc", manager, out this.totalCount, false).Tables[0]; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=客户列表.xlsx"); //HttpUtility.UrlEncode(fileName)); HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; HSSFWorkbook hssfworkbook = new HSSFWorkbook(); ISheet sheet = hssfworkbook.CreateSheet("明细"); IFont font = hssfworkbook.CreateFont(); font.Boldweight = short.MaxValue; font.FontHeightInPoints = 11; #region 表格样式 //设置单元格的样式:水平垂直对齐居中 ICellStyle cellStyle = hssfworkbook.CreateCellStyle(); cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center; cellStyle.BorderBottom = BorderStyle.Thin; cellStyle.BorderLeft = BorderStyle.Thin; cellStyle.BorderRight = BorderStyle.Thin; cellStyle.BorderTop = BorderStyle.Thin; cellStyle.BottomBorderColor = HSSFColor.Black.Index; cellStyle.LeftBorderColor = HSSFColor.Black.Index; cellStyle.RightBorderColor = HSSFColor.Black.Index; cellStyle.TopBorderColor = HSSFColor.Black.Index; cellStyle.WrapText = true;//自动换行 //设置表头的样式:水平垂直对齐居中,加粗 ICellStyle titleCellStyle = hssfworkbook.CreateCellStyle(); titleCellStyle.Alignment = HorizontalAlignment.Center; titleCellStyle.VerticalAlignment = VerticalAlignment.Center; titleCellStyle.FillForegroundColor = HSSFColor.Grey25Percent.Index; //图案颜色 titleCellStyle.FillPattern = FillPattern.SparseDots; //图案样式 titleCellStyle.FillBackgroundColor = HSSFColor.Grey25Percent.Index; //背景颜色 //设置边框 titleCellStyle.BorderBottom = BorderStyle.Thin; titleCellStyle.BorderLeft = BorderStyle.Thin; titleCellStyle.BorderRight = BorderStyle.Thin; titleCellStyle.BorderTop = BorderStyle.Thin; titleCellStyle.BottomBorderColor = HSSFColor.Black.Index; titleCellStyle.LeftBorderColor = HSSFColor.Black.Index; titleCellStyle.RightBorderColor = HSSFColor.Black.Index; titleCellStyle.TopBorderColor = HSSFColor.Black.Index; //设置字体 titleCellStyle.SetFont(font); #endregion //表头 IRow headRow = sheet.CreateRow(0); headRow.HeightInPoints = 25; headRow.CreateCell(0).SetCellValue("客户ID"); headRow.CreateCell(1).SetCellValue("客户名称"); headRow.CreateCell(2).SetCellValue("客户类别"); headRow.CreateCell(3).SetCellValue("业务范围"); headRow.CreateCell(4).SetCellValue("信用代码(税号)"); headRow.CreateCell(5).SetCellValue("所属人"); headRow.CreateCell(6).SetCellValue("联系人"); headRow.CreateCell(7).SetCellValue("审批状态"); headRow.CreateCell(8).SetCellValue("启用状态"); headRow.GetCell(0).CellStyle = titleCellStyle; headRow.GetCell(1).CellStyle = titleCellStyle; headRow.GetCell(2).CellStyle = titleCellStyle; headRow.GetCell(3).CellStyle = titleCellStyle; headRow.GetCell(4).CellStyle = titleCellStyle; headRow.GetCell(5).CellStyle = titleCellStyle; headRow.GetCell(6).CellStyle = titleCellStyle; headRow.GetCell(7).CellStyle = titleCellStyle; headRow.GetCell(8).CellStyle = titleCellStyle; sheet.SetColumnWidth(0, 15 * 256); sheet.SetColumnWidth(1, 20 * 256); sheet.SetColumnWidth(2, 20 * 256); sheet.SetColumnWidth(3, 30 * 256); sheet.SetColumnWidth(4, 20 * 256); sheet.SetColumnWidth(5, 20 * 256); sheet.SetColumnWidth(6, 15 * 256); sheet.SetColumnWidth(7, 20 * 256); sheet.SetColumnWidth(8, 20 * 256); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { IRow row = sheet.CreateRow(i + 1); row.HeightInPoints = 22; row.CreateCell(0).SetCellValue(dt.Rows[i]["c_id"].ToString()); row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_name"])); row.CreateCell(2).SetCellValue(BusinessDict.customerType()[Utils.ObjToByte(dt.Rows[i]["c_type"])]); row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_business"])); row.CreateCell(4).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_num"])); row.CreateCell(5).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_ownerName"])); row.CreateCell(6).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["co_name"])); row.CreateCell(7).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["c_flag"]) == "0"?"待审批": Utils.ObjectToStr(dt.Rows[i]["c_flag"]) == "1"?"审批未通过":"审批通过"); row.CreateCell(8).SetCellValue(BusinessDict.isUseStatus(1)[Convert.ToBoolean(dt.Rows[i]["c_isUse"])]); row.GetCell(0).CellStyle = cellStyle; row.GetCell(1).CellStyle = cellStyle; row.GetCell(2).CellStyle = cellStyle; row.GetCell(3).CellStyle = cellStyle; row.GetCell(4).CellStyle = cellStyle; row.GetCell(5).CellStyle = cellStyle; row.GetCell(6).CellStyle = cellStyle; row.GetCell(7).CellStyle = cellStyle; row.GetCell(8).CellStyle = cellStyle; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }
private void TreeBind(string strWhere) { BLL.Haulway haulwayBll = new BLL.Haulway(); DataTable haulwayDT = haulwayBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlHaulway.Items.Clear(); ddlHaulway.Items.Add(new ListItem("请选择运输路线", "")); foreach (DataRow dr in haulwayDT.Rows) { this.ddlHaulway.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } ddlFormula.Items.Clear(); ddlFormula.Items.Add(new ListItem("计量*运费单价", "1")); ddlFormula.Items.Add(new ListItem("计量*公里*运费单价", "2")); ddlFormula.Items.Add(new ListItem("固定运费", "3")); BLL.Customer customerBll = new BLL.Customer(); DataTable customerDT = customerBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlShipper.Items.Clear(); ddlShipper.Items.Add(new ListItem("请选择托运方", "")); ddlReceiver.Items.Clear(); ddlReceiver.Items.Add(new ListItem("请选择收货方", "")); foreach (DataRow dr in customerDT.Rows) { if (!dr["Category"].ToString().Equals("托运方")) { this.ddlReceiver.Items.Add(new ListItem(dr["ShortName"].ToString(), dr["Id"].ToString())); } if (!dr["Category"].ToString().Equals("收货方")) { this.ddlShipper.Items.Add(new ListItem(dr["ShortName"].ToString(), dr["Id"].ToString())); } } BLL.Address addressBll = new BLL.Address(); DataTable addressDT = addressBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlLoadingAddress.Items.Clear(); ddlLoadingAddress.Items.Add(new ListItem("请选择装货地址", "")); ddlUnloadingAddress.Items.Clear(); ddlUnloadingAddress.Items.Add(new ListItem("请选择卸货地址", "")); foreach (DataRow dr in addressDT.Rows) { if (!dr["CategoryName"].ToString().Equals("卸货地址")) { this.ddlLoadingAddress.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } if (!dr["CategoryName"].ToString().Equals("装货地址")) { this.ddlUnloadingAddress.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } } BLL.Goods goodsBll = new BLL.Goods(); DataTable goodsDT = goodsBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlGoods.Items.Clear(); ddlGoods.Items.Add(new ListItem("请选择承运货物", "")); foreach (DataRow dr in goodsDT.Rows) { this.ddlGoods.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } ddlSettleAccountsWay.Items.Clear(); ddlSettleAccountsWay.Items.Add(new ListItem("现结", "现结")); ddlSettleAccountsWay.Items.Add(new ListItem("月结", "月结")); ddlSettleAccountsWay.Items.Add(new ListItem("预付", "预付")); }
private void TreeBind(string strWhere) { BLL.Haulway haulwayBll = new BLL.Haulway(); DataTable haulwayDT = haulwayBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlHaulway.Items.Clear(); ddlHaulway.Items.Add(new ListItem("请选择运输路线", "")); foreach (DataRow dr in haulwayDT.Rows) { this.ddlHaulway.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.Customer customerBll = new BLL.Customer(); DataTable customerDT = customerBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlShipper.Items.Clear(); ddlShipper.Items.Add(new ListItem("请选择托运方", "")); ddlReceiver.Items.Clear(); ddlReceiver.Items.Add(new ListItem("请选择收货方", "")); foreach (DataRow dr in customerDT.Rows) { if (!dr["Category"].ToString().Equals("托运方")) { this.ddlReceiver.Items.Add(new ListItem(dr["ShortName"].ToString(), dr["Id"].ToString())); } if (!dr["Category"].ToString().Equals("收货方")) { this.ddlShipper.Items.Add(new ListItem(dr["ShortName"].ToString(), dr["Id"].ToString())); } } BLL.Address addressBll = new BLL.Address(); DataTable addressDT = addressBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlLoadingAddress.Items.Clear(); ddlLoadingAddress.Items.Add(new ListItem("请选择装货地址", "")); ddlUnloadingAddress.Items.Clear(); ddlUnloadingAddress.Items.Add(new ListItem("请选择卸货地址", "")); foreach (DataRow dr in addressDT.Rows) { if (!dr["CategoryName"].ToString().Equals("卸货地址")) { this.ddlLoadingAddress.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } if (!dr["CategoryName"].ToString().Equals("装货地址")) { this.ddlUnloadingAddress.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } } BLL.Goods goodsBll = new BLL.Goods(); DataTable goodsDT = goodsBll.GetList(0, strWhere, "Id desc").Tables[0]; ddlGoods.Items.Clear(); ddlGoods.Items.Add(new ListItem("请选择承运货物", "")); foreach (DataRow dr in goodsDT.Rows) { this.ddlGoods.Items.Add(new ListItem(dr["Name"].ToString(), dr["Id"].ToString())); } BLL.TransportOrder transportOrderBLL = new BLL.TransportOrder(); DataTable transportOrderDT = transportOrderBLL.GetSelectList(0, " A.Status = 0", "Id DESC").Tables[0]; ddlTransportOrder.Items.Clear(); ddlTransportOrder.Items.Add(new ListItem("请选择运输单", "")); foreach (DataRow dr in transportOrderDT.Rows) { this.ddlTransportOrder.Items.Add(new ListItem(string.Format("{0}({1})", dr["CarNumber"].ToString(), dr["Code"].ToString()), dr["Id"].ToString())); } }
/// <summary> /// 绑定客户列表 /// </summary> void BindRepList() { repList.DataSource = bll.GetList(0, "", "AddTime asc"); repList.DataBind(); }