DAL/Service.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;
using System.Data;

namespace DAL
{
    public class Service
    {
        //public bool UpdateT(OrderInfo o)
        //{
        //    string sql = string.Format("update [dbo].[Order] set checkeds='审核通过' where OrderID={0}", o.OrderID);
        //    return DBHelper.ExecuteNonQuery(sql);
        //}
        public DataTable GetByP(ProductInfo p)
        {
            string sql = string.Format("select ProductName,ProductID,ProductPrice,count from Product where ProductID='{0}'",p.ProductID);
            return DBHelper.GetDataTable(sql);
        }
        public bool AddP(ProductInfo p)
        {
            string sql = string.Format("insert into Product(ProductName,ProductDesc,ProductPrice,ProductPic,count,ClassID) values('{0}','{1}',{2},'{3}',{4},{5})",p.ProductName,p.ProductDesc,p.ProductPrice,p.ProductPic,p.Count,p.ClassID);
            return DBHelper.ExecuteNonQuery(sql);
        } 
        public DataTable GetPC(ProductClass pc)
        {
            string sql=string.Format("select ClassName from ProductClass where ClassID='{0}'",pc.ClassID);
            return DBHelper.GetDataTable(sql);
        }
        public bool UpdateMinusP(ProductInfo p)
        {
            string sql = string.Format("update Product set count-=1,Sprice-=ProductPrice where ProductID='{0}'", p.ProductID);
            return DBHelper.ExecuteNonQuery(sql);
        }
        public bool UpdateAddP(ProductInfo p)
        {
            string sql = string.Format("update Product set count+=1,Sprice+=ProductPrice where ProductID='{0}'", p.ProductID);
            return DBHelper.ExecuteNonQuery(sql);
        }
        public DataTable GetByIDP(ProductInfo p)
        {
            string sql = string.Format("select*from Product where ProductID='{0}'", p.ProductID);
            return DBHelper.GetDataTable(sql);
        }
        public UserInfo LoginCheck(string username, string pwd)
        {
            string sql = string.Format("select * from UserInfo where Username='{0}' and UserPwd='{1}'", username, pwd);
            DataTable dt = DBHelper.GetDataTable(sql);
            UserInfo user = new UserInfo();
            try
            {
                user.Email = dt.Rows[0]["Email"].ToString();
                user.Phone = dt.Rows[0]["Phone"].ToString();
                user.Userid = int.Parse(dt.Rows[0]["Userid"].ToString());
                user.Username = dt.Rows[0]["Username"].ToString();
                user.UserPwd = dt.Rows[0]["UserPwd"].ToString();
            }
后面还有 129 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。