Пример #1
0
        public bool Support(string userName, string emailId, string message)
        {
            try
            {
                bool mailFlag    = false;
                bool Supportflag = false;
                connection = ConfigurationManager.ConnectionStrings[Constants.connection].ConnectionString;
                using (SqlConnection con = new SqlConnection(connection))
                {
                    using (SqlCommand cmd = new SqlCommand(Constants.UspELTSupportUpdate, con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add(Constants.ESEmail, SqlDbType.VarChar).Value   = emailId;
                        cmd.Parameters.Add(Constants.ESName, SqlDbType.VarChar).Value    = userName;
                        cmd.Parameters.Add(Constants.ESMessage, SqlDbType.VarChar).Value = message;
                        cmd.Parameters.Add(Constants.Action, SqlDbType.Int).Value        = 1;
                        con.Open();
                        Supportflag = Convert.ToBoolean(cmd.ExecuteNonQuery());
                        if (Supportflag == true)
                        {
                            Common_Library.CommonFunctions functionMail = new Common_Library.CommonFunctions();


                            mailFlag = functionMail.SendEmail("*****@*****.**", "", "", "ETL Support", " " + message + "from " + "  " + emailId
                                                              );
                            return(mailFlag);
                        }
                        else
                        {
                            return(mailFlag);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CommonFunctions commonFun = new CommonFunctions();
                commonFun.LogError(HttpContext.Current, ex.Message, "Support", "ETLCenterLoginService");
                commonFun = null;
                return(false);
            }
            finally
            {
            }
        }
Пример #2
0
        public bool ForgotPassword(string mailId)
        {
            bool mailFlag = false;

            try
            {
                Common_Library.CommonFunctions functionMail = new Common_Library.CommonFunctions();
                connection = ConfigurationManager.ConnectionStrings[Constants.connection].ConnectionString;
                using (SqlConnection con = new SqlConnection(connection))
                {
                    using (SqlCommand cmd = new SqlCommand(Constants.UspEmpForgotPassword, con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add(Constants.EmpEmail, SqlDbType.VarChar).Value = mailId;
                        con.Open();
                        cmd.ExecuteNonQuery();
                        SqlDataReader dataReader = cmd.ExecuteReader();
                        DataTable     dataTable  = new DataTable();
                        dataTable.Load(dataReader);
                        if (dataTable.Rows.Count > 0)
                        {
                            string encryptForget = Crypto.Encryption((Convert.ToString(dataTable.Rows[0]["ID_Employee"])));
                            string msgBody       = "<a id='resetLink' href='http://localhost:53097//Login/Reset?userId=" + encryptForget + "'> Reset Link </a>";
                            mailFlag = functionMail.SendEmail(mailId, "", "", "Reset Password", " Your Reset Password Link is  " +
                                                              msgBody);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CommonFunctions commonFun = new CommonFunctions();
                commonFun.LogError(HttpContext.Current, ex.Message, "forgotPassword", "ETLCenterLoginService");
                commonFun = null;
            }
            return(mailFlag);
        }