Sry.Solution.Data/DeptData.Designer.cs

(开头部分) 5KB

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


using System.Data;
using System.Data.SqlClient;
using Sry.Entity;
using Sry.Framework.Dal;
namespace Sry.Data{
   /// <summary>
   /// IDeptData接口 author:Sry
   /// </summary>
   public partial interface IDeptData{
       int Add(Dept instance);
       bool Delete(Dept instance, int option);
       bool Update(Dept instance, int option);
       DataSet Select(Dept instance, int option,  ref QueryParams pageParam);
       Dept Get(Dept instance, int option);
   }
   public partial class DeptData{
      public int Add(Dept instance){
         
         string sql = @"insert into [Dept] (
         [dep_Name],[dep_CreateTime])
          values (@dep_Name,@dep_CreateTime);
         select SCOPE_IDENTITY()";
         SqlParameter[] sps = new SqlParameter[] {
            new SqlParameter("@dep_Name",instance.dep_Name),
            new SqlParameter("@dep_CreateTime",instance.dep_CreateTime)};
         try{
             int size=0;
             size = int.Parse(SqlHelper.ExecuteScalar(SQLConfig.MainLink,CommandType.Text,sql,sps).ToString().Trim());
             if(size==0){
                 
                 return -1;              
             }
             return size;
         }   
         catch (SqlException ex) {
          throw;
         };
      }
      public bool Delete(Dept instance,int option) {
         
         SqlParameter[] sps = null;
         string sql = string.Empty;
         switch (option){
            case 0:
                sps = new SqlParameter[] { new SqlParameter("@dep_ID",instance.dep_ID) };
                sql = "delete from [Dept] where [dep_ID] = @dep_ID";
            break;

         }
         try
         {
              int size = SqlHelper.ExecuteNonQuery(SQLConfig.MainLink, System.Data.CommandType.Text, sql, sps);

              if (size < 1) {
                   
                   return false;
              }
          }
          catch(SqlException ex) {
后面还有 104 行代码,购买后查看完整代码

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

AI 解读 AI

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

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