//Function created by pramod for save and update
        private void functionToSaveUpdate(bool isEdit)
        {
            //string[] sSelectedList=null;
            clsEmail        objEntEmail;
            List <clsEmail> lstSelectedUser = new List <clsEmail>();

            for (int iloop = 0; iloop < lstBoxSelectedUser.Items.Count; iloop++)
            {
                objEntEmail    = new clsEmail();
                objEntEmail.iD = int.Parse(lstBoxSelectedUser.Items[iloop].Value);
                lstSelectedUser.Add(objEntEmail);
            }


            if (objEmail.saveEmailGroup(txtEmailGroupName.Text, lstSelectedUser, isEdit, ((UserDetails)Session[clsConstant.TOKEN]).UserID))
            {
                lblMessage.ForeColor = System.Drawing.Color.Blue;
                lblMessage.Text      = "Information has been saved successfully";
                lstBoxSelectedUser.Items.Clear();
                lstBoxUserName.Items.Clear();
                drpAgency.SelectedIndex = -1;
                txtEmailGroupName.Text  = "";

                Session.Remove("isUpdate");
            }
            else
            {
                lblMessage.ForeColor = System.Drawing.Color.Red;
                lblMessage.Text      = "Sorry Unable to save properly";
            }
        }
Ejemplo n.º 2
0
        public void EnviarNotificacion()
        {
            try
            {
                var ServidorSMTP = System.Configuration.ConfigurationManager.AppSettings["ServidorSMTP"].ToString();
                var Puerto       = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Puerto"].ToString());
                var BuzonCorreo  = System.Configuration.ConfigurationManager.AppSettings["BuzonCorreo"].ToString();
                var PwdBuzon     = System.Configuration.ConfigurationManager.AppSettings["PwdBuzon"].ToString();

                ObjMail         = new clsEmail(ServidorSMTP, Puerto, BuzonCorreo, PwdBuzon);
                ObjMail.From    = BuzonCorreo;
                ObjMail.To      = BuzonCorreo;
                ObjMail.Subject = "Notificación Contactenos Fundación Oscarez";
                string strBody = "<p>Sr(a) Usuario </p>";
                strBody          = strBody + "<p> Se acaba de generar una notificación electronica desde el contactenos de la Fundación Oscarez con la siguiente descripción: <p>";
                strBody          = strBody + "<p>" + Asunto + "</p>";
                strBody          = strBody + "<p>" + Mensaje + "</p>";
                strBody          = strBody + "<p> Para obtener mas detalle del mensaje ingrese a la opción Contactenos/Index de la pagina de la Fundación Oscarez</p> <br/>";
                strBody          = strBody + "<p> Saludos</p>";
                ObjMail.HTMLBody = strBody;
                ObjMail.EnviarMail();
                ObjMail = null;
            }
            catch (Exception ex)
            {
                RutaLOG = System.Configuration.ConfigurationManager.AppSettings["RutaLOG"].ToString();
                System.IO.File.AppendAllText(RutaLOG + "LogError" + DateTime.Today.ToString("ddMMyyyy") + ".txt", ex.Message);
            }
        }
Ejemplo n.º 3
0
        public clsEmail DataLoader(IDataReader reader)
        {
            clsEmail clsEmailList = new clsEmail();

            clsEmailList.iD = int.Parse(reader.GetValue(0).ToString());
            return(clsEmailList);
        }
Ejemplo n.º 4
0
    public static void sendEmail(CommonAudit.EMAIL_KEYS emailFormat, float idReport, string planta)
    {
        DataSet ds;
        Dictionary <string, object> parameters = new Dictionary <string, object>();

        parameters.Add("@IdReport", idReport);
        parameters.Add("@Planta", planta);
        parameters.Add("@EmailKey", emailFormat.ToString());
        try
        {
            DataAccess dsAuditoria = new DataAccess();
            ds = dsAuditoria.executeStoreProcedureDataSet("dbo.spr_GET_EmailInformation", parameters);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        string   To       = FormatEmails(ds.Tables[1]);
        string   fromApp  = System.Configuration.ConfigurationManager.AppSettings.Get("emailApp");
        clsEmail objEmail = new clsEmail(emailFormat.ToString(), fromApp, To);

        //20170322 Ricardo Ramos : comentado debido a que en la importación a WMP se indicó que no existe una sobrecarga para este metodo con el parametro elegido.
        //objEmail.setMessage(ds.Tables[0]);
        try
        {
            //20170322 Ricardo Ramos : comentado debido a que en la importación a WMP se indicó que no existe una sobrecarga para este metodo con el parametro elegido.
            //objEmail.Send();
        }
        catch (Exception ex)
        { throw ex; }
    }
Ejemplo n.º 5
0
        public void InstanceOk()
        {
            string   destination = "";
            clsEmail anEmail     = new clsEmail(destination);

            Assert.IsNotNull(anEmail);
        }
Ejemplo n.º 6
0
        public void EmailInstanceOK()
        {
            //instance of clsEmail
            clsEmail AEmail = new clsEmail();

            //check if not null
            Assert.IsNotNull(AEmail);
        }
Ejemplo n.º 7
0
        public void TimeStampMax()
        {
            //instance of the clsEmail
            clsEmail TestEmail = new clsEmail();
            //test data to store result of validation
            Boolean OK;

            OK = TestEmail.TimeStampValid("2016");
            //check to see if result is ok
            Assert.IsTrue(OK);
        }
        protected void btnRegisterStaffMember_Click(object sender, EventArgs e)
        {
            bool    editStaffMember  = Convert.ToBoolean(Session["editStaffMember"]);
            string  firstName        = txtNewStaffMemberFirstName.Text;
            string  lastName         = txtNewStaffMemberLastName.Text;
            Int32   userId           = Convert.ToInt32(ddlUserId.SelectedItem.Value);
            Int32   privilegeLevelId = Convert.ToInt32(ddlPrivilegelevel.SelectedValue);
            Boolean suspended        = chkStaffMemberSuspended.Checked;

            clsStaffMemberCollection AllStaffMembers = new clsStaffMemberCollection();

            AllStaffMembers.ThisStaffMember.StaffMemberId    = Convert.ToInt32(Session["StaffMemberId"]);
            AllStaffMembers.ThisStaffMember.UserId           = userId;
            AllStaffMembers.ThisStaffMember.PrivilegeLevelId = privilegeLevelId;
            AllStaffMembers.ThisStaffMember.FirstName        = firstName;
            AllStaffMembers.ThisStaffMember.LastName         = lastName;
            AllStaffMembers.ThisStaffMember.Allowed          = suspended;

            if (editStaffMember)
            {
                userId = Convert.ToInt32(Session["UserId"]);
            }

            var      manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
            var      user    = manager.FindById(userId);
            clsEmail AnEmail = new clsEmail(user.Email);

            if (editStaffMember)
            {
                if (suspended)
                {
                    DateTime suspendedEndDate = DateTime.Now.AddDays(3);
                    AnEmail.SendUserSuspensionEmail(suspendedEndDate);
                    user.LockoutEnabled    = true;
                    user.LockoutEndDateUtc = suspendedEndDate;
                    manager.Update(user);
                }
                if (privilegeLevelId != originalPrivilegeLevel)
                {
                    AnEmail.SendStaffMemberPrivilegeChangeEmail();
                }
                AllStaffMembers.Update();
            }
            else
            {
                AllStaffMembers.Add();
                AnEmail.SendNewStaffMemberStandardNoticeEmail();
            }

            grdAllStaffMembers.EditIndex = -1;

            pnlNewStaffMember.Visible = false;
            LoadStaffMemberData();
        }
Ejemplo n.º 9
0
        public void EmailSubjectMinLessOne()
        {
            //instance of the clsEmail
            clsEmail TestEmail = new clsEmail();
            //test data to store result of validation
            Boolean OK;

            //test data to the property
            OK = TestEmail.EmailSubjectValid("Aa");
            Assert.IsFalse(OK);
        }
Ejemplo n.º 10
0
        public void EmailSubjectMax()
        {
            //instance of the clsEmail
            clsEmail TestEmail = new clsEmail();
            //test data to store result of validation
            Boolean OK;

            OK = TestEmail.EmailSubjectValid("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
            //check to see if result is ok
            Assert.IsTrue(OK);
        }
Ejemplo n.º 11
0
        public void TimeStampMinLessOne()
        {
            //instance of the clsEmail
            clsEmail TestEmail = new clsEmail();
            //test data to store result of validation
            Boolean OK;

            //test data to the property
            OK = TestEmail.TimeStampValid("1985");
            Assert.IsFalse(OK);
        }
Ejemplo n.º 12
0
        public void EmailAddressWithoutAt()
        {
            //instance of the clsEmail
            clsEmail TestEmail = new clsEmail();
            //test data to store result of validation
            Boolean OK;

            //test data to the property
            OK = TestEmail.Valid("mulgrewaaron1gmail.com");
            //check to see if result is ok
            Assert.IsFalse(OK);
        }
Ejemplo n.º 13
0
        public void EmailAddressMid()
        {
            //instance of the clsEmail
            clsEmail TestEmail = new clsEmail();
            //test data to store result of validation
            Boolean OK;

            //test data to the property
            OK = TestEmail.Valid("*****@*****.**");
            //check to see if result is ok
            Assert.IsTrue(OK);
        }
Ejemplo n.º 14
0
        public void TimeStampOK()
        {
            //instance of the clsEmail
            clsEmail TestEmail = new clsEmail();
            //put in some test data
            DateTime TestData = new DateTime(25 / 07 / 2012);

            //assign the data to the property
            TestEmail.EmailTimeStamp = TestData;
            //check to see the data is equal
            Assert.AreEqual(TestEmail.EmailTimeStamp, TestData);
        }
Ejemplo n.º 15
0
        public void EmailAddressMinLessOne()
        {
            //instance of the clsEmail
            clsEmail TestEmail = new clsEmail();
            //test data to store result of validation
            Boolean OK;

            //test data to the property
            OK = TestEmail.Valid("");
            //check to see if result is ok
            Assert.IsFalse(OK);
        }
Ejemplo n.º 16
0
        public void EmailAddressExtreme()
        {
            //instance of the clsEmail
            clsEmail TestEmail = new clsEmail();
            //test data to store result of validation
            Boolean OK;

            //test data to the property
            OK = TestEmail.Valid("*****@*****.**");
            //check to see if result is ok
            Assert.IsFalse(OK);
        }
Ejemplo n.º 17
0
        public void EmailAddressNoOK()
        {
            //instance of clsEmail
            clsEmail AEmail = new clsEmail();
            //test data to the property
            Int32 SomeEmailAddressNo = 1;

            //assign the data to the property
            AEmail.EmailAddressNo = SomeEmailAddressNo;
            //test the data to see the two are equal
            Assert.AreEqual(AEmail.EmailAddressNo, SomeEmailAddressNo);
        }
Ejemplo n.º 18
0
        public void EmailTimeStampOK()
        {
            //create an instance of the class
            clsEmail AnEmail = new clsEmail();
            ///create some test data (the current date)
            DateTime testData = DateTime.Now.Date;

            //test data to the property
            AnEmail.EmailTimeStamp = testData;
            //check to see if ok
            Assert.AreEqual(AnEmail.EmailTimeStamp, testData);
        }
Ejemplo n.º 19
0
        public void EmailSubjectOK()
        {
            //create an instance of the class
            clsEmail AnEmail = new clsEmail();
            ///create some test data (the current date)
            String testData = "blahblahblah";

            //test data to the property
            AnEmail.EmailSubject = testData;
            //check to see if ok
            Assert.AreEqual(AnEmail.EmailSubject, testData);
        }
Ejemplo n.º 20
0
        public void EmailAddressOK()
        {
            //instance of clsEmail
            clsEmail AEmail = new clsEmail();
            //test data to the property
            string SomeEmailAddress = "*****@*****.**";

            //assign the data to the property
            AEmail.EmailAddress = SomeEmailAddress;
            //test the data to see the two are equal
            Assert.AreEqual(AEmail.EmailAddress, SomeEmailAddress);
        }
Ejemplo n.º 21
0
        public void EmailContentOK()
        {
            //create an instance of the class
            clsEmail AnEmail = new clsEmail();
            ///create some test data
            String testData = "skslskslkslk";

            //test data to the property
            AnEmail.EmailContent = testData;
            //check to see if ok
            Assert.AreEqual(AnEmail.EmailContent, testData);
        }
Ejemplo n.º 22
0
        public void TimeStampMaxInvalidData()
        {
            //instance of the clsEmail
            clsEmail TestEmail = new clsEmail();
            //test data to store result of validation
            Boolean OK;

            //test data to the property
            OK = TestEmail.TimeStampValid("101010101");
            //check to see if result is ok
            Assert.IsFalse(OK);
        }
Ejemplo n.º 23
0
    public static void setEmailError(clsParametros objParametros, string sAsunto)
    {
        try
        {
            string bEnvioError = clsValidaciones.GetKeyOrAdd("bEnvioErrorSabre", "False");
            if (bEnvioError.ToUpper().Equals("TRUE"))
            {
                StringBuilder consulta = new StringBuilder();
                try
                {
                    consulta.AppendLine("---- Code: ");
                    consulta.AppendLine(objParametros.Code);
                    consulta.AppendLine("---- Mensaje:");
                    consulta.AppendLine(objParametros.Message);
                    consulta.AppendLine("---- Metodo:");
                    consulta.AppendLine(objParametros.Complemento);
                    consulta.AppendLine("---- Complemento:");
                    consulta.AppendLine(objParametros.Metodo);
                    consulta.AppendLine("---- Info:");
                    consulta.AppendLine(objParametros.Info);
                    sAsunto = "ERROR SABRE - " + sAsunto;
                }
                catch { }

                clsEmail cEmail = new clsEmail();
                string   sCC    = clsValidaciones.GetKeyOrAdd("strEmailCC", "*****@*****.**");
                string   sTo    = clsValidaciones.GetKeyOrAdd("strEmailTo", "*****@*****.**");
                string   sCCO   = clsValidaciones.GetKeyOrAdd("strEmailCCO", "*****@*****.**");
                string   sFrom  = clsValidaciones.GetKeyOrAdd("strEmailEnvio", "*****@*****.**");

                cEmail.EnviarMensaje(consulta.ToString(),
                                     sAsunto,
                                     OperacionEmail.Email,
                                     sTo,
                                     sCC,
                                     sCCO,
                                     FormatMail.Text, sFrom);
            }
        }
        catch (Exception Ex)
        {
            clsParametros cParametros = new clsParametros();
            cParametros.Id         = 0;
            cParametros.Message    = Ex.Message.ToString();
            cParametros.Source     = Ex.Source.ToString();
            cParametros.Tipo       = clsTipoError.Library;
            cParametros.Severity   = clsSeveridad.Moderada;
            cParametros.StackTrace = Ex.StackTrace.ToString();
            cParametros.Metodo     = System.Reflection.MethodBase.GetCurrentMethod().Name;
            ExceptionHandled.Publicar(cParametros);
        }
    }
Ejemplo n.º 24
0
        public void ViewArchiveEmail(int EmailAddressNo, int ArchiveNo)
        {
            clsEmail           OneEmail  = new clsEmail();
            clsEmailCollection AllEmails = new clsEmailCollection();

            EmailAddress = AllEmails.GetEmailAddress(EmailAddressNo);
            bool IsArchive = true;

            AllEmails.GetOneEmail(ArchiveNo, IsArchive, out EmailSubject, out EmailContent);
            txtBxSubject.Text = EmailSubject;
            txtBxContent.Text = EmailContent;
            txtBxFrom.Text    = EmailAddress;
        }
Ejemplo n.º 25
0
        public void EmailValidMethodOK()
        {
            //instance of clsEmail
            clsEmail AEmail = new clsEmail();
            //test data to store result of validation
            Boolean OK = false;
            //assign the data to the property
            string SomeEmail = "*****@*****.**";

            //invoke the method
            OK = AEmail.Valid(SomeEmail);
            //check to see if result is ok
            Assert.IsTrue(OK);
        }
Ejemplo n.º 26
0
        //this will be the function that shows the new email and it accepts the emailno selected in
        //the datagridview
        public void NewEmail(int EmailAddressNo, int EmailNo)
        {
            //txtBxFrom.Text = Convert.ToString(EmailAddressNo);
            clsEmail           OneEmail  = new clsEmail();
            clsEmailCollection AllEmails = new clsEmailCollection();

            EmailAddress = AllEmails.GetEmailAddress(EmailAddressNo);
            bool IsArchive = false;

            AllEmails.GetOneEmail(EmailNo, IsArchive, out EmailSubject, out EmailContent);
            txtBxSubject.Text = EmailSubject;
            txtBxContent.Text = EmailContent;
            txtBxFrom.Text    = EmailAddress;
        }
Ejemplo n.º 27
0
    //correo para solicitar confirmación de cuenta
    public static void SendMailByDictionary(Dictionary <string, string> dicEmailInfo, Dictionary <string, Stream> dicFiles, string emailTo, String Key, string mail, string token)
    {
        clsEmail email = new clsEmail(Key);

        try
        {
            email.setMessage(dicEmailInfo);
            email.setFiles(dicFiles);
            email.ToAdress = emailTo;
            email.Send(mail, token);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Ejemplo n.º 28
0
    public static void SendMailByDictionary(Dictionary <string, string> dicEmailInfo, Dictionary <string, Stream> dicFiles, string emailTo, String Key, string razon, string comentarios, string fumigacion)
    {
        clsEmail email = new clsEmail(Key);

        try
        {
            email.setMessage(dicEmailInfo);
            email.setFiles(dicFiles);
            email.ToAdress = emailTo;
            email.Send(razon, comentarios, fumigacion);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Ejemplo n.º 29
0
        public void CountEmailAddressMatchesList()
        {
            //create instance of the class
            clsEmailAddressCollection Emails = new clsEmailAddressCollection();
            //create some test data
            List <clsEmail> TestList = new List <clsEmail>();
            //add an item to the list
            clsEmail TestItem = new clsEmail();

            //set the properties
            TestItem.EmailAddressNo = 1;
            TestItem.EmailAddress   = "*****@*****.**";
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data
            Emails.AllEmailAddresses = TestList;
            //test to see that the two are the same
            Assert.AreEqual(Emails.CountEmailAddresses, TestList.Count);
        }
        protected void grdAllUsers_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Int32   userId    = Convert.ToInt32(((Label)grdAllUsers.Rows[e.RowIndex].FindControl("lblUserId")).Text);
            Boolean suspended = ((CheckBox)grdAllUsers.Rows[e.RowIndex].FindControl("chkSuspended")).Checked;

            if (suspended != false)
            {
                var manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
                var user    = manager.FindById(userId);
                user.LockoutEnabled    = suspended;
                user.LockoutEndDateUtc = DateTime.Now.AddDays(3);

                clsEmail AnEmail    = new clsEmail(user.Email);
                DateTime lockoutEnd = Convert.ToDateTime(user.LockoutEndDateUtc);
                manager.Update(user);

                AnEmail.SendUserSuspensionEmail(lockoutEnd);
            }
            LoadUserData();
        }
Ejemplo n.º 31
0
    //correo para solicitar confirmación de cuenta
    public static void SendMailByDictionary(Dictionary<string, string> dicEmailInfo, Dictionary<string, Stream> dicFiles, string emailTo, String Key, string mail, string token)
    {
        clsEmail email = new clsEmail(Key);
        try
        {

            email.setMessage(dicEmailInfo);
            email.setFiles(dicFiles);
            email.ToAdress = emailTo;
            email.Send(mail, token);
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }