protected void ibtnDeleteAll_Click(object sender, ImageClickEventArgs e)
        {
            string delId = "";

            //先遍历取得选中项

            for (int i = 0; i < this.rpCollecting.Items.Count; i++)
            {
                CheckBox cbx = (CheckBox)(rpCollecting.Items[i].FindControl("cbx"));
                Label    lbl = (Label)rpCollecting.Items[i].FindControl("lbl");
                if (cbx != null || cbx.Text != "")
                {
                    if (cbx.Checked)
                    {
                        delId += lbl.Text + ",";
                    }
                }
            }
            //去掉最后一个,
            delId = (delId + ")").Replace(",)", "");
            IList check = delId.Split(',');

            To_ClaimManager       b_claim       = new To_ClaimManager();
            To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager();

            for (int i = 0; i < check.Count; i++)
            {
                To_Collecting to_Collecting = To_CollectingManager.getTo_CollectingById(Convert.ToInt32(check[i]));
                if (to_Collecting != null)
                {
                    To_CollectingManager.deleteTo_Collecting(Convert.ToInt32(check[i]));
                }
                string claimID = b_claim.GetID(Convert.ToInt32(check[i]));
                if (claimID != "" && b_claim.Delete(int.Parse(claimID)))
                {
                    b_claimDetail.DeleteByClaim(claimID);
                }
            }
            dataBind();
        }
        protected void rpCollecting_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int                   id            = Convert.ToInt32(e.CommandArgument);
                int                   count         = To_CollectingManager.deleteTo_Collecting(id);
                To_ClaimManager       b_claim       = new To_ClaimManager();
                To_ClaimDetailManager b_claimDetail = new To_ClaimDetailManager();

                if (count <= 0)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "page", "alert('删除失败')", true);
                    return;
                }
                string claimID = b_claim.GetID(id);
                if (claimID != "" && b_claim.Delete(int.Parse(claimID)))
                {
                    b_claimDetail.DeleteByClaim(claimID);
                }
            }
            dataBind();
        }
Пример #3
0
 /// <summary>
 /// 根据单据ID删除收款数据
 /// </summary>
 /// <param name="id">要删除的单据ID</param>
 private void DeleteCollecting(int id)
 {
     To_CollectingManager.deleteTo_Collecting(id);
     BindRpList();
 }
Пример #4
0
        protected void RpList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            //参数数组,0:单据ID,1:是否确认,2:制单员
            string[] cmdArgs = e.CommandArgument.ToString().Split(',');

            string cmdName = e.CommandName;

            //表示单据是否已确认
            bool      confirmReceipt = false;
            bool      ismaker        = false;
            LoginInfo login          = Session["login"] as LoginInfo;

            if (cmdArgs.Length > 1)
            {
                confirmReceipt = cmdArgs[1] == "1";
                ismaker        = cmdArgs[2] == login.Cname;
            }

            string msg = "";

            switch (cmdName)
            {
            case "EDIT":
                if (confirmReceipt)
                {
                    msg = "已确认单据不能修改";
                    break;
                }
                if (!ismaker)
                {
                    msg = "不是本人所做的收款单不能修改";
                    break;
                }
                if (HttpContext.Current.Request.QueryString["page"] != null)
                {
                    int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                    Server.Transfer(string.Format("CollectingEdit.aspx?pageindex=" + page + "&id={0}", cmdArgs[0]));
                }
                else
                {
                    Server.Transfer(string.Format("CollectingEdit.aspx?id={0}", cmdArgs[0]));
                }
                break;

            case "search":
                if (AspNetPager1.CurrentPageIndex > 1)
                {
                    int page = AspNetPager1.CurrentPageIndex;
                    Response.Redirect("Collecting.aspx?pageindex=" + page + "&id=" + e.CommandArgument.ToString());    //参数sqsh判断当前所跳转到预览界面的是申请还是审核
                }
                else
                {
                    Response.Redirect("Collecting.aspx?id=" + e.CommandArgument.ToString());
                }
                break;

            case "DELETE":
                if (confirmReceipt)
                {
                    msg = "已确认单据不能删除";
                    break;
                }
                if (!ismaker)
                {
                    msg = "不是本人所做的收款单不能删除";
                    break;
                }
                DeleteCollecting(int.Parse(cmdArgs[0]));
                break;

            case "CANCEL":
                To_ClaimManager claimBLL = new To_ClaimManager();
                if (claimBLL.ExitsCollecting(int.Parse(cmdArgs[0])))
                {
                    msg = "该条收款记录已被认领,不能取消确认";
                    break;
                }
                To_CollectingManager.CancelConfirm(int.Parse(cmdArgs[0]));
                BindRpList();
                break;

            case "confirm":
                To_CollectingManager.updateConfirm(cmdArgs[0], login.Cname, DateTime.Now.ToString());
                BindRpList();
                break;

            case "CHANGE":
                To_Income income  = new To_Income();
                DataTable mytable = To_CollectingManager.GetList(1, "id=" + cmdArgs[0], "id desc");
                if (mytable != null)
                {
                    income.ComeBankAccount = mytable.Rows[0]["payBankAcount"].ToString();
                    income.ComeBankId      = int.Parse(mytable.Rows[0]["payBankId"].ToString());
                    income.ComeBankName    = mytable.Rows[0]["payBank"].ToString();
                    income.ComeDate        = DateTime.Parse(mytable.Rows[0]["receiptDate"].ToString());
                    income.ComeDepart      = mytable.Rows[0]["markerDepartment"].ToString();
                    income.ComeDepartId    = int.Parse(mytable.Rows[0]["markerDepartmentID"].ToString());
                    income.ComeMoney       = double.Parse(mytable.Rows[0]["receiptAmount"].ToString());
                    income.ComeUnit        = mytable.Rows[0]["paymentUnit"].ToString();
                    income.MakeDate        = DateTime.Parse(mytable.Rows[0]["markDate"].ToString());
                    income.MakeId          = int.Parse(mytable.Rows[0]["markerID"].ToString());
                    income.MakeName        = mytable.Rows[0]["marker"].ToString();
                    income.Remark          = mytable.Rows[0]["receiptMark"].ToString() + " 由原收款单号为" + mytable.Rows[0]["receiptNum"].ToString() + "转化而来";
                    income.SKType          = "";
                    income.SKTypeId        = 0;
                    if (To_IncomeManager.Add(income) > 0)
                    {
                        msg = "该条收款记录已成功转化为其他收款";
                        To_CollectingManager.deleteTo_Collecting(int.Parse(cmdArgs[0]));    //转化完成之后对起进行删除
                    }
                }
                BindRpList();
                break;

            default:
                break;
            }

            if (msg != string.Empty)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "page", string.Format("alert('{0}');", msg), true);
            }
        }