public ActionResult preregistration(Registration1 r) { if (ModelState.IsValid) { var database = new HealthInsuranceDB(); var s = new HealthInsuranceDB().Users.Create(); var cc = database.Users.ToList(); // cheking to see if phone , username, and email are unique foreach (var h in cc) { if (h.UserName == r.username) { ViewBag.error = " Username already exist"; return(View()); } } // end of cheking for unique if (r.username != null) { if (r.password != r.repassword) { return(View()); } s.UserName = r.username; s.Password = r.password; s.CreID = 1; database.Users.Add(s); database.SaveChanges(); var database1 = new HealthInsuranceDB(); var user = database.Users.ToList(); int x = -1; foreach (var item in user) { if (item.UserName == s.UserName && item.Password == s.Password) { x = item.UserID; } } TempData["userid"] = x; return(View("registrationview")); } } if (TempData["userid"] != null) { return(View("registrationview")); } return(View()); }
public ActionResult DeleteConfirmed(int id) { Registration1 registration1 = db.Registration1.Find(id); db.Registration1.Remove(registration1); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,StudentID,CourseID,TermID")] Registration1 registration1) { if (ModelState.IsValid) { db.Entry(registration1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "CourseName", registration1.CourseID); ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentFirstName", registration1.StudentID); ViewBag.TermID = new SelectList(db.StudyTerms, "TermID", "TermName", registration1.TermID); return(View(registration1)); }
// GET: Registration1/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Registration1 registration1 = db.Registration1.Find(id); if (registration1 == null) { return(HttpNotFound()); } return(View(registration1)); }
// GET: Registration1/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Registration1 registration1 = db.Registration1.Find(id); if (registration1 == null) { return(HttpNotFound()); } ViewBag.CourseID = new SelectList(db.Courses, "CourseID", "CourseName", registration1.CourseID); ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudentFirstName", registration1.StudentID); ViewBag.TermID = new SelectList(db.StudyTerms, "TermID", "TermName", registration1.TermID); return(View(registration1)); }
public void Insert(DateTime RegDate,string RegName1,string RegName2,string RegCompany,string RegAddr,string RegTel,string RegEmail,bool? RegMailing,string RegWhere,string RegExtra,string RegIp,string RegCountry,string QbookTitle,int? QinDimensions,string QinCurrency,string QinPallet,double? QinLength,double? QinWidth,double? QinDepth,double? QinWeight,double? QinExtent,double? QinPapergsm,bool? QinHardback,int? QcopiesCarton,string QoriginName,string QfinalName,int? QtotCopies,byte[] ResTs) { Registration1 item = new Registration1(); item.RegDate = RegDate; item.RegName1 = RegName1; item.RegName2 = RegName2; item.RegCompany = RegCompany; item.RegAddr = RegAddr; item.RegTel = RegTel; item.RegEmail = RegEmail; item.RegMailing = RegMailing; item.RegWhere = RegWhere; item.RegExtra = RegExtra; item.RegIp = RegIp; item.RegCountry = RegCountry; item.QbookTitle = QbookTitle; item.QinDimensions = QinDimensions; item.QinCurrency = QinCurrency; item.QinPallet = QinPallet; item.QinLength = QinLength; item.QinWidth = QinWidth; item.QinDepth = QinDepth; item.QinWeight = QinWeight; item.QinExtent = QinExtent; item.QinPapergsm = QinPapergsm; item.QinHardback = QinHardback; item.QcopiesCarton = QcopiesCarton; item.QoriginName = QoriginName; item.QfinalName = QfinalName; item.QtotCopies = QtotCopies; item.ResTs = ResTs; item.Save(UserName); }
/// <summary> /// get quote on this form simply sends quore info back to publiship, does not trigger web service /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void dxbtnget_Click(object sender, EventArgs e) { bool _failed = true; try { if (this.dxcapt1.IsValid) { //build contact object Registration1 _reg = new Registration1(); _reg.RegDate = DateTime.Now; _reg.RegName1 = this.dxtxtname1.Text.ToString(); _reg.RegName2 = this.dxtxtname2.Text.ToString(); _reg.RegCompany = this.dxtxtcompany.Text.ToString(); _reg.RegTel = this.dxtxtphone.Text.ToString(); _reg.RegEmail = this.dxtxtemail.Text.ToString(); _reg.RegExtra = this.dxmemoadd.Text.ToString(); _reg.RegMailing = (bool)this.dxckmailing.Value; _reg.RegWhere = this.dxcbowhere.Value.ToString(); _reg.RegIp = wwi_func.user_RequestingIP(); _reg.RegCountry = this.dxcboregcountry.Text.ToString(); //quote info int _dims = wwi_func.vint(this.dxhfpricer.Get("dims").ToString()); string _curr = this.dxhfpricer.Get("crnc").ToString(); string _pall = this.dxhfpricer.Get("pall").ToString(); _reg.QinCurrency = _curr; _reg.QinDimensions = _dims; _reg.QinPallet = _pall; _reg.QoriginName = this.dxcborigin.Text.ToString(); _reg.QfinalName = this.dxcbfinal.Text.ToString(); _reg.QtotCopies = wwi_func.vint(this.dxtxtcopies.Text.ToString()); switch (_dims) { case 1: { _reg.QbookTitle = this.dxtxttitle.Text.ToString(); _reg.QinLength = wwi_func.vdouble(this.dxtxtlength.Text.ToString()); _reg.QinWidth = wwi_func.vdouble(this.dxtxtwidth.Text.ToString()); _reg.QinDepth = wwi_func.vdouble(this.dxtxtdepth.Text.ToString()); _reg.QinWeight = wwi_func.vdouble(this.dxtxtweight.Text.ToString()); _reg.QinExtent = 0; _reg.QinPapergsm = 0; _reg.QinHardback = false; _reg.QcopiesCarton = wwi_func.vint(this.dxtcarton.Text.ToString()); break; } case 2: { _reg.QbookTitle = this.dxtxtcarttitle.Text.ToString(); _reg.QinLength = wwi_func.vdouble(this.dxtxtside1.Text.ToString()); _reg.QinWidth = wwi_func.vdouble(this.dxtxtside2.Text.ToString()); _reg.QinDepth = wwi_func.vdouble(this.dxtxtcartdepth.Text.ToString()); _reg.QinWeight = wwi_func.vdouble(this.dxtxtcartweight.Text.ToString()); _reg.QinExtent = 0; _reg.QinPapergsm = 0; _reg.QinHardback = false; _reg.QcopiesCarton = wwi_func.vint(this.dxtxtcartcopy.Text.ToString()); break; } case 3: { _reg.QbookTitle = this.dxtxttitle3.Text.ToString(); _reg.QinLength = wwi_func.vdouble(this.dxtxtblock1.Text.ToString()); _reg.QinWidth = wwi_func.vdouble(this.dxtxtblock2.Text.ToString()); _reg.QinDepth = 0; _reg.QinWeight = 0; _reg.QinExtent = wwi_func.vdouble(this.dxtxtextent.Text.ToString()); _reg.QinPapergsm = wwi_func.vdouble(this.dxspinpaper.Text.ToString()); _reg.QinHardback = (bool)this.dxckcover.Checked; _reg.QcopiesCarton = wwi_func.vint(this.dxtxtcartcopy.Text.ToString()); break; } } //save! _reg.Save(); //Int32 _newid = (Int32)_reg.GetPrimaryKeyValue(); //successful save notify publiship string _tr = "<tr><td bgcolor=\"#e8edff\" valign=\"middle\" width=\"230px\">" + "{0}" + "</td><td width=\"350px\">" + "{1}" + "</td></tr>"; string _msg1 = String.Format(_tr, "Name", _reg.RegName1.ToString() + ' ' + _reg.RegName2.ToString()) + String.Format(_tr, "Company", _reg.RegCompany.ToString()) + String.Format(_tr, "Country", _reg.RegCountry.ToString()) + String.Format(_tr, "Phone", _reg.RegTel.ToString()) + String.Format(_tr, "Email", _reg.RegEmail.ToString()) + String.Format(_tr, "Comments", _reg.RegExtra.ToString()) + String.Format(_tr, "Currency", _reg.QinCurrency.ToString()); string _msg2 = "<p>Your quote request has been received, and we will be in touch soon to discuss your requirements.</p><p>For your own reference, here is the information you sent us:</p>"; string _quote = String.Format(_tr, "Input type", _reg.QinDimensions == 1 ? "Book dimensions" : _reg.QinDimensions == 2 ? "Carton dimesnions" : "Paper type and extent") + String.Format(_tr, "Title or description", _reg.QbookTitle.ToString()) + String.Format(_tr, _dims == 1 ? "Length (mm)" : _dims == 2 ? "Longest side (mm)" : "Block (longest)", _reg.QinLength.ToString()) + String.Format(_tr, _dims == 1 ? "Width (mm)" : _dims == 2 ? "Next side (mm)" : "Block (other side)", _reg.QinWidth.ToString()) + String.Format(_tr, _dims != 3 ? "Depth (mm)" : "Extent (pages)", _dims != 3 ? _reg.QinDepth.ToString() : _reg.QinExtent.ToString()) + String.Format(_tr, _dims == 1 ? "Weight (grams)" : _dims == 2 ? "Weight (kg)" : "Paper type gsm", _dims != 3 ? _reg.QinWeight.ToString() : _reg.QinPapergsm.ToString()) + String.Format(_tr, _dims != 3 ? "Copies per carton" : "Hardback", _dims != 3 ? _reg.QcopiesCarton.ToString() : _reg.QinHardback == true ? "Yes" : "No") + String.Format(_tr, "Origin", _reg.QoriginName.ToString()) + String.Format(_tr, "Final destination", _reg.QfinalName.ToString()) + String.Format(_tr, "Total copies", _reg.QtotCopies.ToString()); //email to publiship string _emailed = ""; string[] _to = { "*****@*****.**", "*****@*****.**" }; //"*****@*****.**", "*****@*****.**" _emailed = MailHelper.gen_email(_to, true, "Registration and Quote " + _reg.RegCompany.ToString(), "<table cellpadding=\"5px\" style=\"border-color: #669\">" + _msg1 + _quote + "</table>", ""); //anckowledgement to visitor if (!string.IsNullOrEmpty(_reg.RegEmail.ToString())) { string[] _ak = { _reg.RegEmail.ToString() }; _emailed = MailHelper.gen_email(_ak, true, "Thank you for your quote request", _msg2 + "<table cellpadding=\"5px\" style=\"border-color: #669\">" + _quote + "</table><p>Regards</p><p>The Publiship Team</p>", ""); } _failed = false; } } catch (Exception ex) { string _err = ex.Message.ToString(); } finally{ if(_failed) { this.dxbtnquote0.ClientVisible = true; this.dxbtnback0.ClientVisible = true; this.dxbtnext0.ClientVisible = false; this.pnlmsg1.Visible = true; this.pnlmsg2.Visible = false; } else { this.dxbtnquote0.ClientVisible = false; this.dxbtnback0.ClientVisible = false; this.dxbtnext0.ClientVisible = false; this.pnlmsg2.Visible = true; this.pnlmsg1.Visible = false; } this.dxpagepricer.ActiveTabIndex = 2; } }
/// <summary> /// get quote on this form simply sends quore info back to publiship, does not trigger web service /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void dxbtnget_Click(object sender, EventArgs e) { bool _failed = true; try { if (this.dxcapt1.IsValid) { //build contact object Registration1 _reg = new Registration1(); _reg.RegDate = DateTime.Now; _reg.RegName1 = this.dxtxtname1.Text.ToString(); _reg.RegName2 = this.dxtxtname2.Text.ToString(); _reg.RegCompany = this.dxtxtcompany.Text.ToString(); _reg.RegTel = this.dxtxtphone.Text.ToString(); _reg.RegEmail = this.dxtxtemail.Text.ToString(); _reg.RegExtra = this.dxmemoadd.Text.ToString(); _reg.RegMailing = (bool)this.dxckmailing.Value; _reg.RegWhere = this.dxcbowhere.Value.ToString(); _reg.RegIp = wwi_func.user_RequestingIP(); _reg.RegCountry = this.dxcboregcountry.Text.ToString(); //quote info int _dims = wwi_func.vint(this.dxhfpricer.Get("dims").ToString()); string _curr = this.dxhfpricer.Get("crnc").ToString(); string _pall = this.dxhfpricer.Get("pall").ToString(); _reg.QinCurrency = _curr; _reg.QinDimensions = _dims; _reg.QinPallet = _pall; _reg.QoriginName = this.dxcborigin.Text.ToString(); _reg.QfinalName = this.dxcbfinal.Text.ToString(); _reg.QtotCopies = wwi_func.vint(this.dxtxtcopies.Text.ToString()); switch (_dims) { case 1: { _reg.QbookTitle = this.dxtxttitle.Text.ToString(); _reg.QinLength = wwi_func.vdouble(this.dxtxtlength.Text.ToString()); _reg.QinWidth = wwi_func.vdouble(this.dxtxtwidth.Text.ToString()); _reg.QinDepth = wwi_func.vdouble(this.dxtxtdepth.Text.ToString()); _reg.QinWeight = wwi_func.vdouble(this.dxtxtweight.Text.ToString()); _reg.QinExtent = 0; _reg.QinPapergsm = 0; _reg.QinHardback = false; _reg.QcopiesCarton = wwi_func.vint(this.dxtcarton.Text.ToString()); break; } case 2: { _reg.QbookTitle = this.dxtxtcarttitle.Text.ToString(); _reg.QinLength = wwi_func.vdouble(this.dxtxtside1.Text.ToString()); _reg.QinWidth = wwi_func.vdouble(this.dxtxtside2.Text.ToString()); _reg.QinDepth = wwi_func.vdouble(this.dxtxtcartdepth.Text.ToString()); _reg.QinWeight = wwi_func.vdouble(this.dxtxtcartweight.Text.ToString()); _reg.QinExtent = 0; _reg.QinPapergsm = 0; _reg.QinHardback = false; _reg.QcopiesCarton = wwi_func.vint(this.dxtxtcartcopy.Text.ToString()); break; } case 3: { _reg.QbookTitle = this.dxtxttitle3.Text.ToString(); _reg.QinLength = wwi_func.vdouble(this.dxtxtblock1.Text.ToString()); _reg.QinWidth = wwi_func.vdouble(this.dxtxtblock2.Text.ToString()); _reg.QinDepth = 0; _reg.QinWeight = 0; _reg.QinExtent = wwi_func.vdouble(this.dxtxtextent.Text.ToString()); _reg.QinPapergsm = wwi_func.vdouble(this.dxspinpaper.Text.ToString()); _reg.QinHardback = (bool)this.dxckcover.Checked; _reg.QcopiesCarton = wwi_func.vint(this.dxtxtcartcopy.Text.ToString()); break; } } //save! _reg.Save(); //Int32 _newid = (Int32)_reg.GetPrimaryKeyValue(); //successful save notify publiship string _tr = "<tr><td bgcolor=\"#e8edff\" valign=\"middle\" width=\"230px\">" + "{0}" + "</td><td width=\"350px\">" + "{1}" + "</td></tr>"; string _msg1 = String.Format(_tr, "Name", _reg.RegName1.ToString() + ' ' + _reg.RegName2.ToString()) + String.Format(_tr, "Company", _reg.RegCompany.ToString()) + String.Format(_tr, "Country", _reg.RegCountry.ToString()) + String.Format(_tr, "Phone", _reg.RegTel.ToString()) + String.Format(_tr, "Email", _reg.RegEmail.ToString()) + String.Format(_tr, "Comments", _reg.RegExtra.ToString()) + String.Format(_tr, "Currency", _reg.QinCurrency.ToString()); string _msg2 = "<p>Your quote request has been received, and we will be in touch soon to discuss your requirements.</p><p>For your own reference, here is the information you sent us:</p>"; string _quote = String.Format(_tr, "Input type", _reg.QinDimensions == 1 ? "Book dimensions" : _reg.QinDimensions == 2 ? "Carton dimesnions" : "Paper type and extent") + String.Format(_tr, "Title or description", _reg.QbookTitle.ToString()) + String.Format(_tr, _dims == 1 ? "Length (mm)" : _dims == 2 ? "Longest side (mm)" : "Block (longest)", _reg.QinLength.ToString()) + String.Format(_tr, _dims == 1 ? "Width (mm)" : _dims == 2 ? "Next side (mm)" : "Block (other side)", _reg.QinWidth.ToString()) + String.Format(_tr, _dims != 3 ? "Depth (mm)" : "Extent (pages)", _dims != 3 ? _reg.QinDepth.ToString() : _reg.QinExtent.ToString()) + String.Format(_tr, _dims == 1 ? "Weight (grams)" : _dims == 2 ? "Weight (kg)" : "Paper type gsm", _dims != 3 ? _reg.QinWeight.ToString() : _reg.QinPapergsm.ToString()) + String.Format(_tr, _dims != 3 ? "Copies per carton" : "Hardback", _dims != 3 ? _reg.QcopiesCarton.ToString() : _reg.QinHardback == true ? "Yes" : "No") + String.Format(_tr, "Origin", _reg.QoriginName.ToString()) + String.Format(_tr, "Final destination", _reg.QfinalName.ToString()) + String.Format(_tr, "Total copies", _reg.QtotCopies.ToString()); //email to publiship string _emailed = ""; string[] _to = { "*****@*****.**", "*****@*****.**" }; //"*****@*****.**", "*****@*****.**" _emailed = MailHelper.gen_email(_to, true, "Registration and Quote " + _reg.RegCompany.ToString(), "<table cellpadding=\"5px\" style=\"border-color: #669\">" + _msg1 + _quote + "</table>", ""); //anckowledgement to visitor if (!string.IsNullOrEmpty(_reg.RegEmail.ToString())) { string[] _ak = { _reg.RegEmail.ToString() }; _emailed = MailHelper.gen_email(_ak, true, "Thank you for your quote request", _msg2 + "<table cellpadding=\"5px\" style=\"border-color: #669\">" + _quote + "</table><p>Regards</p><p>The Publiship Team</p>", ""); } _failed = false; } } catch (Exception ex) { string _err = ex.Message.ToString(); } finally{ if (_failed) { this.dxbtnquote0.ClientVisible = true; this.dxbtnback0.ClientVisible = true; this.dxbtnext0.ClientVisible = false; this.pnlmsg1.Visible = true; this.pnlmsg2.Visible = false; } else { this.dxbtnquote0.ClientVisible = false; this.dxbtnback0.ClientVisible = false; this.dxbtnext0.ClientVisible = false; this.pnlmsg2.Visible = true; this.pnlmsg1.Visible = false; } this.dxpagepricer.ActiveTabIndex = 2; } }
protected void dxbtnsend_Click(object sender, EventArgs e) { try { if (this.dxcapt1.IsValid) { //build contact object Registration1 _reg = new Registration1(); _reg.RegDate = DateTime.Now; _reg.RegName1 = this.dxtxtname1.Text.ToString(); _reg.RegName2 = this.dxtxtname2.Text.ToString(); _reg.RegCompany = this.dxtxtcompany.Text.ToString(); _reg.RegTel = this.dxtxtphone.Text.ToString(); _reg.RegEmail = this.dxtxtemail.Text.ToString(); _reg.RegExtra = this.dxmemoadd.Text.ToString(); _reg.RegMailing = (bool)this.dxckmailing.Value; _reg.RegWhere = this.dxcbowhere.Value.ToString(); _reg.RegIp = wwi_func.user_RequestingIP(); _reg.RegCountry = this.dxcbocountry.Text.ToString(); //save! _reg.Save(); //successful save notify publiship string[] _to = { "*****@*****.**", "*****@*****.**" }; //"*****@*****.**", "*****@*****.**" string _subject = "Registration (discount) " + _reg.RegCompany.ToString(); string _tr = "<tr><td bgcolor=\"#e8edff\" valign=\"middle\" width=\"230px\">" + "{0}" + "</td><td width=\"350px\">" + "{1}" + "</td></tr>"; string _msg = "<table cellpadding=\"5px\" style=\"border-color: #669\">" + String.Format(_tr, "Name", _reg.RegName1.ToString() + ' ' + _reg.RegName2.ToString()) + String.Format(_tr, "Company", _reg.RegCompany.ToString()) + String.Format(_tr, "Country", _reg.RegCountry.ToString()) + String.Format(_tr, "Phone", _reg.RegTel.ToString()) + String.Format(_tr, "Email", _reg.RegEmail.ToString()) + String.Format(_tr, "Comments", _reg.RegExtra.ToString()) + "</table>"; string _emailed = ""; _emailed = MailHelper.gen_email(_to, true, _subject, _msg, ""); //anckowledgement to visitor if (!string.IsNullOrEmpty(_reg.RegEmail.ToString())) { string[] _ak = { _reg.RegEmail.ToString() }; _emailed = MailHelper.gen_email(_ak, true, "Thank you registering with Publiship", "<p>We will be in touch soon to discuss your requirements</p><p>Regards</p><p>The Publiship Team</p>", ""); } //finally confirm to user this.pnlmsg2.Visible = true; this.pnlmsg1.Visible = false; } } catch (Exception ex) { string _err = ex.Message.ToString(); this.pnlmsg1.Visible = true; this.pnlmsg2.Visible = false; this.dxbtnsend.ClientEnabled = true; } }