Exemplo n.º 1
0
 /// <summary>
 /// 获取实体数据
 /// </summary>
 /// <param name='strCondition'>条件(AND Code='11')</param>
 /// <returns>model</returns>
 public Bse_Attachments GetModel(string strCondition)
 {
     List<Bse_Attachments> list = instance.GetListByWhere(strCondition);
     Bse_Attachments model = new Bse_Attachments();
     if (list != null && list.Count > 0)
     {
         model = list[0];
     }
     else
     {
         model = null;
     }
     return model;
 }
Exemplo n.º 2
0
 /// <summary>
 /// 获取实体数据
 /// </summary>
 /// <param name='strCondition'>条件(AND Code='11')</param>
 /// <returns>model</returns>
 public Bse_Attachments GetModels(string strCondition)
 {
     string where = string.Format(" AND AT_CDate='{0}'", strCondition);
     List<Bse_Attachments> list = instance.GetListByWhere(where);
     Bse_Attachments model = new Bse_Attachments();
     if (list != null && list.Count > 0)
     {
         model = list[0];
     }
     else
     {
         model = null;
     }
     return model;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 新增或更新对象
        /// </summary>
        /// <param name="Mn"></param>
        /// <returns></returns>
        public bool AddUpdatePlanObject(Bse_Attachments info)
        {
            int result = 0;

               if (info != null)
               {
               if (info.AT_ID.Equals(0))
               {
                   result = instance.Add(info);
               }
               else
               {
                   result = instance.Update(info);
               }
               }
               return result > 0 ? true : false;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 更新附件信息 Bse_Attachments对象(即:一条记录
        /// </summary>
        public int Update(Bse_Attachments bse_Attachments)
        {
            StringBuilder sbParameter=new StringBuilder();
              StringBuilder sb=new StringBuilder();
              sb.Append(@"UPDATE       Bse_Attachments       SET ");
            if(bse_Attachments.Module_Code_IsChanged){sbParameter.Append("Module_Code=@Module_Code, ");}
              if(bse_Attachments.Record_ID_IsChanged){sbParameter.Append("Record_ID=@Record_ID, ");}
              if(bse_Attachments.AT_Name_IsChanged){sbParameter.Append("AT_Name=@AT_Name, ");}
              if(bse_Attachments.AT_URL_IsChanged){sbParameter.Append("AT_URL=@AT_URL, ");}
              if(bse_Attachments.AT_CDate_IsChanged){sbParameter.Append("AT_CDate=@AT_CDate, ");}
              if(bse_Attachments.AT_UDate_IsChanged){sbParameter.Append("AT_UDate=@AT_UDate, ");}
              if(bse_Attachments.AT_Creator_IsChanged){sbParameter.Append("AT_Creator=@AT_Creator, ");}
              if(bse_Attachments.AT_Updator_IsChanged){sbParameter.Append("AT_Updator=@AT_Updator, ");}
              if(bse_Attachments.Stat_IsChanged){sbParameter.Append("Stat=@Stat, ");}
              if(bse_Attachments.AT_Code_IsChanged){sbParameter.Append("AT_Code=@AT_Code, ");}
              if(bse_Attachments.CreateDate_IsChanged){sbParameter.Append("CreateDate=@CreateDate, ");}
              if(bse_Attachments.UpdateDate_IsChanged){sbParameter.Append("UpdateDate=@UpdateDate, ");}
              if(bse_Attachments.DeleteDate_IsChanged){sbParameter.Append("DeleteDate=@DeleteDate, ");}
              if(bse_Attachments.AT_Description_IsChanged){sbParameter.Append("AT_Description=@AT_Description ");}
          sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
              sb.Append(      " WHERE 1=1 AND ((Stat is null) or (Stat=0))   and AT_ID=@AT_ID; " );
              string sql=sb.ToString();
             if(bse_Attachments.Module_Code_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Attachments.Module_Code))
             {
            idb.AddParameter("@Module_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Module_Code", bse_Attachments.Module_Code);
             }
              }
             if(bse_Attachments.Record_ID_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Attachments.Record_ID))
             {
            idb.AddParameter("@Record_ID", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Record_ID", bse_Attachments.Record_ID);
             }
              }
             if(bse_Attachments.AT_Name_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Attachments.AT_Name))
             {
            idb.AddParameter("@AT_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_Name", bse_Attachments.AT_Name);
             }
              }
             if(bse_Attachments.AT_URL_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Attachments.AT_URL))
             {
            idb.AddParameter("@AT_URL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_URL", bse_Attachments.AT_URL);
             }
              }
             if(bse_Attachments.AT_CDate_IsChanged)
             {
             if (bse_Attachments.AT_CDate == DateTime.MinValue)
             {
            idb.AddParameter("@AT_CDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_CDate", bse_Attachments.AT_CDate);
             }
              }
             if(bse_Attachments.AT_UDate_IsChanged)
             {
             if (bse_Attachments.AT_UDate == DateTime.MinValue)
             {
            idb.AddParameter("@AT_UDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_UDate", bse_Attachments.AT_UDate);
             }
              }
             if(bse_Attachments.AT_Creator_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Attachments.AT_Creator))
             {
            idb.AddParameter("@AT_Creator", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_Creator", bse_Attachments.AT_Creator);
             }
              }
             if(bse_Attachments.AT_Updator_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Attachments.AT_Updator))
             {
            idb.AddParameter("@AT_Updator", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_Updator", bse_Attachments.AT_Updator);
             }
              }
             if(bse_Attachments.Stat_IsChanged)
             {
             if (bse_Attachments.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Attachments.Stat);
             }
              }
             if(bse_Attachments.AT_Code_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Attachments.AT_Code))
             {
            idb.AddParameter("@AT_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_Code", bse_Attachments.AT_Code);
             }
              }
             if(bse_Attachments.CreateDate_IsChanged)
             {
             if (bse_Attachments.CreateDate == DateTime.MinValue)
             {
            idb.AddParameter("@CreateDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CreateDate", bse_Attachments.CreateDate);
             }
              }
             if(bse_Attachments.UpdateDate_IsChanged)
             {
             if (bse_Attachments.UpdateDate == DateTime.MinValue)
             {
            idb.AddParameter("@UpdateDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@UpdateDate", bse_Attachments.UpdateDate);
             }
              }
             if(bse_Attachments.DeleteDate_IsChanged)
             {
             if (bse_Attachments.DeleteDate == DateTime.MinValue)
             {
            idb.AddParameter("@DeleteDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DeleteDate", bse_Attachments.DeleteDate);
             }
              }
             if(bse_Attachments.AT_Description_IsChanged)
             {
             if (string.IsNullOrEmpty(bse_Attachments.AT_Description))
             {
            idb.AddParameter("@AT_Description", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_Description", bse_Attachments.AT_Description);
             }
              }

             idb.AddParameter("@AT_ID", bse_Attachments.AT_ID);

             int Re = 0;
             //SQL日志记录
             var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
             System.Collections.Hashtable param = new System.Collections.Hashtable();
             string Ex = "0";
             foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
             {
                 param.Add(item.Key, item.Value);
             }
             try
             {
                 Re = idb.ExeCmd(sql);
                 Ex = Re.ToString();
             }
             catch (Exception ex)
             {
                 Ex = ex.Message;
             }

             SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name,Ex);

             return Re;
Exemplo n.º 5
0
 /// <summary>
 /// 获取指定的附件信息 Bse_Attachments对象集合
 /// </summary>
 public List<Bse_Attachments> GetListByWhere(string strCondition)
 {
     List<Bse_Attachments> ret = new List<Bse_Attachments>();
      string sql = "SELECT  AT_ID,Module_Code,Record_ID,AT_Name,AT_URL,AT_CDate,AT_UDate,AT_Creator,AT_Updator,Stat,AT_Code,CreateDate,UpdateDate,DeleteDate,AT_Description FROM Bse_Attachments WHERE 1=1 AND ((Stat is null) or (Stat=0) ) ";
      if(!string.IsNullOrEmpty(strCondition))
      {
     strCondition.Replace('\'','"'); //防sql注入
     sql += strCondition ;
      }
       SqlDataReader dr=null;
        try {
       dr=(SqlDataReader)idb.ReturnReader(sql);
      while(dr.Read())
      {
     Bse_Attachments bse_Attachments = new Bse_Attachments();
     if (dr["AT_ID"] != DBNull.Value) bse_Attachments.AT_ID = Convert.ToDecimal(dr["AT_ID"]);
     if (dr["Module_Code"] != DBNull.Value) bse_Attachments.Module_Code = Convert.ToString(dr["Module_Code"]);
     if (dr["Record_ID"] != DBNull.Value) bse_Attachments.Record_ID = Convert.ToString(dr["Record_ID"]);
     if (dr["AT_Name"] != DBNull.Value) bse_Attachments.AT_Name = Convert.ToString(dr["AT_Name"]);
     if (dr["AT_URL"] != DBNull.Value) bse_Attachments.AT_URL = Convert.ToString(dr["AT_URL"]);
     if (dr["AT_CDate"] != DBNull.Value) bse_Attachments.AT_CDate = Convert.ToDateTime(dr["AT_CDate"]);
     if (dr["AT_UDate"] != DBNull.Value) bse_Attachments.AT_UDate = Convert.ToDateTime(dr["AT_UDate"]);
     if (dr["AT_Creator"] != DBNull.Value) bse_Attachments.AT_Creator = Convert.ToString(dr["AT_Creator"]);
     if (dr["AT_Updator"] != DBNull.Value) bse_Attachments.AT_Updator = Convert.ToString(dr["AT_Updator"]);
     if (dr["Stat"] != DBNull.Value) bse_Attachments.Stat = Convert.ToInt32(dr["Stat"]);
     if (dr["AT_Code"] != DBNull.Value) bse_Attachments.AT_Code = Convert.ToString(dr["AT_Code"]);
     if (dr["CreateDate"] != DBNull.Value) bse_Attachments.CreateDate = Convert.ToDateTime(dr["CreateDate"]);
     if (dr["UpdateDate"] != DBNull.Value) bse_Attachments.UpdateDate = Convert.ToDateTime(dr["UpdateDate"]);
     if (dr["DeleteDate"] != DBNull.Value) bse_Attachments.DeleteDate = Convert.ToDateTime(dr["DeleteDate"]);
     if (dr["AT_Description"] != DBNull.Value) bse_Attachments.AT_Description = Convert.ToString(dr["AT_Description"]);
     ret.Add(bse_Attachments);
      }
       }catch (System.Exception ex){ throw ex; }  finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
      return ret;
 }
Exemplo n.º 6
0
        /// <summary>
        /// 获取指定的附件信息 Bse_Attachments对象(即:一条记录
        /// </summary>
        public Bse_Attachments GetByKey(decimal aT_ID)
        {
            Bse_Attachments bse_Attachments = new Bse_Attachments();
             string sql = "SELECT  AT_ID,Module_Code,Record_ID,AT_Name,AT_URL,AT_CDate,AT_UDate,AT_Creator,AT_Updator,Stat,AT_Code,CreateDate,UpdateDate,DeleteDate,AT_Description FROM Bse_Attachments WHERE 1=1 AND ((Stat is null) or (Stat=0) )  AND AT_ID=@AT_ID ";
             idb.AddParameter("@AT_ID", aT_ID);

              SqlDataReader dr=null;
               try {
              dr=(SqlDataReader)idb.ReturnReader(sql);
             while(dr.Read())
             {
            if (dr["AT_ID"] != DBNull.Value) bse_Attachments.AT_ID = Convert.ToDecimal(dr["AT_ID"]);
            if (dr["Module_Code"] != DBNull.Value) bse_Attachments.Module_Code = Convert.ToString(dr["Module_Code"]);
            if (dr["Record_ID"] != DBNull.Value) bse_Attachments.Record_ID = Convert.ToString(dr["Record_ID"]);
            if (dr["AT_Name"] != DBNull.Value) bse_Attachments.AT_Name = Convert.ToString(dr["AT_Name"]);
            if (dr["AT_URL"] != DBNull.Value) bse_Attachments.AT_URL = Convert.ToString(dr["AT_URL"]);
            if (dr["AT_CDate"] != DBNull.Value) bse_Attachments.AT_CDate = Convert.ToDateTime(dr["AT_CDate"]);
            if (dr["AT_UDate"] != DBNull.Value) bse_Attachments.AT_UDate = Convert.ToDateTime(dr["AT_UDate"]);
            if (dr["AT_Creator"] != DBNull.Value) bse_Attachments.AT_Creator = Convert.ToString(dr["AT_Creator"]);
            if (dr["AT_Updator"] != DBNull.Value) bse_Attachments.AT_Updator = Convert.ToString(dr["AT_Updator"]);
            if (dr["Stat"] != DBNull.Value) bse_Attachments.Stat = Convert.ToInt32(dr["Stat"]);
            if (dr["AT_Code"] != DBNull.Value) bse_Attachments.AT_Code = Convert.ToString(dr["AT_Code"]);
            if (dr["CreateDate"] != DBNull.Value) bse_Attachments.CreateDate = Convert.ToDateTime(dr["CreateDate"]);
            if (dr["UpdateDate"] != DBNull.Value) bse_Attachments.UpdateDate = Convert.ToDateTime(dr["UpdateDate"]);
            if (dr["DeleteDate"] != DBNull.Value) bse_Attachments.DeleteDate = Convert.ToDateTime(dr["DeleteDate"]);
            if (dr["AT_Description"] != DBNull.Value) bse_Attachments.AT_Description = Convert.ToString(dr["AT_Description"]);
             }
              }catch (System.Exception ex){ throw ex; }  finally { if (dr != null) { dr.Close(); } if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open) { idb.GetConnection().Close(); }   }
             return bse_Attachments;
        }
Exemplo n.º 7
0
        /// <summary>
        /// 添加附件信息 Bse_Attachments对象(即:一条记录)
        /// </summary>
        public int Add(Bse_Attachments bse_Attachments)
        {
            string sql = "INSERT INTO Bse_Attachments (Module_Code,Record_ID,AT_Name,AT_URL,AT_CDate,AT_UDate,AT_Creator,AT_Updator,Stat,AT_Code,CreateDate,UpdateDate,DeleteDate,AT_Description) VALUES (@Module_Code,@Record_ID,@AT_Name,@AT_URL,@AT_CDate,@AT_UDate,@AT_Creator,@AT_Updator,@Stat,@AT_Code,@CreateDate,@UpdateDate,@DeleteDate,@AT_Description)";
             if (string.IsNullOrEmpty(bse_Attachments.Module_Code))
             {
            idb.AddParameter("@Module_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Module_Code", bse_Attachments.Module_Code);
             }
             if (string.IsNullOrEmpty(bse_Attachments.Record_ID))
             {
            idb.AddParameter("@Record_ID", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Record_ID", bse_Attachments.Record_ID);
             }
             if (string.IsNullOrEmpty(bse_Attachments.AT_Name))
             {
            idb.AddParameter("@AT_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_Name", bse_Attachments.AT_Name);
             }
             if (string.IsNullOrEmpty(bse_Attachments.AT_URL))
             {
            idb.AddParameter("@AT_URL", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_URL", bse_Attachments.AT_URL);
             }
             if (bse_Attachments.AT_CDate == DateTime.MinValue)
             {
            idb.AddParameter("@AT_CDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_CDate", bse_Attachments.AT_CDate);
             }
             if (bse_Attachments.AT_UDate == DateTime.MinValue)
             {
            idb.AddParameter("@AT_UDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_UDate", bse_Attachments.AT_UDate);
             }
             if (string.IsNullOrEmpty(bse_Attachments.AT_Creator))
             {
            idb.AddParameter("@AT_Creator", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_Creator", bse_Attachments.AT_Creator);
             }
             if (string.IsNullOrEmpty(bse_Attachments.AT_Updator))
             {
            idb.AddParameter("@AT_Updator", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_Updator", bse_Attachments.AT_Updator);
             }
             if (bse_Attachments.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", bse_Attachments.Stat);
             }
             if (string.IsNullOrEmpty(bse_Attachments.AT_Code))
             {
            idb.AddParameter("@AT_Code", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_Code", bse_Attachments.AT_Code);
             }
             if (bse_Attachments.CreateDate == DateTime.MinValue)
             {
            idb.AddParameter("@CreateDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CreateDate", bse_Attachments.CreateDate);
             }
             if (bse_Attachments.UpdateDate == DateTime.MinValue)
             {
            idb.AddParameter("@UpdateDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@UpdateDate", bse_Attachments.UpdateDate);
             }
             if (bse_Attachments.DeleteDate == DateTime.MinValue)
             {
            idb.AddParameter("@DeleteDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DeleteDate", bse_Attachments.DeleteDate);
             }
             if (string.IsNullOrEmpty(bse_Attachments.AT_Description))
             {
            idb.AddParameter("@AT_Description", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@AT_Description", bse_Attachments.AT_Description);
             }

             int Re = 0;
             //SQL日志记录
             var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
             System.Collections.Hashtable param = new System.Collections.Hashtable();
             string Ex = "0";
             foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
             {
                 param.Add(item.Key, item.Value);
             }
             try
             {
                 Re = idb.ExeCmd(sql);
                 Ex = Re.ToString();
             }
             catch (Exception ex)
             {
                 Ex = ex.Message;
             }

             SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType + "." + RunMethod.Name,Ex);

             return Re;
        }
Exemplo n.º 8
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name='model'>实体</param>
 /// <returns>bool</returns>
 public bool Update(Bse_Attachments model,bool IsValid)
 {
     bool result = false;
     var e = new ModelExceptions();
     if(e.IsValid && IsValid){
         int _rseult = instance.Update(model);
         if (_rseult > 0)
         {
             result = true;
         }
     }
     return result;
 }
Exemplo n.º 9
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name='model'>实体</param>
 /// <param name='model'>是否完成验证</param>
 /// <returns>bool</returns>
 public bool Insert(Bse_Attachments model,bool IsValid)
 {
     var e = new ModelExceptions();
     bool result = false;
     if (e.IsValid && IsValid)
     {
         //完成了验证,开始更新数据库了
         int _result = instance.Add(model);
         if (_result > 0)
         {
             result = true;
         }
     }
     return result;
 }
Exemplo n.º 10
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name='model'>实体</param>
        /// <returns>bool</returns>
        public bool Insert(Bse_Attachments model)
        {
            bool result = false;
            try
            {
                int _result = instance.Add(model);
                if (_result > 0)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return result;
        }