//[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)); }