public gridlist BindGrid(MandateDetails data) { try { gridlist res = new gridlist(); List <BindGrid> BindGridlist = new List <BindGrid>(); // var Result = Common.Getdata(dbcontext.MultipleResults("[dbo].[Sp_Mandate]").With<BindGrid>().Execute("@QueryType", "@UserId", "@AppId", "@ToDate" //, "@FromDate", "grdMandateDataDateWise", Dbsecurity.Decrypt(HttpContext.Current.Server.UrlDecode(data.UserId.Replace("_", "%"))), data.AppId, data.ToDate, data.FromDate)); // BindGridlist = Result.Cast<BindGrid>().ToList(); var Result = dbcontext.MultipleResults("[dbo].[Sp_Mandate]").With <BindGrid>().Execute("@QueryType", "@UserId", "@AppId", "@ToDate" , "@FromDate", "grdMandateDataDateWise", Dbsecurity.Decrypt(HttpContext.Current.Server.UrlDecode(data.UserId.Replace("_", "%"))), data.AppId, data.ToDate, data.FromDate); BindGridlist = Result[0].Cast <BindGrid>().ToList(); for (var i = 0; i < BindGridlist.Count; i++) { BindGridlist[i].AcNo = Dbsecurity.Decrypt(Convert.ToString(BindGridlist[i].AcNo)); BindGridlist[i].Amount_Numeric = Dbsecurity.Decrypt(Convert.ToString(BindGridlist[i].Amount_Numeric)); BindGridlist[i].EncryptMandateId = Dbsecurity.Encrypt(Convert.ToString(BindGridlist[i].MandateFreshId)); } res.BindGridlist = BindGridlist; return(res); } catch (Exception ex) { throw ex; } }
public Dictionary <string, object> SaveData(JsonAllFields Data) { string Active = ""; if (Data.Active == true) { Active = "1"; } else { Active = "0"; } FAMSEntities context = new FAMSEntities(); try { string Password = string.Empty; Password = Dbsecurity.Encrypt(Data.Emailid.Split('@').ElementAtOrDefault(0)); var results = Common.Getdata(context.MultipleResults("[dbo].[Sp_PMSEmployees]").With <CommonFields>() .Execute("@Querytype", "@EmployeeCode", "@EmployeeName", "@Gender", "@About", "@Custodian", "@CustomerCode", "@CustomerName", "@EmpLinkingDate", "@Qualification", "@InceptionDate", "@PMSEmpId", "@Active", "@UserId", "@EmailId", "@Password", "SaveEmployee", Data.EmployeeCode, Data.EmployeeName, Data.Gender, Data.About, Data.Custodian, Data.CustomerCode, Data.CustomerName, Data.EmpLinkingDate, Data.Qualification, Data.InceptionDate, Data.PMSEmpId, Active, Dbsecurity.Decrypt(HttpContext.Current.Server.UrlDecode(Data.UserId.Replace("_", "%"))), Data.Emailid, Password)); return(results); } catch (Exception ex) { throw ex; } }
public IEnumerable <CustomerResponse> SaveCustomer(JsonCustomerDetails Data, string UserId) { FAMSEntities context = new FAMSEntities(); CustomerResponse ObjCustResponse = new CustomerResponse(); try { string Password = string.Empty; List <CustomerResponse> dataList = new List <CustomerResponse>(); Password = Dbsecurity.Encrypt(Data.CustomerEmailID.Split('@').ElementAtOrDefault(0)); var results = context.MultipleResults("[dbo].[Sp_user]").With <CustomerResponse>().Execute("@QueryType", "@UserId", "@UserName", "@AccountNo", "@EmailId", "@Password", "@pmsempid", "SaveData", Dbsecurity.Decrypt(UserId).ToString(), Data.CustomerUsername.ToString(), Data.CustomerAccount.ToString(), Data.CustomerEmailID.ToString(), Password.ToString(), Data.EmployeeCode.ToString()); //results.tab dataList = results.FirstOrDefault().Cast <CustomerResponse>().ToList(); if (dataList.Cast <CustomerResponse>().ToList().Select(x => x.value).First().ToString() == "1") { 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 FromMailId = 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 " + (Data.CustomerUsername).ToString() + ",<br> <br>"); sb.Append("Please find your new Password is -- " + Dbsecurity.Decrypt(Password).ToString() + " <br> <br>"); SmtpClient smtpClient = new SmtpClient(); MailMessage mailmsg = new MailMessage(); MailAddress mailaddress = new MailAddress(FromMailId); mailmsg.To.Add((Data.CustomerEmailID).ToString()); mailmsg.From = mailaddress; mailmsg.Subject = "User New 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(FromMailId, MailPassword); smtpClient.Send(mailmsg); //QuickCheck_AngularEntities dbcontext = new QuickCheck_AngularEntities(); //dbcontext.MultipleResults("[dbo].[Sp_SendEmail]").With<Responsevalue>().Execute("@QueryType", "@MandateId", "@EmailCount", "@SmsCount", "SendMail", Convert.ToString(0), "1", "0"); } } } return(dataList); } catch (Exception ex) { throw ex; } }
public static ResAccountValidation IDFCAccountval(string ActivityId, string MandateId, string AcNo, string IFSC, string UserId, string AppId, string EntityId, List <pennyDetails> PendydropData) { string tempp = Dbsecurity.Encrypt("YKS"); ResAccountValidation res = new ResAccountValidation(); string webData = ""; try { //processing.Style.Add("display", "none"); long uni; uni = 0; string GMTformattedDateTime = DateTime.Now.ToString("ddMMyyyyHHmmss"); string hash_string = string.Empty; string action1 = string.Empty; string TraceNumber = string.Empty; TraceNumber = GetTraceNoClass.getTraceNo(AppId); //Global.CreateRandomCode(6) + GMTformattedDateTime; string TempId = MandateId; TempId = EntityDAL.Global.ReverseString(TempId); TempId = EntityDAL.Global.CreateRandomCode(6) + TempId; string msgId, cnvId, txnRfNo = ""; msgId = TempId.Substring(0, 6).ToUpper(); cnvId = EntityDAL.Global.ReverseString(TempId.Substring(0, 6)).ToUpper(); QuickCheck_AngularEntities dbcontext = new QuickCheck_AngularEntities(); List <InsertrequestModel> InsertrequestModellist = new List <InsertrequestModel>(); List <InsertrequestNOModel> InsertrequestNOModelllist = new List <InsertrequestNOModel>(); //var Result = dbcontext.MultipleResults("[dbo].[sp_Payment]").With<InsertrequestModel>().With<InsertrequestNOModel>().Execute("@QueryType", "@BeniACNo", "@BeniAcType", "@BeniAmount", "@BeniIFSC", "@ChkSum", "@UserId", "@EntityId", "@Filler1", "@Filler2", "@Filler3", "@Filler4", // "@Filler5", "@MandateId", "@MerchantId", "@MessageCode", "@Remarks", "@RequestDateTime", "@RequestType", "@TraceNo", "@ActivityId", "@msgId", "@cnvId", "@AppId", "InsertpaymentReq", AcNo, "10", "1.00", IFSC, Convert.ToString(uni), UserId, EntityId, "Yoeki Soft Pvt. Ltd", "9810462147", "", "", "", MandateId, Dbsecurity.Decrypt(), "6210", "Payment", GMTformattedDateTime, "R", TraceNumber, ActivityId, msgId, cnvId, AppId); var Result = dbcontext.MultipleResults("[dbo].[sp_Payment]").With <InsertrequestModel>().With <InsertrequestNOModel>().Execute("@QueryType", "@BeniACNo", "@BeniAcType", "@BeniAmount", "@BeniIFSC", "@ChkSum", "@UserId", "@EntityId", "@Filler1", "@Filler2", "@Filler3", "@Filler4", "@Filler5", "@MandateId", "@MerchantId", "@MessageCode", "@Remarks", "@RequestDateTime", "@RequestType", "@TraceNo", "@ActivityId", "@msgId", "@cnvId", "@AppId", "InsertpaymentReq", AcNo, "10", "1", IFSC, Convert.ToString(uni), UserId.ToString(), EntityId, "Yoeki Soft Pvt. Ltd", PendydropData[0].remMobNb.Replace("+91-", ""), "", "", "", MandateId, Dbsecurity.Decrypt(PendydropData[0].MERCHANT), "6211", "Payment", GMTformattedDateTime, "R", TraceNumber, ActivityId, msgId, cnvId, AppId); //Edited by Bibhu on 25Jan2020 End //Added by Bibhu on 25Jan2020 Start InsertrequestModellist = Result[0].Cast <InsertrequestModel>().ToList(); InsertrequestNOModelllist = Result[1].Cast <InsertrequestNOModel>().ToList(); if (InsertrequestModellist != null && InsertrequestModellist.Count > 0) { txnRfNo = Convert.ToString(InsertrequestNOModelllist[0].RequestNo); } //Added by Bibhu on 25Jan2020 End ReuestObject obj = new ReuestObject { InitiateAuthIMPSFundTransferReq = new InitiateAuthIMPSFundTransferReq { msgHdr = new MsgHdr { msgId = msgId, cnvId = cnvId, extRefId = Convert.ToString(PendydropData[0].IDFCextRefId), //ConfigurationManager.AppSettings["IDFCextRefId"]), appId = Dbsecurity.Decrypt(PendydropData[0].MERCHANT), //ConfigurationManager.AppSettings["IDFCAppId"]), timestamp = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss", CultureInfo.CurrentCulture) }, msgBdy = new MsgBdy { remNm = "", cnsmrNm = Dbsecurity.Decrypt(PendydropData[0].MERCHANT), //Convert.ToString(ConfigurationManager.AppSettings["IDFCAppId"]), remMobNb = PendydropData[0].remMobNb, //Convert.ToString(ConfigurationManager.AppSettings["remMobNb"]), dbtrAcctId = PendydropData[0].dbtrAcctId_idfc, //Convert.ToString(ConfigurationManager.AppSettings["dbtrAcctId"]), acctTp = "10", cdtrAcctId = AcNo, finInstnId = IFSC, amt = "1", ccy = "INR", pmtDesc = "Penny Drop", txnRfNo = TraceNumber //txnRfNo } } }; string inputJson = (new JavaScriptSerializer()).Serialize(obj); // requestjson = inputJson.Replace("\\u003c", "<").Replace("\\u003e", ">"); string postData = new JavaScriptSerializer().Serialize(obj); string host = PendydropData[0].URL;//Convert.ToString(ConfigurationManager.AppSettings["IMPSFundTransferURL"]); string certName = HttpContext.Current.Server.MapPath("../../../YoekiDSC.pfx"); // string password = Convert.ToString(ConfigurationManager.AppSettings["password"]); X509Certificate2 certificate = new X509Certificate2(certName, "Creative0786!@#"); ServicePointManager.CheckCertificateRevocationList = false; ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => true; ServicePointManager.Expect100Continue = true; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(host); req.PreAuthenticate = true; req.AllowAutoRedirect = true; req.ClientCertificates.Add(certificate); req.Method = "POST"; req.ContentType = "application/json"; req.KeepAlive = true; // string postData = "login-form-type=cert"; byte[] postBytes = Encoding.UTF8.GetBytes(postData); req.ContentLength = postBytes.Length; Stream postStream = req.GetRequestStream(); postStream.Write(postBytes, 0, postBytes.Length); postStream.Flush(); postStream.Close(); WebResponse resp = req.GetResponse(); Stream stream = resp.GetResponseStream(); string temp = ""; using (StreamReader reader = new StreamReader(stream)) { string line = reader.ReadLine(); while (line != null) { temp = temp + line; line = reader.ReadLine(); } } stream.Close(); // Response.Write(temp); string Signedxml = temp; ResponseObject UserList = Newtonsoft.Json.JsonConvert.DeserializeObject <ResponseObject>(Signedxml); if (Result != null && Result.Count > 0) { if (Result.Count > 2 && Result[0].Cast <InsertrequestModel>().ToList().Count > 0) { } else { string msg = hash_string + '|' + Convert.ToString(uni); //hash_string = hash_string + '|' + Convert.ToString(uni); string ActionUrl = action1 + msg; //if (System.Configuration.ConfigurationManager.AppSettings["IsLocal"] == "1") //{ // webData = "6220|24082018120636|YK17|wIw4GP24082018122440|KPY00|Successful Transaction|823612654816|KMB0000037731||Fateh|1658580580"; // //webData = "6220|24082018120636|YK17|wIw4GP24082018122440|KPY00|Successful Transaction|823612654816|KMB0000037731||Fateh|1658580580"; //} //else //{ if (UserList.ToString() != "") { if (Convert.ToString(UserList.initiateAuthIMPSFundTransferResp.msgHdr.rslt) == "OK") { webData = "6221|" + GMTformattedDateTime + "|" + Dbsecurity.Decrypt(PendydropData[0].MERCHANT) + "|" + TraceNumber + "|" + UserList.initiateAuthIMPSFundTransferResp.msgBdy.respCd + "|Successful Transaction|" + UserList.initiateAuthIMPSFundTransferResp.msgBdy.txnId + "|||" + UserList.initiateAuthIMPSFundTransferResp.msgBdy.cdtrNm + "|"; } else { if (!string.IsNullOrEmpty(UserList.initiateAuthIMPSFundTransferResp.msgBdy.txnId)) { webData = "6221|" + GMTformattedDateTime + "|" + Dbsecurity.Decrypt(PendydropData[0].MERCHANT) + "|" + TraceNumber + "|" + UserList.initiateAuthIMPSFundTransferResp.msgHdr.error.cd + "|" + UserList.initiateAuthIMPSFundTransferResp.msgHdr.error.rsn + "|" + UserList.initiateAuthIMPSFundTransferResp.msgBdy.txnId + "|||" + UserList.initiateAuthIMPSFundTransferResp.msgBdy.cdtrNm + "|"; } else { webData = "6221|" + GMTformattedDateTime + "|" + Dbsecurity.Decrypt(PendydropData[0].MERCHANT) + "|" + TraceNumber + "|" + UserList.initiateAuthIMPSFundTransferResp.msgHdr.error.cd + "|" + UserList.initiateAuthIMPSFundTransferResp.msgHdr.error.rsn + "||||" + UserList.initiateAuthIMPSFundTransferResp.msgBdy.cdtrNm + "|"; } } } // } //string webData = wc.DownloadString(ActionUrl); string[] Data = webData.Split('|'); dbcontext = new QuickCheck_AngularEntities(); var ResResult = dbcontext.MultipleResults("[dbo].[sp_Payment]").With <ResDescription>().With <ResCust1>().With <ResIfsc>().With <Resshow>().Execute("@QueryType", "@BankRefNo", "@BeniName", "@ChkSum", "@UserId", "@EntityId", "@ErrorReason", "@MandateId", "@MerchantId", "@MessageCode", "@RRN", "@RequestDateTime", "@ResponseCode", "@TraceNo", "@IFSC", "@ActivityId", "@AppId", "InsertpaymentResIDFC", Data[7], Data[9], Data[10], UserId.ToString(), EntityId, Data[5], MandateId, Data[2], Data[0], Data[6], Data[1], Data[4], Data[3], Convert.ToString(IFSC), ActivityId, AppId); res.ResDescriptionlist = ResResult[0].Cast <ResDescription>().ToList(); res.ResCust1list = ResResult[1].Cast <ResCust1>().ToList(); res.ResIfsclist = ResResult[2].Cast <ResIfsc>().ToList(); res.Resshowlist = ResResult[3].Cast <Resshow>().ToList(); } } } catch (Exception ex) { } return(res); }
public IEnumerable <CommonFlag> Binddetails(Formdataget Login) { List <CommonFlag> common = new List <CommonFlag>(); CommonFlag Flag = new CommonFlag(); int Isallowattempt = 5; List <Logindetails> dataList = new List <Logindetails>(); try { var Result = dbcontext.MultipleResults("[dbo].[sp_UserLogin]").With <Logindetails>().Execute("@QueryType", "@UserName", "@Appid", "GetUser", Login.UserName, Login.APPID); 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())); if (strDbPassword.Trim() != Dbsecurity.Decrypt(Login.Password)) { if (Convert.ToBoolean(Logindata.Cast <Logindetails>().ToList().Select(x => x.IsAccountBlocked).First().ToString()) == true) { Flag.Flag = "0"; Flag.FlagValue = "Account is blocked please contact to admin!!"; common.Add(Flag); } else if (Convert.ToInt32(Logindata.Cast <Logindetails>().ToList().Select(x => x.IswrongAttempt).First().ToString()) >= Isallowattempt) { QuickCheck_AngularEntities dbcontext = new QuickCheck_AngularEntities(); var Updateaccountblockflag = dbcontext.MultipleResults("[dbo].[sp_UserLogin]").With <Logindetails>().Execute("@QueryType", "@UserName", "@Appid", "@IsAccountblock", "GetUser", Login.UserName, Login.APPID, Convert.ToString(1)); Flag.Flag = "0"; Flag.FlagValue = "Account is blocked please contact to admin!!"; common.Add(Flag); } else if (Convert.ToInt32(Logindata.Cast <Logindetails>().ToList().Select(x => x.IswrongAttempt).First().ToString()) != Isallowattempt) { QuickCheck_AngularEntities dbcontext = new QuickCheck_AngularEntities(); var Updateleftattemptflag = dbcontext.MultipleResults("[dbo].[sp_UserLogin]").With <Logindetails>().Execute("@QueryType", "@UserName", "@Appid", "@Iswrongattempt", "GetUser", Login.UserName, Login.APPID, Convert.ToString(1)); int attempt = Convert.ToInt32(Updateleftattemptflag.FirstOrDefault().Cast <Logindetails>().ToList().Select(x => x.IswrongAttempt).First().ToString()); if (attempt == Isallowattempt) { QuickCheck_AngularEntities dbcontext1 = new QuickCheck_AngularEntities(); var Updateaccountblockflag = dbcontext1.MultipleResults("[dbo].[sp_UserLogin]").With <Logindetails>().Execute("@QueryType", "@UserName", "@Appid", "@IsAccountblock", "GetUser", Login.UserName, Login.APPID, Convert.ToString(1)); Flag.Flag = "0"; Flag.FlagValue = "Account is blocked please contact to admin!!"; common.Add(Flag); } else { int leftAttempt = Isallowattempt - attempt; Flag.Flag = "0"; Flag.FlagValue = "Login Failed! Left attempt is '" + leftAttempt + "'!!"; common.Add(Flag); } } else if (Convert.ToInt32(Logindata.Cast <Logindetails>().ToList().Select(x => x.IswrongAttempt).First().ToString()) != Isallowattempt) { Flag.Flag = "0"; Flag.FlagValue = "Account is blocked please contact to admin!!"; common.Add(Flag); } } else { if (Convert.ToBoolean(Logindata.Cast <Logindetails>().ToList().Select(x => x.IsAccountBlocked).First().ToString()) == true) { Flag.Flag = "0"; Flag.FlagValue = "Account is blocked please contact to admin!!"; common.Add(Flag); } else { Random generator = new Random(); QuickCheck_AngularEntities dbcontext = new QuickCheck_AngularEntities(); var SaveLoginSessionTrxn = dbcontext.MultipleResults("[dbo].[sp_UserLogin]").With <SaveLoginSessionTrxn>().Execute("@QueryType", "@UserId", "@TokenID", "@IPAddress", "@MacAddress", "@IsLogin", "@Iscorrectattempt", "@Appid", "SaveLoginSessionTrxn", Convert.ToString(Logindata.Cast <Logindetails>().ToList().Select(x => x.UserId).First().ToString()), Convert.ToString(generator.Next(1, 1000000)), Convert.ToString(GetMacIP.GetIpAddress()), Convert.ToString(GetMacIP.GetMacAddress()), Convert.ToString(1), Convert.ToString(1), Login.APPID); 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 = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsRefrenceCheck).First().ToString())); Flag.IsOverPrintMandate = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsOverPrintMandate).First().ToString())); Flag.IsBulkMandate = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsBulkMandate).First().ToString())); Flag.IsMandate = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsMandate).First().ToString())); //NewCode Flag.IsMandateEdit = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsMandateEdit).First().ToString())); Flag.IsRefrenceEdit = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsRefrenceEdit).First().ToString())); Flag.IsEmandate = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsEmandate).First().ToString())); Flag.IsPhysical = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsPhysical).First().ToString())); Flag.IsZipShoreABPS = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsZipShoreABPS).First().ToString())); Flag.UserId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserId).First().ToString())); Flag.ReferenceId = Dbsecurity.Encrypt(dataList.Cast <Logindetails>().ToList().Select(x => x.ReferenceId).First().ToString()); Flag.UserName = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserName).First().ToString())); Flag.Password = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.Password).First().ToString())); Flag.UserCode = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserCode).First().ToString())); Flag.UserType = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserType).First().ToString())); Flag.BranchId = Dbsecurity.Encrypt(dataList.Cast <Logindetails>().ToList().Select(x => x.BranchId).First().ToString()); Flag.BranchName = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.BranchName).First().ToString())); Flag.IsDefaultPswdChange = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsDefaultPswdChange).First().ToString())); Flag.LastLogin = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.LastLogin).First().ToString())); Flag.IsActive = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsActive).First().ToString())); Flag.IsDeleted = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsDeleted).First().ToString())); Flag.CreatedBy = Dbsecurity.Encrypt(dataList.Cast <Logindetails>().ToList().Select(x => x.CreatedBy).First().ToString()); Flag.CreatedOn = Dbsecurity.Encrypt(dataList.Cast <Logindetails>().ToList().Select(x => x.CreatedOn).First().ToString()); Flag.AppId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.AppId).First().ToString())); #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 = "Login Failed!!"; common.Add(Flag); } } return(common); } catch (Exception ex) { throw ex; } }
public IEnumerable <EmailSent> SendMail(string email) { List <EmailSent> common = new List <EmailSent>(); EmailSent emailobect = new EmailSent(); try { List <Responsevalue> dataList = new List <Responsevalue>(); List <UserDetails> dataList1 = new List <UserDetails>(); var Result = dbcontext.MultipleResults("[dbo].[Sp_UserLogin]").With <Responsevalue>().With <UserDetails>().Execute("@QueryType", "@EmailId", "ChkEmail", email); dataList = Result.FirstOrDefault().Cast <Responsevalue>().ToList(); dataList1 = Result.LastOrDefault().Cast <UserDetails>().ToList(); if (dataList.Cast <Responsevalue>().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["SMTPHost"].ToString(); string FromMailId = 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 " + 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())); 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(email); 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(FromMailId, MailPassword); smtpClient.Send(mailmsg); //QuickCheck_AngularEntities dbcontext = new QuickCheck_AngularEntities(); //dbcontext.MultipleResults("[dbo].[Sp_SendEmail]").With<Responsevalue>().Execute("@QueryType", "@MandateId", "@EmailCount", "@SmsCount", "SendMail", Convert.ToString(0), "1", "0"); emailobect.Flag = "1"; emailobect.FlagValue = "Email sent successfully!!"; common.Add(emailobect); } } } } else { emailobect.Flag = "0"; emailobect.FlagValue = "Invalid EmailID!!"; common.Add(emailobect); } } catch (Exception) { emailobect.Flag = "0"; emailobect.FlagValue = "Email sent not successfully!!"; common.Add(emailobect); } return(common); }
public gridlist GetEmandateData(MandateHeader data) { try { MsgId = Dbsecurity.Decrypt(data.AppId) + MsgId + GMTformattedDateTime + RandomDigits(4); gridlist res = new gridlist(); List <MandateDetailList> list = new List <MandateDetailList>(); var Result = dbcontext.MultipleResults("[dbo].[sp_ENach]").With <MandateDetailList>().Execute("@QueryType", "@MandateId", "@EMandatetype", "@MsgId" , "@Link", "@AppId", "@UserId", "Emandate", Dbsecurity.Decrypt(data.MandateId), data.Authmode, MsgId, data.URL, Dbsecurity.Decrypt(data.AppId), Dbsecurity.Decrypt(data.UserId)); list = Result[0].Cast <MandateDetailList>().ToList(); if (list.Count > 0) { list[0].CustAcNo = Dbsecurity.Decrypt(Convert.ToString(list[0].CustAcNo)); list[0].AmountRupees = Dbsecurity.Decrypt(Convert.ToString(list[0].AmountRupees)); list[0].FirstCollectionDate = Dbsecurity.Decrypt(Convert.ToString(list[0].FirstCollectionDate)); list[0].FinalCollectionDate = Dbsecurity.Decrypt(Convert.ToString(list[0].FinalCollectionDate)); MerchantKey = MerchantKey + GMTformattedDateTime1; string dDateTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff", CultureInfo.CurrentCulture); string xml = ""; xml = @"<mdata><FirstCollectionDate>" + list[0].FirstCollectionDate.ToString() + "</FirstCollectionDate><FinalCollectionDate>" + list[0].FinalCollectionDate.ToString() + "</FinalCollectionDate> <CollectionAmount>" + list[0].AmountRupees.ToString() + "</CollectionAmount><DebitType>" + list[0].DebitType.ToString() + "</DebitType><EntityName>" + list[0].EntityName.ToString() + "</EntityName><YoekiNachCode>" + list[0].YoekiNachCode.ToString() + "</YoekiNachCode><EntityIFSC>" + list[0].EntityIFSC.ToString() + "</EntityIFSC><EntityBank>" + list[0].EntityBankName.ToString() + "</EntityBank><CustIFSC>" + list[0].CustIFSC.ToString() + "</CustIFSC><CustBank>" + list[0].customerBankname.ToString() + "</CustBank><CustAcNo>" + list[0].CustAcNo.ToString() + "</CustAcNo><EntityAcNo>" + list[0].EntityAcNo.ToString() + "</EntityAcNo><CustName>" + list[0].CustName.ToString() + "</CustName><Refrence1>" + list[0].Refrence1.ToString() + "</Refrence1><PhoneNo>" + list[0].PhoneNo.ToString() + "</PhoneNo><emailId>" + list[0].EmailId.ToString() + "</emailId><ToDebit>" + list[0].ToDebit.ToString() + "</ToDebit><BankID>" + list[0].BankID.ToString() + "</BankID><MsgId>" + MsgId + "</MsgId><CategoryName>" + list[0].CategoryName.ToString() + "</CategoryName><CategoryCode>" + list[0].CategoryCode.ToString() + "</CategoryCode><Frequency>" + list[0].Frequency.ToString() + "</Frequency><EMandatetype>" + list[0].EMandatetype.ToString() + "</EMandatetype><BankCode>" + list[0].BankCode.ToString() + "</BankCode> </mdata>"; string ASPId_Key = ConfigurationManager.AppSettings["ASPId_Key"]; string ConsentURL = ""; ConsentURL = ConfigurationManager.AppSettings["EMandateURL"]; var url = ConsentURL + "NachMandate/UserId=" + Dbsecurity.Encrypt(data.UserId) + "&EntityId=" + Dbsecurity.Encrypt(data.EntityId) + "&AppId=" + Dbsecurity.Encrypt(data.AppId) + "&MandateId=" + Dbsecurity.Encrypt(data.MandateId) + "&Same=B&AuthType=" + data.Authmode + ""; NameValueCollection collections = new NameValueCollection(); collections.Add("Request", xml); string remoteUrl = url; list[0].xml = xml; list[0].url = url; //string html = "<html><head><style>#preloader_1 label{clear: both;margin-bottom: 28%!important;font-weight: bold;}#preloader_1{ position: relative;margin: 20% 0 10% 45%;}#preloader_1 span{display:block;bottom: -15px;width: 9px;height: 5px; background:#9b59b6;position:absolute;animation: preloader_1 1.5s infinite ease-in-out;}#preloader_1 span:nth-child(2){left:11px;animation-delay: .2s;}" + // "#preloader_1 span:nth-child(3){left:22px;animation-delay: .4s;}" + // "#preloader_1 span:nth-child(4){left:33px;animation-delay: .6s;}#preloader_1 span:nth-child(5){left:44px;animation-delay: .8s;}@keyframes preloader_1 {0% {height:5px;transform:translateY(0px);background:#9b59b6;}25% {height:30px;transform:translateY(15px);background:#3498db;}50% {height:5px;transform:translateY(0px);background:#9b59b6;}" + // "100% {height:5px;transform:translateY(0px);background:#9b59b6;}}</style>"; //html += "</head><body onload='document.forms[0].submit()'>"; //// html += string.Format("<form name='PostForm' method='POST' action='{0}' target='_blank'>", remoteUrl); //html += string.Format("<form name='PostForm' method='POST' action='{0}'>", remoteUrl); //foreach (string key in collections.Keys) //{ // html += string.Format("<input name='{0}' type='text' value='{1}'>", key, collections[key]); //} //html += "<div id='overlay' style='background: #fff;overflow: auto;display: block;position: absolute;width: 98%;top: 0;height: 90%;z-index: 999;' class='col-xs-12 col-md-12 col-sm-12 overlay'></div><div id='preloader_1' style='display: block; z-index: 999999; position: relative;' class='preloader'><span></span><span></span><span></span><span></span><span></span><label style='margin-bottom:5%'>Loading...</label></div>"; //html += "</form></body></html>"; //HttpContext.Current.Response.Clear(); //HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-1"); //HttpContext.Current.Response.HeaderEncoding = Encoding.GetEncoding("ISO-8859-1"); //HttpContext.Current.Response.Charset = "ISO-8859-1"; //HttpContext.Current.Response.Write(html); //HttpContext.Current.Response.End(); } res.Gridlist = list; return(res); } catch (Exception ex) { throw ex; } }
public IEnumerable <CommonFlag> Binddetails(Formdataget Login) { List <CommonFlag> common = new List <CommonFlag>(); CommonFlag Flag = new CommonFlag(); List <Logindetails> dataList = new List <Logindetails>(); try { var Result = dbcontext.MultipleResults("[dbo].[FAMS_Login]").With <Logindetails>().Execute("@QueryType", "@Emailid", "UserAccess", Login.UserName); foreach (var Logindata in Result) { dataList = Logindata.Cast <Logindetails>().ToList(); if (dataList.Count > 0) { if (Convert.ToString(Logindata.Cast <Logindetails>().ToList().Select(x => x.EmailId).First().ToString()) == "0") { Flag.Flag = "0"; Flag.FlagValue = "User is InActive!!"; common.Add(Flag); } else if (Convert.ToString(Logindata.Cast <Logindetails>().ToList().Select(x => x.EmailId).First().ToString()) == "-1") { Flag.Flag = "0"; Flag.FlagValue = "Invalid User!!"; common.Add(Flag); } else { string strDbPassword = Dbsecurity.Decrypt(Convert.ToString(Logindata.Cast <Logindetails>().ToList().Select(x => x.Password).First().ToString())); if (strDbPassword.Trim() != Dbsecurity.Decrypt(Login.Password)) { Flag.Flag = "0"; Flag.FlagValue = "Wrong Password!!"; common.Add(Flag); } else { #region Session creation if (Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserType).First().ToString()) == "1") { Flag.UserId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserId).First().ToString())); //Flag.EmailId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast<Logindetails>().ToList().Select(x => x.EmailId).First().ToString())); Flag.EmailId = Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.EmailId).First().ToString()); Flag.UserName = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserName).First().ToString())); Flag.WareHouseId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.WareHouseId).First().ToString())); //Flag.AccountNo = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast<Logindetails>().ToList().Select(x => x.AccountNo).First().ToString())); Flag.AccountNo = Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.AccountNo).First().ToString()); Flag.IsDefaultPswdChange = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsDefaultPswdChange).First().ToString())); Flag.UserType = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserType).First().ToString())); Flag.Flag = "1"; Flag.FlagValue = "ReportsDashboard"; } // Iace.User.User.SaveUserToSession(dataList); else if (Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserType).First().ToString()) == "2") { Flag.UserId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserId).First().ToString())); //Flag.EmailId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast<Logindetails>().ToList().Select(x => x.EmailId).First().ToString())); Flag.EmailId = Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.EmailId).First().ToString()); Flag.UserName = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserName).First().ToString())); Flag.WareHouseId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.WareHouseId).First().ToString())); //Flag.AccountNo = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast<Logindetails>().ToList().Select(x => x.AccountNo).First().ToString())); Flag.AccountNo = Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.AccountNo).First().ToString()); Flag.IsDefaultPswdChange = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsDefaultPswdChange).First().ToString())); Flag.UserType = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserType).First().ToString())); Flag.Flag = "1"; Flag.FlagValue = "ReportsDashboard"; } else if (Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserType).First().ToString()) == "3") { Flag.UserId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserId).First().ToString())); //Flag.EmailId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast<Logindetails>().ToList().Select(x => x.EmailId).First().ToString())); Flag.EmailId = Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.EmailId).First().ToString()); Flag.UserName = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserName).First().ToString())); Flag.WareHouseId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.WareHouseId).First().ToString())); //Flag.AccountNo = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast<Logindetails>().ToList().Select(x => x.AccountNo).First().ToString())); Flag.AccountNo = Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.AccountNo).First().ToString()); Flag.IsDefaultPswdChange = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsDefaultPswdChange).First().ToString())); Flag.UserType = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserType).First().ToString())); Flag.Flag = "1"; Flag.FlagValue = "Dashboard"; } else if (Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserType).First().ToString()) == "4") { Flag.UserId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserId).First().ToString())); Flag.EmailId = Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.EmailId).First().ToString()); //Flag.EmailId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast<Logindetails>().ToList().Select(x => x.EmailId).First().ToString())); Flag.UserName = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserName).First().ToString())); Flag.WareHouseId = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.WareHouseId).First().ToString())); //Flag.AccountNo = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast<Logindetails>().ToList().Select(x => x.AccountNo).First().ToString())); Flag.AccountNo = Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.AccountNo).First().ToString()); Flag.IsDefaultPswdChange = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.IsDefaultPswdChange).First().ToString())); Flag.UserType = Dbsecurity.Encrypt(Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.UserType).First().ToString())); Flag.Flag = "1"; Flag.FlagValue = "Dashboard"; } else { Flag.Flag = "0"; Flag.FlagValue = "Incorrect"; } #endregion Flag.Password = Convert.ToString(dataList.Cast <Logindetails>().ToList().Select(x => x.Password).First().ToString()); common.Add(Flag); } } } else { Flag.Flag = "0"; Flag.FlagValue = "Login Failed!!"; common.Add(Flag); } } return(common); } catch (Exception ex) { throw ex; } }