Beispiel #1
0
        public NewDocLayoutViewModel(bool isedit, CongVan cv)
        {
            edit = isedit;

            editID         = cv.Id;
            SoVao          = (int)cv.SoCongVan;
            NgayNhan       = cv.NgayXuLi;
            TrichYeu       = cv.TrichYeu;
            NoiGui         = cv.NoiGui;
            VisibleButton  = "Visible";
            VisibleTextBox = "Collapsed";
            foreach (NoiNhan item in cv.DanhSachNoiNhan)
            {
                DSNoiNhan.Add(new LienHeShort()
                {
                    Email = item.LienHe.Email, TenLienHe = item.LienHe.Name
                });
            }
            NgayTrenCongVan = (DateTime)cv.NgayCongVan;
            GhiChu          = cv.GhiChu;

            listLoaiCongVan = new ObservableCollection <string>();

            ResetListCongVan();
            ResetListMaKyHieu();
            SoKyHieu            = cv.SoKyHieu.Remove(cv.SoKyHieu.IndexOf("/"));
            MaKyHieu            = cv.SoKyHieu.Remove(0, cv.SoKyHieu.IndexOf("/") + 1);
            selectedLoaiCongVan = cv.LoaiCongVan.Id;

            filename = showFileName = cv.PDFScanLocation;

            IsVisibleHuy = "Visible";
        }
Beispiel #2
0
 public void ValueChanged(object sender, string[] args = null)
 {
     if (sender is CongVan)
     {
         CongVan target = sender as CongVan;
         target.NgayXuLi = System.DateTime.Now;
         // TODO: Update database
     }
 }
Beispiel #3
0
        protected List <CongVan> XuLyVanBan_New(string noiDungHTML)
        {
            var ret     = new List <CongVan>();
            var htmlDoc = new HtmlDocument();

            if (!string.IsNullOrEmpty(noiDungHTML))
            {
                htmlDoc.LoadHtml(noiDungHTML);
            }
            else
            {
                return(ret);
            }
            var pNotes = htmlDoc.DocumentNode.SelectNodes("//text()[normalize-space()]");
            var i      = 1;

            foreach (var p in pNotes)
            {
                if (!string.IsNullOrWhiteSpace(p.InnerText))
                {
                    var isParentContent      = p.ParentNode.Name == "b" || p.ParentNode.Name == "i" || p.ParentNode.Name == "u";
                    var isGrandContent       = p.ParentNode.ParentNode != null ? p.ParentNode.ParentNode.Name == "b" || p.ParentNode.ParentNode.Name == "i" || p.ParentNode.ParentNode.Name == "u" : false;
                    var isGrandParentContent = (p.ParentNode.ParentNode != null && p.ParentNode.ParentNode.ParentNode != null) ? p.ParentNode.ParentNode.ParentNode.Name == "b" || p.ParentNode.ParentNode.ParentNode.Name == "i" || p.ParentNode.ParentNode.ParentNode.Name == "u" : false;

                    var addContent = p.OuterHtml;
                    if (isParentContent)
                    {
                        addContent = p.ParentNode.OuterHtml.Replace("<br>", "");
                    }
                    if (isGrandContent)
                    {
                        addContent = p.ParentNode.ParentNode.OuterHtml.Replace("<br>", "");
                    }
                    if (isGrandParentContent)
                    {
                        addContent = p.ParentNode.ParentNode.ParentNode.OuterHtml.Replace("<br>", "");
                    }

                    var cv = new CongVan();
                    cv.Id         = i;
                    cv.TenCongVan = addContent;
                    i++;
                    ret.Add(cv);
                }
            }
            return(ret);
        }
Beispiel #4
0
        public override bool Filter(CongVan item)
        {
            string filterText = MainWindowViewModel.Ins.FilterText;

            if (!Match(item, filterText))
            {
                return(false);
            }

            foreach (var func in filterList)
            {
                if (func?.Invoke(item) == true)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #5
0
 private bool Filter(CongVan item)
 {
     return((UCFilter.DataContext as FilterSetting).Filter(item));
 }
Beispiel #6
0
        public bool Match(CongVan cv, string MatchText)
        {
            if (MatchText is null || MatchText == "")
            {
                return(true);
            }

            List <string> matchItem = new List <string>();

            string[] strSplit = MatchText.Split('"');
            for (int i = 0; i < strSplit.Count(); i++)
            {
                if (strSplit[i] == "")
                {
                    continue;
                }
                if (i % 2 == 1)
                {
                    matchItem.Add(strSplit[i]);
                }
                else
                {
                    string[] wordSplit = strSplit[i].Split(' ');
                    foreach (string word in wordSplit)
                    {
                        matchItem.Add(word);
                    }
                }
            }

            foreach (string word in matchItem)
            {
                if (cv.GhiChu != null && cv.GhiChu.ToLower().Contains(word.ToLower()))
                {
                    return(true);
                }
                if (cv.LoaiCongVan != null && cv.LoaiCongVan.Id.Contains(word.ToUpper()))
                {
                    return(true);
                }
                if (cv.SoKyHieu == word)
                {
                    return(true);
                }
                if (cv.TrichYeu != null && cv.TrichYeu.ToLower().Contains(word.ToLower()))
                {
                    return(true);
                }
                if (cv.Status != null && cv.Status.ToLower().Contains(word.ToLower()))
                {
                    return(true);
                }
                if (cv.NoiGui != null && cv.NoiGui.Name.ToLower().Contains(word.ToLower()))
                {
                    return(true);
                }
                if (cv.NoiGui != null && cv.NoiGui.Email == word)
                {
                    return(true);
                }
                foreach (var noiNhan in cv.DanhSachNoiNhan)
                {
                    if (noiNhan.LienHe == null)
                    {
                        continue;
                    }
                    if (noiNhan.LienHe.Name.ToLower().Contains(word.ToLower()))
                    {
                        return(true);
                    }
                    if (noiNhan.LienHe.Email == word)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #7
0
 public abstract bool Filter(CongVan cv);