username@email.com
2025-05-09 66beb245e516809514642c00922f0339bf760518
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CY.IDAL;
using CY.Model;
using AbstractFactory;
using CY.Infrastructure.Query;
using System.Data;
namespace CY.BLL.OA
{
    public class OA_BrandBLL
    {
        IOA_BrandDAL brandDal = null;
 
        public OA_BrandBLL()
        {
            brandDal = Factory.GetDALByInterfaceName(DALInterface.IOA_BrandDAL) as IOA_BrandDAL;
 
        }
 
        /// <summary>
        /// 插入一个品牌
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool InsertModel(OA_Brand model)
        {
            return brandDal.InserModel(model);
 
        }
 
        /// <summary>
        /// 更新品牌
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateModel(OA_Brand model)
        {
            return brandDal.UpdateModel(model);
 
        }
 
        public bool DeleteModel(OA_Brand model)
        {
            return brandDal.DeleteModel(model);
        }
 
        /// <summary>
        /// 获取全部品牌
        /// </summary>
        /// <param name="pa"></param>
        /// <param name="FirmId"></param>
        /// <param name="BrandName"></param>
        /// <returns></returns>
        public IEnumerable<Model.OA_Brand> getAllBrand(Pagination pa, Guid FirmId, string BrandName, string CommodityName, string GoodsName)
        {
 
            return brandDal.getAllBrand(pa, FirmId, BrandName, CommodityName, GoodsName);
 
        }
 
        public DataTable getAllBrand(Guid FrimId, string CommodityId, string GoodsId)
        {
            return brandDal.getAllBrand(FrimId, CommodityId, GoodsId);
        }
 
        /// <summary>
        /// 获取单个品牌
        /// </summary>
        /// <param name="Keyid"></param>
        /// <returns></returns>
        public Model.OA_Brand getSingleBrand(string Keyid)
        {
            return brandDal.getSingleBrand(Keyid);
        }
 
        public string GetMaxOrderNum(Guid FirmId, string TName)
        {
            return brandDal.GetMaxOrderNum(FirmId, TName);
        }
 
        public string GetMaxOrderNumMemberId(Guid FirmId, string TName)
        {
            return brandDal.GetMaxOrderNumMemberId(FirmId, TName);
        }
 
        /// <summary>
        /// 获取全部规格
        /// </summary>
        /// <param name="pa"></param>
        /// <param name="FirmId"></param>
        /// <param name="BrandName"></param>
        /// <returns></returns>
        public IEnumerable<Model.OA_Brand> getAllBrandNameByGoods(Pagination pa, Guid FirmId, string SpecificationName, string GoodsName, string CommdityName)
        {
            IEnumerable<OA_Brand> SpecificationList = brandDal.getAllBrandnew(pa, FirmId, SpecificationName, GoodsName, CommdityName);
            IList<OA_Brand> templist = new List<OA_Brand>();
            if (SpecificationList != null)
            {
                foreach (OA_Brand model in SpecificationList)
                {
                    templist.Add(getModel(model.GoodsId.ToString()));
                }
            }
            return templist;
        }
 
        /// <summary>
        /// 根据货品Id获取所对应的规格
        /// </summary>
        /// <param name="GoodsId"></param>
        /// <returns></returns>
        public OA_Brand getModel(string GoodsId)
        {
            IList<Model.OA_Brand> OldList = brandDal.getAllModelByGoodsId(GoodsId).ToList<OA_Brand>();
            OA_Brand model = new OA_Brand();
            if (OldList != null && OldList.Count() > 0)
            {
                model.CommodityId = OldList[0].CommodityId;
                model.CommodityName = OldList[0].CommodityName;
                model.FirmId = OldList[0].FirmId;
                model.GoodsId = OldList[0].GoodsId;
                model.GoodsName = OldList[0].GoodsName;
                model.Keyid = OldList[0].Keyid;
                model.LastUpdateTime = OldList[0].LastUpdateTime;
                model.Remark = "";
                model.Operator = OldList[0].Operator;
                model.OrderNum = OldList[0].OrderNum;
                model.Remark = OldList[0].Remark;
                foreach (OA_Brand modl in OldList)
                {
                    model.Name += modl.Name.ToString() + "|";
 
                }
 
                if (!string.IsNullOrEmpty(model.Name))
                {
                    model.Name = model.Name.Substring(0, model.Name.Length - 1);
                }
            }
            return model;
        }
 
        /// <summary>
        /// 获取一个货品下面的全部规格-分页
        /// </summary>
        /// <param name="pa"></param>
        /// <param name="GoodsId"></param>
        /// <returns></returns>
        public IEnumerable<Model.OA_Brand> getAllModelByGoodsId(Pagination pa, string GoodsId)
        {
            return brandDal.getAllModelByGoodsId(pa, GoodsId);
        }
 
    }
}