ZSJ_BCY_Web_DAL/ConsumptionForeignService.cs

(开头部分) 5KB

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

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using ZSJ_BCY_Web_Model;

namespace ZSJ_BCY_Web_DAL
{
    public class ConsumptionForeignService
    {
        /// <summary>
        /// 多表查询  消费表
        /// </summary>
        /// <returns></returns>
        public static List<ConsumptionForeign> Select(InquireCondition ic)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(@"select Consumption.Id,Customer.CustomerName,Goods.GoodsName,Project.ProjectName,
            Room.RoomName,Consumption.ConsumptionTime,Consumption.ConsumptionSum,Consumption.ConsumptionStatus 
            from Consumption,Customer,Goods,Project,Room where Consumption.CustomerId=Customer.Id and 
            Consumption.GoodsId=Goods.Id and Consumption.ProjectId=Project.Id and Consumption.RoomId=Room.Id ");


            //string sql = @"select Consumption.Id,Customer.CustomerName,Goods.GoodsName,Project.ProjectName,
            //Room.RoomName,Consumption.ConsumptionTime,Consumption.ConsumptionSum,Consumption.ConsumptionStatus 
            //from Consumption,Customer,Goods,Project,Room where Consumption.CustomerId=Customer.Id and 
            //Consumption.GoodsId=Goods.Id and Consumption.ProjectId=Project.Id and Consumption.RoomId=Room.Id";

            List<string> listString = new List<string>();
            List<SqlParameter> listpame = new List<SqlParameter>();
                                                                                                                                                                                                
            if (!string.IsNullOrWhiteSpace(ic.CustomerName))
            {
                listString.Add("Customer.CustomerName like @CustomerName");
                listpame.Add(new SqlParameter("@CustomerName","%"+ic.CustomerName+"%"));
            }

            if (ic.ConsumptionStatus>-1)
            {
                listString.Add("Consumption.ConsumptionStatus= @ConsumptionStatus");
                listpame.Add(new SqlParameter("@ConsumptionStatus", ic.ConsumptionStatus));
            }
            if (listpame.Count>0)
            {
                sb.Append(" and " + string.Join(" and ", listString.ToArray()));
            }



            DataTable dt = DBHelper.Query(sb.ToString(),listpame.ToArray());
            List<ConsumptionForeign> list = new List<ConsumptionForeign>();
            foreach (DataRow item in dt.Rows)
            {
                ConsumptionForeign consumptionForeign = new ConsumptionForeign()
                {
                    ConsumptionStatus = Convert.ToInt32(item["ConsumptionStatus"]),
                    ConsumptionSum = Convert.ToDouble(item["ConsumptionSum"]),
                    ConsumptionTime = Convert.ToDateTime(item["ConsumptionTime"]),
后面还有 93 行代码,解锁后查看完整代码

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

AI 解读

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

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