示例#1
0
        /// <summary>
        /// 获取指定的Bug日志 Sys_BugLog对象集合
        /// </summary>
        public List <Sys_BugLog> GetListByWhere(string strCondition)
        {
            List <Sys_BugLog> ret = new List <Sys_BugLog>();
            string            sql = "SELECT  SL_ID,SL_Code,SL_OpUser,SL_Date,SL_Status,SL_Owner,Stat FROM Sys_BugLog WHERE 1=1 AND ((Stat is null) or (Stat=0) ) ";

            if (!string.IsNullOrEmpty(strCondition))
            {
                strCondition.Replace('\'', '"'); //防sql注入
                sql += strCondition;
            }
            SqlDataReader dr = null;

            try {
                sql += "ORDER BY SL_ID DESC";
                dr   = (SqlDataReader)idb.ReturnReader(sql);
                while (dr.Read())
                {
                    Sys_BugLog sys_BugLog = new Sys_BugLog();
                    if (dr["SL_ID"] != DBNull.Value)
                    {
                        sys_BugLog.SL_ID = Convert.ToDecimal(dr["SL_ID"]);
                    }
                    if (dr["SL_Code"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Code = Convert.ToString(dr["SL_Code"]);
                    }
                    if (dr["SL_OpUser"] != DBNull.Value)
                    {
                        sys_BugLog.SL_OpUser = Convert.ToString(dr["SL_OpUser"]);
                    }
                    if (dr["SL_Date"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Date = Convert.ToDateTime(dr["SL_Date"]);
                    }
                    if (dr["SL_Status"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Status = Convert.ToString(dr["SL_Status"]);
                    }
                    if (dr["SL_Owner"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Owner = Convert.ToString(dr["SL_Owner"]);
                    }
                    if (dr["Stat"] != DBNull.Value)
                    {
                        sys_BugLog.Stat = Convert.ToInt32(dr["Stat"]);
                    }
                    ret.Add(sys_BugLog);
                }
            }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);
        }
示例#2
0
        public ActionResult Get(string oper, string id)
        {
            string     Form     = Request["form"];
            Sys_Bug    model    = new Sys_Bug();
            Sys_BugLog Logmodel = new Sys_BugLog();

            if (!string.IsNullOrEmpty(Form))
            {
                model = JsonConvert.DeserializeObject <Sys_Bug>(Form);
            }
            Logmodel.SL_Code   = model.Sys_Code;
            Logmodel.SL_OpUser = SessionConfig.UserName();
            Logmodel.SL_Date   = DateTime.Now;
            Logmodel.SL_Status = model.Sys_Status;
            Logmodel.SL_Owner  = model.Sys_Owner;
            if (oper == JqGridEnum.view.ToString())
            {
                List <Sys_Bug> list = bugInstance.GetListByCode(" AND Sys_Code='" + id + "'");
                model = new Sys_Bug();
                if (list.Count > 0)
                {
                    model = list[0];
                }
                return(JavaScript(JsonConvert.SerializeObject(model, new JsonDateConverter("yyyy-MM-dd HH:mm"))));
            }
            else if (oper == JqGridEnum.edit.ToString())
            {
                model.Sys_ID = bugInstance.GetModel(" AND Sys_Code='" + model.Sys_Code + "'  ").Sys_ID;
                bool result = bugInstance.Update(model);
                result = buglogInstance.Insert(Logmodel);
                string strResult = result ? "success" : "fail";

                return(Content(strResult));
            }
            else if (oper == JqGridEnum.del.ToString())
            {
                bool   result    = bugInstance.Delete(" AND WHBM_Code='" + id + "'");
                string strResult = result ? "success" : "fail";

                return(Content(strResult));
            }
            else if (oper == JqGridEnum.add.ToString())
            {
                string form = Request["form"];
                model.Sys_Date = DateTime.Now;
                bool result = bugInstance.Insert(model);
                result = buglogInstance.Insert(Logmodel);
                string strResult = result ? "success" : "fail";

                return(Content(strResult));
            }
            else
            {
                return(new EmptyResult());
            }
        }
示例#3
0
        /// <summary>
        /// 获取指定的Bug日志 Sys_BugLog对象(即:一条记录
        /// </summary>
        public Sys_BugLog GetByKey(decimal sL_ID)
        {
            Sys_BugLog sys_BugLog = new Sys_BugLog();
            string     sql        = "SELECT  SL_ID,SL_Code,SL_OpUser,SL_Date,SL_Status,SL_Owner,Stat FROM Sys_BugLog WHERE 1=1 AND ((Stat is null) or (Stat=0) )  AND SL_ID=@SL_ID ";

            idb.AddParameter("@SL_ID", sL_ID);

            SqlDataReader dr = null;

            try {
                sql += "ORDER BY SL_ID DESC";
                dr   = (SqlDataReader)idb.ReturnReader(sql);
                while (dr.Read())
                {
                    if (dr["SL_ID"] != DBNull.Value)
                    {
                        sys_BugLog.SL_ID = Convert.ToDecimal(dr["SL_ID"]);
                    }
                    if (dr["SL_Code"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Code = Convert.ToString(dr["SL_Code"]);
                    }
                    if (dr["SL_OpUser"] != DBNull.Value)
                    {
                        sys_BugLog.SL_OpUser = Convert.ToString(dr["SL_OpUser"]);
                    }
                    if (dr["SL_Date"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Date = Convert.ToDateTime(dr["SL_Date"]);
                    }
                    if (dr["SL_Status"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Status = Convert.ToString(dr["SL_Status"]);
                    }
                    if (dr["SL_Owner"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Owner = Convert.ToString(dr["SL_Owner"]);
                    }
                    if (dr["Stat"] != DBNull.Value)
                    {
                        sys_BugLog.Stat = Convert.ToInt32(dr["Stat"]);
                    }
                }
            }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(sys_BugLog);
        }
示例#4
0
        /// <summary>
        /// 获取所有的Bug日志 Sys_BugLog对象(即:一条记录
        /// </summary>
        public List <Sys_BugLog> GetAll()
        {
            List <Sys_BugLog> ret = new List <Sys_BugLog>();
            string            sql = "SELECT  SL_ID,SL_Code,SL_OpUser,SL_Date,SL_Status,SL_Owner,Stat FROM Sys_BugLog where 1=1 AND ((Stat is null) or (Stat=0) ) order by SL_ID desc ";
            SqlDataReader     dr  = null;

            try {
                // sql += "ORDER BY SL_ID DESC";
                dr = (SqlDataReader)idb.ReturnReader(sql);
                while (dr.Read())
                {
                    Sys_BugLog sys_BugLog = new Sys_BugLog();
                    if (dr["SL_ID"] != DBNull.Value)
                    {
                        sys_BugLog.SL_ID = Convert.ToDecimal(dr["SL_ID"]);
                    }
                    if (dr["SL_Code"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Code = Convert.ToString(dr["SL_Code"]);
                    }
                    if (dr["SL_OpUser"] != DBNull.Value)
                    {
                        sys_BugLog.SL_OpUser = Convert.ToString(dr["SL_OpUser"]);
                    }
                    if (dr["SL_Date"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Date = Convert.ToDateTime(dr["SL_Date"]);
                    }
                    if (dr["SL_Status"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Status = Convert.ToString(dr["SL_Status"]);
                    }
                    if (dr["SL_Owner"] != DBNull.Value)
                    {
                        sys_BugLog.SL_Owner = Convert.ToString(dr["SL_Owner"]);
                    }
                    if (dr["Stat"] != DBNull.Value)
                    {
                        sys_BugLog.Stat = Convert.ToInt32(dr["Stat"]);
                    }
                    ret.Add(sys_BugLog);
                }
            }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);
        }
示例#5
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name='model'>实体</param>
        /// <returns>bool</returns>
        public bool Update(Sys_BugLog model)
        {
            bool result  = false;
            var  e       = new ModelExceptions();
            int  _rseult = instance.Update(model);

            if (_rseult > 0)
            {
                result = true;
            }
            return(result);
        }
示例#6
0
        /// <summary>
        /// 获取实体数据
        /// </summary>
        /// <param name='strCondition'>条件(AND Code='11')</param>
        /// <returns>model</returns>
        public Sys_BugLog GetModel(string strCondition)
        {
            List <Sys_BugLog> list  = instance.GetListByWhere(strCondition);
            Sys_BugLog        model = new Sys_BugLog();

            if (list != null && list.Count > 0)
            {
                model = list[0];
            }
            else
            {
                model = null;
            }
            return(model);
        }
示例#7
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name='model'>实体</param>
        /// <param name='model'>是否完成验证</param>
        /// <returns>bool</returns>
        public bool Insert(Sys_BugLog 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);
        }
示例#8
0
        /// <summary>
        /// 逻辑删除数据
        /// </summary>
        /// <param name='model'>model</param>
        /// <returns>bool</returns>
        public bool Delete(string Condition)
        {
            bool result            = false;
            List <Sys_BugLog> list = instance.GetListByWhere(Condition);

            if (list.Count > 0)
            {
                Sys_BugLog model = list[0];
                model.Stat = 1;
                int _rseult = instance.Update(model);
                if (_rseult > 0)
                {
                    result = true;
                }
            }
            return(result);
        }
示例#9
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name='model'>实体</param>
        /// <returns>bool</returns>
        public bool Insert(Sys_BugLog model)
        {
            bool result = false;

            try
            {
                int _result = instance.Add(model);
                if (_result > 0)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
示例#10
0
        /// <summary>
        /// 添加Bug日志 Sys_BugLog对象(即:一条记录)
        /// </summary>
        public int Add(Sys_BugLog sys_BugLog)
        {
            string sql = "INSERT INTO Sys_BugLog (SL_Code,SL_OpUser,SL_Date,SL_Status,SL_Owner,Stat) VALUES (@SL_Code,@SL_OpUser,@SL_Date,@SL_Status,@SL_Owner,@Stat)";

            if (string.IsNullOrEmpty(sys_BugLog.SL_Code))
            {
                idb.AddParameter("@SL_Code", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@SL_Code", sys_BugLog.SL_Code);
            }
            if (string.IsNullOrEmpty(sys_BugLog.SL_OpUser))
            {
                idb.AddParameter("@SL_OpUser", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@SL_OpUser", sys_BugLog.SL_OpUser);
            }
            if (sys_BugLog.SL_Date == DateTime.MinValue)
            {
                idb.AddParameter("@SL_Date", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@SL_Date", sys_BugLog.SL_Date);
            }
            if (string.IsNullOrEmpty(sys_BugLog.SL_Status))
            {
                idb.AddParameter("@SL_Status", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@SL_Status", sys_BugLog.SL_Status);
            }
            if (string.IsNullOrEmpty(sys_BugLog.SL_Owner))
            {
                idb.AddParameter("@SL_Owner", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@SL_Owner", sys_BugLog.SL_Owner);
            }
            if (sys_BugLog.Stat == 0)
            {
                idb.AddParameter("@Stat", 0);
            }
            else
            {
                idb.AddParameter("@Stat", sys_BugLog.Stat);
            }


            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);
        }
示例#11
0
        /// <summary>
        /// 更新Bug日志 Sys_BugLog对象(即:一条记录
        /// </summary>
        public int Update(Sys_BugLog sys_BugLog)
        {
            StringBuilder sbParameter = new StringBuilder();
            StringBuilder sb          = new StringBuilder();

            sb.Append(@"UPDATE       Sys_BugLog       SET ");
            if (sys_BugLog.SL_Code_IsChanged)
            {
                sbParameter.Append("SL_Code=@SL_Code, ");
            }
            if (sys_BugLog.SL_OpUser_IsChanged)
            {
                sbParameter.Append("SL_OpUser=@SL_OpUser, ");
            }
            if (sys_BugLog.SL_Date_IsChanged)
            {
                sbParameter.Append("SL_Date=@SL_Date, ");
            }
            if (sys_BugLog.SL_Status_IsChanged)
            {
                sbParameter.Append("SL_Status=@SL_Status, ");
            }
            if (sys_BugLog.SL_Owner_IsChanged)
            {
                sbParameter.Append("SL_Owner=@SL_Owner, ");
            }
            if (sys_BugLog.Stat_IsChanged)
            {
                sbParameter.Append("Stat=@Stat ");
            }
            sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
            sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0))   and SL_ID=@SL_ID; ");
            string sql = sb.ToString();

            if (sys_BugLog.SL_Code_IsChanged)
            {
                if (string.IsNullOrEmpty(sys_BugLog.SL_Code))
                {
                    idb.AddParameter("@SL_Code", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@SL_Code", sys_BugLog.SL_Code);
                }
            }
            if (sys_BugLog.SL_OpUser_IsChanged)
            {
                if (string.IsNullOrEmpty(sys_BugLog.SL_OpUser))
                {
                    idb.AddParameter("@SL_OpUser", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@SL_OpUser", sys_BugLog.SL_OpUser);
                }
            }
            if (sys_BugLog.SL_Date_IsChanged)
            {
                if (sys_BugLog.SL_Date == DateTime.MinValue)
                {
                    idb.AddParameter("@SL_Date", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@SL_Date", sys_BugLog.SL_Date);
                }
            }
            if (sys_BugLog.SL_Status_IsChanged)
            {
                if (string.IsNullOrEmpty(sys_BugLog.SL_Status))
                {
                    idb.AddParameter("@SL_Status", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@SL_Status", sys_BugLog.SL_Status);
                }
            }
            if (sys_BugLog.SL_Owner_IsChanged)
            {
                if (string.IsNullOrEmpty(sys_BugLog.SL_Owner))
                {
                    idb.AddParameter("@SL_Owner", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@SL_Owner", sys_BugLog.SL_Owner);
                }
            }
            if (sys_BugLog.Stat_IsChanged)
            {
                if (sys_BugLog.Stat == 0)
                {
                    idb.AddParameter("@Stat", 0);
                }
                else
                {
                    idb.AddParameter("@Stat", sys_BugLog.Stat);
                }
            }

            idb.AddParameter("@SL_ID", sys_BugLog.SL_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);
        }
示例#12
0
        /// <summary>
        /// 获取实体数据
        /// </summary>
        /// <param name='strCondition'>条件(AND Code='11')</param>
        /// <returns>model</returns>
        public Sys_BugLog GetModel(int id)
        {
            Sys_BugLog model = instance.GetByKey(id);

            return(model);
        }