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_GongzuoneirongDAL.cs | 272 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 272 insertions(+), 0 deletions(-)
diff --git a/CY_ECommercePlatform/CY.SQLDAL/OA/OA_GongzuoneirongDAL.cs b/CY_ECommercePlatform/CY.SQLDAL/OA/OA_GongzuoneirongDAL.cs
new file mode 100644
index 0000000..857177f
--- /dev/null
+++ b/CY_ECommercePlatform/CY.SQLDAL/OA/OA_GongzuoneirongDAL.cs
@@ -0,0 +1,272 @@
+锘縰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_GongzuoneirongDAL : IOA_GongzuoneirongDAL
+ {
+ private Database _dataBase = null;
+
+ public OA_GongzuoneirongDAL()
+ {
+ _dataBase = new Database();
+ }
+
+ public OA_GongzuoneirongDAL(Database dataBase)
+ {
+ _dataBase = dataBase;
+ }
+
+ /// <summary>
+ /// 鏂板
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ public bool InserModel(Infrastructure.Domain.IAggregateRoot model)
+ {
+ Model.OA_Gongzuoneirong trueModel = model as Model.OA_Gongzuoneirong;
+ if (trueModel == null)
+ {
+ return false;
+ }
+
+
+ IList<SqlParameter> sqlParms = new List<SqlParameter>()
+ { new SqlParameter("@MemberId", trueModel.MemberId) ,
+ new SqlParameter("@Gongzuozhize", trueModel.Gongzuozhize) ,
+ new SqlParameter("@Zerenren",trueModel.Zerenren.HasValue?trueModel.Zerenren.Value:0 ) ,
+ new SqlParameter("@ZerenrenName", string.IsNullOrEmpty(trueModel.ZerenrenName)?"":trueModel.ZerenrenName) ,
+
+
+ new SqlParameter("@CreateTime", trueModel.CreateTime) ,
+ new SqlParameter("@Creator", trueModel.Creator) ,
+
+ new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime) ,
+ new SqlParameter("@Updator", trueModel.Updator) ,
+
+ };
+ string sql = "Insert Into OA_Gongzuoneirong ([MemberId],[Gongzuozhize],[Zerenren],[ZerenrenName],[CreateTime],[Creator],[LastUpdateTime],[Updator])"
+ + " Values (@MemberId,@Gongzuozhize,@Zerenren,@ZerenrenName,@CreateTime,@Creator,@LastUpdateTime,@Updator )";
+
+ 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_Gongzuoneirong trueModel = model as Model.OA_Gongzuoneirong;
+ if (trueModel == null)
+ {
+ return false;
+ }
+
+
+ IList<SqlParameter> sqlParms = new List<SqlParameter>()
+ { new SqlParameter("@Keyid", trueModel.Keyid) ,
+ new SqlParameter("@MemberId", trueModel.MemberId) ,
+ new SqlParameter("@Gongzuozhize", trueModel.Gongzuozhize) ,
+ new SqlParameter("@Zerenren",trueModel.Zerenren.HasValue?trueModel.Zerenren.Value:0 ) ,
+ new SqlParameter("@ZerenrenName", string.IsNullOrEmpty(trueModel.ZerenrenName)?"":trueModel.ZerenrenName) ,
+
+
+
+
+ new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime) ,
+ new SqlParameter("@Updator", trueModel.Updator) ,
+ };
+ string sql = "Update OA_Gongzuoneirong Set [MemberId]=@MemberId,[Gongzuozhize]=@Gongzuozhize,[Zerenren]=@Zerenren,[ZerenrenName]=@ZerenrenName, [LastUpdateTime]=@LastUpdateTime, [Updator]=@Updator 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_Gongzuoneirong trueModel = model as Model.OA_Gongzuoneirong;
+ if (trueModel == null)
+ {
+ return false;
+ }
+ IList<SqlParameter> sqlParms = new List<SqlParameter>()
+ {
+ new SqlParameter("@Keyid",trueModel.Keyid)
+ };
+ string sql = "Delete OA_Gongzuoneirong 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_Gongzuoneirong> SelectModelPage(Infrastructure.Query.Query query, Infrastructure.Query.Pagination pagination)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
+ /// 鍗曚釜鏌ヨ
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ public IEnumerable<Model.OA_Gongzuoneirong> SelectAllModel(Infrastructure.Query.Query query)
+ {
+ return _dataBase.SelectModel<Model.OA_Gongzuoneirong>(" * ", " OA_Gongzuoneirong ") as IList<Model.OA_Gongzuoneirong>;//鎵ц鏌ヨ
+ }
+
+ /// <summary>
+ /// 鏍规嵁缂栧彿鑾峰緱淇℃伅
+ /// </summary>
+ /// <param name="Keyid">缂栧彿</param>
+ /// <returns></returns>
+ public OA_Gongzuoneirong GetModelByKeyid(int? Keyid)
+ {
+ try
+ {
+ if (Keyid == null || Keyid < 0)
+ return null;//閿欒鏁版嵁杩斾細绌�
+
+ IList<OA_Gongzuoneirong> result = _dataBase.SelectModel<OA_Gongzuoneirong>(" * ", " OA_Gongzuoneirong ", string.Format(" Keyid='{0}'", Keyid)) as IList<OA_Gongzuoneirong>;//鎵ц鏌ヨ
+
+ return (null == result || result.Count == 0) ? null : result[0];//杩斿洖缁撴灉
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+
+ /// <summary>
+ /// 鑾峰彇鐗╁搧鍒嗙被
+ /// </summary>
+ /// <param name="_MemberId"></param>
+ /// <returns></returns>
+ public IEnumerable<Model.OA_GongzuoneirongCate> GetDataByType(Guid _MemberId)
+ {
+ try
+ {
+ string condition = " 1=1 ";
+
+ if (_MemberId != Guid.Empty)
+ condition += " and MemberId = '" + _MemberId + "'";
+
+ return _dataBase.SelectModel<Model.OA_GongzuoneirongCate>(" * ", " OA_GongzuoneirongCate ", condition);
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ /// <summary>
+ /// 鍒嗛〉鏌ヨ
+ /// </summary>
+ /// <param name="pagination"></param>
+ /// <returns></returns>
+ public IEnumerable<Model.OA_Gongzuoneirong> SelectModelPage(Infrastructure.Query.Pagination pagination, Guid _MemberId, string Gongzuozhize, int? Zerenren)
+ {
+ try
+ {
+ string condition = " 1=1 ";
+
+ if (_MemberId != Guid.Empty)
+ condition += " and a.MemberId = '" + _MemberId + "'";
+
+
+
+ if (!string.IsNullOrEmpty(Gongzuozhize))
+ condition += " and a.Gongzuozhize like '%" + Gongzuozhize + "%'";
+
+ if (Zerenren.HasValue)
+ condition += " and a.Zerenren = '" + Zerenren + "'";
+
+
+
+ return _dataBase.SelectModelPage<Model.OA_Gongzuoneirong>(pagination, " a.* ", " OA_Gongzuoneirong a ", " a.Zerenren", " Zerenren ", 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(int? Zerenren, int? Keyid, string neirong)
+ {
+ try
+ {
+ string where = " Zerenren = " + Zerenren + " and Gongzuozhize='"+ neirong + "'";
+
+ if (Keyid.HasValue)
+ {
+ where += " and Keyid <> " + Keyid + " ";
+ }
+
+ IList<OA_CarManage> result = _dataBase.SelectModel<OA_CarManage>("*", "OA_Gongzuoneirong", where) 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