Пример #1
0
        public int Update(SOAlipayInfo oParam)
        {
            string sql = @"UPDATE SO_Alipay SET
                            SOSysNo=@SOSysNo, AlipayTradeNo=@AlipayTradeNo
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int, 4);
            SqlParameter paramAlipayTradeNo = new SqlParameter("@AlipayTradeNo", SqlDbType.NVarChar, 50);

            if (oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if (oParam.SOSysNo != AppConst.IntNull)
                paramSOSysNo.Value = oParam.SOSysNo;
            else
                paramSOSysNo.Value = System.DBNull.Value;
            if (oParam.AlipayTradeNo != AppConst.StringNull)
                paramAlipayTradeNo.Value = oParam.AlipayTradeNo;
            else
                paramAlipayTradeNo.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramSOSysNo);
            cmd.Parameters.Add(paramAlipayTradeNo);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Пример #2
0
        public int Insert(SOAlipayInfo oParam)
        {
            string sql = @"INSERT INTO SO_Alipay
                            (
                            SOSysNo, AlipayTradeNo
                            )
                            VALUES (
                            @SOSysNo, @AlipayTradeNo
                            );set @SysNo = SCOPE_IDENTITY();";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramSOSysNo = new SqlParameter("@SOSysNo", SqlDbType.Int, 4);
            SqlParameter paramAlipayTradeNo = new SqlParameter("@AlipayTradeNo", SqlDbType.NVarChar, 50);
            paramSysNo.Direction = ParameterDirection.Output;
            if (oParam.SOSysNo != AppConst.IntNull)
                paramSOSysNo.Value = oParam.SOSysNo;
            else
                paramSOSysNo.Value = System.DBNull.Value;
            if (oParam.AlipayTradeNo != AppConst.StringNull)
                paramAlipayTradeNo.Value = oParam.AlipayTradeNo;
            else
                paramAlipayTradeNo.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramSOSysNo);
            cmd.Parameters.Add(paramAlipayTradeNo);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }
Пример #3
0
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            if (txtTradeNo.Text != string.Empty)
            {
                int Result = 0;
                bool IsAdd = true;
                int SOSysNo = Int32.Parse(lblSOID.Text.Substring(1));
                SOAlipayInfo oInfo = SaleManager.GetInstance().LoadSOAlipay(SOSysNo);
                if (oInfo == null)
                {
                    oInfo = new SOAlipayInfo();
                    oInfo.SOSysNo = SOSysNo;
                    oInfo.AlipayTradeNo = txtTradeNo.Text.Trim();
                    Result = SaleManager.GetInstance().InsertSOAlipay(oInfo);
                    lblResult.Text = "输入支付宝交易号完成!";
                }
                else
                {
                    IsAdd = false;
                    oInfo.AlipayTradeNo = txtTradeNo.Text.Trim();
                    Result = SaleManager.GetInstance().UpdateSOAlipay(oInfo);
                    lblResult.Text = "更新支付宝交易号完成!";
                }

                if (Result == 1)
                {
                    SOInfo order = SaleManager.GetInstance().LoadSOMaster(SOSysNo);
                    if (order != null)
                    {
                        if (IsAdd)
                        {
                            NetPayInfo netpay = new NetPayInfo();

                            netpay.SOSysNo = SOSysNo;
                            netpay.PayTypeSysNo = order.PayTypeSysNo;
                            netpay.InputTime = DateTime.Now;
                            netpay.Source = (int)AppEnum.NetPaySource.Bank;
                            netpay.PayAmount = order.GetTotalAmt();
                            netpay.Status = (int)AppEnum.NetPayStatus.Origin;
                            netpay.Note = "支付宝即时到帐付款";
                            NetPayManager.GetInstance().Insert(netpay);
                        }
                    }
                    lblResult.Visible = true;
                }
            }
        }
Пример #4
0
 private void map(SOAlipayInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.SOSysNo = Util.TrimIntNull(tempdr["SOSysNo"]);
     oParam.AlipayTradeNo = Util.TrimNull(tempdr["AlipayTradeNo"]);
 }
Пример #5
0
 public int UpdateSOAlipay(SOAlipayInfo oParam)
 {
     return new SOAlipayDac().Update(oParam);
 }
Пример #6
0
 public SOAlipayInfo LoadSOAlipay(int SOSysNo)
 {
     string sql = "select * from so_alipay where sosysno=" + SOSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     SOAlipayInfo oInfo = new SOAlipayInfo();
     if (Util.HasMoreRow(ds))
         map(oInfo, ds.Tables[0].Rows[0]);
     else
         oInfo = null;
     return oInfo;
 }
Пример #7
0
 public int InsertSOAlipay(SOAlipayInfo oParam)
 {
     return new SOAlipayDac().Insert(oParam);
 }