点击回欢乐生肖官方网站APP下载
我的浏览记录 | | 帮助?
当前位置:
欢乐生肖官方网站APP下载>> 电子商务>> AD新秀商城源码>> 源文件浏览
[商业版 500金币] WebForm,下载次数:12 次 | 关键字: 新秀商城 商城 支付 微信

源码截图

源码目录树

当前路径:Lk.ProductShow.DAL/OrderInfo.cs     using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data;
using System.Collections.Generic;
namespace LK.ProductShow.DAL
{
	/// <summary>
	/// 数据访问类:OrderInfo
	/// </summary>
	public partial class OrderInfo
	{
        public string sqlConnectionString = LK.ProductShow.SqlConn.SqlConn.SqlConnectionString();

		public OrderInfo()
		{}
		#region  BasicMethod


        /// <summary>
        /// 提交订单
        /// </summary>
        /// <param name="orderDetailInfoList"></param>
        /// <param name="orderInfo"></param>
        /// <returns></returns>
        public bool AddOrder(List<Model.OrderDetailInfo> orderDetailInfoList, LK.ProductShow.Model.OrderInfo orderInfo)
        {
            LK.ProductShow.DAL.OrderDetailInfo orderDetailInfoDal = new OrderDetailInfo();
            Model.OrderDetailInfo orderDetailInfo = new Model.OrderDetailInfo();

            using (SqlConnection con = new SqlConnection(sqlConnectionString))
            {
                con.Open();
                SqlTransaction tran = con.BeginTransaction();
                try
                {
                    if (tran == null)
                    {
                        throw new Exception("Transaction is null");
                    }

                    Add(orderInfo,tran);

                    for (int i = 0; i < orderDetailInfoList.Count; i++)
                    {
                        //orderDetailInfo.OrderID = orderInfo.OrderID;
                        orderDetailInfo.OrderNo = orderInfo.OrderNo;
                        orderDetailInfo.GoodsID = orderDetailInfoList[i].GoodsID;
                        orderDetailInfo.GoodsNum = orderDetailInfoList[i].GoodsNum;
                        orderDetailInfo.GoodsPrices = orderDetailInfoList[i].GoodsPrices;
                        if (orderDetailInfoDal.Add(orderDetailInfo, tran).ToString()=="0")
                        {
                            throw new Exception("GoodsOrder Err");
                        }
                    }
                    tran.Commit();
                    return true;
                }
                catch
                {
                    tran.Rollback();
                    return false;
                }
                finally
                {
                    tran.Dispose();
                }
            }
        }


		/// <summary>
		/// 得到最大ID
		/// </summary>
		public int GetMaxId()
		{
        return new GetMaxID().GetID("OrderID", "LK_OrderInfo"); 
		}

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(int OrderID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from LK_OrderInfo");
			strSql.Append(" where OrderID=@OrderID");
			SqlParameter[] parameters = {
					new SqlParameter("@OrderID", SqlDbType.Int,4)
			};
			parameters[0].Value = OrderID;

            object o = SqlHelper.ExecuteScalar(sqlConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (o != null)
            {
                if (Convert.ToInt32(o) > 0)
                {
                    return true;
                }
                return false;
            }
            else
            {
                return false;
            }
		}





		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(LK.ProductShow.Model.OrderInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into LK_OrderInfo(");
			strSql.Append("OrderNo,OrderDate,OrderMoney,OrderType,OrderState,SupermarketID,SiteID,UserID)");
			strSql.Append(" values (");
			strSql.Append("@OrderNo,@OrderDate,@OrderMoney,@OrderType,@OrderState,@SupermarketID,@SiteID,@UserID)");
			strSql.Append(";select @@IDENTITY");
			SqlParameter[] parameters = {
					new SqlParameter("@OrderNo", SqlDbType.NVarChar,50),
					new SqlParameter("@OrderDate", SqlDbType.DateTime),
					new SqlParameter("@OrderMoney", SqlDbType.Money,8),
					new SqlParameter("@OrderType", SqlDbType.Int,4),
					new SqlParameter("@OrderState", SqlDbType.Int,4),
					new SqlParameter("@SupermarketID", SqlDbType.Int,4),
					new SqlParameter("@Si...
对不起,完整源码文件,请先购买后再查看
| | | |
联系电话(Tel):4008-010-151(免长途)
地址:北京市海淀区中关村鼎好大厦A座二层 邮编:100080
Room A-801,Dinghao Building,Zhongguancun,Beijing,China,100080
版权所有 CopyRight © 2006-2015. | 京公网安备11010702000869号
分享该页面
关闭侧边栏
欢乐生肖游戏APP 欢乐生肖游戏APP 欢乐生肖游戏APP 欢乐生肖APP 欢乐生肖官方网站APP下载 欢乐生肖APP注册网址 欢乐生肖游戏 手机版欢乐生肖APP下载 欢乐生肖游戏 欢乐生肖APP