public ActionResult Billdesk(long id) { tbl_CSI_69_Con_Transections Trans = db.tbl_CSI_69_Con_Transections.Find(id); string CheckSumKey = "CMcyWPzYC8DH"; string MerchantID = "CARDIOSOCT"; string CustomerID = Trans.UserId.ToString(); string TransactionAmt = "2.00"; // string TransactionAmt = Trans.AmountToPay.ToString(); string CurrencyType = "INR"; string TypeField1 = "R"; string SecurityID = "cardiosoct"; string TypeField2 = "F"; string AdditionalInfo1 = Trans.TransId.ToString(); string AdditionalInfo2 = "NA"; string AdditionalInfo3 = "NA"; string AdditionalInfo4 = "NA"; string AdditionalInfo5 = "NA"; string AdditionalInfo6 = "NA"; string AdditionalInfo7 = "NA"; string ResponseURL = "http://69thac.csi.org.in/home/thankyou"; GlobalData myUtility = new GlobalData(); // string msg = "CARDIOSOCT" + "|" + "14" + "|" + "NA" + "|" + "2.00" + "|" + "NA|NA|NA|" + "INR" + "|" + "NA" + "|" + "R" + "|" + "cardiosoct" + "|" + "NA|NA|" + "F" + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "http://69thac.csi.org.in/home/thankyou"; //string msg = MerchantID + "|" + CustomerID + "|" + "NA" + "|" + TransactionAmt + "|" + "NA|NA|NA|" + CurrencyType + "|" + "NA" + "|" + TypeField1 + "|" + SecurityID + "|" + "NA|NA|" + TypeField2 + "|" + AdditionalInfo1 + "|" + AdditionalInfo2 + "|" + AdditionalInfo3 + "|" + AdditionalInfo4 + "|" + AdditionalInfo5 + "|" + AdditionalInfo6 + "|" + AdditionalInfo7 + "|" + ResponseURL; //string mg1 = "CARDIOSOCT" + "|" + "14" + "|" + "NA" + "|" + "2.00" + "|" + "NA|NA|NA|" + "INR" + "|" + "NA" + "|" + "R" + "|" + "cardiosoct" + "|" + "NA|NA|" + "F" + "|" + "NA" + "|" + "NA" + "|" + "20" + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "http://69thac.csi.org.in/home/thankyou"; string msg = "CARDIOSOCT" + "|" + CustomerID + "|" + "NA" + "|" + TransactionAmt + "|" + "NA|NA|NA|" + "INR" + "|" + "NA" + "|" + "R" + "|" + "cardiosoct" + "|" + "NA|NA|" + "F" + "|" + AdditionalInfo1 + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "NA" + "|" + "http://69thac.csi.org.in/home/thankyou"; string hashData = msg; string checksumvalue = myUtility.GetHMACSHA256(hashData, "CMcyWPzYC8DH"); checksumvalue = checksumvalue.ToUpper(); checksumvalue = hashData + "|" + checksumvalue; Response.Redirect("https://pgi.billdesk.com/pgidsk/PGIMerchantPayment?msg=" + checksumvalue); Console.Out.WriteLine("HMAC {0}", hashData); Console.ReadKey(); return(View()); }
public ActionResult Thankyou1(string msg) { string[] arrResponse = msg.Split('|'); //PG string merchantId = arrResponse[0]; string _customerId = arrResponse[1]; string txnReferenceNo = arrResponse[2]; string bankReferenceNo = arrResponse[3]; string txnAmount = Convert.ToDecimal(arrResponse[4]).ToString(); string bankId = arrResponse[5]; string bankMerchantId = arrResponse[6]; string txnType = arrResponse[7]; string currency = arrResponse[8]; string itemCode = arrResponse[9]; string securityType = arrResponse[10]; string securityId = arrResponse[11]; string securityPassword = arrResponse[12]; string txnDate = arrResponse[13]; //dd-mm-yyyy string authStatus = arrResponse[14]; string settlementType = arrResponse[15]; string additionalInfo1 = arrResponse[16]; //string additionalInfo1 = "10"; string additionalInfo2 = arrResponse[17]; string additionalInfo3 = arrResponse[18]; string additionalInfo4 = arrResponse[19]; string additionalInfo5 = arrResponse[20]; string additionalInfo6 = arrResponse[21]; string additionalInfo7 = arrResponse[22]; string errorStatus = arrResponse[23]; string _errorDescription = arrResponse[24]; string _CheckSum = arrResponse[25]; GlobalData ga = new GlobalData(); if (authStatus == "0300") { long tranid = Convert.ToInt64(additionalInfo1); tbl_CSI_69_Con_Transections Trans = db.tbl_CSI_69_Con_Transections.Find(tranid); Trans.AmountPaid = Convert.ToDecimal(txnAmount); Trans.Extra3 = txnReferenceNo; Trans.Status = "Y"; db.Entry(Trans).State = EntityState.Modified; db.SaveChanges(); long custId = Convert.ToInt64(_customerId); tbl_CSI_69_Con_RegistrationDetails registration = db.tbl_CSI_69_Con_RegistrationDetails.Find(custId); ViewBag.Name = registration.Prefix + " " + registration.Name; int count = registration.tbl_CSI_69_Con_Accompanys.Count(); if (count > 0) { CSIMemberMail(registration, "Yes"); } else { CSIMemberMail(registration, "No"); } // ga.AdminMail("*****@*****.**"); ga.RegisterSendMail("*****@*****.**", "Satya Bhattacharyya", custId, tranid); } return(View()); }
public void RegisterSendMail(string email, string name, long id, long tranid) { tbl_CSI_69_Con_RegistrationDetails tbl_csi_69_con_registrationdetails = db.tbl_CSI_69_Con_RegistrationDetails.Find(id); tbl_CSI_69_Con_Transections Trans = db.tbl_CSI_69_Con_Transections.Find(tranid); List <tbl_CSI_69_Con_Accompanys> objgroup = new List <tbl_CSI_69_Con_Accompanys>(); objgroup = db.tbl_CSI_69_Con_Accompanys.Where(t => t.RegId == id).ToList(); //SelectList <tbl_CSI_69_Con_Accompanys> acmp = new SelectListItem<tbl_CSI_69_Con_Accompanys> string type = tbl_csi_69_con_registrationdetails.Category; string Date = tbl_csi_69_con_registrationdetails.CreatedDate.ToString("dd'/'MMM'/'yyyy"); string Reference_No = Trans.Extra3; string Amount = tbl_csi_69_con_registrationdetails.Payment_Amount.ToString() + "/-"; string Accompanying_Person = "0"; int veg = 0; int nonveg = 0; if (objgroup.Count() > 0) { Accompanying_Person = (objgroup.Count()).ToString(); } else { Accompanying_Person = "NA"; } string Choice_of_food = ""; if (tbl_csi_69_con_registrationdetails.Foodtype == "vegetarian") { veg++; } else if (tbl_csi_69_con_registrationdetails.Foodtype == "nonvegetarian") { nonveg++; } if (objgroup.Count() > 0) { foreach (var item in objgroup) { if (item.Meal_Preference == "Veg") { veg++; } else if (tbl_csi_69_con_registrationdetails.Foodtype == "Non-Veg") { nonveg++; } } } Choice_of_food = veg.ToString() + " " + "Veg" + " ," + nonveg.ToString() + " " + "Non-Veg"; if (type == "1") { type = "CSI Member"; } else if (type == "2") { type = " Non-CSI Member "; } else if (type == "3") { type = "CSI Member"; } else if (type == "4") { type = " PG Students"; } else if (type == "5") { type = " Industry Professional"; } else if (type == "6") { type = " Nurse/Technician"; } else if (type == "7") { type = " SAARC Countries (Non-CSI Member)"; } else if (type == "8") { type = " Non-SAARC Foreign Nationals"; } try { MailAddress mailTo = new MailAddress(email, name); MailAddress mailFrom = new MailAddress("*****@*****.**"); // MailMessage mail = new MailMessage(mailFrom, mailTo); MailMessage mail = new MailMessage("*****@*****.**", "*****@*****.**"); // MailMessage mail = new MailMessage("*****@*****.**", "*****@*****.**"); // MailMessage mail = new MailMessage("*****@*****.**", "*****@*****.**"); mail.IsBodyHtml = true; string strsubj = "Welcome to 69th Annual Conference of CSI Kolkata-2017"; mail.Subject = strsubj; string strMessage = ""; strMessage = "<div align=\"center\">"; strMessage += "<table border=\"1\" width=\"798\" cellpadding=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#F0F0F0\">"; strMessage += "<tr>"; strMessage += "<td>"; strMessage += "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">"; strMessage += "<tr>"; strMessage += "<td colspan=\"2\"><img border=\"0\" src=\"http://csicon2017.org/images/logo0000.png\" width=\"302\"></td>"; strMessage += "<td colspan=\"3\"><h3 style=\"padding:0 25px; font-family: Trebuchet ms;\">Welcome to 69th Annual Conference of Cardiological Society of India <span class=\"span\">Kolkata, 30<sup>th</sup> Nov. to 3rd Dec. 2017</span></h3></td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td colspan=\"5\"><hr style=\"border-top:1px solid #e5e5e5;border-left:none;border-right:none;border-bottom:none;\"></td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"><b>"; strMessage += "<font style=\"font-family:Trebuchet ms;font-size:14pt;font-weight:bold;color:#E4252C;\">Dear " + tbl_csi_69_con_registrationdetails.Prefix + " " + tbl_csi_69_con_registrationdetails.Name + "</font></b></td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"><font style=\"font-family:Trebuchet ms;font-size:10pt;letter-spacing:1px;font-weight:normal;color:#333;line-height:20px;\">Your Registration has been accepted with successful confirmation of payment as per the below details:</font></td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr height=\"35\">"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"31%\"><font style=\"font-family:Trebuchet ms;font-size:13pt;letter-spacing:1px;font-weight:normal;color:#333;line-height:22px;font-weight:bold;\">Category :</font></td>"; strMessage += "<td width=\"31%\"><font style=\"font-family:Trebuchet ms;font-size:13pt;letter-spacing:1px;font-weight:normal;color:#E4252C;line-height:22px;font-weight:bold;\">" + type + "</font></td>"; strMessage += "<td width=\"31%\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr height=\"35\">"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"31%\"><font style=\"font-family:Trebuchet ms;font-size:13pt;letter-spacing:1px;font-weight:normal;color:#333;line-height:22px;font-weight:bold;\">"; strMessage += "Payment Date :</font></td>"; strMessage += "<td width=\"31%\"><font style=\"font-family:Trebuchet ms;font-size:13pt;letter-spacing:1px;font-weight:normal;color:#E4252C;line-height:22px;font-weight:bold;\">" + Date + "</font></td>"; strMessage += "<td width=\"31%\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr height=\"35\">"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 700; font-size: 13pt; color: #333333; letter-spacing: 1px\">"; strMessage += "Payment Reference No :</span></td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 700; font-size: 13pt; color: #E4252C; letter-spacing: 1px\">"; strMessage += Reference_No + "</span></td>"; strMessage += "<td width=\"31%\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr height=\"35\">"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 700; font-size: 13pt; color: #333333; letter-spacing: 1px\">"; strMessage += "Amount :</span></td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 700; font-size: 13pt; color: #E4252C; letter-spacing: 1px\">"; strMessage += Amount + "</span></td>"; strMessage += "<td width=\"31%\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr height=\"35\">"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 700; font-size: 13pt; color: #333333; letter-spacing: 1px\">"; strMessage += "Accompanying Person :</span></td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 700; font-size: 13pt; color: #E4252C; letter-spacing: 1px\">"; strMessage += Accompanying_Person + "</span></td>"; strMessage += "<td width=\"31%\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr height=\"35\">"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 700; font-size: 13pt; color: #333333; letter-spacing: 1px\">"; strMessage += "Choice of food :</span></td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 700; font-size: 13pt; color: #E4252C; letter-spacing: 1px\">"; strMessage += Choice_of_food + "</span></td>"; strMessage += "<td width=\"31%\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\">"; strMessage += "<span style=\"letter-spacing: 1px;font-family: Trebuchet ms;font-style:italic;color:#333333;font-size:12pt;\">You can login to the Conference Portal using the following details:</b></span></td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr height=\"35\">"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 700; font-size: 13pt; color: #333333; letter-spacing: 1px\">"; strMessage += "Username :</span></td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 300; font-size: 16pt; color: #E4252C; letter-spacing: 1px\">"; strMessage += tbl_csi_69_con_registrationdetails.Username + "</span></td>"; strMessage += "<td width=\"31%\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr height=\"35\">"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 700; font-size: 13pt; color: #333333; letter-spacing: 1px\">"; strMessage += "Password :</span></td>"; strMessage += "<td width=\"31%\">"; strMessage += "<span style=\"font-family: Trebuchet ms; font-weight: 300; font-size: 16pt; color: #E4252C; letter-spacing: 1px\">"; strMessage += tbl_csi_69_con_registrationdetails.Password + "</span></td>"; strMessage += "<td width=\"31%\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\">"; strMessage += "<span style=\"letter-spacing: 1px;font-family: Trebuchet ms;font-style:italic;color:#E4252C;font-size:12pt;\">Kindly treat this email as original receipt of your transaction.</b></span></td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"><font style=\"letter-spacing: 1px;font-family: Trebuchet ms;font-style:italic;color:#333333;font-size:12pt;line-height:25px;\">Regards"; strMessage += "<br>"; strMessage += "</font>"; strMessage += "<b>"; strMessage += "<font style=\"letter-spacing: 1px;font-family: Trebuchet ms;font-style:italic;font-size:12pt;line-height:25px\" color=\"#E4252C\">Dr. Mrinal Kanti Das, Organizing Secretary</font><font style=\"letter-spacing: 1px;font-family: Trebuchet ms;font-style:italic;color:#333333;font-size:12pt;line-height:25px;\"> "; strMessage += "<br>"; strMessage += "</font>"; strMessage += "<font style=\"letter-spacing: 1px;font-family: Trebuchet ms;font-style:italic;color:#333333;font-size:11pt;line-height:25px\"> "; strMessage += "Indian Heart House, P-60, C.I.T Road,<br>Scheme - VII-M, Kankurgachi,<br>Kolkata - 700054, India<br>Telephone: +91 33 2355 7837, 2355 6308, 2355 1500<br>Email: </font></b><font style=\"letter-spacing: 1px;font-family: Trebuchet ms;font-style:italic;color:#333333;font-size:11pt;line-height:25px\"> "; strMessage += "<a href=\"mailto:[email protected]\">"; strMessage += "<font color=\"#E4252C\"><span style=\"text-decoration: none\">[email protected]</span></font></a> / <a href=\"http://www.csicon2017.org\">"; strMessage += "<font color=\"#E4252C\"><span style=\"text-decoration: none\">www.csicon2017.org</span></font></a></font></td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr>"; strMessage += "<td width=\"3%\"> </td>"; strMessage += "<td width=\"93%\" colspan=\"3\"> </td>"; strMessage += "<td width=\"4%\"> </td>"; strMessage += "</tr>"; strMessage += "<tr height=\"40\">"; strMessage += "<td width=\"3%\" bgcolor=\"#ed3237\"> </td>"; strMessage += "<td width=\"93%\" bgcolor=\"#ed3237\" align=\"right\" colspan=\"3\">"; strMessage += "<a style=\"text-decoration: none;\" target=\"_blank\" href=\"http://csicon2017.org/\">"; strMessage += "<span style=\"text-decoration: none;font-family: Trebuchet ms;color:#fff;font-weight:bold;font-size:10pt;\">www.csicon2017.org</span></a></td>"; strMessage += "<td width=\"4%\" bgcolor=\"#ed3237\"> </td>"; strMessage += "</tr>"; strMessage += "</table>"; strMessage += "</td>"; strMessage += "</tr>"; strMessage += "</table>"; strMessage += "</div>"; mail.Body = strMessage; //SmtpClient client = new SmtpClient((string)ConfigurationManager.AppSettings["NIC2013.smtpserver"]); //client.EnableSsl = false; // client.Port = 26; //client.Send(mail); SmtpClient client = new SmtpClient(); client.Host = "127.0.0.1"; client.EnableSsl = false; client.Port = 26; client.Send(mail); //================================================== //mail = new MailMessage("*****@*****.**", "*****@*****.**"); //mail.IsBodyHtml = true; //client.Host = "127.0.0.1"; //client.EnableSsl = false; //client.Port = 26; //client.Send(mail); } catch (Exception ex) { //m_lblMessage.Text = (string)("Mail seding failed"); throw ex; } }
//[ValidateAntiForgeryToken] public ActionResult Create(tbl_CSI_69_Con_RegistrationDetails tbl_csi_69_con_registrationdetails) { tbl_CSI_69_Con_Accompanys tbl_csi_69_con_accompanys = new tbl_CSI_69_Con_Accompanys(); string Hdnid = Request.Form["hdnid"].ToString(); // for Accompany_Pertion set value int count = Convert.ToInt32(Hdnid); string Hdnmemberid = Request.Form["hdntypemember"].ToString(); string regno = ""; decimal payableAmt = CalculatePayableAmount(tbl_csi_69_con_registrationdetails.Category, Convert.ToInt32(Hdnid)); if (tbl_csi_69_con_registrationdetails.Badge_Name == null) { tbl_csi_69_con_registrationdetails.Badge_Name = tbl_csi_69_con_registrationdetails.Prefix + " " + tbl_csi_69_con_registrationdetails.Name; } if (tbl_csi_69_con_registrationdetails.Category == "1") { if (Hdnmemberid == "EC_Member") { regno = "EC/CSICON17/10"; } if (Hdnmemberid == "Ex_President") { regno = "EP/CSICON17/10"; } if (Hdnmemberid == "Ex_President") { regno = "ES/CSICON17/10"; } if (Hdnmemberid == "CSI_Member") { regno = "CSIME/CSICON17/10"; } } if (tbl_csi_69_con_registrationdetails.Category == "2") { regno = "NCSI/CSICON17/1000"; } if (tbl_csi_69_con_registrationdetails.Category == "4") { regno = "PG/CSICON17/1000"; } if (tbl_csi_69_con_registrationdetails.Category == "5") { regno = "IP/CSICON17/1000"; } if (tbl_csi_69_con_registrationdetails.Category == "6") { regno = "NT/CSICON17/1000"; } if (tbl_csi_69_con_registrationdetails.Category == "7") { regno = "SAARC/CSICON17/1000"; } if (tbl_csi_69_con_registrationdetails.Category == "8") { regno = "IF/CSICON17/1000"; } tbl_csi_69_con_registrationdetails.Regno = regno; tbl_csi_69_con_registrationdetails.CreatedDate = DateTime.Now; tbl_csi_69_con_registrationdetails.ModifiedDate = DateTime.Now; tbl_csi_69_con_registrationdetails.ModifiedBy = 1; tbl_csi_69_con_registrationdetails.Payment_Id = 1; tbl_csi_69_con_registrationdetails.Payment_Amount = payableAmt; tbl_csi_69_con_registrationdetails.Sponsorship = " NA"; tbl_csi_69_con_registrationdetails.Status = 1; if (ModelState.IsValid) { long lastProductId = db.tbl_CSI_69_Con_RegistrationDetails.Max(item => item.RegId); lastProductId = lastProductId + 1; tbl_csi_69_con_registrationdetails.Regno = regno + lastProductId.ToString(); db.tbl_CSI_69_Con_RegistrationDetails.Add(tbl_csi_69_con_registrationdetails); db.SaveChanges(); lastProductId = db.tbl_CSI_69_Con_RegistrationDetails.Max(item => item.RegId); if (count > 0) { string anam = "Accompany_Pertion_Name"; string age = "Accompany_Pertion_Age"; string sex = "Accompany_Pertion_sex"; string meal = "Accompany_Pertion_meal"; string AccommodationPtn = "Accompany_Pertion_Accommodation"; string Accompany_frmday = "Accompany_frmday"; string Accompany_frmmonth = "Accompany_frmmonth"; string Accompany_today = "Accompany_today"; string Accompany_tomonth = "Accompany_tomonth"; string Accompany_Check_inh = "Accompany_Check_inh"; string Accompany_Check_inm = "Accompany_Check_inm"; string Accompany_Check_inMeridian = "Accompany_Check_inMeridian"; string Accompany_Check_outh = "Accompany_Check_outh"; string Accompany_Check_outm = "Accompany_Check_outm"; string Accompany_Check_outMeridia = "Accompany_Check_outMeridian"; for (int i = 1; i <= count; i++) { anam = "Accompany_Pertion_Name" + i.ToString(); age = "Accompany_Pertion_Age" + i.ToString(); sex = "Accompany_Pertion_sex" + i.ToString(); meal = "Accompany_Pertion_meal" + i.ToString(); AccommodationPtn = "Accompany_Pertion_Accommodation" + i.ToString(); Accompany_frmday = "Accompany_frmday" + i.ToString(); Accompany_frmmonth = "Accompany_frmmonth" + i.ToString(); Accompany_today = "Accompany_today" + i.ToString(); Accompany_tomonth = "Accompany_tomonth" + i.ToString(); Accompany_Check_inh = "Accompany_Check_inh" + i.ToString(); Accompany_Check_inm = "Accompany_Check_inm" + i.ToString(); Accompany_Check_inMeridian = "Accompany_Check_inMeridian" + i.ToString(); Accompany_Check_outh = "Accompany_Check_outh" + i.ToString(); Accompany_Check_outm = "Accompany_Check_outm" + i.ToString(); Accompany_Check_outMeridia = "Accompany_Check_outMeridian" + i.ToString(); tbl_csi_69_con_accompanys.RegId = lastProductId; tbl_csi_69_con_accompanys.Name = Request.Form[anam]; tbl_csi_69_con_accompanys.Age = Convert.ToInt32(Request.Form[age]); tbl_csi_69_con_accompanys.Sex = Request.Form[sex].ToString(); tbl_csi_69_con_accompanys.Meal_Preference = Request.Form[meal].ToString(); tbl_csi_69_con_accompanys.Accommodation = Request.Form[AccommodationPtn].ToString(); tbl_csi_69_con_accompanys.FromDate = Request.Form[Accompany_frmday].ToString() + "/" + Request.Form[Accompany_frmmonth].ToString() + "/2017"; tbl_csi_69_con_accompanys.ToDate = Request.Form[Accompany_today].ToString() + "/" + Request.Form[Accompany_tomonth].ToString() + "/2017"; tbl_csi_69_con_accompanys.Check_in_Time = Request.Form[Accompany_Check_inh].ToString() + ":" + Request.Form[Accompany_Check_inm].ToString() + " " + Request.Form[Accompany_Check_inMeridian].ToString(); tbl_csi_69_con_accompanys.Check_out_Time = Request.Form[Accompany_Check_outh].ToString() + ":" + Request.Form[Accompany_Check_outm].ToString() + " " + Request.Form[Accompany_Check_outMeridia].ToString(); db.tbl_CSI_69_Con_Accompanys.Add(tbl_csi_69_con_accompanys); db.SaveChanges(); } } tbl_CSI_69_Con_Transections Trans = new tbl_CSI_69_Con_Transections(); // Trans.UserId = tbl_csi_69_con_registrationdetails.RegId; Trans.UserId = lastProductId; Trans.AmountToPay = payableAmt; Trans.AmountPaid = 0; Trans.TransDate = DateTime.Now.Date; Trans.Status = "N"; Trans.Remarks = ""; db.tbl_CSI_69_Con_Transections.Add(Trans); db.SaveChanges(); long id1 = db.tbl_CSI_69_Con_Transections.Max(item => item.TransId); GlobalData ga = new GlobalData(); ga.AdminMail("*****@*****.**"); ga.RegisterSendMail("*****@*****.**", "Satya Bhattacharyya", lastProductId, id1); return(RedirectToAction("Billdesk", "Registration", new { id = id1 })); //return RedirectToAction("Index"); } ViewBag.cntlist = new SelectList(db.tblCountryCodes, "Code", "Country"); var StorageDevice = new SelectList(new[] { new { value = "1", Text = "CSI Member" }, new { value = "2", Text = "Non-CSI Member" }, //new { value = "3", Text = "Non-CSI Member" }, new { value = "4", Text = "PG Students" }, new { value = "5", Text = "Industry Professional" }, new { value = "6", Text = "Nurse/Technician" }, new { value = "7", Text = "SAARC Countries (Non-CSI Member)" }, new { value = "8", Text = "Non-SAARC Foreign Nationals" }, }, "value", "Text"); ViewBag.catgrylist = StorageDevice; var pfx = new SelectList(new[] { new { value = "Dr.", Text = "Dr." }, new { value = "Mr.", Text = "Mr." }, new { value = "Mrs.", Text = "Mrs." }, new { value = "Ms.", Text = "Ms." }, }, "value", "Text"); ViewBag.Prefixlst = pfx; return(View(tbl_csi_69_con_registrationdetails)); }