From 24ac6e50da797cc3372f67f346618be86b86c4d1 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 21 十一月 2025 15:06:15 +0800
Subject: [PATCH] 提交

---
 CY_ECommercePlatform/CY.SQLDAL/OA/OA_GongzuoneirongCateDAL.cs |  232 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 232 insertions(+), 0 deletions(-)

diff --git a/CY_ECommercePlatform/CY.SQLDAL/OA/OA_GongzuoneirongCateDAL.cs b/CY_ECommercePlatform/CY.SQLDAL/OA/OA_GongzuoneirongCateDAL.cs
new file mode 100644
index 0000000..54a3008
--- /dev/null
+++ b/CY_ECommercePlatform/CY.SQLDAL/OA/OA_GongzuoneirongCateDAL.cs
@@ -0,0 +1,232 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using CY.IDAL;
+using System.Data.SqlClient;
+using System.Data;
+using CY.Model;
+using System.Transactions;
+namespace CY.SQLDAL
+{
+	 	//琛屾斂鐗╁搧鍒嗙被
+		public class OA_GongzuoneirongCateDAL:IOA_GongzuoneirongCateDAL
+	{
+		 private Database _dataBase = null;
+
+        public OA_GongzuoneirongCateDAL()
+        {
+            _dataBase = new Database();
+        }
+        
+        public OA_GongzuoneirongCateDAL(Database dataBase)
+        {
+            _dataBase = dataBase;
+        }
+	
+		/// <summary>
+        /// 鏂板
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public bool InserModel(Infrastructure.Domain.IAggregateRoot model)
+        {
+            Model.OA_GongzuoneirongCate trueModel = model as Model.OA_GongzuoneirongCate;
+            if (trueModel == null)
+            {
+                return false;
+            }
+            IList<SqlParameter> sqlParms = new List<SqlParameter>()
+            {            	new SqlParameter("@MemberId", trueModel.MemberId) ,            
+                        	new SqlParameter("@Name", trueModel.Name) ,            
+                        	new SqlParameter("@Status", trueModel.Status) ,            
+                        	new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime) ,            
+                        	new SqlParameter("@Operator", trueModel.Operator) ,            
+                        	new SqlParameter("@Remark", trueModel.Remark)             
+            		 };
+            string sql = "Insert Into OA_GongzuoneirongCate ([MemberId],[Name],[Status],[LastUpdateTime], [Operator])"
+                                             + " Values (@MemberId,@Name,@Status, @LastUpdateTime, @Operator )";
+
+            try
+            {
+                _dataBase.ExecuteSql(sql, sqlParms.ToArray<SqlParameter>());
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            return true;
+        }
+		
+		/// <summary>
+        /// 淇敼
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public bool UpdateModel(Infrastructure.Domain.IAggregateRoot model)
+        {
+            Model.OA_GongzuoneirongCate trueModel = model as Model.OA_GongzuoneirongCate;
+            if (trueModel == null)
+            {
+                return false;
+            }
+            IList<SqlParameter> sqlParms = new List<SqlParameter>()
+            {                new SqlParameter("@Keyid", trueModel.Keyid) ,            
+                            new SqlParameter("@MemberId", trueModel.MemberId) ,            
+                            new SqlParameter("@Name", trueModel.Name) ,            
+                            new SqlParameter("@Status", trueModel.Status) ,            
+                            new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime) ,            
+                            new SqlParameter("@Operator", trueModel.Operator) ,            
+                            new SqlParameter("@Remark", trueModel.Remark)             
+            		 };
+            string sql = "Update OA_GongzuoneirongCate Set [MemberId]=@MemberId,[Name]=@Name,[Status]=@Status, [LastUpdateTime]=@LastUpdateTime, [Operator]=@Operator,[Remark]=@Remark  where [Keyid] =@Keyid ";
+
+            try
+            {
+                _dataBase.ExecuteSql(sql, sqlParms.ToArray<SqlParameter>());
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            return true;
+        }
+		
+		/// <summary>
+        /// 鍒犻櫎
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public bool DeleteModel(Infrastructure.Domain.IAggregateRoot model)
+        {
+            Model.OA_GongzuoneirongCate trueModel = model as Model.OA_GongzuoneirongCate;
+            if (trueModel == null)
+            {
+                return false;
+            }
+            IList<SqlParameter> sqlParms = new List<SqlParameter>()
+                {
+                	new SqlParameter("@Keyid",trueModel.Keyid)
+                };
+            string sql = "Delete OA_GongzuoneirongCate Where [Keyid] = @Keyid ";
+
+
+            try
+            {
+                _dataBase.ExecuteSql(sql, sqlParms.ToArray<SqlParameter>());
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+
+            return true;
+        }
+         
+        /// <summary>
+        /// 鍒嗛〉鏌ヨ
+        /// </summary>
+        /// <param name="query"></param>
+        /// <param name="pagination"></param>
+        /// <returns></returns>
+        public IEnumerable<Model.OA_GongzuoneirongCate> SelectModelPage(Infrastructure.Query.Query query, Infrastructure.Query.Pagination pagination)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// 鍗曚釜鏌ヨ
+        /// </summary>
+        /// <param name="query"></param>
+        /// <returns></returns>
+        public IEnumerable<Model.OA_GongzuoneirongCate> SelectAllModel(Infrastructure.Query.Query query)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// 鏍规嵁缂栧彿鑾峰緱淇℃伅
+        /// </summary>
+        /// <param name="Keyid">缂栧彿</param>
+        /// <returns></returns>
+        public OA_GongzuoneirongCate GetModelByKeyid(int? Keyid)
+        {
+            try
+            {
+                if (Keyid == null || Keyid < 0)
+                    return null;//閿欒鏁版嵁杩斾細绌� 
+
+                IList<OA_GongzuoneirongCate> result = _dataBase.SelectModel<OA_GongzuoneirongCate>(" * ", " OA_GongzuoneirongCate ", string.Format(" Keyid='{0}'", Keyid)) as IList<OA_GongzuoneirongCate>;//鎵ц鏌ヨ
+
+                return (null == result || result.Count == 0) ? null : result[0];//杩斿洖缁撴灉
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+        
+        /// <summary>
+        /// 鍒嗛〉鏌ヨ
+        /// </summary>
+        /// <param name="pagination"></param>
+        /// <returns></returns>
+        public IEnumerable<Model.OA_GongzuoneirongCate> SelectModelPage(Infrastructure.Query.Pagination pagination,Guid _MemberId,string _Name,int? _Status,DateTime? _BeginLastUpdateTime,DateTime? _EndLastUpdateTime,string _Operator,string _Remark)
+        {
+            try
+            {
+                string condition = " 1=1 ";
+                 
+                        if (_MemberId != Guid.Empty)
+                    	condition += " and MemberId = '" + _MemberId + "'";
+             
+                        if (!string.IsNullOrEmpty(_Name))
+                    	condition += " and Name = '" + _Name + "'";
+             
+                        if (_Status.HasValue)
+                    	condition += " and Status = '" + _Status + "'";
+             
+                        	if (_BeginLastUpdateTime.HasValue)
+                    condition += string.Format(" and CAST(LastUpdateTime AS DATE) >='{0}'", _BeginLastUpdateTime);
+
+                if (_EndLastUpdateTime.HasValue)
+                    condition += string.Format(" and CAST(LastUpdateTime AS DATE) <='{0}'", _EndLastUpdateTime);
+             
+                        if (!string.IsNullOrEmpty(_Operator))
+                    	condition += " and Operator = '" + _Operator + "'";
+             
+                        if (!string.IsNullOrEmpty(_Remark))
+                    	condition += " and Remark = '" + _Remark + "'";
+            
+                return _dataBase.SelectModelPage<Model.OA_GongzuoneirongCate>(pagination, " * ", " OA_GongzuoneirongCate ", " Keyid desc", " Keyid desc ", condition);
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+
+        /// <summary>
+        /// 妫�娴嬬墿鍝佸垎绫绘槸鍚﹂噸澶�
+        /// </summary>
+        /// <param name="Name"></param>
+        /// <param name="MemberId"></param>
+        /// <param name="Keyid"></param>
+        /// <returns></returns>
+        public int IsExitsName(string Name, Guid MemberId, string Keyid)
+        {
+            try
+            {
+                IList<OA_CarManage> result = _dataBase.SelectModel<OA_CarManage>("*", "OA_GongzuoneirongCate", " Name = '" + Name + "' and MemberId ='" + MemberId + "' and Keyid <> '" + Keyid + "'") as IList<OA_CarManage>;//鎵ц鏌ヨ
+                if (null == result || result.Count == 0)
+                    return 0;
+                else
+                    return 1;
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+	}
+}
\ No newline at end of file

--
Gitblit v1.9.1