示例#1
0
 internal List <ApplicationRole> GetByRoleId(long roleId)
 {
     try
     {
         ApplicationRoleFilterQuery filterQuery = new ApplicationRoleFilterQuery();
         filterQuery.RoleId = roleId;
         return(this.Get(filterQuery));
     }
     catch (Exception ex)
     {
         LogSystem.Error(ex);
         param.HasException = true;
         return(null);
     }
 }
示例#2
0
        /// <summary>
        /// Su dung de kiem tra list co du lieu.
        /// True neu listData != null && Count > 0.
        /// False neu nguoc lai.
        /// </summary>
        /// <param name="listData"></param>
        /// <returns></returns>
        protected bool IsNotNullOrEmpty(ICollection listData)
        {
            bool result = false;

            try
            {
                result = (listData != null && listData.Count > 0);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = false;
            }
            return(result);
        }
示例#3
0
        /// <summary>
        /// Su dung de kiem tra cac truong ID trong CSDL.
        /// True neu id > 0.
        /// False neu nguoc lai.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        protected bool IsGreaterThanZero(long id)
        {
            bool result = false;

            try
            {
                result = (id > 0);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = false;
            }
            return(result);
        }
示例#4
0
        /// <summary>
        /// True neu data != null.
        /// False neu nguoc lai.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        protected bool IsNotNull(Object data)
        {
            bool result = false;

            try
            {
                result = (data != null);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = false;
            }
            return(result);
        }
示例#5
0
        /// <summary>
        /// True neu string != NullOrEmpty.
        /// False neu nguoc lai.
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        protected bool IsNotNullOrEmpty(string data)
        {
            bool result = false;

            try
            {
                result = (!String.IsNullOrEmpty(data));
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = false;
            }
            return(result);
        }
示例#6
0
        public bool IsObjectInArea(ISpaceObject obj, Shape area)
        {
            if (null == obj || null == area)
            {
                return(false);
            }
            Shape shape = obj.GetCollideShape();

            if (null == shape)
            {
                LogSystem.Error("IsObjectInArea:obj({0}[{1}])'s shape is null", obj.GetID(), obj.GetObjType());
                return(false);
            }
            return(collide_detector_.Intersect(shape, area));
        }
示例#7
0
        public bool UpdateList(List <Module> listData)
        {
            bool result = false;

            try
            {
                result = UpdateWorker.UpdateList(listData);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = false;
            }
            return(result);
        }
示例#8
0
        public bool CreateList(List <Application> listData)
        {
            bool result = false;

            try
            {
                result = CreateWorker.CreateList(listData);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = false;
            }
            return(result);
        }
示例#9
0
        public bool Update(Application data)
        {
            bool result = false;

            try
            {
                result = UpdateWorker.Update(data);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = false;
            }
            return(result);
        }
示例#10
0
        public bool TruncateList(List <Address> listData)
        {
            bool result = false;

            try
            {
                result = TruncateWorker.TruncateList(listData);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = false;
            }
            return(result);
        }
示例#11
0
 private void ucPaging_LoadDataEvent(object sender, EventArgs e)
 {
     try
     {
         if (sender != null && sender is CommonParam)
         {
             UserListViewModel viewModel = this.DataContext as UserListViewModel;
             viewModel.LoadPaging((CommonParam)sender);
         }
     }
     catch (Exception ex)
     {
         LogSystem.Error(ex);
     }
 }
示例#12
0
        public bool Truncate(Role data)
        {
            bool result = false;

            try
            {
                result = TruncateWorker.Truncate(data);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = false;
            }
            return(result);
        }
示例#13
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         UCPagingViewModel viewModel = this.DataContext as UCPagingViewModel;
         if (viewModel != null)
         {
             this.LoadDataEvent(viewModel.GetParam(), EventArgs.Empty);
         }
     }
     catch (Exception ex)
     {
         LogSystem.Error(ex);
     }
 }
示例#14
0
 public static IPlugin GetPlugin(string name)
 {
     try
     {
         if (_DIC_PLUGIN.ContainsKey(name))
         {
             return(_DIC_PLUGIN[name]);
         }
     }
     catch (Exception ex)
     {
         LogSystem.Error(ex);
     }
     return(null);
 }
 internal void LateUpdate()
 {
     try {
         if (null == m_Camera || !m_Camera.enabled)
         {
             return;
         }
         if (!m_ControlByOtherScript)
         {
             Apply();
         }
     } catch (System.Exception ex) {
         LogSystem.Error("MainCamera.LateUpdate throw exception {0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
示例#16
0
        public bool Create(Module data)
        {
            bool result = false;

            try
            {
                result = CreateWorker.Create(data);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = false;
            }
            return(result);
        }
示例#17
0
 internal List <Post> GetByProjectId(long projectId)
 {
     try
     {
         PcsPostFilterQuery filter = new PcsPostFilterQuery();
         filter.ProjectId = projectId;
         return(this.Get(filter));
     }
     catch (Exception ex)
     {
         LogSystem.Error(ex);
         param.HasException = true;
     }
     return(null);
 }
示例#18
0
 private void RequestClientFriends()
 {
     try
     {
         RoleInfo role_info = LobbyClient.Instance.CurrentRole;
         if (null != role_info && null != role_info.Friends)
         {
             GfxSystem.PublishGfxEvent("ge_client_friends", "friend", role_info.Friends);
         }
     }
     catch (Exception ex)
     {
         LogSystem.Error("Exception:{0}\n{1}", ex.Message, ex.StackTrace);
     }
 }
        internal bool SendMessage(string msgStr)
        {
            bool ret = false;

            try {
                if (IsConnected)
                {
                    m_WebSocket.Send(msgStr);
                    ret = true;
                }
            } catch (Exception ex) {
                LogSystem.Error("SendMessage throw exception:{0}\n{1}", ex.Message, ex.StackTrace);
            }
            return(ret);
        }
示例#20
0
        internal bool ValidData(PcsPostSDO data, ref List <Post> listPost)
        {
            bool valid = true;

            try
            {
                List <Post> posts = new List <Post>();
                if (IsNotNullOrEmpty(data.Posts))
                {
                    valid = valid && new PcsPostCheck(param).VerifyIds(data.Posts.Select(s => s.Id).ToList(), posts);
                    if (!valid)
                    {
                        return(valid);
                    }
                    if (!IsNotNullOrEmpty(posts))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.Common__DuLieuDauVaoKhongChinhXac);
                        throw new Exception("PostIds invalid");
                    }

                    if (posts.Exists(e => e.ProjectId != data.ProjectId))
                    {
                        MessageUtil.SetMessage(param, LibraryMessage.Message.Enum.PcsPost__TonTaiBaiDangKhongThuocDuAn);
                        throw new Exception("Ton tai bai dang khong thuoc du an");
                    }
                }
                else
                {
                    PcsPostFilterQuery filterQuery = new PcsPostFilterQuery();
                    filterQuery.ProjectId = data.ProjectId;
                    filterQuery.PostSttId = PostSttConstant.POST_STT_ID__NOT_APPROVAL;
                    posts = new PcsPostManagerGet().Get(filterQuery);
                    if (!IsNotNullOrEmpty(posts))
                    {
                        MessageUtil.SetMessage(param, LibraryMessage.Message.Enum.PcsPost__DuAnKhongCoBaiDangNaoHopLe);
                        throw new Exception("Project Khong co bai dang nao hop le");
                    }
                }
                listPost = posts;
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                valid = false;
                param.HasException = true;
            }
            return(valid);
        }
 public static Dsl.DslFile LoadStory(string file)
 {
     if (!string.IsNullOrEmpty(file))
     {
         Dsl.DslFile dataFile = new Dsl.DslFile();
         var         bytes    = new byte[Dsl.DslFile.c_BinaryIdentity.Length];
         using (var fs = File.OpenRead(file)) {
             fs.Read(bytes, 0, bytes.Length);
             fs.Close();
         }
         var id = System.Text.Encoding.ASCII.GetString(bytes);
         if (id == Dsl.DslFile.c_BinaryIdentity)
         {
             try {
                 dataFile.LoadBinaryFile(file, StoryConfigManager.ReuseKeyBuffer, StoryConfigManager.ReuseIdBuffer);
                 return(dataFile);
             }
             catch (Exception ex) {
                 var sb = new System.Text.StringBuilder();
                 sb.AppendFormat("[LoadStory] LoadStory file:{0} Exception:{1}\n{2}", file, ex.Message, ex.StackTrace);
                 sb.AppendLine();
                 Helper.LogInnerException(ex, sb);
                 LogSystem.Error("{0}", sb.ToString());
             }
         }
         else
         {
             try {
                 if (dataFile.Load(file, LogSystem.Log))
                 {
                     return(dataFile);
                 }
                 else
                 {
                     LogSystem.Error("LoadStory file:{0} failed", file);
                 }
             }
             catch (Exception ex) {
                 var sb = new System.Text.StringBuilder();
                 sb.AppendFormat("[LoadStory] LoadStory file:{0} Exception:{1}\n{2}", file, ex.Message, ex.StackTrace);
                 sb.AppendLine();
                 Helper.LogInnerException(ex, sb);
                 LogSystem.Error("{0}", sb.ToString());
             }
         }
     }
     return(null);
 }
示例#22
0
        internal bool Create(Post data)
        {
            bool result = false;

            try
            {
                bool            valid          = true;
                Project         project        = null;
                PcsPostCheck    checker        = new PcsPostCheck(param);
                PcsProjectCheck projectChecker = new PcsProjectCheck(param);
                valid = valid && IsNotNull(data);
                valid = valid && checker.VerifyRequireField(data);
                valid = valid && projectChecker.VerifyId(data.ProjectId, ref project);
                valid = valid && projectChecker.IsUnFinish(project);
                if (valid)
                {
                    data.PostSttId = PostSttConstant.POST_STT_ID__NOT_APPROVAL;
                    if (String.IsNullOrWhiteSpace(data.PostType))
                    {
                        data.PostType = "post";
                    }
                    if (String.IsNullOrWhiteSpace(data.Status))
                    {
                        data.Status = "publish";
                    }
                    data.ApprovalLoginname = null;
                    data.ApprovalTime      = null;
                    data.ApprovalUsername  = null;
                    data.PostTime          = null;
                    data.ApprovalNote      = null;

                    if (!DAOWorker.PcsPostDAO.Create(data))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.PcsPost_ThemMoiThatBai);
                        throw new Exception("Them moi thong tin PcsPost that bai." + LogUtil.TraceData("data", data));
                    }
                    this.recentPcsPosts.Add(data);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
        public Role GetByCode(string code, AasRoleSO search)
        {
            Role result = null;

            try
            {
                result = GetWorker.GetByCode(code, search);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = null;
            }

            return(result);
        }
示例#24
0
        public RAW GetSqlSingle <RAW>(string sql, params object[] parameters)
        {
            RAW result = default(RAW);

            try
            {
                result = SqlWorker.GetSqlSingle <RAW>(sql, parameters);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = default(RAW);
            }

            return(result);
        }
示例#25
0
        public List <RAW> GetSql <RAW>(string sql, params object[] parameters)
        {
            List <RAW> result = new List <RAW>();

            try
            {
                result = SqlWorker.GetSql <RAW>(sql, parameters);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result.Clear();
            }

            return(result);
        }
示例#26
0
        internal bool CheckConstraint(long id)
        {
            bool valid = true;

            try
            {
                //TODO
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                valid = false;
                param.HasException = true;
            }
            return(valid);
        }
示例#27
0
        public Employee GetByLoginname(string loginname, PcsEmployeeSO search)
        {
            Employee result = null;

            try
            {
                result = GetWorker.GetByLoginname(loginname, search);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = null;
            }

            return(result);
        }
示例#28
0
        public Employee GetById(long id, PcsEmployeeSO search)
        {
            Employee result = null;

            try
            {
                result = GetWorker.GetById(id, search);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = null;
            }

            return(result);
        }
示例#29
0
        public List <Employee> Get(PcsEmployeeSO search, CommonParam param)
        {
            List <Employee> result = new List <Employee>();

            try
            {
                result = GetWorker.Get(search, param);
            }
            catch (Exception ex)
            {
                param.HasException = true;
                LogSystem.Error(ex);
                result.Clear();
            }
            return(result);
        }
示例#30
0
        public Application GetByCode(string code, AasApplicationSO search)
        {
            Application result = null;

            try
            {
                result = GetWorker.GetByCode(code, search);
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                result = null;
            }

            return(result);
        }