Ejemplo n.º 1
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns></returns>
 public int Add(ParameterName entity)
 {
     try
     {
         if (dr == null)
         {
             dr = new CallDatabase();
         }
         entity.Status = "1";
         dr.InitiCommand("insert into Sys_ParameterName([ConfigName],[No],[Memo])values(@ConfigName,@No,@Memo);select @@identity");
         dr.AddParameters("ConfigName", DbType.String, 50, entity.ConfigName);
         dr.AddParameters("No", DbType.Int32, entity.No);
         dr.AddParameters("Memo", DbType.String, 250, entity.Memo);
         int value = Convert.ToInt32(dr.ExecuteScalar());
         entity.Id = value;
         dr.Close();
         return(0);
     }
     catch (Exception ex)
     {
         using (ILog_Error log = new Log_Error_Generate())
         {
             log.Title   = ex.Message;
             log.Content = ex.StackTrace;
             log.Generatelog();
         }
         return(-1);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="entity">实体</param>
 /// <returns></returns>
 public int Add(System_User entity)
 {
     try
     {
         if (dr == null)
         {
             dr = new CallDatabase();
         }
         dr.InitiCommand("insert into Sys_User([LoginName],[Pwd],[UserName],[Remarks])values(@LoginName,@Pwd,@UserName,@Remarks);select @@identity");
         dr.AddParameters("LoginName", DbType.String, 30, entity.LoginName);
         dr.AddParameters("Pwd", DbType.String, 20, entity.Pwd);
         dr.AddParameters("UserName", DbType.String, 8, entity.UserName);
         dr.AddParameters("Remarks", DbType.String, 200, entity.Remarks);
         int value = Convert.ToInt32(dr.ExecuteScalar());
         entity.Id = value;
         dr.Close();
         return(0);
     }
     catch (Exception ex)
     {
         using (ILog_Error log = new Log_Error_Generate())
         {
             log.Title   = ex.Message;
             log.Content = ex.StackTrace;
             log.Generatelog();
         }
         return(-1);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 根据日期获取数据
        /// </summary>
        /// <param name="date">日期</param>
        /// <param name="loginName">登录用户</param>
        /// <returns></returns>
        public DataSet GetData(DateTime date, string loginName)
        {
            ICallDatabase dr = new CallDatabase();

            dr.InitiCommand();
            dr.CommandText = "select Login_Name,Result,ResultsDescribed,Creation_Date from [Log_Login]  where DateDiff(day,Creation_Date,@Creation_Date)=0  And [Login_Name] like @Login_Name  order by [Creation_Date] desc";
            dr.AddParameters("Creation_Date", DbType.String, 20, date.ToString());
            dr.AddParameters("Login_Name", DbType.String, 50, "%" + loginName + "%");
            DataSet data = dr.DataList();

            dr.Close();
            dr.Dispose();
            return(data);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 根据主键来获取数据集
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns></returns>
        public DataSet GetData(int id, out DataTable log_Contents_Data)
        {
            log_Contents_Data = new DataTable();
            ICallDatabase dr = new CallDatabase();

            dr.InitiCommand();
            dr.CommandText = "select Login_Name,ModuleName,OperationType,Result,ResultsDescribed,Creation_Date from [Log_Operating] where Id=@Id ";
            dr.AddParameters("Id", DbType.Int32, id);
            DataSet data = dr.DataList();

            dr.CommandText    = "select  Contents from [Log_Operating_Contents] where L_Id=@Id order by [No]";
            log_Contents_Data = dr.DataList().Tables[0];
            dr.Close();
            dr.Dispose();
            return(data);
        }