예제 #1
0
        /// <summary>
        /// 获取待处理的订单
        /// </summary>
        /// <param name="orderId">订单号</param>
        /// <returns></returns>
        public IList <CashGetModel> GetListDataTable()
        {
            using (DbOperHandler dbOperHandler = new ComData().Doh())
            {
                IList <CashGetModel> records  = new List <CashGetModel>();
                StringBuilder        sql      = new StringBuilder("INSERT INTO N_UserGetCashHistory(SsId, UserId, UserName) VALUES");
                StringBuilder        sqlValue = new StringBuilder();

                dbOperHandler.Reset();
                dbOperHandler.SqlCmd = "select A.SsId, A.UserId, B.UserName, A.PayBank, A.PayAccount, A.PayName, A.Money, A.Msg from N_UserGetCash A INNER JOIN N_USER B ON A.UserId=B.Id where state=0 and not exists(SELECT 1 FROM N_UserGetCashHistory WHERE SsId = A.SsId)";
                DataTable table = dbOperHandler.GetDataTable();

                if (table != null && table.Rows.Count > 0)
                {
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        if (table.Rows[i]["Money"] != null)
                        {
                            sqlValue.Append(String.Format("('{0}', {1}, '{2}')", table.Rows[i]["SsId"].ToString(), table.Rows[i]["UserId"].ToString(), table.Rows[i]["UserName"].ToString()));

                            if (i < table.Rows.Count - 1)
                            {
                                sqlValue.Append(",");
                            }

                            records.Add(new CashGetModel()
                            {
                                SsId       = table.Rows[i]["SsId"].ToString(),
                                UserName   = table.Rows[i]["UserName"].ToString(),
                                PayBank    = table.Rows[i]["PayBank"].ToString(),
                                PayAccount = table.Rows[i]["PayAccount"].ToString(),
                                PayName    = table.Rows[i]["PayName"].ToString(),
                                Money      = Convert.ToDecimal(table.Rows[i]["Money"]),
                                Msg        = table.Rows[i]["Msg"].ToString()
                            });
                        }
                    }
                }

                if (records.Count > 0)
                {
                    dbOperHandler.Reset();
                    sql.Append(sqlValue.ToString());
                    dbOperHandler.ExecuteSql(sql.ToString());
                }

                return(records);
            }
        }