Ejemplo n.º 1
0
        public ResponseBoolBase HttpResultSaveStatus(long id, HttpTaskModel.TaskStatus status, AnalyseHtmlStatus astatus)
        {
            ResponseBoolBase obj = new ResponseBoolBase();

            try
            {
                datapro.EnterWriteLock();
                HttpTaskDBContext db = new HttpTaskDBContext();
                var d = db.HttpResultCfg.Find(id);
                d.TaskStatus    = status;
                d.AnalyseStatus = astatus;
                int i = db.SaveChanges();
                if (i == 0)
                {
                    obj.IsSuccess = false;
                }
                else
                {
                    obj.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                obj.IsSuccess = false;
                obj           = ResponseBase.GetResponseByException <ResponseBoolBase>(ex);
            }
            finally
            {
                datapro.ExitWriteLock();
            }
            return(obj);
        }
Ejemplo n.º 2
0
        public ResponseBoolBase HttpResultCfgSave(HttpResultCfgDataUI data)
        {
            ResponseBoolBase obj = new ResponseBoolBase();

            try
            {
                //datapro.EnterWriteLock();
                HttpTaskDBContext db = new HttpTaskDBContext();
                var d = db.HttpResultCfg.Find(data.Id);
                d = data;
                int i = db.SaveChanges();
                if (i == 0)
                {
                    obj.IsSuccess = false;
                }
                else
                {
                    obj.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                obj.IsSuccess = false;
                obj           = ResponseBase.GetResponseByException <ResponseBoolBase>(ex);
                logger.ErrorFormat("HttpResultCfgSave", ex);
            }
            finally
            {
                //datapro.ExitWriteLock();
            }
            return(obj);
        }
Ejemplo n.º 3
0
        public ResponseBoolBase HttpRequestCfgAdd(HttpRequestCfg data)
        {
            ResponseBoolBase obj = new ResponseBoolBase();

            try
            {
                datapro.EnterWriteLock();
                HttpTaskDBContext db = new HttpTaskDBContext();
                db.HttpRequestCfg.Add(data);
                int i = db.SaveChanges();
                if (i == 0)
                {
                    obj.IsSuccess = false;
                }
                else
                {
                    obj.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                obj.IsSuccess = false;
                obj           = ResponseBase.GetResponseByException <ResponseBoolBase>(ex);
                logger.ErrorFormat("HttpRequestCfgAdd", ex);
            }
            finally
            {
                datapro.ExitWriteLock();
            }
            return(obj);
        }
Ejemplo n.º 4
0
        public ResponseBoolBase HttpRequestChildCfgAdd(HttpRequestChildCfgDataUI data)
        {
            ResponseBoolBase obj = new ResponseBoolBase();

            try
            {
                datapro.EnterWriteLock();
                using (HttpTaskDBContext db = new HttpTaskDBContext())
                {
                    db.HttpRequestChildCfg.Add(data);
                    int i = db.SaveChanges();
                    if (i == 0)
                    {
                        obj.IsSuccess = false;
                    }
                    else
                    {
                        obj.IsSuccess = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                obj.IsSuccess = false;
                obj           = ResponseBase.GetResponseByException <ResponseBoolBase>(ex);
            }
            finally
            {
                datapro.ExitWriteLock();
            }
            return(obj);
        }
Ejemplo n.º 5
0
        public ResponseBoolBase HttpRequestCfgSaveStatus(long id, HttpTaskModel.TaskStatus status, int CurrentPage, DateTime?CurrentDate, string info = "")
        {
            ResponseBoolBase obj = new ResponseBoolBase();

            try
            {
                datapro.EnterWriteLock();
                HttpTaskDBContext db = new HttpTaskDBContext();
                var d = db.HttpRequestCfg.Find(id);
                d.TaskStatus  = status;
                d.CurrentPage = CurrentPage;
                d.CurrentDate = CurrentDate;
                d.info        = info;
                int i = db.SaveChanges();
                if (i == 0)
                {
                    obj.IsSuccess = false;
                }
                else
                {
                    obj.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                obj.IsSuccess = false;
                obj           = ResponseBase.GetResponseByException <ResponseBoolBase>(ex);
            }
            finally
            {
                datapro.ExitWriteLock();
            }
            return(obj);
        }
Ejemplo n.º 6
0
        public ResponseBoolBase HttpResultCfgAdd(HttpResultCfgDataUI data)
        {
            ResponseBoolBase obj = new ResponseBoolBase();

            try
            {
                //datapro.EnterWriteLock();
                HttpTaskDBContext db = new HttpTaskDBContext();
                HttpResponseCfg   d  = new HttpResponseCfg()
                {
                    Binary = data.Binary, CreatedTime = data.CreatedTime, DeletedTime = data.DeletedTime, FullText = data.FullText, HttpStatusCode = data.HttpStatusCode, Id = data.Id, info = data.info, IsDelete = data.IsDelete, Key = data.Key, Page = data.Page, RequstChildId = data.RequstChildId, ResponseType = data.ResponseType, SearchKey = data.SearchKey, SeqNo = data.SeqNo, TaskStatus = data.TaskStatus, UpdatedTime = data.UpdatedTime, AnalyseStatus = HttpTaskManage.AnalyseHtmlStatus.Created, WebName = data.WebName, Date = data.Date
                };
                db.HttpResultCfg.Add(d);
                int i = db.SaveChanges();
                if (i == 0)
                {
                    obj.IsSuccess = false;
                }
                else
                {
                    obj.IsSuccess = true;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                obj.IsSuccess = false;
                obj           = ResponseBase.GetResponseByException <ResponseBoolBase>(ex);
                logger.ErrorFormat("HttpResultCfgAdd", ex);
            }
            finally
            {
                //datapro.ExitWriteLock();
            }
            return(obj);
        }