private string DoEdit(int _id) { BLL.customerBank bll = new BLL.customerBank(); Model.customerBank model = bll.GetModel(_id); string _content = string.Empty; if (model.cb_bankName != txtBankName.Text.Trim()) { _content += "银行账户名称:" + model.cb_bankName + "→<font color='red'>" + txtBankName.Text.Trim() + "</font><br/>"; } model.cb_bankName = txtBankName.Text.Trim(); if (model.cb_bankNum != txtBankNum.Text.Trim()) { _content += "客户银行账号:" + model.cb_bankNum + "→<font color='red'>" + txtBankNum.Text.Trim() + "</font><br/>"; } model.cb_bankNum = txtBankNum.Text.Trim(); if (model.cb_bank != txtBank.Text.Trim()) { _content += "开户行:" + model.cb_bank + "→<font color='red'>" + txtBank.Text.Trim() + "</font><br/>"; } model.cb_bank = txtBank.Text.Trim(); if (model.cb_bankAddress != txtBankAddress.Text.Trim()) { _content += "开户地址:" + model.cb_bankAddress + "→<font color='red'>" + txtBankAddress.Text.Trim() + "</font><br/>"; } model.cb_bankAddress = txtBankAddress.Text.Trim(); if (model.cb_flag != cbIsUse.Checked) { _content += "状态:" + (model.cb_flag.Value ? "启用" : "禁用") + "→<font color='red'>" + (cbIsUse.Checked ? "启用" : "禁用") + "</font><br/>"; } model.cb_flag = cbIsUse.Checked; return(bll.Update(model, _content, manager)); }
private void ShowInfo(int _id) { BLL.customerBank bll = new BLL.customerBank(); DataSet ds = bll.GetList(0, "cb_id=" + _id, ""); if (ds != null && ds.Tables[0].Rows.Count > 0) { dr = ds.Tables[0].Rows[0]; //txtCusName.Text = dr["c_name"].ToString(); //hCusId.Value = dr["cb_cid"].ToString(); labCusName.Text = dr["c_name"].ToString(); txtBankName.Text = dr["cb_bankName"].ToString(); txtBankNum.Text = dr["cb_bankNum"].ToString(); txtBank.Text = dr["cb_bank"].ToString(); txtBankAddress.Text = dr["cb_bankAddress"].ToString(); if (Convert.ToBoolean(dr["cb_flag"])) { cbIsUse.Checked = true; } else { cbIsUse.Checked = false; } } }
protected void btnDelBank_Click(object sender, EventArgs e) { //ChkAdminLevel("sys_customerBank", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.customerBank bll = new BLL.customerBank(); string result = ""; int success = 0, error = 0; StringBuilder sb = new StringBuilder(); manager = GetAdminInfo(); for (int i = 0; i < bankrptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)bankrptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)bankrptList.Items[i].FindControl("chkId"); if (cb.Checked) { result = bll.Delete(id, manager); if (result == "") { success++; } else { error++; sb.Append(result + "<br/>"); } } } JscriptMsg("共选择" + (success + error) + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString(), "customer_edit.aspx?action=" + action + "&id=" + this.id); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { PrintLoad(); ChkAdminLevel("sys_customerBank", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.customerBank bll = new BLL.customerBank(); string result = ""; int success = 0, error = 0; StringBuilder sb = new StringBuilder(); manager = GetAdminInfo(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { result = bll.Delete(id, manager); if (result == "") { success++; } else { error++; sb.Append(result + "<br/>"); } } } JscriptMsg("共选择" + (success + error) + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString(), Utils.CombUrlTxt("bank_list.aspx", "page={0}&txtCusName={1}&hCusId={2}&ddlisUse={3}", "__id__", _cusName, _cid, _isUse)); }
private string DoAdd() { Model.customerBank model = new Model.customerBank(); BLL.customerBank bll = new BLL.customerBank(); model.cb_cid = cid; model.cb_bankName = txtBankName.Text.Trim(); model.cb_bankNum = txtBankNum.Text.Trim(); model.cb_bank = txtBank.Text.Trim(); model.cb_bankAddress = txtBankAddress.Text.Trim(); model.cb_flag = cbIsUse.Checked; return(bll.Add(model, manager)); }
private void RptBind(string _strWhere, string _orderby) { if (!this.isSearch) { this.page = DTRequest.GetQueryInt("page", 1); } else { this.page = 1; } BLL.customerBank bll = new BLL.customerBank(); 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("bank_list.aspx", "page={0}&txtCusName={1}&hCusId={2}&ddlisUse={3}", "__id__", _cusName, _cid, _isUse); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
protected void btnExcel_Click(object sender, EventArgs e) { DataTable dt = new BLL.customerBank().GetList(0, "cb_cid=" + id + "", "cb_id asc").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("银行账户名称"); headRow.CreateCell(1).SetCellValue("客户银行账号"); headRow.CreateCell(2).SetCellValue("开户行"); headRow.CreateCell(3).SetCellValue("开户地址"); headRow.CreateCell(4).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; sheet.SetColumnWidth(0, 15 * 256); sheet.SetColumnWidth(1, 20 * 256); sheet.SetColumnWidth(2, 20 * 256); sheet.SetColumnWidth(3, 20 * 256); sheet.SetColumnWidth(4, 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]["cb_bankName"].ToString()); row.CreateCell(1).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["cb_bankNum"])); row.CreateCell(2).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["cb_bank"])); row.CreateCell(3).SetCellValue(Utils.ObjectToStr(dt.Rows[i]["cb_bankAddress"])); row.CreateCell(4).SetCellValue(Utils.StrToBool(Utils.ObjectToStr(dt.Rows[i]["cb_flag"]), false) ? "启用" : "禁用"); 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; } } MemoryStream file = new MemoryStream(); hssfworkbook.Write(file); HttpContext.Current.Response.BinaryWrite(file.GetBuffer()); HttpContext.Current.Response.End(); }
private void DtBind() { dt = new DataTable(); BLL.customerBank bll = new BLL.customerBank(); dt = bll.GetList(0, "cb_cid=" + cid + " and cb_flag=1", "cb_id asc", false).Tables[0]; }