コード例 #1
0
        protected void init_form(string ctrID)
        {
            if (!string.IsNullOrEmpty(ctrID))
            {
                _LogEntity = DataProvider.GetInstance().GetLogEntity(int.Parse(ctrID));

               				                				                   TextBox_ModuleName.Text = _LogEntity.ModuleName.ToString();
                                				                   TextBox_Operation.Text = _LogEntity.Operation.ToString();
                                				                   TextBox_LogContent.Text = _LogEntity.LogContent.ToString();
                                				                   TextBox_LogType.Text = _LogEntity.LogType.ToString();
                                				                   TextBox_FromUserID.Text = _LogEntity.FromUserID.ToString();
                                				                            }
        }
コード例 #2
0
        /// <summary>
        /// 写日志
        /// </summary>
        /// <param name="module">模块名称</param>
        /// <param name="operate">函数名称</param>
        /// <param name="logcontent">日志正文</param>
        /// <param name="logtype">日志类型</param>
        protected void WriteLog(string module, string operate, string logcontent, MideSmsType.LogType logtype)
        {
            LogEntity log = new LogEntity();
            log.ModuleName = module;
            log.Operation = operate;
            log.LogContent = logcontent;
            log.FromUserID = CurrentUser.ID;
            log.LogType = (int)logtype;
            log.CreateDate = DateTime.Now;

            try
            {
                DataProvider.GetInstance().AddLog(log);
            }
            catch
            {
            }
        }
コード例 #3
0
        /// <summary>
        /// 写日志
        /// </summary>
        /// <param name="module">模块名称</param>
        /// <param name="operate">函数名称</param>
        /// <param name="logcontent">日志正文</param>
        /// <param name="logtype">日志类型</param>
        protected void WriteLog(string module, string operate, string logcontent, int userID)
        {
            LogEntity log = new LogEntity();
            log.ModuleName = module;
            log.Operation = operate;
            log.LogContent = logcontent;
            log.FromUserID = userID;
            log.LogType = 2;//操作日志
            log.CreateDate = DateTime.Now;

            try
            {
                DataProvider.GetInstance().AddLog(log);
            }
            catch
            {
            }
        }
コード例 #4
0
        private MideFrameWork.Data.Entity.LogEntity GetLog(DataRow dr)
        {
            MideFrameWork.Data.Entity.LogEntity info = new MideFrameWork.Data.Entity.LogEntity();
										if(DBNull.Value==dr["ID"])
					info.ID=0;
				else
					info.ID=int.Parse(dr["ID"].ToString());
									
																								
						if(DBNull.Value==dr["ModuleName"])
				info.ModuleName= string.Empty;
			else	
				info.ModuleName= dr["ModuleName"].ToString();
																								
						if(DBNull.Value==dr["Operation"])
				info.Operation= string.Empty;
			else	
				info.Operation= dr["Operation"].ToString();
																								
						if(DBNull.Value==dr["LogContent"])
				info.LogContent= string.Empty;
			else	
				info.LogContent= dr["LogContent"].ToString();
																						if(DBNull.Value==dr["LogType"])
					info.LogType=0;
				else
					info.LogType=int.Parse(dr["LogType"].ToString());
									
																						if(DBNull.Value==dr["FromUserID"])
					info.FromUserID=0;
				else
					info.FromUserID=int.Parse(dr["FromUserID"].ToString());
									
																									if(DBNull.Value==dr["CreateDate"])
					info.CreateDate=DateTime.Now;
				else
					info.CreateDate=DateTime.Parse(dr["CreateDate"].ToString());
						
															            return info;
        }
コード例 #5
0
        protected void LogAdd()
        {
            #region 判断是否可空
		 
                                                                          
                  var _ModuleName = Request.Form["TextBox_ModuleName"];
                 if (string.IsNullOrEmpty(_ModuleName))
                   {
                        Alert("[ 模块名称(触发页面名称) ]不能为空");
                        return;
                  }
				                                           
                  var _Operation = Request.Form["TextBox_Operation"];
                 if (string.IsNullOrEmpty(_Operation))
                   {
                        Alert("[ 操作名称 ]不能为空");
                        return;
                  }
				                                           
                  var _LogContent = Request.Form["TextBox_LogContent"];
                 if (string.IsNullOrEmpty(_LogContent))
                   {
                        Alert("[ 日志正文 ]不能为空");
                        return;
                  }
				                                           
                  var _LogType = Request.Form["TextBox_LogType"];
                 if (string.IsNullOrEmpty(_LogType))
                   {
                        Alert("[ 日志类型 ]不能为空");
                        return;
                  }
				                                           
                  var _FromUserID = Request.Form["TextBox_FromUserID"];
                 if (string.IsNullOrEmpty(_FromUserID))
                   {
                        Alert("[ 用户ID ]不能为空");
                        return;
                  }
				                                                
	        #endregion
           
            #region 获取数据

            LogEntity  _LogEntity = new LogEntity();
            
               		                               	  		                            
                 	                 	                
                    _LogEntity.ModuleName =Convert.ToString(_ModuleName.ToString());
               		                        	  		                            
                 	                 	                
                    _LogEntity.Operation =Convert.ToString(_Operation.ToString());
               		                        	  		                            
                 	                 	                
                    _LogEntity.LogContent =Convert.ToString(_LogContent.ToString());
               		                        	  		                            
                 	                 	                     _LogEntity.LogType =Convert.ToInt32(_LogType.ToString());
                	                        	  		                            
                 	                 	                     _LogEntity.FromUserID =Convert.ToInt32(_FromUserID.ToString());
                	                        	  		        
		       	_LogEntity.CreateDate =DateTime.Now;
		               	              try
            {
                DataProvider.GetInstance().AddLog(_LogEntity);
            }
            catch
            {
                WriteLog("LogAdd", "添加Log", "插入数据库时出错", Common.DailyUtility.MideSmsType.LogType.SystemLog);
                Alert("添加数据时出错,请重试");
                return;
            }
            Alert("添加Log成功");
        }