// 导出出库单货品清单以便打印的Excel文件 protected void btnExportExcel_Click(object sender, EventArgs e) { int intContractId = Convert.ToInt32(ViewState["ContractId"]); string[] aryExcel = BllCheckoutContract.setExcel(intContractId); // 设置压缩文件的下载链接 hlDownloadExcel.NavigateUrl = HelperExcel.SetExcelZip(aryExcel); hlDownloadExcel.Visible = true; }
public void OP_Command(object sender, CommandEventArgs e) { int intId = Convert.ToInt32(e.CommandArgument); string strUrl = ""; if (e.CommandName == "edit") { if (HelperUtility.hasPurviewOP("CheckoutContract_update")) { Response.Redirect("edit.aspx?id=" + intId.ToString() + "&page=" + ViewState["page"]); } else { HelperUtility.showAlert("没有操作权限", "list.aspx?page=" + ViewState["page"]); } } else if (e.CommandName == "del") { if (HelperUtility.hasPurviewOP("CheckoutContract_del")) { BllCheckoutContract.deleteById(intId); } else { HelperUtility.showAlert("没有操作权限", "list.aspx?page=" + ViewState["page"]); } } else if (e.CommandName == "ShowGoodsList") { if (HelperUtility.hasPurviewOP("CheckoutGoods_show")) { // 跳到添加货品清单页面,传过去合同cid和合同分页的页面值以便添加完成后返回此页 strUrl = "../checkout_record/list.aspx?cid=" + intId.ToString() + "&cpage=" + ViewState["page"]; Response.Redirect(strUrl); } else { HelperUtility.showAlert("没有操作权限", "list.aspx?page=" + ViewState["page"]); } } else if (e.CommandName == "AddGoods") { if (HelperUtility.hasPurviewOP("CheckoutGoods_add")) { // 跳到添加货品清单页面,传过去合同cid和合同分页的页面值以便添加完成后返回此页 strUrl = "../checkout_record/add.aspx?cid=" + intId.ToString() + "&cpage=" + ViewState["page"]; Response.Redirect(strUrl); } else { HelperUtility.showAlert("没有操作权限", "list.aspx?page=" + ViewState["page"]); } } LoadDataPage(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int intAdminId = HelperUtility.hasPurviewPage("CheckoutContract_update"); ViewState["AdminId"] = intAdminId; // 本页只能从list.aspx的编辑页转过来 // 因此要得到要修改的id值和页面的page值用于修改成功后返回 int intId = HelperUtility.getQueryInt("id"); ViewState["id"] = intId; int intPage = HelperUtility.getQueryInt("page"); ViewState["page"] = intPage; if (HelperUtility.hasPurviewPage("SUPERADMIN") > 0) { cbFlag.Visible = true; } // 根据入库单id查询得到入库单model ModelCheckoutContract model = BllCheckoutContract.getById(intId); List <string> listUnitName = model.name_unit.Split(',').ToList(); if (!"".Equals(listUnitName[0])) { cbUnitName1.Checked = true; } if (!"".Equals(listUnitName[1])) { cbUnitName2.Checked = true; } tbDepartmentName.Value = model.name_department; tbSignName.Value = model.name_sign; tbTimeCreate.Value = model.time_create.ToString("yyyy-MM-dd"); tbComment.Text = model.comment; if (model.flag > 0) { cbFlag.Checked = true; } BllDepartment.bindRPT(rptName); } }
private int intRecordCount = 0; //总记录数 public void LoadDataPage() { DataTable objDT; if ("".Equals(lblCurentPage.Text.Trim())) { lblCurentPage.Text = "1"; } intCurrentPage = Convert.ToInt32(lblCurentPage.Text.Trim()); if (intCurrentPage <= 0) { intCurrentPage = 1; } // 得到总记录数 intRecordCount = BllCheckoutContract.getRecordsAmount(); // 计算总页数 intPageCount = (intRecordCount + intPageSize - 1) / intPageSize; if (intCurrentPage > intPageCount) { intCurrentPage = intPageCount; } lblPageCount.Text = intPageCount.ToString(); // 根据当前页获取当前页的分页记录DataTable if (intRecordCount > 0) { objDT = BllCheckoutContract.getPage(intCurrentPage, intPageSize); } else { lblCurentPage.Text = "1"; objDT = null; } if (objDT != null && objDT.Rows.Count > 0) { lbtnFirst.Enabled = true; lbtnPrev.Enabled = true; lbtnNext.Enabled = true; lbtnLast.Enabled = true; if (intCurrentPage == 1) { lbtnFirst.Enabled = false; lbtnPrev.Enabled = false; } if (intCurrentPage == intPageCount) { lbtnNext.Enabled = false; lbtnLast.Enabled = false; } } else { lbtnFirst.Enabled = false; lbtnPrev.Enabled = false; lbtnNext.Enabled = false; lbtnLast.Enabled = false; } gvShow.DataSource = objDT; gvShow.DataBind(); lblRecordCount.Text = intRecordCount.ToString(); lblCurentPage.Text = intCurrentPage.ToString(); tbPageNum.Text = intCurrentPage.ToString(); ViewState["page"] = intCurrentPage; }
protected void btnEdit_Click(object sender, EventArgs e) { if (!HelperUtility.hasPurviewOP("CheckoutContract_update")) { HelperUtility.showAlert("没有操作权限", "/BackManager/home.aspx"); } int intAdminId = (int)ViewState["AdminId"]; int intId = (int)ViewState["id"]; int intPage = (int)ViewState["page"]; string strThisPageUrl = "edit.aspx?id=" + intId + "&page=" + intPage; // 验证输入 string strMsgError = ""; string strUnitName, strUnitName1, strUnitName2; strUnitName1 = cbUnitName1.Checked ? cbUnitName1.Value : ""; strUnitName2 = cbUnitName2.Checked ? cbUnitName2.Value : ""; strUnitName = strUnitName1 + "," + strUnitName2; if (",".Equals(strUnitName)) { strMsgError += "申请单位至少选一个!"; } string strDepartmentName = tbDepartmentName.Value.Trim(); if ("".Equals(strDepartmentName)) { strMsgError += "申请部门/科室不能为空!"; } string strSignName = tbSignName.Value.Trim(); if ("".Equals(strSignName)) { strMsgError += "申请人姓名不能为空!"; } string strTimeCreate = tbTimeCreate.Value.Trim(); if ("".Equals(strTimeCreate)) { strMsgError += "签发时间不能为空!"; } if (!HelperUtility.isDateType(strTimeCreate)) { strMsgError += "签发时间格式不正确!"; } string strComment = tbComment.Text.Trim(); if (strComment.Length > 500) { strMsgError += "备注信息不能超过500个字数!"; } if (!"".Equals(strMsgError)) { HelperUtility.showAlert(strMsgError, strThisPageUrl); return; } string strPhotoUrls = ""; // 验证完毕,提交数据 ModelCheckoutContract model = BllCheckoutContract.getById(intId); model.id_admin = intAdminId; model.time_create = Convert.ToDateTime(strTimeCreate); model.name_unit = strUnitName; model.name_department = strDepartmentName; model.name_sign = strSignName; model.photo_urls = strPhotoUrls; model.comment = strComment; if (cbFlag.Checked) { model.flag = 1; } else { model.flag = 0; } // 更新数据库记录 BllCheckoutContract.update(model); // 跳转回列表页 Response.Redirect("/BackManager/checkout_contract/list.aspx?page=" + intPage); }
protected void btnAdd_Click(object sender, EventArgs e) { if (!HelperUtility.hasPurviewOP("CheckoutContract_add")) { string strUrl = "/BackManager/home.aspx"; HelperUtility.showAlert("没有操作权限", strUrl); } string strMsgError = ""; string strUnitName, strUnitName1, strUnitName2; strUnitName1 = cbUnitName1.Checked ? cbUnitName1.Value : ""; strUnitName2 = cbUnitName2.Checked ? cbUnitName2.Value : ""; strUnitName = strUnitName1 + "," + strUnitName2; if (",".Equals(strUnitName)) { strMsgError += "申请单位至少选一个!"; } string strDepartmentName = tbDepartmentName.Value.Trim(); if ("".Equals(strDepartmentName)) { strMsgError += "申请部门/科室不能为空!"; } string strSignName = tbSignName.Value.Trim(); if ("".Equals(strSignName)) { strMsgError += "申请人姓名不能为空!"; } string strComment = tbComment.Text.Trim(); if (strComment.Length > 500) { strMsgError += "备注信息不能超过500个字数!"; } if (!"".Equals(strMsgError)) { HelperUtility.showAlert(strMsgError, "add.aspx"); return; } string strPhotoUrls = ""; // 验证完毕,提交数据 int intAdminId = (int)ViewState["AdminId"]; ModelCheckoutContract model = new ModelCheckoutContract(); model.id_admin = intAdminId; model.time_create = DateTime.Now; model.name_unit = strUnitName; model.name_department = strDepartmentName; model.name_sign = strSignName; model.photo_urls = strPhotoUrls; model.comment = strComment; if (cbFlag.Checked) { model.flag = 1; } else { model.flag = 0; } int intId = BllCheckoutContract.add(model); if (intId > 0) { string strUrl = "list.aspx"; HelperUtility.showAlert("添加成功!", strUrl); } else { string strUrl = "add.aspx"; HelperUtility.showAlert("添加失败,请联系管理员!", strUrl); } }