Exemple #1
0
    protected void SaveTarget()
    {
        this.UpdateTargetTable();
        List <PaymentTargetModel> list = new List <PaymentTargetModel>();

        for (int i = 0; i < this.gvBudget.Rows.Count; i++)
        {
            PaymentTargetModel paymentTargetModel = new PaymentTargetModel();
            paymentTargetModel.Id          = Guid.NewGuid().ToString();
            paymentTargetModel.ConTargetId = this.gvBudget.DataKeys[i].Value.ToString();
            paymentTargetModel.PaymentId   = this.hfldPaymentId.Value;
            string value = ((HtmlInputText)this.gvBudget.Rows[i].FindControl("txtTheMoney")).Value;
            if (!string.IsNullOrEmpty(value))
            {
                paymentTargetModel.PaymentAmount = Convert.ToDecimal(value);
            }
            else
            {
                paymentTargetModel.PaymentAmount = 0m;
            }
            paymentTargetModel.InputDate = DateTime.Now;
            paymentTargetModel.InputUser = base.UserCode;
            list.Add(paymentTargetModel);
        }
        PaymentTarget paymentTarget = new PaymentTarget();

        paymentTarget.Add(list, this.hfldPaymentId.Value);
    }
Exemple #2
0
        private void Add(SqlTransaction trans, PaymentTargetModel model)
        {
            string cmdText = "INSERT INTO Con_Payout_PaymentTarget VALUES(@TargetId,@PaymentId,@ContTargetId,@PaymentAmount,@InputUser,@InputDate)";

            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@TargetId", model.Id), new SqlParameter("@PaymentId", model.PaymentId), new SqlParameter("@ContTargetId", model.ConTargetId), new SqlParameter("@PaymentAmount", model.PaymentAmount), new SqlParameter("@InputUser", model.InputUser), new SqlParameter("@InputDate", model.InputDate) };
            if (trans == null)
            {
                SqlHelper.ExecuteNonQuery(CommandType.Text, cmdText, commandParameters);
            }
            else
            {
                SqlHelper.ExecuteNonQuery(trans, CommandType.Text, cmdText, commandParameters);
            }
        }