Esempio n. 1
0
        private void btnFILE_Click(object sender, EventArgs e)
        {
            using (XtraOpenFileDialog xtraOpenFileDialog = new XtraOpenFileDialog())
            {
                xtraOpenFileDialog.Multiselect      = true;
                xtraOpenFileDialog.RestoreDirectory = true;
                if (xtraOpenFileDialog.ShowDialog() == DialogResult.OK)
                {
                    txtFileDinhKem.Properties.Tokens.Clear();
                    var filenames = xtraOpenFileDialog.FileNames;

                    foreach (var item in filenames)
                    {
                        string filename   = Path.GetFileName(item);
                        var    token_item = new TokenEditToken(filename + $" [{GetFileSizeFromFileNameURL(item)}]", item);
                        txtFileDinhKem.Properties.Tokens.Add(token_item);
                    }
                    try
                    {
                        txtFileDinhKem.EditValue             = string.Join(",", filenames);
                        txtFileDinhKem.Properties.PopupPanel = flyEmail;
                    }
                    catch (Exception ex)
                    {
                        XuLyGiaoDien.Alert(ex.Message, Form_Alert.enmType.Warning);
                    }
                }
            }
        }
        private IList GetCustomFilterSourceCore()
        {
            TokenEditTokenCollection        tokCol = Properties.Tokens;
            TokenEditSelectedItemCollection selCol = Properties.SelectedItems;

            if (selCol.Count == 0)
            {
                return(tokCol);
            }
            HashSet <int> indices = new HashSet <int>();

            for (int i = 0; i < selCol.Count; i++)
            {
                TokenEditToken tok = selCol[i];
                indices.Add(Properties.Tokens.IndexOf(tok));
            }
            List <TokenEditToken> list = new List <TokenEditToken>(tokCol.Count);

            for (int i = 0; i < tokCol.Count; i++)
            {
                if (indices.Contains(i))
                {
                    continue;
                }
                list.Add(tokCol[i]);
            }
            return(list);
        }
Esempio n. 3
0
 public static void InitializeHistory(TokenEdit tokenEdit)
 {
     foreach (Contact contact in DataHelper.Contacts)
     {
         TokenEditToken item = new TokenEditToken(contact.Email, contact);
         tokenEdit.Properties.Tokens.Add(item);
     }
 }
        protected override Rectangle CalcBounds(Point topPt, TokenEditToken token)
        {
            Rectangle rect = base.CalcBounds(topPt, token);
            Rectangle temp = CalcGlyphBounds(token, rect);

            checkBoxBounds[token] = new Rectangle(rect.Right, temp.Top, temp.Width, temp.Height);
            rect.Width           += CalcGlyphWidth(token) + ItemContentMargin;
            return(rect);
        }
 protected bool IsSelected(TokenEditToken tok)
 {
     foreach (TokenEditToken item in Properties.SelectedItems)
     {
         if (object.ReferenceEquals(tok, item))
         {
             return(true);
         }
     }
     return(false);
 }
        protected override Rectangle CalcBounds(Point topPt, TokenEditToken token)
        {
            if (TokenCount < 1)
            {
                return(base.CalcBounds(topPt, token));
            }

            Size      itemSize = CalcItemSize(token);
            Rectangle r        = new Rectangle(topPt, itemSize);

            r.Location = new Point(ContentRect.X, r.Bottom + IndentBetweenRows);
            return(r);
        }
        protected override IList GetDataSource()
        {
            TokenEditTokenCollection        tokCol = Properties.Tokens;
            TokenEditSelectedItemCollection selCol = Properties.SelectedItems;
            List <TokenEditToken>           list   = new List <TokenEditToken>(Properties.Tokens.Count);

            for (int i = 0; i < tokCol.Count; i++)
            {
                TokenEditToken tok = tokCol[i];
                if (IsSelected(tok))
                {
                    ObjectWrapper wr = (ObjectWrapper)tok.Value;
                    tok = new TokenEditToken(tok.Description, wr.Clone());
                }
                list.Add(tok);
            }
            return(list);
        }
Esempio n. 8
0
        private void frmCongNo_Load(object sender, EventArgs e)
        {
            //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            try
            {
                Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\THCRM", true);
                if ((key.GetValue("TepDinhKem") ?? string.Empty) != string.Empty)
                {
                    txtFileDinhKem.Properties.Tokens.Clear();
                    List <string> filenames = key.GetValue("TepDinhKem").ToString().Split(',').ToList();

                    foreach (var item in filenames)
                    {
                        string filename   = Path.GetFileName(item);
                        var    token_item = new TokenEditToken(filename + $" [{GetFileSizeFromFileNameURL(item)}]", item);
                        txtFileDinhKem.Properties.Tokens.Add(token_item);
                    }
                    try
                    {
                        txtFileDinhKem.EditValue             = string.Join(",", filenames);
                        txtFileDinhKem.Properties.PopupPanel = flyEmail;
                    }
                    catch (Exception ex)
                    {
                        XuLyGiaoDien.Alert(ex.Message, Form_Alert.enmType.Warning);
                    }
                }
                key.Close();
            }
            catch { }
            //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            dtpTuNgay.EditValue  = DateTime.ParseExact("01/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString(), "d/M/yyyy", null);
            dtpDenNgay.EditValue = (DateTime.Today.Day == 1) ? DateTime.Today : DateTime.Today.AddDays(-1);
            dateEdit1.EditValue  = DateTime.ParseExact("01/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString(), "d/M/yyyy", null).AddDays(-3);
            dateEdit2.EditValue  = DateTime.Today;
            loaiGiaoDichOBindingSource.DataSource = new D_LOAIGIAODICH().DuLieu_CongNo_TheoLoai(chk.Checked ? 1 : 2);
            tuyenBayOBindingSource.DataSource     = new D_TUYENBAY().DuLieu();
            //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            btnExcel.Enabled   = DuLieuTaoSan.Q.Lv2Excel;
            btnGuiMail.Enabled = DuLieuTaoSan.Q.Lv2GuiMail;
            btnFILE.Enabled    = DuLieuTaoSan.Q.Lv2ThemTep;
        }
Esempio n. 9
0
        private void frmCapSignIn_Load(object sender, EventArgs e)
        {
            ma     = new D_MAUEMAIL().DuLieu()[5];
            _lstDL = new D_DAILY().All(false).Where(w => w.LoaiKhachHang.Equals(1)).ToList();

            for (int i = 0; i < _lstDL.Count; i++)
            {
                _lstDL[i].TenTam = (_lstDL[i].Ten + "_" + _lstDL[i].MaAGS).ToUpper();
            }

            daiLyOBindingSource.DataSource = _lstDL;
            _lstHB = new D_HANGBAY().DuLieu().Where(w => w.SapXep).ToList();;
            hangBayOBindingSource.DataSource = _lstHB;
            List <O_NHACUNGCAP> nc = new D_NHACUNGCAP().DuLieu();

            lstSI = new D_SIGNIN().DuLieu();

            Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\THCRM", true);
            if ((key.GetValue("TepDinhKemSignIn") ?? string.Empty) != string.Empty)
            {
                txtFileDinhKem.Properties.Tokens.Clear();
                List <string> filenames = key.GetValue("TepDinhKemSignIn").ToString().Split(',').ToList();

                try
                {
                    foreach (var item in filenames)
                    {
                        string filename   = Path.GetFileName(item);
                        var    token_item = new TokenEditToken(filename + $" [{GetFileSizeFromFileNameURL(item)}]", item);
                        txtFileDinhKem.Properties.Tokens.Add(token_item);
                    }
                    txtFileDinhKem.EditValue             = string.Join(",", filenames);
                    txtFileDinhKem.Properties.PopupPanel = flyEmail;
                }
                catch (Exception ex)
                {
                    XuLyGiaoDien.Alert(ex.Message, Form_Alert.enmType.Warning);
                }
            }
        }
Esempio n. 10
0
        private void barButtonItemAttach_ItemClick(object sender, ItemClickEventArgs e)
        {
            var openFileDialog = new OpenFileDialog
            {
                RestoreDirectory = true,
                Multiselect      = true
            };

            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                var tokenAttachements = new StringBuilder();
                var tokens            = tokenEditAttachements.Properties.Tokens;
                var valueFiles        = new BindingList <string>();
                foreach (TokenEditToken selectedToken in tokenEditAttachements.GetTokenList())
                {
                    valueFiles.Add(selectedToken.Value.ToString());
                }

                foreach (var fullFileName in openFileDialog.FileNames)
                {
                    var file  = Path.GetFileName(fullFileName);
                    var token = new TokenEditToken {
                        Description = file, Value = fullFileName
                    };
                    if (tokens.FirstOrDefault(t => t.Description == token.Description) == null)
                    {
                        tokens.Add(token);
                    }
                    if (!valueFiles.Contains(fullFileName))
                    {
                        valueFiles.Add(fullFileName);
                    }
                }
                tokenEditAttachements.EditValue = valueFiles;
                //tokenEditAttachements.EditValue = tokenEditAttachements.Properties.Tokens.Last().Description;
            }
        }
        protected override TokenEditTokenInfo CreateTokenEditTokenInfo(TokenEditToken token)
        {
            CustomTokenEditTokenInfo info = new CustomTokenEditTokenInfo(token, checkBoxBounds, this);

            return(info);
        }
 public TreeListLeaf(TokenEditToken token)
 {
     this.token = token;
 }
 protected override void UpdateEditValueOnClosePopupCore(TokenEditToken token)
 {
     base.UpdateEditValueOnClosePopupCore(token);
     SetCaretToEnd();
 }
 public CustomTokenEditTokenInfo(TokenEditToken token, Dictionary <TokenEditToken, Rectangle> _checkBoxBounds, CustomTokenEditViewInfo _viewInfo) : base(token)
 {
     checkBoxBounds = _checkBoxBounds;
     viewInfo       = _viewInfo;
 }
 public CustomTokenEditTokenInfo(TokenEditToken token) : base(token)
 {
 }
Esempio n. 16
0
 public TokenEditFilterEventArgs(TokenEditToken token)
 {
     this.Token   = token;
     IsValidToken = true;
 }
 public TreeListRootObj(TokenEditToken token)
 {
     this.leaf = new TreeListLeaf(token);
 }