示例#1
0
        // 导出Excel文件
        protected void btnExportExcel_Click(object sender, EventArgs e)
        {
            int intContractId = Convert.ToInt32(ViewState["ContractId"]);

            string[] aryExcel = BllInventoryContract.setExcel(intContractId);
            // 设置压缩文件的下载链接
            hlDownloadExcel.NavigateUrl = HelperExcel.SetExcelZip(aryExcel);
            hlDownloadExcel.Visible     = true;
        }
示例#2
0
        public void OP_Command(object sender, CommandEventArgs e)
        {
            int    intId = Convert.ToInt32(e.CommandArgument);
            string strUrl;

            if (e.CommandName == "edit")
            {
                if (HelperUtility.hasPurviewOP("InventoryContract_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("InventoryContract_del"))
                {
                    BllInventoryContract.deleteById(intId);
                }
                else
                {
                    HelperUtility.showAlert("没有操作权限", "list.aspx?page=" + ViewState["page"]);
                }
            }
            else if (e.CommandName == "ShowGoodsList")
            {
                if (HelperUtility.hasPurviewOP("InventoryRecord_show"))
                {
                    // 跳到添加货品清单页面,传过去合同cid和合同分页的页面值以便添加完成后返回此页
                    strUrl = "../inventory_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("InventoryRecord_add"))
                {
                    // 跳到添加货品清单页面,传过去合同cid和合同分页的页面值以便添加完成后返回此页
                    strUrl = "../inventory_record/add.aspx?cid=" + intId.ToString() + "&cpage=" + ViewState["page"];
                    Response.Redirect(strUrl);
                }
                else
                {
                    HelperUtility.showAlert("没有操作权限", "list.aspx?page=" + ViewState["page"]);
                }
            }
            LoadDataPage();
        }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int intAdminId = HelperUtility.hasPurviewPage("InventoryContract_add");
         ViewState["AdminId"] = intAdminId;
         // 得到上次盘点的结束时间
         ModelInventoryContract model = BllInventoryContract.getLatestContract();
         lblTimeLast.Text  = model.time_end.ToString("yyyy-MM-dd");
         tbTimeStart.Value = model.time_end.ToString("yyyy-MM-dd");
     }
 }
示例#4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int intAdminId = HelperUtility.hasPurviewPage("InventoryContract_update");
         ViewState["AdminId"] = intAdminId;
         // 本页只能从list.aspx的编辑页转过来
         // 因此要得到要修改的id值和页面的page值用于修改成功后返回
         int intId = HelperUtility.getQueryInt("id");
         ViewState["id"] = intId;
         int intPage = HelperUtility.getQueryInt("page");
         ViewState["page"] = intPage;
         // 根据入库单id查询得到入库单model
         ModelInventoryContract model = BllInventoryContract.getById(intId);
         tbNameSign.Text   = model.name_sign;
         tbComment.Text    = model.comment;
         tbTimeStart.Value = model.time_start.ToString("yyyy-MM-dd");
         tbTimeEnd.Value   = model.time_end.ToString("yyyy-MM-dd");
     }
 }
示例#5
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            if (!HelperUtility.hasPurviewOP("InventoryContract_update"))
            {
                HelperUtility.showAlert("没有操作权限", "/BackManager/home.aspx");
            }
            int    intAdminId     = Convert.ToInt32(ViewState["AdminId"]);
            int    intId          = Convert.ToInt32(ViewState["id"]);
            int    intPage        = Convert.ToInt32(ViewState["page"]);
            string strThisPageUrl = "edit.aspx?id=" + intId + "&page=" + intPage;
            string strMsgError    = "";
            // 验证输入
            string strTimeStart = tbTimeStart.Value.Trim();

            if ("".Equals(strTimeStart))
            {
                strMsgError += "开始时间不能为空!";
            }
            if (!HelperUtility.isDateType(strTimeStart))
            {
                strMsgError += "开始时间格式不正确!";
            }
            string strTimeEnd = tbTimeEnd.Value.Trim();

            if ("".Equals(strTimeEnd))
            {
                strMsgError += "结束时间不能为空!";
            }
            if (!HelperUtility.isDateType(strTimeEnd))
            {
                strMsgError += "结束时间格式不正确!";
            }
            string strNameSign = tbNameSign.Text.Trim();

            if ("".Equals(strNameSign))
            {
                strMsgError += "公司名不能为空!";
            }
            string strComment = tbComment.Text.Trim();

            if (strComment.Length > 500)
            {
                strMsgError += "备注信息不能超过500个字数!";
            }
            if (!"".Equals(strMsgError))
            {
                HelperUtility.showAlert(strMsgError, strThisPageUrl);
                return;
            }
            // 验证完毕,提交数据
            ModelInventoryContract model = BllInventoryContract.getById(intId);

            model.name_sign  = strNameSign;
            model.comment    = strComment;
            model.time_start = Convert.ToDateTime(strTimeStart);
            model.time_end   = Convert.ToDateTime(strTimeEnd);
            // 更新数据库记录
            BllInventoryContract.update(model);
            // 跳转回列表页
            Response.Redirect("/BackManager/inventory_contract/list.aspx?page=" + intPage);
        }
示例#6
0
        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 = BllInventoryContract.getRecordsAmount();
            // 计算总页数
            intPageCount = (intRecordCount + intPageSize - 1) / intPageSize;
            if (intCurrentPage > intPageCount)
            {
                intCurrentPage = intPageCount;
            }
            lblPageCount.Text = intPageCount.ToString();
            // 根据当前页获取当前页的分页记录DataTable
            if (intRecordCount > 0)
            {
                objDT = BllInventoryContract.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;
        }
示例#7
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (!HelperUtility.hasPurviewOP("InventoryContract_add"))
            {
                string strUrl = "/BackManager/home.aspx";
                HelperUtility.showAlert("没有操作权限", strUrl);
            }
            string strMsgError = "";

            string strTimeStart = tbTimeStart.Value.Trim();

            if ("".Equals(strTimeStart))
            {
                strMsgError += "开始时间不能为空!";
            }
            if (!HelperUtility.isDateType(strTimeStart))
            {
                strMsgError += "开始时间格式不正确!";
            }
            string strTimeEnd = tbTimeEnd.Value.Trim();

            if ("".Equals(strTimeEnd))
            {
                strMsgError += "结束时间不能为空!";
            }
            if (!HelperUtility.isDateType(strTimeEnd))
            {
                strMsgError += "结束时间格式不正确!";
            }
            if (Convert.ToDateTime(strTimeEnd) <= Convert.ToDateTime(strTimeStart))
            {
                strMsgError += "结束时间不能早于开始时间!";
            }
            string strNameSign = tbNameSign.Text.Trim();

            if ("".Equals(strNameSign))
            {
                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 = Convert.ToInt32(ViewState["AdminId"]);
            ModelInventoryContract model = new ModelInventoryContract();

            model.id_admin   = intAdminId;
            model.name_sign  = strNameSign;
            model.photo_urls = strPhotoUrls;
            model.comment    = strComment;
            model.time_start = Convert.ToDateTime(strTimeStart);
            model.time_end   = Convert.ToDateTime(strTimeEnd);
            int intContractId = BllInventoryContract.add(model);

            if (intContractId <= 0)
            {
                HelperUtility.showAlert("添加失败,请联系管理员!", "add.aspx");
            }
            // 盘点单表添加完成后,在盘点物品表里添加所有库存量大于0的货品记录
            BllInventoryRecord.setInventoryRecord(intContractId);
            HelperUtility.showAlert("添加成功!", "list.aspx");
        }