Ejemplo n.º 1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hi.Model.PAY_PaymentAccountdtl model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 2
0
    /// <summary>
    /// 银行卡绑定、关联代理商
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //声明变量
        string AccountName = string.Empty;
        string bankcode    = string.Empty;
        string bankAddress = string.Empty;
        string bankPrivate = string.Empty;
        string bankCity    = string.Empty;
        int    Isno        = 0;
        string remark      = string.Empty;
        string county      = string.Empty; //开会所在区县
        int    BankId      = 0;            //银行Id
        int    type        = 0;            //账户类型

        //收集数据
        AccountName = this.txtDisUser.Value.Trim();//账户名称
        bankcode    = this.txtbankcode.Value.Replace(" ", "");
        bankAddress = this.txtbankAddress.Value.Trim();
        // bankPrivate = this.txtbankPrivate.Value;
        // bankCity = this.txtbankCity.Value;
        bankPrivate = this.hidProvince.Value.Trim();
        bankCity    = this.hidCity.Value.Trim();
        county      = this.hidArea.Value.Trim();
        Isno        = Convert.ToInt32(this.chkIsno.Checked == true ? 1 : 0);

        int is_no = Convert.ToInt32(this.hid_isno.Value);

        if (is_no == 1)
        {
            //Isno = 1;
            int success = new Hi.BLL.PAY_PrePayment().UpisnoBYCompID(CompID);
        }
        //else
        //{
        //    Isno = 0;
        //}
        remark = this.txtRemark.Value.Trim();
        BankId = Convert.ToInt32(this.ddlbank.Value);
        type   = Convert.ToInt32(this.ddltype.Value);

        //实例化对象实体
        Hi.Model.PAY_PaymentBank pbModel = new Hi.Model.PAY_PaymentBank();

        // Paid = Convert.ToInt32(Request.QueryString["paid"]);
        pbModel.paymentAccountID = Paid;
        pbModel.BankID           = BankId;
        pbModel.AccountName      = AccountName;
        pbModel.bankcode         = bankcode;
        pbModel.bankAddress      = bankAddress;
        pbModel.bankPrivate      = bankPrivate;
        pbModel.bankCity         = bankCity;
        pbModel.Isno             = Isno;
        pbModel.Remark           = remark;
        pbModel.CreateDate       = DateTime.Now;
        pbModel.CreateUser       = UserID;
        pbModel.dr         = 0;
        pbModel.modifyuser = UserID;
        pbModel.ts         = DateTime.Now;
        pbModel.vdef1      = county;
        pbModel.Start      = 1;

        pbModel.vdef4  = this.txtphone.InnerText;
        pbModel.vdef5  = this.txtphpcode.Value;
        pbModel.CompID = CompID;
        pbModel.type   = type;
        pbModel.vdef2  = this.SltPesontype.Value;
        pbModel.vdef3  = this.txtpesoncode.Value;
        if (KeyID > 0)
        {
            pbModel.ID = KeyID;
            bool result = new Hi.BLL.PAY_PaymentBank().Update(pbModel);

            if (result)
            {
                result = new Hi.BLL.PAY_PaymentAccountdtl().DeldtlBYpbID(KeyID);

                if (result)
                {
                    if (this.chkIsno.Checked != true)
                    {
                        #region 保存关联代理商信息


                        Hi.BLL.PAY_PaymentAccountdtl          padtlbll  = new Hi.BLL.PAY_PaymentAccountdtl();
                        List <Hi.Model.PAY_PaymentAccountdtl> padtlList = new List <Hi.Model.PAY_PaymentAccountdtl>();
                        DataTable dt = ViewState["Distributor"] as DataTable;
                        foreach (DataRow dr in dt.Rows)
                        {
                            string lblDisId = Convert.ToString(dr["ID"]);//代理商ID


                            Hi.Model.PAY_PaymentAccountdtl padtl = new Hi.Model.PAY_PaymentAccountdtl();
                            //    Label lblDisId = (Label)gvRow.FindControl("lblGoodsId");//代理商ID
                            //    Label lblDisName = (Label)gvRow.FindControl("lblDisName");
                            //    Label lblDisCode = (Label)gvRow.FindControl("lblDisCode");
                            //    Label lblAreaID = (Label)gvRow.FindControl("lblAreaID");
                            //    Label lblDisLevel = (Label)gvRow.FindControl("lblDisLevel");
                            //    Label lblAddress = (Label)gvRow.FindControl("lblAddress");
                            //    Label lblPrincipal = (Label)gvRow.FindControl("lblPrincipal");

                            padtl.DisID      = Convert.ToInt32(lblDisId); //代理商ID
                            padtl.PBID       = KeyID;                     //银行表ID
                            padtl.CreateDate = DateTime.Now;
                            padtl.CreateUser = UserID;
                            padtl.ts         = DateTime.Now;
                            padtl.dr         = 0;
                            padtl.modifyuser = UserID;
                            padtl.Start      = 0;

                            padtlList.Add(padtl);//插入到list集合中
                        }

                        padtlbll.Add(padtlList);
                        #endregion
                    }

                    //判断代理商是否有默认账户
                    int num = new Hi.BLL.PAY_PrePayment().GetBankBYCompID(CompID);

                    if (Request["nextstep"] + "" == "1")
                    {
                        if (num == 0)
                        {
                            JScript.AlertMethod(this, "一个企业,最好有一个,默认第一收款账户,请检查!", JScript.IconOption.错误, "function (){ location.href='" + ("PayBankAuditInfo.aspx?nextstep=1&paid=" + Paid + "&KeyID=" + KeyID) + "'; }");
                        }
                        else
                        {
                            Response.Redirect("PayBankAuditInfo.aspx?nextstep=1&paid=" + Paid + "&KeyID=" + KeyID);
                        }
                    }
                    else
                    {
                        if (num == 0)
                        {
                            JScript.AlertMethod(this, "一个企业,最好有一个,默认第一收款账户,请检查!", JScript.IconOption.错误, "function (){ location.href='" + ("PayBankAuditInfo.aspx?paid=" + Paid + "&KeyID=" + KeyID) + "'; }");
                        }
                        else
                        {
                            Response.Redirect("PayBankAuditInfo.aspx?paid=" + Paid + "&KeyID=" + KeyID);
                        }
                        //JScript.AlertMsg(this, "操作成功!", "PayBankAuditInfo.aspx?paid=" + Paid + "&KeyID=" + KeyID);
                    }
                }
            }
        }
        else
        {
            int succes = new Hi.BLL.PAY_PaymentBank().Add(pbModel);
            if (succes > 0)//银行账户保存成功后,进行绑定代理商操作
            {
                if (this.chkIsno.Checked != true)
                {
                    #region 保存关联代理商信息


                    Hi.BLL.PAY_PaymentAccountdtl          padtlbll  = new Hi.BLL.PAY_PaymentAccountdtl();
                    List <Hi.Model.PAY_PaymentAccountdtl> padtlList = new List <Hi.Model.PAY_PaymentAccountdtl>();
                    DataTable dt = ViewState["Distributor"] as DataTable;
                    foreach (DataRow dr in dt.Rows)
                    {
                        string lblDisId = Convert.ToString(dr["ID"]);//代理商ID
                        //Label lblDisName = (Label)gvRow.FindControl("lblDisName");
                        //Label lblDisCode = (Label)gvRow.FindControl("lblDisCode");
                        //Label lblAreaID = (Label)gvRow.FindControl("lblAreaID");
                        //Label lblDisLevel = (Label)gvRow.FindControl("lblDisLevel");
                        //Label lblAddress = (Label)gvRow.FindControl("lblAddress");
                        //Label lblPrincipal = (Label)gvRow.FindControl("lblPrincipal");

                        Hi.Model.PAY_PaymentAccountdtl padtl = new Hi.Model.PAY_PaymentAccountdtl();
                        padtl.DisID      = Convert.ToInt32(lblDisId); //代理商ID
                        padtl.PBID       = succes;                    //银行表ID
                        padtl.CreateDate = DateTime.Now;
                        padtl.CreateUser = UserID;
                        padtl.ts         = DateTime.Now;
                        padtl.dr         = 0;
                        padtl.modifyuser = UserID;
                        padtl.Start      = 0;

                        padtlList.Add(padtl);//插入到list集合中
                    }

                    padtlbll.Add(padtlList);

                    #endregion
                }
                // JScript.AlertMsg(this, "操作成功!", "PAbankInfo.aspx?paid=" + Paid + "&KeyID=" + succes);
                // ClientScript.RegisterStartupScript(this.GetType(), "add", "<script>activeName(); window.location.href ='PAbankInfo.aspx?paid=" + Paid + "&KeyID=" + succes+"';</script>");
                //判断代理商是否有默认账户
                int num = new Hi.BLL.PAY_PrePayment().GetBankBYCompID(CompID);

                if (Request["nextstep"] + "" == "1")
                {
                    if (num == 0)
                    {
                        JScript.AlertMethod(this, "一个企业,最好有一个,默认第一收款账户,请检查!", JScript.IconOption.错误, "function (){ location.href='" + ("PayBankAuditInfo.aspx?nextstep=1&paid=" + Paid + "&KeyID=" + succes) + "'; }");
                    }
                    else
                    {
                        Response.Redirect("PayBankAuditInfo.aspx?nextstep=1&paid=" + Paid + "&KeyID=" + succes);
                    }
                }
                else
                {
                    if (num == 0)
                    {
                        JScript.AlertMethod(this, "一个企业,最好有一个,默认第一收款账户,请检查!", JScript.IconOption.错误, "function (){ location.href='" + ("PayBankAuditInfo.aspx?paid=" + Paid + "&KeyID=" + succes) + "'; }");
                    }
                    else
                    {
                        Response.Redirect("PayBankAuditInfo.aspx?paid=" + Paid + "&KeyID=" + succes);
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hi.Model.PAY_PaymentAccountdtl model)
 {
     return(dal.Add(model));
 }