Beispiel #1
0
        public IEnumerable <Users> SaveUserData(Users userdata, string EntityId, string UserId, string dtUserRights_1, string dtUserRights_2, string dtSponsorBankCode, string dtCategoryCode, string dtPresentmentMaker, int chkPresentMaker, int chkPresentChecker, int IsZipSure, int IsAllowFundTransfer, int IsMandateEdit, int Ismandate, int IsBulk, int iSDashboard, int IsEnableCancel, int IsViewAll, string Defaultpwd, string dtPaymentMode, string dtUserRights_3, string dtUserRights_4, int chkRefEdit)
        {
            try
            {
                string password    = "";
                string passwordKey = "";

                if (Defaultpwd.Trim() != "")
                {
                    Defaultpwd = Convert.ToString(ConfigurationManager.AppSettings["DefaultPswdUser"]);
                    password   = DbSecurity.Encrypt(Defaultpwd, ref passwordKey);
                }


                var Result = dbcontext.MultipleResults("[dbo].[sp_user]").With <Users>().Execute("@QueryType", "@XmlSponsorBankCode", "@EntityId", "@Type"
                                                                                                 , "@UserId", "@ContactNo", "@EmailId", "@userNameId",
                                                                                                 "@password", "@passwordKey", "@XmlPaymentMode", "@IsBulkMandate", "@IsMandate", "@IsMandateEdit", "@IsRefrenceEdit",
                                                                                                 "@EmailSendTo", "@IsAllowFundTransfer", "@IsZipSure", "@APPId", "@PresentmentMaker", "@PresentmentChecker", "@XmlPresentmentMaker", "@XmlUserRightsA", "@XmlUserRightsB", "@XmlUserRightsC", "@XmlUserRightsD", "@NachViewUserID", "@IsDashBoard", "@IsEnableCancel", "@BankValidationUserCount", "@AcValidationUserCount", "@IsViewAll", "@XmlCategoryCode", "SaveData"
                                                                                                 , dtSponsorBankCode, DbSecurity.Decrypt(HttpContext.Current.Server.UrlDecode(EntityId.Replace("_", "%"))), userdata.Type, DbSecurity.Decrypt(HttpContext.Current.Server.UrlDecode(UserId.Replace("_", "%"))), userdata.PhoneNo, userdata.EmailId, userdata.UserName,
                                                                                                 password, passwordKey, dtPaymentMode, IsBulk.ToString(), Ismandate.ToString(), IsMandateEdit.ToString(), chkRefEdit.ToString(), userdata.emailsent, IsAllowFundTransfer.ToString(), IsZipSure.ToString(), Convert.ToString(ConfigurationManager.AppSettings["APPId"]), chkPresentMaker.ToString(), chkPresentChecker.ToString(), dtPresentmentMaker, dtUserRights_1, dtUserRights_2, dtUserRights_3, dtUserRights_4, userdata.nachuser, iSDashboard.ToString(), IsEnableCancel.ToString(), Convert.ToString(userdata.bankval), Convert.ToString(userdata.accountval), IsViewAll.ToString(), dtCategoryCode);

                foreach (var usrdata in Result)
                {
                    //Flag = employe.Cast<ResFlag>().ToList() .Select(x=>x.Responseflag).First().ToString();
                    dataList = usrdata.Cast <Users>().ToList();
                }
                return(dataList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public string Validate(string oldPassword, string newPassword, string UserId, string PasswordKey)
        {
            try
            {
                // password = DbSecurity.Encrypt(oldPassword, ref passwordKey);
                //  UserId = CurrentUser.User.UserId.ToString();
                //  int count = objManager.IntMethodWithParam("Sp_UserCreation", "@QueryType", "@User", "@Password","@PasswordKey", "UpdatePassword", UserId, password, passwordKey);
                dt = objManager.FillDatatableWithParam("Sp_UserLogin", "@QueryType", "@UserID", "CheckOldPassword", UserId);
                string Pass = (DbSecurity.Decrypt(dt.Rows[0]["Password"].ToString(), dt.Rows[0]["PasswordKey"].ToString()));
                if (Pass.Trim() == oldPassword.Trim())
                {
                    string NEWPassword = DbSecurity.Encrypt(newPassword, ref PasswordKey);
                    dt = objManager.FillDatatableWithParam("Sp_UserLogin", "@QueryType", "@NewPassword", "@PasswordKey", "@UserID", "ChangePassword", NEWPassword, PasswordKey, UserId);

                    result = "1";
                }
                else
                {
                    result = "0";
                }

                return(result);
            }

            catch (Exception ex)
            {
                return("NotSccess");
            }
        }
Beispiel #3
0
        public ActionResult BindPaymentPage(string restroid, string orderId)
        {
            string UserId = CurrentUser.User.UserId.ToString();
            var    result = 0;

            string OrderId = DbSecurity.Encrypt(orderId);

            return(Json(OrderId, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
 protected void btnChangePassword_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtPassword.Text == txtConfirmPassword.Text)
         {
             if (txtPassword.Text.Length >= 6)
             {
                 ChangePassword = DbSecurity.Encrypt(txtPassword.Text, ref changePasswordKey);
                 //int Text = objManager.IntMethodWithParam("Sp_UserLogin", "@QueryType", "@ChangePassword", "@ChangePasswordKey",
                 //    "@UserId", "UpdatePassword", ChangePassword, changePasswordKey, ViewState["UserId"].ToString());
                 var results = context.MultipleResults("[dbo].[Sp_UserLogin]").With <DefaultPasswordChange>().Execute("@QueryType", "@ChangePassword", "@ChangePasswordKey",
                                                                                                                      "@UserId", "UpdatePassword", ChangePassword, changePasswordKey, ViewState["UserId"].ToString());
                 foreach (var data in results)
                 {
                     dataList_value = data.Cast <DefaultPasswordChange>().ToList();
                 }
                 dt_value = ToDataTable(dataList_value);
                 if (Convert.ToInt32(dt_value.Rows[0]["value"]) >= 0)
                 {
                     HdnIndustries.Value = "Y";
                     //ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Password Updated Successfuly !!');window.location ='Login.aspx';", true);
                     //Response.Redirect("~/Login.aspx");
                     txtConfirmPassword.Text = "";
                     txtPassword.Text        = "";
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Password Updated Unsuccessfuly !!')", true);
                 }
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Minimum Length Of Password Is 6 !!')", true);
                 txtConfirmPassword.Text = "";
                 txtPassword.Text        = "";
                 // popup1.Visible = true;
             }
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('New Password Does Not Match To Confirm Password !!')", true);
             txtConfirmPassword.Text = "";
             txtPassword.Text        = "";
             //  popup1.Visible = true;
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Beispiel #5
0
        public DataSet SaveEmployee(string EmailId, string EmpCode, string EmpName, string mobileNo, string kitchensectionId, string restroId, string UserPin, string Password, string ConfirmPassword, string UserName, string AccessCode, string RoleId)

        {
            //ImageData = "00";
            string PasswordKey = string.Empty;
            string AccessKey   = string.Empty;

            Password   = DbSecurity.Encrypt(Password, ref PasswordKey);
            AccessCode = DbSecurity.Encrypt(AccessCode, ref AccessKey);
            ds         = objManager.FillDatasetWithParam("Sp_GetEmployee", "@QueryType", "@emailId", "@EmpCode", "@EmpName", "@mobileNo", "@KitchenSectionId", "@restroId", "@userpin", "@password", "@passwordkey", "@username", "@accesscode", "@accesskey", "@RoleId ", "SaveEmployee", EmailId, EmpCode, EmpName, mobileNo, kitchensectionId, restroId, UserPin, Password, PasswordKey, UserName, AccessCode, AccessKey, RoleId);

            return(ds);
        }
Beispiel #6
0
        public IEnumerable <CommonFlag> UpdateForgot(string Password, string Email)
        {
            List <Forgotflag> dataList          = new List <Forgotflag>();
            string            ChangePassword    = string.Empty;
            string            changePasswordKey = string.Empty;

            try
            {
                if (Password.Length >= 6)
                {
                    ChangePassword = DbSecurity.Encrypt(Password, ref changePasswordKey);
                    var Result = dbcontext.MultipleResults("[dbo].[sp_UserLogin]").With <Forgotflag>().Execute("@QueryType", "@ChangePassword", "@ChangePasswordKey",
                                                                                                               "@UserId", "UpdatePassword", ChangePassword, changePasswordKey, DbSecurity.Decrypt(HttpContext.Current.Server.UrlDecode(Email.Replace("_", "%"))));
                    dataList = Result.FirstOrDefault().Cast <Forgotflag>().ToList();
                    if (dataList.Count > 0)
                    {
                        Flag.Flag      = "1";
                        Flag.FlagValue = "Password Updated Successfuly !!";
                        common.Add(Flag);
                    }
                    else
                    {
                        Flag.Flag      = "0";
                        Flag.FlagValue = "Invalid UserId !!";
                        common.Add(Flag);
                    }
                }
                else
                {
                    Flag.Flag      = "0";
                    Flag.FlagValue = "Minimum length of password is 6 !!";
                    common.Add(Flag);
                }

                return(common);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #7
0
        public int ChangePassword(string OldPassword, string NewPassword, string ConfmPassword, string UserId)
        {
            int       value             = -1;
            string    Password          = string.Empty;
            string    PasswordKey       = string.Empty;
            string    ChangePassword    = string.Empty;
            string    changePasswordKey = string.Empty;
            DataTable dt_results_Password;
            //CommonManger objManager = new CommonManger();
            var results_Password = context.MultipleResults("[dbo].[Sp_UserLogin]").With <UserDetails>().Execute("@QueryType", "@UserId", "FindPassword", UserId);

            foreach (var data in results_Password)
            {
                dataList_results_Password = data.Cast <UserDetails>().ToList();
            }
            dt_results_Password = ToDataTable(dataList_results_Password);
            //dt = objManager.FillDatatableWithParam("Sp_UserLogin", "@QueryType", "@UserId", "FindPassword", UserId);
            if (dt_results_Password != null && dt_results_Password.Rows.Count > 0)
            {
                Password = DbSecurity.Decrypt(dt_results_Password.Rows[0]["Password"].ToString(), dt_results_Password.Rows[0]["PasswordKey"].ToString());
                if (Password == OldPassword)
                {
                    ChangePassword = DbSecurity.Encrypt(NewPassword, ref changePasswordKey);
                    //dt = objManager.FillDatatableWithParam("Sp_UserLogin", "@QueryType", "@ChangePassword", "@ChangePasswordKey",
                    //    "@UserId", "UpdatePassword", ChangePassword, changePasswordKey, UserId);

                    var results = context1.MultipleResults("[dbo].[Sp_UserLogin]").With <DefaultPasswordChange>().Execute("@QueryType", "@ChangePassword", "@ChangePasswordKey",
                                                                                                                          "@UserId", "UpdatePassword", ChangePassword, changePasswordKey, UserId);
                    foreach (var data in results)
                    {
                        dataList_value = data.Cast <DefaultPasswordChange>().ToList();
                    }
                    dt_value = ToDataTable(dataList_value);

                    return(Convert.ToInt32(dt_value.Rows[0]["value"]));
                }
            }
            return(value);
        }
Beispiel #8
0
        protected void btnAgree_Click(object sender, EventArgs e)
        {
            if (txtRecoverEmail.Text != "")
            {
                FAMSEntities          context        = new FAMSEntities();
                List <UserDetailCode> dataList_value = new List <UserDetailCode>();
                List <UserDetails>    dataList       = new List <UserDetails>();
                DataTable             dt_value;
                DataTable             dt;
                try
                {
                    var results = context.MultipleResults("[dbo].[Sp_UserLogin]").With <UserDetailCode>().With <UserDetails>()
                                  .Execute("@QueryType", "@EmailId", "ChkEmail", txtRecoverEmail.Text);
                    int i = 0;
                    foreach (var data in results)
                    {
                        i++;
                        if (i == 1)
                        {
                            dataList_value = data.Cast <UserDetailCode>().ToList();
                        }
                        else
                        {
                            dataList = data.Cast <UserDetails>().ToList();
                        }
                    }
                    dt_value = ToDataTable(dataList_value);
                    dt       = ToDataTable(dataList);
                }
                catch (Exception)
                {
                    throw;
                }


                //  DataSet ds = CommonManger.FillDatasetWithParam("Sp_UserLogin", "@QueryType", "@EmailId", "ChkEmail", txtRecoverEmail.Text);
                // if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null && Convert.ToInt32(ds.Tables[0].Rows[0]["value"]) == 1)
                if (dt_value.Rows.Count > 0 && dt_value != null && Convert.ToInt32(dt_value.Rows[0]["value"]) == 1)
                {
                    // if (ds.Tables[1].Rows.Count > 0 && ds.Tables[1] != null)
                    if (dt.Rows.Count > 0 && dt != null)
                    {
                        StringBuilder sb               = new StringBuilder();
                        string        smtpAddress      = "smtp.gmail.com";
                        int           portNumber       = 587;
                        bool          enableSSL        = true;
                        string        emailFromAddress = "*****@*****.**"; //Sender Email Address
                        string        password         = "******";              //Sender Password
                        string        emailToAddress   = "*****@*****.**";  //Receiver Email Address
                        string        subject          = "Recover Password";
                        string        WebAppUrl        = ConfigurationManager.AppSettings["WebAppUrl"].ToString();

                        sb.Append("Dear " + dt.Rows[0]["UserName"].ToString() + ",<br> <br>");
                        sb.Append("Please click on the below button to set a new Password . <br> <br>");

                        string User = DbSecurity.Encrypt(dt.Rows[0]["UserId"].ToString());
                        sb.Append("<a href='" + WebAppUrl + "changepassword.aspx?Id=" + User + "' target='_blank'>");
                        sb.Append("<input style='background-color: #3965a9;color: #fff;padding: 3px 10px 3px 10px;' type='button' value='Change Password' /></a> </div>");
                        // string body = "Hello, This is Email sending test using gmail.";
                        using (MailMessage mail = new MailMessage())
                        {
                            mail.From = new MailAddress(emailFromAddress);
                            mail.To.Add(txtRecoverEmail.Text);
                            mail.Subject    = subject;
                            mail.Body       = sb.ToString();
                            mail.IsBodyHtml = true;
                            //mail.Attachments.Add(new Attachment("D:\\TestFile.txt"));//--Uncomment this to send any attachment
                            using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                            {
                                smtp.Credentials = new NetworkCredential(emailFromAddress, password);
                                smtp.EnableSsl   = enableSSL;
                                smtp.Send(mail);
                            }
                        }
                        //using (StringWriter sw = new StringWriter())
                        //{
                        //    using (HtmlTextWriter hw = new HtmlTextWriter(sw))
                        //    {
                        //        StringBuilder sb = new StringBuilder();
                        //        string WebAppUrl = ConfigurationManager.AppSettings["WebAppUrl"].ToString();
                        //        string SMTPHost = ConfigurationManager.AppSettings["Amazon_SMTPHost"].ToString();
                        //        string UserId = ConfigurationManager.AppSettings["Amazon_UserId"].ToString();
                        //        string MailPassword = ConfigurationManager.AppSettings["Amazon_MailPassword"].ToString();
                        //        string SMTPPort = ConfigurationManager.AppSettings["Amazon_SMTPPort"].ToString();
                        //        string SMTPEnableSsl = ConfigurationManager.AppSettings["Amazon_SMTPEnableSsl"].ToString();
                        //        string FromMailId = ConfigurationManager.AppSettings["Amazon_FromMailId"].ToString();
                        //        string Teamtext = ConfigurationManager.AppSettings["Team"].ToString();

                        //        sb.Append("Dear " + dt.Rows[0]["UserName"].ToString() + ",<br> <br>");
                        //        sb.Append("Please click on the below button to set a new Password . <br> <br>");

                        //        string User = DbSecurity.Encrypt(dt.Rows[0]["UserId"].ToString());
                        //        sb.Append("<a href='" + WebAppUrl + "changepassword.aspx?Id=" + User + "' target='_blank'>");
                        //        sb.Append("<input style='background-color: #3965a9;color: #fff;padding: 3px 10px 3px 10px;' type='button' value='Change Password' /></a> </div>");

                        //        SmtpClient smtpClient = new SmtpClient();
                        //        MailMessage mailmsg = new MailMessage();
                        //        MailAddress mailaddress = new MailAddress(FromMailId);
                        //        mailmsg.To.Add(txtRecoverEmail.Text);
                        //        mailmsg.From = mailaddress;

                        //        mailmsg.Subject = "Recover Password";
                        //        mailmsg.IsBodyHtml = true;
                        //        mailmsg.Body = sb.ToString();

                        //        smtpClient.Host = SMTPHost;
                        //        smtpClient.Port = Convert.ToInt32(SMTPPort);
                        //        smtpClient.EnableSsl = Convert.ToBoolean(SMTPEnableSsl);
                        //        smtpClient.UseDefaultCredentials = true;
                        //        smtpClient.Credentials = new System.Net.NetworkCredential(UserId, MailPassword);
                        //        //smtpClient.Send(mailmsg);
                        //        //  CommonManger.FillDatasetWithParam("Sp_SendEmail", "@QueryType", "@MandateId", "@EmailCount", "@SmsCount", "SendMail", Convert.ToString(0), "1", "0");

                        //    }
                        //}
                    }
                    txtRecoverEmail.Text = "";
                    HdnIndustries.Value  = "Y";
                    //ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "ShowPopup()", true);
                    //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "ShowPopup();", true);
                    //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>ShowMailPopup();</script>", false);
                    // ClientScript.RegisterClientScriptBlock(this.GetType(), "script", "ShowPopup();", true);
                }
                //    //else if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null && Convert.ToInt32(ds.Tables[0].Rows[0]["value"]) == 2)
                //    //{
                //    //    if (ds.Tables[1].Rows.Count > 0 && ds.Tables[1] != null)
                //    //    {
                //    //        using (StringWriter sw = new StringWriter())
                //    //        {
                //    //            using (HtmlTextWriter hw = new HtmlTextWriter(sw))
                //    //            {
                //    //                StringBuilder sb = new StringBuilder();
                //    //                string WebAppUrl = ConfigurationManager.AppSettings["WebAppUrl"].ToString();
                //    //                string SMTPHost = ConfigurationManager.AppSettings["Amazon_SMTPHost"].ToString();
                //    //                string UserId = ConfigurationManager.AppSettings["Amazon_UserId"].ToString();
                //    //                string MailPassword = ConfigurationManager.AppSettings["Amazon_MailPassword"].ToString();
                //    //                string SMTPPort = ConfigurationManager.AppSettings["Amazon_SMTPPort"].ToString();
                //    //                string SMTPEnableSsl = ConfigurationManager.AppSettings["Amazon_SMTPEnableSsl"].ToString();
                //    //                string FromMailId = ConfigurationManager.AppSettings["Amazon_FromMailId"].ToString();
                //    //                string Teamtext = ConfigurationManager.AppSettings["Team"].ToString();
                //    //                sb.Append("Dear Sir/Mam ,<br> <br>");
                //    //                sb.Append(" " + ds.Tables[1].Rows[0]["Name"].ToString() + " has requested to set a new password. Please click on the below button to set a new Password. <br> <br>");

                //    //                string User = DbSecurity.Encrypt(ds.Tables[1].Rows[0]["UserId"].ToString());
                //    //                sb.Append("<a href='" + WebAppUrl + "ChangePassword.aspx?Id=" + User + "' target='_blank'>");
                //    //                sb.Append("<input style='background-color: #3965a9;color: #fff;padding: 3px 10px 3px 10px;' type='button' value='Change Password' /></a> </div>");
                //    //                SmtpClient smtpClient = new SmtpClient();
                //    //                MailMessage mailmsg = new MailMessage();
                //    //                MailAddress mailaddress = new MailAddress(FromMailId);
                //    //                mailmsg.To.Add(ds.Tables[2].Rows[0]["EmailId"].ToString());
                //    //                mailmsg.From = mailaddress;
                //    //                mailmsg.Subject = "Recover Password";
                //    //                mailmsg.IsBodyHtml = true;
                //    //                mailmsg.Body = sb.ToString();
                //    //                smtpClient.Host = SMTPHost;
                //    //                smtpClient.Port = Convert.ToInt32(SMTPPort);
                //    //                smtpClient.EnableSsl = Convert.ToBoolean(SMTPEnableSsl);
                //    //                smtpClient.UseDefaultCredentials = true;
                //    //                smtpClient.Credentials = new System.Net.NetworkCredential(UserId, MailPassword);
                //    //                smtpClient.Send(mailmsg);
                //    //                CommonManger.FillDatasetWithParam("Sp_SendEmail", "@QueryType", "@MandateId", "@EmailCount", "@SmsCount", "SendMail", Convert.ToString(0), "1", "0");

                //    //            }
                //    //        }
                //    //    }
                //    //    txtEmail_Zipnach.Text = "";
                //    //    ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Email is sent to Admin !!')", true);
                //    //}
                //    else if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null && Convert.ToInt32(ds.Tables[0].Rows[0]["value"]) == -1)
                //    {
                //        txtRecoverEmail.Text = "";
                //        ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Not exist!!!')", true);
                //    }

                //}
                //else
                //{

                //}
            }
            //protected void btnAgree_Click(object sender, EventArgs e)
            //{
            //    FAMSEntities context = new FAMSEntities();

            //    if (txtEmail.Value != "")
            //    {
            //        var results = context.MultipleResults("[dbo].[Sp_DemoReport]").With<SummaryReportExcel>()
            //.Execute("@Querytype", "@CustomerAccount", "@Fromdate", "@Todate", "GetSummaryReportDataExcel", Session["UserName"].ToString(), fromdate, todate);
            //        DataSet ds = CommonManger.FillDatasetWithParam("Sp_UserLogin", "@QueryType", "@EmailId", "ChkEmail", txtEmail.Value);
            //        if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null && Convert.ToInt32(ds.Tables[0].Rows[0]["value"]) == 1)
            //        {
            //            if (ds.Tables[1].Rows.Count > 0 && ds.Tables[1] != null)
            //            {
            //                using (StringWriter sw = new StringWriter())
            //                {
            //                    using (HtmlTextWriter hw = new HtmlTextWriter(sw))
            //                    {
            //                        StringBuilder sb = new StringBuilder();
            //                        string WebAppUrl = ConfigurationManager.AppSettings["WebAppUrl"].ToString();
            //                        string SMTPHost = ConfigurationManager.AppSettings["Amazon_SMTPHost"].ToString();
            //                        string UserId = ConfigurationManager.AppSettings["Amazon_UserId"].ToString();
            //                        string MailPassword = ConfigurationManager.AppSettings["Amazon_MailPassword"].ToString();
            //                        string SMTPPort = ConfigurationManager.AppSettings["Amazon_SMTPPort"].ToString();
            //                        string SMTPEnableSsl = ConfigurationManager.AppSettings["Amazon_SMTPEnableSsl"].ToString();
            //                        string FromMailId = ConfigurationManager.AppSettings["Amazon_FromMailId"].ToString();
            //                        string Teamtext = ConfigurationManager.AppSettings["Team"].ToString();

            //                        //string User = DbSecurity.Encrypt(ds.Tables[1].Rows[0]["UserId"].ToString());

            //                        //sb.Append("Dear " + ds.Tables[1].Rows[0]["UserName"].ToString() + ",<br> <br>");
            //                        //sb.Append("Please click on the below button to set a new Password . <br> <br>");
            //                        //sb.Append("<a href='" + WebAppUrl + "ChangePassword.aspx?Id=" + User + "' target='_blank'>");
            //                        //sb.Append("<input style='background-color: #3965a9;color: #fff;padding: 3px 10px 3px 10px;' type='button' value='Change Password' /></a> </div>");
            //                        string User = DbSecurity.Encrypt(ds.Tables[1].Rows[0]["UserId"].ToString());
            //                        sb.Append("Hi " + ds.Tables[1].Rows[0]["UserName"].ToString() + ",<br> <br>");
            //                        sb.Append("We have received a request to reset your password. In case you have not initiated such request, you should ignore this email.<br/>");
            //                        sb.Append("Reset your password by clicking on this link:");
            //                        sb.Append("<a href='" + WebAppUrl + "ChangePassword.aspx?Id=" + User + "' target='_blank'>" + WebAppUrl + "ChangePassword.aspx?Id=" + User + "/> <br/>");

            //                        sb.Append("Thanks<br/>");
            //                        sb.Append("Team " + Convert.ToString(ConfigurationManager.AppSettings["Team"]));
            //                        sb.Append("<br/>");
            //                        sb.Append("<i style='font-size:11px'>(Email Generated from Unattendable MailBox, Please Do Not reply.)</i>");

            //                        SmtpClient smtpClient = new SmtpClient();
            //                        MailMessage mailmsg = new MailMessage();
            //                        MailAddress mailaddress = new MailAddress(FromMailId);
            //                        mailmsg.To.Add(txtEmail.Value);
            //                        mailmsg.From = mailaddress;

            //                        mailmsg.Subject = "Reset your QuickCheck Password";
            //                        mailmsg.IsBodyHtml = true;
            //                        mailmsg.Body = sb.ToString();

            //                        smtpClient.Host = SMTPHost;
            //                        smtpClient.Port = Convert.ToInt32(SMTPPort);
            //                        smtpClient.EnableSsl = Convert.ToBoolean(SMTPEnableSsl);
            //                        smtpClient.UseDefaultCredentials = true;
            //                        smtpClient.Credentials = new System.Net.NetworkCredential(UserId, MailPassword);
            //                        smtpClient.Send(mailmsg);

            //                        CommonManger.FillDatasetWithParam("Sp_SendEmail", "@QueryType", "@MandateId", "@EmailCount", "@SmsCount", "SendMail", Convert.ToString(0), "1", "0");

            //                    }
            //                }
            //            }
            //            txtEmail.Value = "";
            //            ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Email is sent!!!')", true);

            //        }
            //        else if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null && Convert.ToInt32(ds.Tables[0].Rows[0]["value"]) == 2)
            //        {
            //            if (ds.Tables[1].Rows.Count > 0 && ds.Tables[1] != null)
            //            {
            //                using (StringWriter sw = new StringWriter())
            //                {
            //                    using (HtmlTextWriter hw = new HtmlTextWriter(sw))
            //                    {
            //                        StringBuilder sb = new StringBuilder();
            //                        string WebAppUrl = ConfigurationManager.AppSettings["WebAppUrl"].ToString();
            //                        string SMTPHost = ConfigurationManager.AppSettings["Amazon_SMTPHost"].ToString();
            //                        string UserId = ConfigurationManager.AppSettings["Amazon_UserId"].ToString();
            //                        string MailPassword = ConfigurationManager.AppSettings["Amazon_MailPassword"].ToString();
            //                        string SMTPPort = ConfigurationManager.AppSettings["Amazon_SMTPPort"].ToString();
            //                        string SMTPEnableSsl = ConfigurationManager.AppSettings["Amazon_SMTPEnableSsl"].ToString();
            //                        string FromMailId = ConfigurationManager.AppSettings["Amazon_FromMailId"].ToString();
            //                        string Teamtext = ConfigurationManager.AppSettings["Team"].ToString();

            //                        string User = DbSecurity.Encrypt(ds.Tables[1].Rows[0]["UserId"].ToString());
            //                        sb.Append("Hi " + ds.Tables[1].Rows[0]["UserName"].ToString() + ",<br> <br>");
            //                        sb.Append("We have received a request to reset your password. In case you have not initiated such request, you should ignore this email.<br/>");
            //                        sb.Append("Reset your password by clicking on this link:");
            //                        sb.Append("<a href='" + WebAppUrl + "ChangePassword.aspx?Id=" + User + "' target='_blank'>" + WebAppUrl + "ChangePassword.aspx?Id=" + User + "/> <br/>");

            //                        sb.Append("Thanks<br/>");
            //                        sb.Append("Team " + Convert.ToString(ConfigurationManager.AppSettings["Team"]));
            //                        sb.Append("<br/>");
            //                        sb.Append("<i style='font-size:11px'>(Email Generated from Unattendable MailBox, Please Do Not reply.)</i>");

            //                        SmtpClient smtpClient = new SmtpClient();
            //                        MailMessage mailmsg = new MailMessage();
            //                        MailAddress mailaddress = new MailAddress(FromMailId);
            //                        mailmsg.To.Add(ds.Tables[2].Rows[0]["EmailId"].ToString());
            //                        mailmsg.From = mailaddress;
            //                        mailmsg.Subject = "Reset your QuickCheck Password";
            //                        mailmsg.IsBodyHtml = true;
            //                        mailmsg.Body = sb.ToString();
            //                        smtpClient.Host = SMTPHost;
            //                        smtpClient.Port = Convert.ToInt32(SMTPPort);
            //                        smtpClient.EnableSsl = Convert.ToBoolean(SMTPEnableSsl);
            //                        smtpClient.UseDefaultCredentials = true;
            //                        smtpClient.Credentials = new System.Net.NetworkCredential(UserId, MailPassword);
            //                        smtpClient.Send(mailmsg);
            //                        CommonManger.FillDatasetWithParam("Sp_SendEmail", "@QueryType", "@MandateId", "@EmailCount", "@SmsCount", "SendMail", Convert.ToString(0), "1", "0");

            //                    }
            //                }
            //            }
            //            txtEmail.Value = "";
            //            ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Email is sent to Admin !!')", true);
            //        }
            //        else if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null && Convert.ToInt32(ds.Tables[0].Rows[0]["value"]) == -1)
            //        {
            //            txtEmail.Value = "";
            //            ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Not exist!!!')", true);
            //        }

            //    }
            //    else
            //    {

            //    }
        }
Beispiel #9
0
        public IEnumerable <CommonFlag> Binddetails(string Username, string Password)
        {
            List <Logindetails> dataList = new List <Logindetails>();

            try
            {
                var Result = dbcontext.MultipleResults("[dbo].[sp_UserLogin]").With <Logindetails>().Execute("@QueryType", "@UserName", "GetUser", Username);
                foreach (var Logindata in Result)
                {
                    dataList = Logindata.Cast <Logindetails>().ToList();
                    if (dataList.Count > 0)
                    {
                        string strDbPassword = DbSecurity.Decrypt(Convert.ToString(Logindata.Cast <Logindetails>().ToList().Select(x => x.Password).First().ToString()), Convert.ToString(Logindata.Cast <Logindetails>().ToList().Select(x => x.PasswordKey).First().ToString()));
                        if (strDbPassword.Trim() != Password)
                        {
                            Flag.Flag      = "0";
                            Flag.FlagValue = "Wrong Username or Password!!";
                            common.Add(Flag);
                        }
                        else
                        {
                            Random generator = new Random();
                            QuickCheckEmandate_AngularEntities dbcontext = new QuickCheckEmandate_AngularEntities();
                            var SaveLoginSessionTrxn = dbcontext.MultipleResults("[dbo].[sp_UserLogin]").With <SaveLoginSessionTrxn>().Execute("@QueryType", "@UserId", "@TokenID", "@IPAddress", "@MacAddress", "@IsLogin", "SaveLoginSessionTrxn", Convert.ToString(Logindata.Cast <Logindetails>().ToList().Select(x => x.UserId).First().ToString()), Convert.ToString(generator.Next(1, 1000000)), Convert.ToString(GetIpAddress()), Convert.ToString(GetMacAddress()), Convert.ToString(1));
                            foreach (var Existlogin in SaveLoginSessionTrxn)
                            {
                                //  if (Existlogin.Cast<SaveLoginSessionTrxn>().ToList().Select(x => x.SessionActive).First().ToString() == "0")
                                //  {
                                #region Session creation
                                // Iace.User.User.SaveUserToSession(dataList);
                                Flag.IsRefrenceCheck    = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsRefrenceCheck).First().ToString()))).Replace("%", "_");
                                Flag.IsOverPrintMandate = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsOverPrintMandate).First().ToString()))).Replace("%", "_");
                                Flag.IsBulkMandate      = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsBulkMandate).First().ToString()))).Replace("%", "_");
                                Flag.IsMandate          = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsMandate).First().ToString()))).Replace("%", "_");
                                //NewCode
                                Flag.IsMandateEdit       = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsMandateEdit).First().ToString()))).Replace("%", "_");
                                Flag.IsRefrenceEdit      = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsRefrenceEdit).First().ToString()))).Replace("%", "_");
                                Flag.IsEmandate          = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsEmandate).First().ToString()))).Replace("%", "_");
                                Flag.IsPhysical          = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsPhysical).First().ToString()))).Replace("%", "_");
                                Flag.IsZipShoreABPS      = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsZipShoreABPS).First().ToString()))).Replace("%", "_");
                                Flag.UserId              = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserId).First().ToString()))).Replace("%", "_");
                                Flag.ReferenceId         = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(dataList.Cast <Logindetails>().ToList().Select(x => x.ReferenceId).First().ToString())).Replace("%", "_");
                                Flag.UserName            = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserName).First().ToString()))).Replace("%", "_");
                                Flag.Password            = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.Password).First().ToString()))).Replace("%", "_");
                                Flag.PasswordKey         = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.PasswordKey).First().ToString()))).Replace("%", "_");
                                Flag.UserCode            = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserCode).First().ToString()))).Replace("%", "_");
                                Flag.UserType            = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserType).First().ToString()))).Replace("%", "_");
                                Flag.BranchId            = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(dataList.Cast <Logindetails>().ToList().Select(x => x.BranchId).First().ToString())).Replace("%", "_");
                                Flag.BranchName          = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.BranchName).First().ToString()))).Replace("%", "_");
                                Flag.IsDefaultPswdChange = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsDefaultPswdChange).First().ToString()))).Replace("%", "_");
                                Flag.LastLogin           = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.LastLogin).First().ToString()))).Replace("%", "_");
                                Flag.IsActive            = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsActive).First().ToString()))).Replace("%", "_");
                                Flag.IsDeleted           = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsDeleted).First().ToString()))).Replace("%", "_");
                                Flag.CreatedBy           = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(dataList.Cast <Logindetails>().ToList().Select(x => x.CreatedBy).First().ToString())).Replace("%", "_");
                                Flag.CreatedOn           = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(dataList.Cast <Logindetails>().ToList().Select(x => x.CreatedOn).First().ToString())).Replace("%", "_");
                                #endregion

                                Flag.Flag = "1";
                                common.Add(Flag);
                                //}
                                //else {
                                //    Flag.Flag = "0";
                                //    Flag.FlagValue = "User already logged on. Either Try logging in after closing the current session or Try after some time!!";
                                //    common.Add(Flag);
                                //}
                            }
                        }
                    }
                    else
                    {
                        Flag.Flag      = "0";
                        Flag.FlagValue = "Invalid User!!";
                        common.Add(Flag);
                    }
                }
                return(common);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #10
0
        public IEnumerable <CommonFlag> SendMail(string Username)
        {
            try
            {
                List <Value> dataList = new List <Value>(); List <UserDetails> dataList1 = new List <UserDetails>();
                var          Result = dbcontext.MultipleResults("[dbo].[Sp_UserLogin]").With <Value>().With <UserDetails>().Execute("@QueryType", "@EmailId", "ChkEmail", Username);

                dataList  = Result.FirstOrDefault().Cast <Value>().ToList();
                dataList1 = Result.LastOrDefault().Cast <UserDetails>().ToList();
                if (dataList.Cast <Value>().ToList().Select(x => x.value).First().ToString() == "1")
                {
                    if (dataList1.Count > 0)
                    {
                        using (StringWriter sw = new StringWriter())
                        {
                            using (HtmlTextWriter hw = new HtmlTextWriter(sw))
                            {
                                StringBuilder sb            = new StringBuilder();
                                string        WebAppUrl     = ConfigurationManager.AppSettings["WebAppUrl"].ToString();
                                string        SMTPHost      = ConfigurationManager.AppSettings["Amazon_SMTPHost"].ToString();
                                string        UserId        = ConfigurationManager.AppSettings["Amazon_UserId"].ToString();
                                string        MailPassword  = ConfigurationManager.AppSettings["Amazon_MailPassword"].ToString();
                                string        SMTPPort      = ConfigurationManager.AppSettings["Amazon_SMTPPort"].ToString();
                                string        SMTPEnableSsl = ConfigurationManager.AppSettings["Amazon_SMTPEnableSsl"].ToString();
                                string        FromMailId    = ConfigurationManager.AppSettings["Amazon_FromMailId"].ToString();
                                string        Teamtext      = ConfigurationManager.AppSettings["Team"].ToString();
                                sb.Append("Dear " + dataList1.Cast <UserDetails>().ToList().Select(x => x.UserName).First().ToString() + ",<br> <br>");
                                sb.Append("Please click on the below button to set a new Password . <br> <br>");
                                string User = HttpContext.Current.Server.UrlEncode(DbSecurity.Encrypt(dataList1.Cast <UserDetails>().ToList().Select(x => x.UserId).First().ToString())).Replace("%", "_");
                                sb.Append("<a href=' " + WebAppUrl + "ChangePassword/" + User + "' target='_blank'>");
                                sb.Append("<input style='background-color: #3965a9;color: #fff;padding: 3px 10px 3px 10px;' type='button' value='Change Password' /></a> </div>");

                                SmtpClient  smtpClient  = new SmtpClient();
                                MailMessage mailmsg     = new MailMessage();
                                MailAddress mailaddress = new MailAddress(FromMailId);
                                mailmsg.To.Add(Username);
                                mailmsg.From = mailaddress;

                                mailmsg.Subject    = "Recover Password";
                                mailmsg.IsBodyHtml = true;
                                mailmsg.Body       = sb.ToString();

                                smtpClient.Host                  = SMTPHost;
                                smtpClient.Port                  = Convert.ToInt32(SMTPPort);
                                smtpClient.EnableSsl             = Convert.ToBoolean(SMTPEnableSsl);
                                smtpClient.UseDefaultCredentials = true;
                                smtpClient.Credentials           = new System.Net.NetworkCredential(UserId, MailPassword);
                                smtpClient.Send(mailmsg);
                                QuickCheckEmandate_AngularEntities dbcontext = new QuickCheckEmandate_AngularEntities();
                                dbcontext.MultipleResults("[dbo].[Sp_SendEmail]").With <Value>().Execute("@QueryType", "@MandateId", "@EmailCount", "@SmsCount", "SendMail", Convert.ToString(0), "1", "0");
                                Flag.Flag = "1";
                                common.Add(Flag);
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Flag.Flag = "1";
                common.Add(Flag);
            }

            return(common);
        }
Beispiel #11
0
        public int CreateUser(string UserName, string UserEmail, string UserAccount, string UserId)
        {
            try
            {
                string Password    = string.Empty;
                string PasswordKey = string.Empty;
                //int value = CommonManger.IntMethodWithParam("Sp_BankBulkUpload", "@QueryType", "@MandateId", "@UserId", "CancelMandate", MandateId, DbSecurity.Decrypt(UserId));
                //return value;
                Password = DbSecurity.Encrypt(UserEmail.Split('@').ElementAtOrDefault(0), ref PasswordKey);
                var results_Password = context.MultipleResults("[dbo].[Sp_user]").With <DefaultPasswordChange>().Execute("@QueryType", "@UserName", "@EmailId", "@AccountNo", "@UserId", "@UserType", "@Password", "@PasswordKey", "SaveData", UserName, UserEmail, UserAccount, UserId, "1", Password, PasswordKey);

                foreach (var data in results_Password)
                {
                    dataList_Save_value = data.Cast <DefaultPasswordChange>().ToList();
                }
                dt_Save_value = ToDataTable(dataList_Save_value);

                if (Convert.ToInt32(dt_Save_value.Rows[0]["value"]) != -1)
                {
                    StringBuilder sb               = new StringBuilder();
                    string        smtpAddress      = "smtp.gmail.com";
                    int           portNumber       = 587;
                    bool          enableSSL        = true;
                    string        emailFromAddress = "*****@*****.**"; //Sender Email Address
                    string        password         = "******";              //Sender Password
                    //string emailToAddress = "*****@*****.**"; //Receiver Email Address
                    string subject   = "User New Password";
                    string WebAppUrl = ConfigurationManager.AppSettings["WebAppUrl"].ToString();


                    sb.Append("Dear " + UserName + ",<br> <br>");
                    sb.Append("Please find your new Password is --   " + UserEmail.Split('@').ElementAtOrDefault(0) + " <br> <br>");

                    //  string User = DbSecurity.Encrypt(dt.Rows[0]["UserId"].ToString());
                    //sb.Append("<a href='" + WebAppUrl + "changepassword.aspx?Id=" + User + "' target='_blank'>");
                    //sb.Append("<input style='background-color: #3965a9;color: #fff;padding: 3px 10px 3px 10px;' type='button' value='Change Password' /></a> </div>");

                    using (MailMessage mail = new MailMessage())
                    {
                        mail.From = new MailAddress(emailFromAddress);
                        mail.To.Add(UserEmail);
                        mail.Subject    = subject;
                        mail.Body       = sb.ToString();
                        mail.IsBodyHtml = true;
                        //mail.Attachments.Add(new Attachment("D:\\TestFile.txt"));//--Uncomment this to send any attachment
                        using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
                        {
                            smtp.Credentials = new NetworkCredential(emailFromAddress, password);
                            smtp.EnableSsl   = enableSSL;
                            smtp.Send(mail);
                        }
                    }


                    // For mail purpose start
                    //using (StringWriter sw = new StringWriter())
                    //{
                    //    using (HtmlTextWriter hw = new HtmlTextWriter(sw))
                    //    {
                    //        StringBuilder sb = new StringBuilder();
                    //        string WebAppUrl = ConfigurationManager.AppSettings["WebAppUrl"].ToString();
                    //        string SMTPHost = ConfigurationManager.AppSettings["Amazon_SMTPHost"].ToString();
                    //        string UserId_Mail = ConfigurationManager.AppSettings["Amazon_UserId"].ToString();
                    //        string MailPassword = ConfigurationManager.AppSettings["Amazon_MailPassword"].ToString();
                    //        string SMTPPort = ConfigurationManager.AppSettings["Amazon_SMTPPort"].ToString();
                    //        string SMTPEnableSsl = ConfigurationManager.AppSettings["Amazon_SMTPEnableSsl"].ToString();
                    //        string FromMailId = ConfigurationManager.AppSettings["Amazon_FromMailId"].ToString();
                    //        string Teamtext = ConfigurationManager.AppSettings["Team"].ToString();

                    //        sb.Append("Dear " + UserName + ",<br> <br>");
                    //        sb.Append("Please find your new Password is --   " + UserEmail.Split('@').ElementAtOrDefault(0) + " <br> <br>");

                    //        //  string User = DbSecurity.Encrypt(dt.Rows[0]["UserId"].ToString());
                    //        //sb.Append("<a href='" + WebAppUrl + "changepassword.aspx?Id=" + User + "' target='_blank'>");
                    //        //sb.Append("<input style='background-color: #3965a9;color: #fff;padding: 3px 10px 3px 10px;' type='button' value='Change Password' /></a> </div>");

                    //        SmtpClient smtpClient = new SmtpClient();
                    //        MailMessage mailmsg = new MailMessage();
                    //        MailAddress mailaddress = new MailAddress(FromMailId);
                    //        mailmsg.To.Add(UserEmail);
                    //        mailmsg.From = mailaddress;

                    //        mailmsg.Subject = "Recover Password";
                    //        mailmsg.IsBodyHtml = true;
                    //        mailmsg.Body = sb.ToString();

                    //        smtpClient.Host = SMTPHost;
                    //        smtpClient.Port = Convert.ToInt32(SMTPPort);
                    //        smtpClient.EnableSsl = Convert.ToBoolean(SMTPEnableSsl);
                    //        smtpClient.UseDefaultCredentials = true;
                    //        smtpClient.Credentials = new System.Net.NetworkCredential(UserId_Mail, MailPassword);
                    //       //smtpClient.Send(mailmsg);
                    //        //  CommonManger.FillDatasetWithParam("Sp_SendEmail", "@QueryType", "@MandateId", "@EmailCount", "@SmsCount", "SendMail", Convert.ToString(0), "1", "0");

                    //    }
                    //}
                }
                return(Convert.ToInt32(dt_Save_value.Rows[0]["value"]));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #12
0
        public ActionResult BindtempOrderId(string temporderid)
        {
            string temprder = DbSecurity.Encrypt(temporderid);

            return(Json(temprder, JsonRequestBehavior.AllowGet));
        }
Beispiel #13
0
        public ActionResult BindOrderTypeId(string OrderTypeId)
        {
            string OrderType = DbSecurity.Encrypt(OrderTypeId);

            return(Json(OrderType, JsonRequestBehavior.AllowGet));
        }
Beispiel #14
0
        // public void Validate1(string EmailId)
        //{
        //   Boolean IsFoundAccessCode = false;
        //     try
        //     {
        //         if (EmailId != "")
        //         {
        //             dt = objManager.FillDatatableWithParam("Sp_UserLogin", "@QueryType", "@EmailId", "chkEmail", EmailId);
        //             if (dt != null && dt.Rows.Count > 0)
        //             {
        //                 foreach (DataRow row in dt.Rows)
        //                 {
        //                     try
        //                     {
        //                        // string Pass = (DbSecurity.Decrypt(row["AccessCode"].ToString()));
        //                         string Pass = DbSecurity.Decrypt(row["AccessCode"].ToString(), row["AccessKey"].ToString());
        //                         IsFoundAccessCode = true;
        //                         break;
        //                     }
        //                     catch { }
        //                 }
        //             }
        //             if (IsFoundAccessCode == true)
        //             {
        //                 EmailId = "";

        //                 Console.WriteLine("Present");
        //             }
        //             else
        //             {
        //               //  MessageBox.Show("AccessCode is invalid", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //               //  txtAccessCode.Focus();
        //                 Console.WriteLine("AccessCode is invalid");
        //             }
        //         }
        //         else
        //         {
        //           //  MessageBox.Show("Please enter AccessCode", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //            // txtAccessCode.Focus();
        //           Console.WriteLine("Please enter AccessCode");

        //         }


        //     }
        //     catch (Exception ex)
        //     {
        //         //MessageBox.Show(ex.Message);
        //     }
        // }

        public string  Validate(string EmailId)
        {
            if (EmailId != "")


            {
                //string Email = EmailId;


                DataSet ds = objManager.FillDatasetWithParam("Sp_UserLogin", "@QueryType", "@EmailId", "chkEmail", EmailId);
                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null)
                    {
                        using (StringWriter sw = new StringWriter())
                        {
                            using (HtmlTextWriter hw = new HtmlTextWriter(sw))
                            {
                                StringBuilder sb            = new StringBuilder();
                                string        WebAppUrl     = ConfigurationManager.AppSettings["WebAppUrl"].ToString();
                                string        SMTPHost      = ConfigurationManager.AppSettings["SMTPHost"].ToString();
                                string        UserId        = ConfigurationManager.AppSettings["UserId"].ToString();
                                string        MailPassword  = ConfigurationManager.AppSettings["MailPassword"].ToString();
                                string        SMTPPort      = ConfigurationManager.AppSettings["SMTPPort"].ToString();
                                string        SMTPEnableSsl = ConfigurationManager.AppSettings["SMTPEnableSsl"].ToString();

                                // sb.Append("Dear " + ds.Tables[1].Rows[0]["UserName"].ToString() + ",<br> <br>");

                                string User       = ds.Tables[1].Rows[0]["UserPin"].ToString();
                                string Pass       = DbSecurity.Decrypt(ds.Tables[1].Rows[0]["Password"].ToString(), ds.Tables[1].Rows[0]["PasswordKey"].ToString());
                                string accesscode = DbSecurity.Decrypt(ds.Tables[1].Rows[0]["AccessCode"].ToString(), ds.Tables[1].Rows[0]["AccessKey"].ToString());
                                //    string User = DbSecurity.Encrypt(ds.Tables[1].Rows[0]["UserId"].ToString());
                                sb.Append("Your UserPin = " + " " + User);
                                sb.Append("<br>\nYour AccessCode = " + " " + Pass);


                                //sb.Append("<a href='" + WebAppUrl + "ForgetPassword.aspx?Id=" + User + "' target='_blank'>");
                                //sb.Append("<input style='background-color: #3965a9;color: #fff;padding: 3px 10px 3px 10px;' type='button' value='Change Password' /></a> </div>");
                                SmtpClient smtpClient = new SmtpClient();

                                MailMessage mailmsg     = new MailMessage();
                                MailAddress mailaddress = new MailAddress(UserId);

                                mailmsg.To.Add(EmailId);

                                mailmsg.From = mailaddress;

                                mailmsg.Subject                  = "Recover Password";
                                mailmsg.IsBodyHtml               = true;
                                mailmsg.Body                     = sb.ToString();
                                smtpClient.Host                  = SMTPHost;
                                smtpClient.Port                  = Convert.ToInt32(SMTPPort);
                                smtpClient.EnableSsl             = Convert.ToBoolean(SMTPEnableSsl);
                                smtpClient.UseDefaultCredentials = true;
                                smtpClient.Credentials           = new System.Net.NetworkCredential(UserId, MailPassword);
                                smtpClient.Send(mailmsg);
                            }
                        }
                    }
                    EmailId = "";
                    //string result = "0";
                    //return result;

                    //ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('E-Mail has been sent Successfuly !!')", true);
                }
                else if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null && Convert.ToInt32(ds.Tables[0].Rows[0]["value"]) == 2)
                {
                    if (ds.Tables[1].Rows.Count > 0 && ds.Tables[1] != null)
                    {
                        using (StringWriter sw = new StringWriter())
                        {
                            using (HtmlTextWriter hw = new HtmlTextWriter(sw))
                            {
                                string        WebAppUrl     = ConfigurationManager.AppSettings["WebAppUrl"];
                                string        SMTPHost      = ConfigurationManager.AppSettings["SMTPHost"];
                                string        UserId        = ConfigurationManager.AppSettings["UserId"];
                                string        MailPassword  = ConfigurationManager.AppSettings["Password"];
                                string        SMTPPort      = ConfigurationManager.AppSettings["SMTPPort"];
                                string        SMTPEnableSsl = ConfigurationManager.AppSettings["SMTPEnableSsl"];
                                StringBuilder sb            = new StringBuilder();


                                sb.Append("Dear Sir/Mam ,<br> <br>");
                                sb.Append(" " + ds.Tables[1].Rows[0]["Name"].ToString() + " has requested to set a new password. Please click on the below button to set a new Password. <br> <br>");

                                string User = DbSecurity.Encrypt(ds.Tables[1].Rows[0]["UserId"].ToString());
                                sb.Append("<a href='" + WebAppUrl + "ForgetPassword.aspx?Id=" + User + "' target='_blank'>");
                                sb.Append("<input style='background-color: #3965a9;color: #fff;padding: 3px 10px 3px 10px;' type='button' value='Change Password' /></a> </div>");
                                SmtpClient  smtpClient  = new SmtpClient();
                                MailMessage mailmsg     = new MailMessage();
                                MailAddress mailaddress = new MailAddress(UserId);
                                mailmsg.To.Add(ds.Tables[2].Rows[0]["EmailId"].ToString());
                                mailmsg.From = mailaddress;

                                mailmsg.Subject    = "Recover Password";
                                mailmsg.IsBodyHtml = true;
                                mailmsg.Body       = sb.ToString();

                                smtpClient.Host                  = SMTPHost;
                                smtpClient.Port                  = Convert.ToInt32(SMTPPort);
                                smtpClient.EnableSsl             = Convert.ToBoolean(SMTPEnableSsl);
                                smtpClient.UseDefaultCredentials = true;
                                smtpClient.Credentials           = new System.Net.NetworkCredential(UserId, MailPassword);
                                smtpClient.Send(mailmsg);
                            }
                        }
                    }
                    //txtEmail.Value = "";
                    //ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Email has been sent to Admin !!')", true);
                }
                else if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0] != null && Convert.ToInt32(ds.Tables[0].Rows[0]["value"]) == -1)
                {
                    //txtEmail.Value = "";
                    //ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Not exist!!!')", true);
                }
            }

            else
            {
                //  ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Enter the value!!!')", true);
            }

            string result = "0";

            return(result);
        }