基本信息
源码名称:<推荐>asp.net 网上商城源码(vs2013,含数据库)
源码大小:8.78M
文件格式:.zip
开发语言:ASP
更新时间:2016-12-22
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍
MyShop源码

本系统采用三层结构开发,数据库为MSSQL或ACCESS,可由用户自行选择。 数据库 在 web/DB目录下


MyShop源码

本系统采用三层结构开发,数据库为MSSQL或ACCESS,可由用户自行选择。
由于时间关系,部分功能尚未完成。如有志同道合者愿意一起完成,请联系本人。
本系统只作为交流学习使用,由于本人技术所限,错误恐难避免,欢迎高手批评指正。
有问题请联系作者


后台管理地址:/admin/login.aspx,默认帐号密码均为:51aspx

修改web.config设置

  <appSettings>
    <!--修改此处调用不同的数据库
     SQL:  MyShop.SQLServerDAL
     Access: MyShop.AccessDAL
    -->
<add key="WebDAL" value="MyShop.SQLServerDAL"/>

说明:如果调用ACCESS数据库,则并将"MyShop.SQLServerDAL"改为"MyShop.AccessDAL"。

  </appSettings>  
  
<connectionStrings>
   <!--此处修改数据库的路径
    -->
<add name="MyShopSQLConnectionString" connectionString="Data Source=(local);Initial Catalog=MyShop;User ID=sa;Password=sa" providerName="System.Data.SqlClient"/>
    <add name="MyShopAccessConnectionString" connectionString="Provider=Microsoft.Jet.OleDb.4.0;Data Source=E:\MyShop\web\DB_51aspx.com\MyShop.mdb;Persist Security Info=True;" providerName="System.Data.OleDb"/>
  </connectionStrings>  





using System;
using System.Collections.Generic;

using System.Data;


using MyShop.DALFactory;
using MyShop.IDAL;
using MyShop.Model;

namespace MyShop.BLL
{
    public class Order
    {
        private IOrder dal = DataAccess.CreateOrder();
        
        #region IOrder


        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns>返回刚插入的记录的orderId</returns>
        public int Add(OrderInfo model)
        {
            if (model == null)
            {
                return -1;
            }
            return dal.Add(model);
        }

        public int Delete(string filter)
        {
            if (string.IsNullOrEmpty(filter))
                return 0;
            return dal.Delete(filter);
        }

        public bool Exist(string filter)
        {
            filter = filter.Trim();
            if (string.IsNullOrEmpty(filter))
                return false;
            return dal.Exist(filter);
        }
        public DataSet GetDataSet()
        {
            return dal.GetDataSet();
        }

        public DataSet GetDataSet(string filter)
        {
            filter = filter.Trim();
            if (string.IsNullOrEmpty(filter))
                return null;
            return dal.GetDataSet(filter);
        }

        public OrderInfo GetModel(DataRow dr)
        {
            if (dr == null)
                return null;
            return dal.GetModel(dr);
        }

        private DataSet Query(string sql)
        {
            sql = sql.Trim();
            if (string.IsNullOrEmpty(sql))
                return null;
            return dal.Query(sql);
        }

        public int Update(OrderInfo model, string filter)
        {            
            if (model == null)
                return 0;
            filter = filter.Trim();
            if (string.IsNullOrEmpty(filter))
                return 0;
            return dal.Update(model, filter);
        }

        #endregion

        #region common

        public int Add(OrderInfo model, out string msg)
        {
            msg = "";
            if (model == null)
            {
                msg = "<li>数据不能为空</li>";
                return -1;
            }
            return Add(model);
        }

        public int Delete(int orderId)
        {
            if ( string.IsNullOrEmpty( orderId.ToString()) )
                return 0;
            string filer;
            filer = " orderId ="   orderId;
            return Delete(filer);
        }
        public int Update(OrderInfo model)
        {

            if (model == null)
            {
                return 0;
            }
            string filter;
            filter = " orderId="   model.orderId;
            return Update(model, filter);
        }

        public OrderInfo GetModel(int orderId)
        {
            DataSet dataset = new DataSet();
            dataset = GetDataSet(" orderId="   orderId);
            if (dataset != null && dataset.Tables[0].Rows.Count > 0)
                return GetModel(dataset.Tables[0].Rows[0]);
            return null;

        }



        #endregion  
  
        public DataSet GetDataSet(int userId)
        {
            string filter = "";
            if (userId == -1)
                return null;
            filter = " [clientId]= "   userId;
            return dal.GetDataSet(filter);
        }
        public DataSet GetDataSetByOrderNum(string orderNum)
        {
            if (orderNum == string.Empty)
                return null;
            string filter;
            filter = " [orderNum]='"   orderNum   "'";
            return dal.GetDataSet(" orderNum='"   orderNum   "'");
        }
        public OrderInfo GetModel(string orderNum)
        {
            if ( string.IsNullOrEmpty( orderNum ))
                return null;
            if (GetDataSetByOrderNum(orderNum).Tables[0].Rows.Count == 0)
                return null;
            return GetModel(GetDataSetByOrderNum(orderNum).Tables[0].Rows[0]);  
        }

        /// <summary>
        /// 是否已付清
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public bool IsPaid(int orderId)
        {
            OrderInfo model = new OrderInfo();
            Order order = new Order();
            model = order.GetModel(orderId);
            if (model == null)
                return true; //订单号码错误,直接返回true
            if (model.status == 3 || model.moneyTotal == model.MoneyReceipt )
                return true;
            else
                return false;
        }

        /// <summary>
        /// 是否已付清
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public bool IsPaid(string orderNum)
        {
            OrderInfo model = new OrderInfo();
            Order order = new Order();
            model = order.GetModel(orderNum);
            if (model == null)
                return true; //订单号码错误,直接返回true
            if (model.status == 3 || model.moneyTotal == model.MoneyReceipt)
                return true;
            else
                return false;
        }

        #region SearchOrder
        /// <summary>
        /// 快速搜索
        /// </summary>
        /// <param name="searchType"></param>
        /// <returns></returns>
        public DataSet QuickSearch(int searchType)
        {
            return dal.QuickSearch(searchType);

        }

        /// <summary>
        /// 高级查询
        /// </summary>
        /// <param name="field"></param>
        /// <param name="keywords"></param>
        /// <returns></returns>
        public DataSet KeywordsSearch(string field, string keywords)
        {
            field = Utils.ReplaceBadSQL(field.Trim());
            keywords = Utils.ReplaceBadSQL(keywords.Trim());
            if (string.IsNullOrEmpty(field) || string.IsNullOrEmpty(keywords))
                return null;
            return dal.KeywordsSearch( field, keywords);
        }

        #endregion

        public DataSet GetDataSetByProductId(int productId)
        {
            if(string.IsNullOrEmpty(productId.ToString()))
                return null;
            return GetDataSet(" productId ="   productId);
        }

        public DataSet GetDataSetByOrderId(int orderId)
        {
            DataSet dataset = new DataSet();
            dataset = GetDataSet(" orderId="   orderId);
            return dataset;
        }

        #region 

        public int DeleteOrderByOrderId(int orderId)
        {
            return dal.DeleteOrderByOrderId(orderId);
        }

        /// <summary>
        /// 当订单结清时,赠送相应会员购物积分
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public int AddUserExp(int orderId)
        {
            return dal.AddUserExp(orderId);
        }

        public DataSet GetDataSetOrderByDate()
        {
           return dal.GetDataSetOrderByDate();
        }
        #endregion


        /// <summary>
        /// 获取今日订单
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public  DataSet GetTodayOrder(int userId)
        {

            return dal.GetTodayOrder(userId);
        }

    }
}