username@email.com
2026-02-25 b73be4c097b5e12c9534fbefd8df54b404c05cb0
CY_ECommercePlatform/CY.SQLDAL/OA/OA_CorporateClientsDAL.cs
@@ -1264,7 +1264,100 @@
            try
            {
                IList<OA_CorporateClientsVisit> result = _dataBase.SelectModel<OA_CorporateClientsVisit>("  a.*,b.[Name] as CreaterName ", "OA_CorporateClientsVisit a left join EC_MemberBasic b on a.Creater = b.MemberId ", string.Format(" CorporateClientsid = '{0}'  order by a.[VisitTime] desc", CustomId)) as IList<OA_CorporateClientsVisit>;//执行查询
                IList<OA_CorporateClientsVisit> result = _dataBase.SelectModel<OA_CorporateClientsVisit>(" top 50  a.*,b.[Name] as CreaterName ", "OA_CorporateClientsVisit a left join EC_MemberBasic b on a.Creater = b.MemberId ", string.Format(" CorporateClientsid = '{0}'  order by a.[VisitTime] desc", CustomId)) as IList<OA_CorporateClientsVisit>;//执行查询
                return result;//返回结果
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 新增合作客户设计沟通
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool InsertModelSheji(CY.Model.OA_CorporateClientsSheji trueModel)
        {
            //Model.OA_CorporateClients trueModel = model as Model.OA_CorporateClientsVist;
            if (trueModel == null)
            {
                return false;
            }
            SqlParameter par = null;
            if (trueModel.ShejiTime.HasValue)
            {
                par = new SqlParameter("@ShejiTime", trueModel.ShejiTime.Value);
            }
            else
            {
                par = new SqlParameter("@ShejiTime", DBNull.Value);
            }
            SqlParameter par1 = null;
            if (trueModel.CreateTime.HasValue)
            {
                par1 = new SqlParameter("@CreateTime", trueModel.CreateTime.Value);
            }
            else
            {
                par1 = new SqlParameter("@CreateTime", DBNull.Value);
            }
            SqlParameter par2 = null;
            if (trueModel.LastUpdateTime.HasValue)
            {
                par2 = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value);
            }
            else
            {
                par2 = new SqlParameter("@LastUpdateTime", DBNull.Value);
            }
            IList<SqlParameter> sqlParms = new List<SqlParameter>()
            {
                       new SqlParameter("@Keyid",trueModel.Keyid),
                    new SqlParameter("@CorporateClientsid",trueModel.CorporateClientsid),
                    par,
                     new SqlParameter("@YinjianName",trueModel.YinjianName),
                      new SqlParameter("@JiaogaoCount",trueModel.JiaogaoCount.HasValue?trueModel.JiaogaoCount.Value:0),
                    new SqlParameter("@Remark",trueModel.Remark),
                    new SqlParameter("@Creater",trueModel.Creater),
                    par1,
                    new SqlParameter("@Updater",trueModel.Updater),
                    par2,
            };
            string sql = "Insert Into OA_CorporateClientsSheji ([Keyid],[CorporateClientsid],[ShejiTime],[YinjianName], [JiaogaoCount], [Remark],[Creater], [CreateTime],[Updater], [LastUpdateTime] )"
                                              + " Values (@Keyid,@CorporateClientsid,@ShejiTime, @YinjianName, @JiaogaoCount, @Remark, @Creater, @CreateTime, @Updater, @LastUpdateTime  )";
            try
            {
                _dataBase.ExecuteSql(sql, sqlParms.ToArray<SqlParameter>());
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return true;
        }
        /// <summary>
        /// 根据客户id查询设计沟通
        /// </summary>
        /// <param name="CustomId">编号</param>
        /// <returns></returns>
        public IEnumerable<OA_CorporateClientsSheji> SelectShejiListByCorId(Guid CustomId)
        {
            if (CustomId == null)
                return null;//错误数据返会空
            try
            {
                IList<OA_CorporateClientsSheji> result = _dataBase.SelectModel<OA_CorporateClientsSheji>(" top 50  a.*,b.[Name] as CreaterName ", "OA_CorporateClientsSheji a left join EC_MemberBasic b on a.Creater = b.MemberId ", string.Format(" CorporateClientsid = '{0}'  order by a.[ShejiTime] desc", CustomId)) as IList<OA_CorporateClientsSheji>;//执行查询
                return result;//返回结果
            }
            catch (Exception ex)
@@ -1635,5 +1728,22 @@
            return (null == result || result.Count == 0) ? null : result[0];//返回结果
        }
        /// <summary>
        /// 单个查询设计沟通
        /// </summary>
        /// <param name="Keyid">编号</param>
        /// <returns></returns>
        public OA_CorporateClientsSheji SelectShejiByKeyid(Guid Keyid)
        {
            if (Keyid == null)
                return null;//错误数据返会空
            IList<OA_CorporateClientsSheji> result = _dataBase.SelectModel<OA_CorporateClientsSheji>(" a.* ", " OA_CorporateClientsSheji a ", string.Format(" a.Keyid='{0}'", Keyid)) as IList<OA_CorporateClientsSheji>;//执行查询
            return (null == result || result.Count == 0) ? null : result[0];//返回结果
        }
    }
}