Exemplo n.º 1
0
        /// <summary>
        ///[To_PaymentReturn]表查询实体的方法
        /// </summary>
        public static To_PaymentReturn getTo_PaymentReturnById(int id)
        {
            To_PaymentReturn to_paymentreturn = null;

            string sql = "select * from To_PaymentReturn where id=@id";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@id", id)
            };
            DataTable dt = DBHelper.GetDataSet(sql, sp);

            if (dt.Rows.Count > 0)
            {
                to_paymentreturn = new To_PaymentReturn();
                foreach (DataRow dr in dt.Rows)
                {
                    to_paymentreturn.Id           = Convert.ToInt32(dr["id"]);
                    to_paymentreturn.PaymentID    = Convert.ToString(dr["paymentID"]);
                    to_paymentreturn.orderRetID   = Convert.ToInt32(dr["orderRetID"]);
                    to_paymentreturn.OrderNum     = Convert.ToString(dr["orderNum"]);
                    to_paymentreturn.ShouldReturn = Convert.ToDouble(dr["shouldReturn"]);
                    to_paymentreturn.ReturnAmount = Convert.ToDouble(dr["returnAmount"]);
                }
            }

            return(to_paymentreturn);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 保存退款信息
        /// </summary>
        /// <param name="paymentId"></param>
        private void SavePaymentReturn(string paymentId)
        {
            IList <string>   returnIDs     = new List <string>();
            To_PaymentReturn paymentReturn = new To_PaymentReturn();

            paymentReturn.PaymentID = paymentId;
            if (hidPayReturn.Value.Trim().TrimEnd('@') != string.Empty)
            {
                IEnumerable <string> returnList = hidPayReturn.Value.Trim().TrimEnd('@').Split('@').Where(x => x.Trim() != string.Empty);
                if (returnList.Count() > 0)
                {
                    foreach (string list in returnList)
                    {
                        string[] item = list.Split('$');
                        paymentReturn.orderRetID = int.Parse(item[0].Trim()); //订单退款信息明细表id
                        if (!returnIDs.Contains(item[0].Trim()))
                        {
                            returnIDs.Add(item[0].Trim());
                        }
                        paymentReturn.OrderNum     = item[1].Trim();               //订单编号
                        paymentReturn.ShouldReturn = double.Parse(item[2].Trim()); //应退金额
                        paymentReturn.ReturnAmount = double.Parse(item[3].Trim()); //本次退付金额

                        To_PaymentReturnManager.addTo_PaymentReturn(paymentReturn);
                    }
                }

                for (int i = 0; i < returnIDs.Count; i++)
                {
                    if (returnIDs[i] != "")
                    {
                        double hasAmount    = To_PaymentReturnManager.GetHasAmount(returnIDs[i]);                                   //得到该退款信息明细表关联的所有退过款的金额
                        double shouldAmount = To_OrderRefunDetialManager.getTo_OrderRefunDetialById(int.Parse(returnIDs[i])).Money; //得到应退金额
                        string getstatus    = "";
                        if (hasAmount == 0)
                        {
                            getstatus = "未退款";
                        }
                        else if (shouldAmount > hasAmount)
                        {
                            getstatus = "部分退款";
                        }
                        else
                        {
                            getstatus = "完成退款";
                        }

                        To_OrderRefunDetialManager.updateDetialStatusAndMoney(returnIDs[i], getstatus, hasAmount.ToString());
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///[To_PaymentReturn]表添加的方法
        /// </summary>
        public static int addTo_PaymentReturn(To_PaymentReturn to_paymentreturn)
        {
            string sql = "insert into To_PaymentReturn([paymentID],[orderRetID],[orderNum],[shouldReturn],[returnAmount]) values (@paymentID,@orderRetID,@orderNum,@shouldReturn,@returnAmount)";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@paymentID", to_paymentreturn.PaymentID),
                new SqlParameter("@orderRetID", to_paymentreturn.orderRetID),
                new SqlParameter("@orderNum", to_paymentreturn.OrderNum),
                new SqlParameter("@shouldReturn", to_paymentreturn.ShouldReturn),
                new SqlParameter("@returnAmount", to_paymentreturn.ReturnAmount)
            };
            return(DBHelper.ExecuteCommand(sql, sp));
        }
Exemplo n.º 4
0
        /// <summary>
        ///[To_PaymentReturn]表修改的方法
        /// </summary>
        public static int updateTo_PaymentReturnById(To_PaymentReturn to_paymentreturn)
        {
            string sql = "update To_PaymentReturn set paymentID=@paymentID,orderRetID=@orderRetID,orderNum=@orderNum,shouldReturn=@shouldReturn,returnAmount=@returnAmount where id=@id";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@id", to_paymentreturn.Id),
                new SqlParameter("@paymentID", to_paymentreturn.PaymentID),
                new SqlParameter("@orderRetID", to_paymentreturn.orderRetID),
                new SqlParameter("@orderNum", to_paymentreturn.OrderNum),
                new SqlParameter("@shouldReturn", to_paymentreturn.ShouldReturn),
                new SqlParameter("@returnAmount", to_paymentreturn.ReturnAmount)
            };
            return(DBHelper.ExecuteCommand(sql, sp));
        }
Exemplo n.º 5
0
        /// <summary>
        ///根据SQL语句获取实体
        /// </summary>
        public static To_PaymentReturn getTo_PaymentReturnBySql(string sql)
        {
            To_PaymentReturn to_paymentreturn = null;
            DataTable        dt = DBHelper.GetDataSet(sql);

            if (dt.Rows.Count > 0)
            {
                to_paymentreturn = new To_PaymentReturn();
                foreach (DataRow dr in dt.Rows)
                {
                    to_paymentreturn.Id           = Convert.ToInt32(dr["id"]);
                    to_paymentreturn.PaymentID    = Convert.ToString(dr["paymentID"]);
                    to_paymentreturn.orderRetID   = Convert.ToInt32(dr["orderRetID"]);
                    to_paymentreturn.OrderNum     = Convert.ToString(dr["orderNum"]);
                    to_paymentreturn.ShouldReturn = Convert.ToDouble(dr["shouldReturn"]);
                    to_paymentreturn.ReturnAmount = Convert.ToDouble(dr["returnAmount"]);
                }
            }
            return(to_paymentreturn);
        }
Exemplo n.º 6
0
 public static int updateTo_PaymentReturn(To_PaymentReturn to_paymentreturn)
 {
     return(To_PaymentReturnService.updateTo_PaymentReturnById(to_paymentreturn));
 }
Exemplo n.º 7
0
 public static int addTo_PaymentReturn(To_PaymentReturn to_paymentreturn)
 {
     return(To_PaymentReturnService.addTo_PaymentReturn(to_paymentreturn));
 }