示例#1
0
        //作废单据
        protected void imgbtn_Delete_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            var linkTradeId  = ((ImageButton)sender).CommandName;
            var documentReds = _documentRedDao.GetDocumentRedInfoByLinkTradeId(new Guid(linkTradeId));

            if (documentReds == null || documentReds.Count == 0)
            {
                MessageBox.Show(this, string.Format("获取关联红冲单据列表失败!"));
                return;
            }
            var current = documentReds.FirstOrDefault(act => act.DocumentType != (int)DocumentType.RedDocument);

            if (current == null)
            {
                MessageBox.Show(this, string.Format("对应的红冲单据不存在!"));
                return;
            }
            if (_companyFundReceipt.IsExistsByStockOrderNos(current.LinkTradeCode, ""))
            {
                MessageBox.Show(this, string.Format("对应的单据已生成收付款单据,不能删除!"));
                return;
            }

            using (var ts = new TransactionScope(TransactionScopeOption.Required))
            {
                foreach (var documentRedInfo in documentReds)
                {
                    _documentRedDao.DelDocumentRedDetailByRedId(documentRedInfo.RedId);
                    _documentRedDao.DelDocumentRedByRedId(documentRedInfo.RedId);
                }
                ts.Complete();
            }
            Rgd_DocumentRed.Rebind();
        }
示例#2
0
 //查询
 protected void btn_Search_Click(object sender, EventArgs e)
 {
     GridDataBind();
     Rgd_DocumentRed.DataBind();
 }