private void getEmailuri()
        {
            try
            {
                incepeIncarcarea();

                BColectieEmail lista = BEmail.GetListByParam(CDL.iStomaLab.CDefinitiiComune.EnumStare.Activa, null);

                if (!(lista.Count == flpListaEmailuri.Controls.Count))
                {
                    ImapClient client = new ImapClient();
                    foreach (var clientEmail in lista)
                    {
                        ControlAdresaEmail ctrlAdresaEmail = new ControlAdresaEmail();
                        ctrlAdresaEmail.Tag = clientEmail;
                        this.flpListaEmailuri.Controls.Add(ctrlAdresaEmail);
                        ctrlAdresaEmail.Initializeaza(clientEmail);
                    }

                    initControlGestiuneInbox(lista[0]);
                }
            }
            catch (Exception ex)
            {
                GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex);
            }
            finally
            {
                finalizeazaIncarcarea();
            }
        }
Beispiel #2
0
        private void BtnValidare_Click(object sender, EventArgs e)
        {
            if (this.lSeIncarca)
            {
                return;
            }
            try
            {
                incepeIncarcarea();

                BEmail email = this.dgvListaEmail.Rows[this.dgvListaEmail.CurrentCell.RowIndex].Tag as BEmail;

                if (email != null)
                {
                    _SEmail = email;
                    this.inchideEcranulOK();
                }
            }
            catch (Exception ex)
            {
                GestiuneErori.AfiseazaMesaj(this.GetFormParinte(), ex);
            }
            finally
            {
                finalizeazaIncarcarea();
            }
        }
        private void salveazaEmailuri()
        {
            BColectieEmail lista  = BEmail.GetListByParam(CDL.iStomaLab.CDefinitiiComune.EnumStare.Activa, null);
            BEmail         email  = lista.GetById(lista[0].Id);
            ImapClient     client = new ImapClient();

            Logheaza(email, client);
        }
Beispiel #4
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            BEmail r = await DocumentDBRepository.GetItemAsync <BEmail>(id);

            await DocumentDBRepository.DeleteItemAsync(r.Id);

            return(RedirectToAction("Index"));
        }
Beispiel #5
0
 public static bool Afiseaza(Form pEcranPariente, BEmail pEmail)
 {
     using (FormAdaugaEmail ecran = new FormAdaugaEmail(pEmail))
     {
         ecran.AplicaPreferinteleUtilizatorului();
         return(CCL.UI.IHMUtile.DeschideEcran(pEcranPariente, ecran));
     }
 }
Beispiel #6
0
 private void LblFrom_DeschideEcranCautare(Control psender, object pxObiectExistent)
 {
     FormListaEmail.Afiseaza(this.GetFormParinte(), this.lblFrom.Location.X, this.lblFrom.Location.Y);
     if (FormListaEmail._SEmail != null)
     {
         this.lEmail       = FormListaEmail._SEmail;
         this.lblFrom.Text = this.lEmail.AdresaMail;
     }
 }
        public void incarcaOptiuneaSelectata(BEmail pEmail)
        {
            if (this.lctrlInbox != null)
            {
                this.lctrlInbox.Visible = false;
            }

            initControlGestiuneInbox(pEmail);
        }
Beispiel #8
0
        public async Task <ActionResult> EditAsync([Bind(Include = "Id,Tag,BridgeModule,TemplateName,MailTo,MailCC,MailBOdy,MailTitle")] BEmail item)
        {
            if (ModelState.IsValid)
            {
                await DocumentDBRepository.UpdateItemAsync <BEmail>(item.Id, item);

                return(RedirectToAction("Index"));
            }

            return(View(item));
        }
Beispiel #9
0
        public void Initializeaza(BEmail pEmail)
        {
            base.InitializeazaVariabileleGenerale();

            incepeIncarcarea();

            this.lEmail = pEmail;

            ConstruiesteColoaneDGV();
            ConstruiesteRanduriDGV();

            finalizeazaIncarcarea();
        }
        private void initControlGestiuneInbox(BEmail pEmail)
        {
            if (this.lctrlInbox == null)
            {
                this.lctrlInbox      = new ControlInbox();
                this.lctrlInbox.Name = "ctrlGestiuneInbox";
                adaugaControlInZonaUtila(this.lctrlInbox);
            }

            this.lctrlInbox.Initializeaza(pEmail);
            this.lctrlInbox.Visible = true;
            this.lctrlInbox.BringToFront();
        }
Beispiel #11
0
        private void ConstruiesteRanduriDGV()
        {
            this.dgvListaEmail.IncepeContructieRanduri();

            var listaElem = BEmail.GetListByParam(CDL.iStomaLab.CDefinitiiComune.EnumStare.Activa, null);

            foreach (var elem in listaElem)
            {
                incarcaRand(this.dgvListaEmail.Rows[this.dgvListaEmail.Rows.Add()], elem);
            }

            this.dgvListaEmail.FinalizeazaContructieRanduri();
        }
Beispiel #12
0
        public void Initializeaza(BEmail pEmail, IEnumerable <IMessageSummary> pSummaries, IMailFolder pMailFolder)
        {
            base.InitializeazaVariabileleGenerale();

            incepeIncarcarea();

            this.lEmail      = pEmail;
            this.lMailFolder = pMailFolder;

            ConstruiesteColoaneDGV();
            ConstruiesteRanduriDGV(pSummaries);

            finalizeazaIncarcarea();
        }
Beispiel #13
0
        private FormSetariEmail(BEmail pEmail)
        {
            this.DoubleBuffered = true;
            InitializeComponent();

            this.lEmail = pEmail;

            if (!CCL.UI.IHMUtile.SuntemInDebug())
            {
                adaugaHandlere();
                initTextML();

                this.CentratCuDeplasare();
            }
        }
        private void incarcaMailuri(BEmail pEmail, ImapClient pClient)
        {
            pClient.GetFolder(SpecialFolder.Sent).Open(FolderAccess.ReadWrite);
            IEnumerable <IMessageSummary> sent = pClient.GetFolder(SpecialFolder.Sent).Fetch(0, -1, MessageSummaryItems.Full | MessageSummaryItems.UniqueId).ToList();

            pClient.GetFolder(SpecialFolder.Drafts).Open(FolderAccess.ReadWrite);
            IEnumerable <IMessageSummary> drafts = pClient.GetFolder(SpecialFolder.Drafts).Fetch(0, -1, MessageSummaryItems.Full | MessageSummaryItems.UniqueId).ToList();

            pClient.GetFolder(SpecialFolder.Trash).Open(FolderAccess.ReadWrite);
            IEnumerable <IMessageSummary> trash = pClient.GetFolder(SpecialFolder.Trash).Fetch(0, -1, MessageSummaryItems.Full | MessageSummaryItems.UniqueId).ToList();

            pClient.GetFolder(SpecialFolder.Flagged).Open(FolderAccess.ReadWrite);
            IEnumerable <IMessageSummary> flagged = pClient.GetFolder(SpecialFolder.Flagged).Fetch(0, -1, MessageSummaryItems.Full | MessageSummaryItems.UniqueId).ToList();

            pClient.GetFolder(SpecialFolder.Junk).Open(FolderAccess.ReadWrite);
            IEnumerable <IMessageSummary> junk = pClient.GetFolder(SpecialFolder.Junk).Fetch(0, -1, MessageSummaryItems.Full | MessageSummaryItems.UniqueId).ToList();

            pClient.GetFolder(SpecialFolder.All).Open(FolderAccess.ReadWrite);
            IEnumerable <IMessageSummary> all = pClient.GetFolder(SpecialFolder.All).Fetch(0, -1, MessageSummaryItems.Full | MessageSummaryItems.UniqueId).ToList();

            int nrEmailuriDeExtras = sent.ToList().Count + drafts.ToList().Count + trash.ToList().Count + flagged.ToList().Count + junk.ToList().Count + all.ToList().Count;

            pbIncarcaEmailuri.Minimum = 1;
            pbIncarcaEmailuri.Maximum = nrEmailuriDeExtras;
            pbIncarcaEmailuri.Value   = 1;
            pbIncarcaEmailuri.Step    = 1;

            if (sent != null && drafts != null && trash != null && flagged != null && junk != null && all != null)
            {
                this.pbIncarcaEmailuri.Visible = true;

                //List<IEnumerable<IMessageSummary>> listaAll = new List<IEnumerable<IMessageSummary>>();
                //listaAll.Add(sent);
                //listaAll.Add(drafts);
                //listaAll.Add(trash);
                //listaAll.Add(flagged);
                //listaAll.Add(junk);

                getMesageDinCategorii(pEmail, sent, MessageFlags.Answered);
                getMesageDinCategorii(pEmail, drafts, MessageFlags.Draft);
                getMesageDinCategorii(pEmail, trash, MessageFlags.None);
                getMesageDinCategorii(pEmail, flagged, MessageFlags.Flagged);
                getMesageDinCategorii(pEmail, junk, MessageFlags.UserDefined);
                getMesageDinAll(pEmail, all);
            }

            inchideEcranulOK();
        }
Beispiel #15
0
        public async Task <ActionResult> Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            BEmail r = await DocumentDBRepository.GetItemAsync <BEmail>(id);

            if (r == null)
            {
                return(HttpNotFound());
            }

            return(View(r));
        }
Beispiel #16
0
        public void Initializeaza(BEmail pEmail)
        {
            base.InitializeazaVariabileleGenerale();

            incepeIncarcarea();
            _SEmail = pEmail;

            this.btnAdresaEmail.Initializeaza(_SEmail.AdresaMail, EnumRubricaEmail.Inbox, EnumRubricaEmail.Inbox == this.lRubricaSelectata, this.panelOptiuniEmail);

            this.btnOptiuneInbox.Initializeaza(BMultiLingv.getElementById(BMultiLingv.EnumDictionar.Inbox), EnumRubricaEmail.Inbox, EnumRubricaEmail.Inbox == this.lRubricaSelectata);
            this.btnOptiuneDrafts.Initializeaza("Drafts", EnumRubricaEmail.Drafts, EnumRubricaEmail.Drafts == this.lRubricaSelectata);
            this.btnOptiuneSent.Initializeaza("Sent", EnumRubricaEmail.Sent, EnumRubricaEmail.Sent == this.lRubricaSelectata);
            this.btnOptiuneTrash.Initializeaza("Trash", EnumRubricaEmail.Trash, EnumRubricaEmail.Trash == this.lRubricaSelectata);

            finalizeazaIncarcarea();
        }
 private void getMesageDinCategorii(BEmail pEmail, IEnumerable <IMessageSummary> pTipFolder, MessageFlags pFlag)
 {
     foreach (var mail in pTipFolder)
     {
         int nrAtasamente = 0;
         foreach (var attach in mail.BodyParts)
         {
             if (!string.IsNullOrEmpty(attach.FileName) && string.IsNullOrEmpty(attach.ContentId))
             {
                 nrAtasamente++;
             }
         }
         BEmailuriExtrase.Add(pEmail.Id, getIndiceFlag(pFlag), nrAtasamente, getData(mail.Date), mail.Envelope.Subject, mail.Envelope.From.ToString(), mail.Envelope.To.ToString(), (int)mail.UniqueId.Id, string.Empty, null);
         this.pbIncarcaEmailuri.PerformStep();
         nrAtasamente = 0;
     }
 }
        internal async void Logheaza(BEmail pEmail, ImapClient pClient)
        {
            var    host   = pEmail.HostIMAP.Trim();
            string passwd = CCL.iStomaLab.Utile.CSecuritate.Decrypt(pEmail.ParolaMail);
            var    user   = pEmail.AdresaMail.Trim();
            string protocol;
            string url;

            ICredentials Credentials = new NetworkCredential(user, passwd);

            if (pEmail.SSL)
            {
                protocol = "imaps";
            }
            else
            {
                protocol = "imap";
            }

            if (pEmail.PortIMAP != 0)
            {
                url = string.Format("{0}://{1}:{2}", protocol, host, pEmail.PortIMAP);
            }
            else
            {
                url = string.Format("{0}://{1}", protocol, host);
            }

            Uri Uri = new Uri(url);

            try
            {
                await Reconnect(Uri, Credentials, pClient);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            incarcaMailuri(pEmail, pClient);
        }
        private void getMesageDinAll(BEmail pEmail, IEnumerable <IMessageSummary> pTipFolder)
        {
            List <DateTime> lista = BEmailuriExtrase.GetListUniqueId(pEmail.Id, CDL.iStomaLab.CDefinitiiComune.EnumStare.Activa, null);

            foreach (var mail in pTipFolder)
            {
                int nrAtasamente = 0;
                foreach (var attach in mail.BodyParts)
                {
                    if (!string.IsNullOrEmpty(attach.FileName) && string.IsNullOrEmpty(attach.ContentId))
                    {
                        nrAtasamente++;
                    }
                }
                if (!lista.Contains(getData(mail.Date)))
                {
                    BEmailuriExtrase.Add(pEmail.Id, getIndiceFlag(mail.Flags), nrAtasamente, getData(mail.Date), mail.Envelope.Subject, mail.Envelope.From.ToString(), mail.Envelope.To.ToString(), (int)mail.UniqueId.Id, string.Empty, null);
                    this.pbIncarcaEmailuri.PerformStep();
                    nrAtasamente = 0;
                }
            }
        }
Beispiel #20
0
        public async Task <ActionResult> EditAsync(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            BEmail item = await DocumentDBRepository.GetItemAsync <BEmail>(id);

            if (item == null)
            {
                return(HttpNotFound());
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var j = await DocumentDBRepository.GetItemAsync <Job>("93ffbdaa-72bd-4df8-a154-d140a73ef700");

            ViewBag.Job = j;
            var i = await DocumentDBRepository.GetItemAsync <IORA>("38ea1592-88d9-4c53-a6d9-b571b1c37532");

            ViewBag.IORA = i;
            var f = await DocumentDBRepository.GetItemsAsync <BFinancial>(d => d.Tag == "BFinancial" && d.BridgeModule == i.BridgeModule && d.CertType == j.CertType);

            ViewBag.FinancialSet = f.FirstOrDefault();
            var u = await DocumentDBRepository.GetItemAsync <BUser>("8864ba7d-8593-4eb5-88c0-0b224e24567f");

            ViewBag.TargetUser = u;

            if (item == null)
            {
                return(HttpNotFound());
            }

            return(View(item));
        }
Beispiel #21
0
        bool Salveaza()
        {
            bool esteValid = BEmail.SuntInformatiileNecesareCoerente(this.txtAdresaMail.Text, this.lEmail.ParolaMail, this.txtServerSMTP.Text, CUtil.GetAsInt32(this.txtPortSMTP.Text),
                                                                     this.txtServerIMAP.Text, CUtil.GetAsInt32(this.txtPortIMAP.Text));

            if (esteValid)
            {
                this.lEmail.AdresaMail = this.txtAdresaMail.Text;
                this.lEmail.User       = this.txtUtilizator.Text;
                this.lEmail.HostSMTP   = this.txtServerSMTP.Text;
                this.lEmail.PortSMTP   = CUtil.GetAsInt32(this.txtPortSMTP.Text);
                this.lEmail.HostIMAP   = this.txtServerIMAP.Text;
                this.lEmail.PortIMAP   = CUtil.GetAsInt32(this.txtPortIMAP.Text);
                this.lEmail.SSL        = this.chkSSL.Checked;
                this.lEmail.UpdateAll();
            }
            else
            {
                seteazaAlerta();
            }

            return(esteValid);
        }
        public void Initializeaza(BEmail pEmail)
        {
            base.InitializeazaVariabileleGenerale();

            incepeIncarcarea();

            this.lEmail = pEmail;

            if (this.lEmail == null)
            {
                this.txtEmail.Goleste();
                this.txtParola.Goleste();
                this.txtUser.Goleste();
            }
            else
            {
                this.txtEmail.Text  = lEmail.AdresaMail;
                this.txtParola.Text = lEmail.ParolaMail;
                this.txtUser.Text   = lEmail.User;
            }

            finalizeazaIncarcarea();
        }
        internal bool Salveaza()
        {
            bool esteValid = BEmail.SuntInformatiileNecesareCoerente(this.txtEmail.Text, this.txtParola.Text, getSMTP(), getSMTPPort(), getIMAP(), getIMAPPort());

            if (this.lEmail == null)
            {
                if (esteValid)
                {
                    BEmail.Add(this.txtEmail.Text, this.txtParola.Text, getSMTP(), getSMTPPort(), getIMAP(), getIMAPPort(), 2000, getSSL(), this.txtUser.Text, 1, CCL.iStomaLab.Utile.CGestiuneIO.getComputerName(), null);
                }
                else
                {
                    seteazaAlerta();
                }
            }
            else
            {
                this.lEmail.AdresaMail   = this.txtEmail.Text;
                this.lEmail.ParolaMail   = this.txtParola.Text;
                this.lEmail.HostSMTP     = getSMTP();
                this.lEmail.PortSMTP     = getSMTPPort();
                this.lEmail.HostIMAP     = getIMAP();
                this.lEmail.PortIMAP     = getIMAPPort();
                this.lEmail.SSL          = getSSL();
                this.lEmail.User         = this.txtUser.Text;
                this.lEmail.IdCalculator = CCL.iStomaLab.Utile.CGestiuneIO.getComputerName();
                if (esteValid)
                {
                    this.lEmail.UpdateAll();
                }
                else
                {
                    seteazaAlerta();
                }
            }
            return(esteValid);
        }
Beispiel #24
0
 private void incarcaRand(DataGridViewRow pRand, BEmail pElem)
 {
     pRand.Tag            = pElem;
     pRand.Cells[0].Value = pElem.AdresaMail;
 }
Beispiel #25
0
            public static IEnumerable <MimeEntity> getAtasamente(bool esteInInbox, SpecialFolder pFolderPath, BEmail pEmail, UniqueId pUniqueId)
            {
                IEnumerable <MimeEntity> atasament = null;

                using (ImapClient client = new ImapClient())
                {
                    try
                    {
                        client.Connect(pEmail.HostIMAP, pEmail.PortIMAP, SecureSocketOptions.SslOnConnect);
                        client.Authenticate(pEmail.AdresaMail, pEmail.ParolaMail);
                        if (esteInInbox)
                        {
                            client.Inbox.Open(FolderAccess.ReadWrite);
                            var inbox           = client.Inbox;
                            var listaAtasamente = inbox.GetMessage(pUniqueId).Attachments;
                            atasament = listaAtasamente;
                        }
                        else
                        {
                            client.GetFolder(pFolderPath).Open(FolderAccess.ReadOnly);
                            var listaAtasamente = client.GetFolder(pFolderPath).GetMessage(pUniqueId).Attachments;
                            atasament = listaAtasamente;
                        }

                        client.Disconnect(true);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
                return(atasament);
            }
Beispiel #26
0
        public ActionResult Create()
        {
            var S = new BEmail();

            return(View(S));
        }