public ActionResult ProcessCompanyPwd(string userLoginName,string userMail) { string timeString = DateTime.Now.ToString("yyyy年MM月dd日HH时mm分ss秒"); Models.sziit_researchEntities db = new Models.sziit_researchEntities(); var info= db.companyInfo.Where(a => a.loginName == userLoginName && a.userMail == userMail && a.is_Del == "否").FirstOrDefault(); if (info != null) { string before=info.userID+info.userMail+info.loginName+DateTime.Now.ToString(); MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider(); byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(before)); StringBuilder sBuilder = new StringBuilder(); for (int i = 0; i < data.Length; i++) { sBuilder.Append(data[i].ToString("x2")); } string authIn = sBuilder.ToString(); App_Class.Mail sm = new App_Class.Mail(); Models.ResetUserPasswordInfo rup = new Models.ResetUserPasswordInfo() { userID=info.userID, authInfo=authIn, EXP=DateTime.Now.AddMinutes(30), is_Use="否" }; db.ResetUserPasswordInfo.Add(rup); db.SaveChanges(); string mailContent = " <div style =\"width: 1003px;font-size:16px; margin: 0 auto;font-family:'Microsoft YaHei UI'\">" + "<div style=\"text-align:center\"><img src=\"http://139.129.23.13:81/Static/img/sziitselogo.jpg\"></div>" + "<p style=\"margin-left:23px;\">尊敬的" + info.userName + "专家:</p><p style=\"margin: 0 23px; text-indent:2em;\"><span style=\"color:red\">"+ "您在"+timeString+"提交找回密码请求,请点击下面的链接修改用户"+info.loginName+"的密码</span></p>"+ "<p style=\"margin: 0 23px; text-indent:2em;\"><a href=\"http://139.129.23.13:81/Home/ResetUserPassword?authenticationInfo=" + authIn + "\" target=\"_blank\">重置密码</a></p>" + "<p style=\"margin: 0 23px; text-indent:2em;\">http://139.129.23.13:81/Home/ResetUserPassword?authenticationInfo=" + authIn + "</p>" + "<p style=\"margin: 0 23px; text-indent:2em;\">(如果您无法点击这个链接,请将此链接复制到浏览器地址栏后访问)</p>"+ "<p style=\"margin: 0 23px; text-indent:2em;\">为了保证您帐号的安全性,该链接有效期为30分钟,并且点击一次后将失效! </p>"+ "<p style=\"margin: 0 23px; text-indent:2em;\">如果您误收到此电子邮件,则可能是其他用户在尝试帐号设置时的误操作,如果您并未发起该请求,则无需再进行任何操作,并可以放心地忽略此电子邮件。 </p>"+ "<p style=\"margin: 0 23px; text-indent:2em;\">若您担心帐号安全,建议您立即登录,修改登陆密码。</p>"+ " <p style=\"float:right\">深圳信息职业技术学院软件学院调研系统 <br/>邮件发送时间:" + DateTime.Now.ToString() + "</p><br/>" + "<p><a href=\"http://139.129.23.13:81 \" target=\"_blank\"style=\"-moz-box-shadow: inset 0px 1px 0px 0px #54a3f7; -webkit-box-shadow: inset 0px 1px 0px 0px #54a3f7; box-shadow: inset 0px 1px 0px 0px #54a3f7; background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #007dc1), color-stop(1, #0061a7)); background: -moz-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -webkit-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -o-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -ms-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: linear-gradient(to bottom, #007dc1 5%, #0061a7 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#007dc1', endColorstr='#0061a7',GradientType=0); background-color: #007dc1; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; border: 1px solid #124d77; display: inline-block; cursor: pointer; color: #ffffff; font-family: Arial; font-size: 13px; padding: 6px 24px; text-decoration: none; text-shadow: 0px 1px 0px #154682;\">了解更多</a></p>" + "</div>" + "<div style=\"text-align: center;padding:23px 0 0 0;font-size:12px;color:#909090;\">本邮件由软件学院调研系统自动发出,无需回复。感谢您的支持与合作</div>"; if (sm.sendMail(info.userMail, info.userName, "软件学院调研系统-用户密码找回", mailContent)) { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('资料核对成功,请到邮箱点击链接重置密码,该链接30分钟内有效',function (){var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);});}</script>"); } else { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('资料核对成功,但由于系统故障,暂未能发送重置密码邮件,请重试或者联系管理员',function (){var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);});}</script>"); } } else { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('很抱歉,没有找到相关资料,无法为您重置密码,请联系管理员',function (){var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);});}</script>"); } return View(); }
public ContentResult SetUserAudit(string UID,string OperatingValue) { if (!is_Login()) { return Content("ERROR"); } else { try { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); Int64 ui = Convert.ToInt64(UID); var ua = db.companyInfo.Where(e => e.userID == ui).FirstOrDefault(); App_Class.Mail sm = new App_Class.Mail(); if (OperatingValue == "pass") { ua.is_Audit = "是"; string mailContent = " <div style =\"width: 1003px;font-size:16px; margin: 0 auto;font-family:'Microsoft YaHei UI'\">" + "<div style=\"text-align:center\"><img src=\"http://139.129.23.13:81//Static/img/sziitselogo.jpg\"></div>" + "<p style=\"margin-left:23px;\">尊敬的" + ua.userName + "专家:</p><p style=\"margin: 0 23px; text-indent:2em;\">恭喜!您已成功通过系统审核,现在您已经可以登录系统,欢迎您使用,您的登陆账号为:" + ua.loginName + "</p>" + " <p style=\"margin: 0 23px; text-indent:2em;\">感谢您的支持与合作</p><br />" + " <p style=\"float:right\">深圳信息职业技术学院软件学院调研系统 <br/>邮件发送时间:" + DateTime.Now.ToString() + "</p><br/>" + "<p><a href=\"http://139.129.23.13:81/\" target=\"_blank\"style=\"-moz-box-shadow: inset 0px 1px 0px 0px #54a3f7; -webkit-box-shadow: inset 0px 1px 0px 0px #54a3f7; box-shadow: inset 0px 1px 0px 0px #54a3f7; background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #007dc1), color-stop(1, #0061a7)); background: -moz-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -webkit-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -o-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -ms-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: linear-gradient(to bottom, #007dc1 5%, #0061a7 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#007dc1', endColorstr='#0061a7',GradientType=0); background-color: #007dc1; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; border: 1px solid #124d77; display: inline-block; cursor: pointer; color: #ffffff; font-family: Arial; font-size: 13px; padding: 6px 24px; text-decoration: none; text-shadow: 0px 1px 0px #154682;\">了解更多</a></p>" + "</div>" + "<div style=\"text-align: center;padding:23px 0 0 0;font-size:12px;color:#909090;\">本邮件由软件学院调研系统自动发出,无需回复。感谢您的支持与合作</div>"; sm.sendMail(ua.userMail, ua.userName, "恭喜,您已成功通过系统审核!", mailContent); } else { string mailContent1 = " <div style =\"width: 1003px;font-size:16px; margin: 0 auto;font-family:'Microsoft YaHei UI'\">" + "<div style=\"text-align:center\"><img src=\"http://139.129.23.13:81//Static/img/sziitselogo.jpg\"></div>" + "<p style=\"margin-left:23px;\">尊敬的" + ua.userName + "专家:</p><p style=\"margin: 0 23px; text-indent:2em;\">很抱歉的通知您,您的申请尚未通过,请您提供真实信息或者联系管理员,欢迎您再次注册</p>" + " <p style=\"margin: 0 23px; text-indent:2em;\">感谢您的支持与合作</p><br />" + " <p style=\"float:right\">深圳信息职业技术学院软件学院调研系统 <br/>邮件发送时间:" + DateTime.Now.ToString() + "</p><br/>" + "<p><a href=\"http://139.129.23.13:81/\" target=\"_blank\"style=\"-moz-box-shadow: inset 0px 1px 0px 0px #54a3f7; -webkit-box-shadow: inset 0px 1px 0px 0px #54a3f7; box-shadow: inset 0px 1px 0px 0px #54a3f7; background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #007dc1), color-stop(1, #0061a7)); background: -moz-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -webkit-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -o-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -ms-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: linear-gradient(to bottom, #007dc1 5%, #0061a7 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#007dc1', endColorstr='#0061a7',GradientType=0); background-color: #007dc1; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; border: 1px solid #124d77; display: inline-block; cursor: pointer; color: #ffffff; font-family: Arial; font-size: 13px; padding: 6px 24px; text-decoration: none; text-shadow: 0px 1px 0px #154682;\">了解更多</a></p>" + "</div>" + "<div style=\"text-align: center;padding:23px 0 0 0;font-size:12px;color:#909090;\">本邮件由软件学院调研系统自动发出,无需回复。感谢您的支持与合作</div>"; sm.sendMail(ua.userMail, ua.userName, "很抱歉,您未能通过系统审核!", mailContent1); ua.is_Del = "是"; } db.SaveChanges(); return Content("OK,设置成功"); } catch { return Content("ERROR,设置失败"); } } }
//设置调研表状态【启用】【禁用】 public ContentResult SetReportStatus(string ReportID, string operationType) { if (!is_Login()) { return Content("Error"); } else { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); Int64 rid = Convert.ToInt64(ReportID); var d = db.questionnaireInfo.Where(e => e.questionnaireID == rid).FirstOrDefault(); if (operationType == "delete") { d.is_Del = "是"; db.SaveChanges(); return Content("删除成功"); } else if (operationType == "lockOrUnlock") { if (d.questionnaireState == "启用") { d.questionnaireState = "禁用"; } else { d.questionnaireState = "启用"; } db.SaveChanges(); return Content("状态更改成功"); } else { return Content("Error"); } } }
public ActionResult ProcessUpdateReport(FormCollection form) { if (!is_Login()) { return RedirectToAction("Index", "Home"); } else { Int64 rid = Convert.ToInt64(Session["updateReportID"]); Models.sziit_researchEntities db = new Models.sziit_researchEntities(); var info = db.questionnaireInfo.Where(a => a.questionnaireID == rid).FirstOrDefault(); info.questionnaireName = form["questionnaireName"]; DateTime dt = Convert.ToDateTime(form["questionnaireEXP"]); info.questionnaireEXP = dt; info.questionnaireYear = form["userYear"]; db.SaveChanges(); Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('修改成功',function (){var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);});}</script>"); return View(); } }
public ActionResult ProcessAddReportTopics(FormCollection form) { if (!is_Login()) { return RedirectToAction("Index", "Home"); } else { try { int qid = Convert.ToInt32(Session["AddReportTopics"]); Models.sziit_researchEntities db = new Models.sziit_researchEntities(); if (form["TopicsType"].ToString() == "单选题") { Models.problemTitleInfo pti = new Models.problemTitleInfo() { questionnaireID = qid, problemType = "单选", problemTitle = form["problemTitle"] }; db.problemTitleInfo.Add(pti); Int64 problemID = pti.problemID; int count = Convert.ToInt32(form["optionNum"].ToString()); for (int i = 1; i <= count; i++) { string formName = "option" + i.ToString(); Models.problemKeyInfo pki = new Models.problemKeyInfo() { problemID = problemID, keyContent = form[formName] }; db.problemKeyInfo.Add(pki); } db.SaveChanges(); } else if (form["TopicsType"].ToString() == "多选题") { Models.problemTitleInfo pti = new Models.problemTitleInfo() { questionnaireID = qid, problemType = "多选", problemTitle = form["problemTitle"] }; db.problemTitleInfo.Add(pti); Int64 problemID = pti.problemID; int count = Convert.ToInt32(form["optionNum"].ToString()); for (int i = 1; i <= count; i++) { string formName = "option" + i.ToString(); Models.problemKeyInfo pki = new Models.problemKeyInfo() { problemID = problemID, keyContent = form[formName] }; db.problemKeyInfo.Add(pki); } db.SaveChanges(); } else if (form["TopicsType"].ToString() == "单选加其他") { Models.problemTitleInfo pti = new Models.problemTitleInfo() { questionnaireID = qid, problemType = "单选加其他", problemTitle = form["problemTitle"] }; db.problemTitleInfo.Add(pti); Int64 problemID = pti.problemID; int count = Convert.ToInt32(form["optionNum"].ToString()); for (int i = 1; i <= count; i++) { string formName = "option" + i.ToString(); Models.problemKeyInfo pki = new Models.problemKeyInfo() { problemID = problemID, keyContent = form[formName] }; db.problemKeyInfo.Add(pki); } db.SaveChanges(); } else if (form["TopicsType"].ToString() == "多选加其他") { Models.problemTitleInfo pti = new Models.problemTitleInfo() { questionnaireID = qid, problemType = "多选加其他", problemTitle = form["problemTitle"] }; db.problemTitleInfo.Add(pti); Int64 problemID = pti.problemID; int count = Convert.ToInt32(form["optionNum"].ToString()); for (int i = 1; i <= count; i++) { string formName = "option" + i.ToString(); Models.problemKeyInfo pki = new Models.problemKeyInfo() { problemID = problemID, keyContent = form[formName] }; db.problemKeyInfo.Add(pki); } db.SaveChanges(); } else { Models.problemTitleInfo pti = new Models.problemTitleInfo() { questionnaireID = qid, problemType = form["TopicsType"].ToString(), problemTitle = form["problemTitle"] }; db.problemTitleInfo.Add(pti); db.SaveChanges(); } Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('新增成功',function (){var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);});}</script>"); return View(); } catch { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('系统错误!!!',function (){var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);});}</script>"); return View(); } } }
public ActionResult ProcessAddNewReport(FormCollection form) { if (!is_Login()) { return RedirectToAction("Index", "Home"); } else { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); DateTime dt = Convert.ToDateTime(form["questionnaireEXP"]); Models.questionnaireInfo qi = new Models.questionnaireInfo() { questionnaireName = form["questionnaireName"], questionnaireEXP = dt, questionnaireState = form["questionnaireState"], is_Del = "否", questionnaireYear = DateTime.Now.Year.ToString() }; db.questionnaireInfo.Add(qi); db.SaveChanges(); Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('新增成功',function (){window.parent.location = window.parent.location ;});}</script>"); return View(); } }
//DeleteTopics删除题目 public ContentResult DeleteTopics(string TopicsID) { try { if (!is_Login()) { return Content("系统错误,请重新登录"); } else { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); Int64 rid = Convert.ToInt64(TopicsID); var d = db.problemOptionInfo.Where(a => a.problemID == rid); db.problemOptionInfo.RemoveRange(d); var f = db.problemKeyInfo.Where(a => a.problemID == rid); db.problemKeyInfo.RemoveRange(f); var g = db.problemTitleInfo.Where(h => h.problemID == rid); db.problemTitleInfo.RemoveRange(g); db.SaveChanges(); return Content("删除成功"); } } catch { return Content("删除失败,系统错误"); } }
public ContentResult AddUser(string userType,string userLoginName,string userName) { if (!is_Login()) { return Content("ERROR"); } else { try { if (userLoginName == "" || userName == "") { return Content("Error,相关信息不能为空"); } else { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); if (userType == "teacher") { Models.teacherInfo ti = new Models.teacherInfo() { loginName = userLoginName, loginPWD = "sziit*123", teacherName = userName, is_del = "否" }; db.teacherInfo.Add(ti); db.SaveChanges(); return Content("OK,新增成功"); } else if (userType == "admin") { Models.adminInfo ai = new Models.adminInfo() { adminName = userName, adminPwd = "sziit*123", loginName = userLoginName, is_Del = "否" }; db.adminInfo.Add(ai); db.SaveChanges(); return Content("OK,新增成功"); } else if (userType == "company") { Models.companyInfo cp = new Models.companyInfo() { userName = userName, loginName = userLoginName, loginPwd = "sziit*123", is_Audit = "是", is_edit = "否", is_Del = "否" }; db.companyInfo.Add(cp); db.SaveChanges(); return Content("OK,新增成功"); } else { return null; } } } catch { return Content("Error,新增失败!登录账号重复了"); } } }
public ContentResult AccountOperation(string userType, string userID, string operationType) { if (!is_Login()) { return Content("ERROR"); } else { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); if (userType == "company") { Int64 uid = Convert.ToInt64(userID); var ee = db.companyInfo.Where(e => e.userID == uid).FirstOrDefault(); if (operationType == "lockOrUnlock") { if (ee.is_Del == "冻结") { ee.is_Del = "否"; } else { ee.is_Del = "冻结"; } } if (operationType == "delete") { ee.is_Del = "是"; } if (operationType == "resetPassword") { ee.loginPwd = "sziit*123"; } db.SaveChanges(); return Content("操作成功"); } else if (userType == "teacher") { int uid = Convert.ToInt32(userID); var ee = db.teacherInfo.Where(e => e.teacherID == uid).FirstOrDefault(); if (operationType == "delete") { ee.is_del = "是"; } if (operationType == "resetPassword") { ee.loginPWD = "sziit*123"; } db.SaveChanges(); return Content("操作成功"); } else if (userType == "admin") { string outs = ""; int uid = Convert.ToInt32(userID); var ee = db.adminInfo.Where(e => e.adminID == uid).FirstOrDefault(); if (operationType == "delete") { if (db.adminInfo.Count() < 2) { outs = "最少保留一个管理员账号"; } else { ee.is_Del = "是"; outs = "操作成功"; } } if (operationType == "resetPassword") { ee.adminPwd = "sziit*123"; outs = "操作成功"; } db.SaveChanges(); return Content(outs); } else { return Content("ERROR"); } } }
public ActionResult UpdatePwd(string oldPwd, string newPwd) { if (Session["userType"] == null) { return RedirectToAction("Index", "Home"); } else { if (oldPwd != null && newPwd != null) { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); if (Session["userType"].ToString() == "teacher") { Int64 uid = Convert.ToInt64(Session["userID"]); var ci = db.companyInfo.Where(e => e.userID == uid && e.loginPwd == oldPwd).FirstOrDefault(); if (ci != null) { ci.loginPwd = newPwd; db.SaveChanges(); ViewBag.msgInfo = "修改成功,下次登录时生效"; } else { ViewBag.msgInfo = "修改失败,原始密码不正确"; } return View(); } else if (Session["userType"].ToString() == "company") { Int64 uid = Convert.ToInt64(Session["userID"]); var ci = db.companyInfo.Where(e => e.userID == uid && e.loginPwd == oldPwd).FirstOrDefault(); if (ci != null) { ci.loginPwd = newPwd; db.SaveChanges(); ViewBag.msgInfo = "修改成功,下次登录时生效"; } else { ViewBag.msgInfo = "修改失败,原始密码不正确"; } return View(); } else { int uid = Convert.ToInt32(Session["adminID"]); var ci = db.adminInfo.Where(f => f.adminID == uid).FirstOrDefault(); if (ci != null) { ci.adminPwd = newPwd; db.SaveChanges(); ViewBag.msgInfo = "修改成功,下次登录时生效"; } else { ViewBag.msgInfo = "修改失败,原始密码不正确"; } return View(); } } else { ViewBag.msgInfo = null; return View(); } } }
public ActionResult ProcessUpdateUserInfo(FormCollection form) { if (Session["userType"] == null) { return RedirectToAction("Index", "Home"); } else { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); try { if (Session["updateUserType"].ToString() == "admin") { int uid = Convert.ToInt32(Session["updateuinfoID"]); var info = db.adminInfo.Where(r => r.adminID == uid).FirstOrDefault(); info.loginName = form["adminLoginName"]; info.adminName = form["adminUserName"]; db.SaveChanges(); Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('修改成功',function (){window.parent.location=window.parent.location;});}</script>"); return View(); } else if (Session["updateUserType"].ToString() == "teacher") { int uid = Convert.ToInt32(Session["updateuinfoID"]); var info = db.teacherInfo.Where(t => t.teacherID == uid).FirstOrDefault(); info.loginName = form["teacherLoginName"]; info.teacherName = form["teacherName"]; db.SaveChanges(); Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('修改成功',function (){window.parent.location=window.parent.location;});}</script>"); return View(); } else if (Session["updateUserType"].ToString() == "company") { Int64 uid = Convert.ToInt64(Session["updateuinfoID"]); var info = db.companyInfo.Where(a => a.userID == uid).FirstOrDefault(); info.companyName = form["companyName"]; info.companyAddress = form["companyAddress"]; info.companyWebsite = form["companyWebsite"]; info.userPhone = form["userPhone"]; info.companyPhone = form["companyPhone"]; info.userName = form["userName"]; info.loginName = form["userLoginName"]; info.userMail = form["userMail"]; db.SaveChanges(); Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('修改成功',function (){window.parent.location=window.parent.location;});}</script>"); return View(); } else { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('修改成功',function (){window.parent.location=window.parent.location;});}</script>"); return View(); } } catch { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('出错了,可能原因为:登陆账号重复了',function (){window.parent.location=window.parent.location;});}</script>"); return View(); } } }
public ActionResult ProcessMaintenanceCompanyInformation(FormCollection form) { if (!is_Login()) { return RedirectToAction("Index", "Home"); } else { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); Int64 uid = Convert.ToInt64(Session["userID"]); var info = db.companyInfo.Where(a => a.userID == uid).FirstOrDefault(); info.companyName = form["companyName"]; info.companyAddress = form["companyAddress"]; info.companyWebsite = form["companyWebsite"]; info.userPhone = form["userPhone"]; info.companyPhone = form["companyPhone"]; db.SaveChanges(); return RedirectToAction("Index", "Company"); } }
public ActionResult ProcessCompleteReport(FormCollection form) { if (!is_Login()) { return RedirectToAction("Index", "Home"); } else { try { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); int ReportID = Convert.ToInt32(Session["ReportID"]); var questionnaireInfo = db.questionnaireInfo.Where(a => a.questionnaireID == ReportID).FirstOrDefault(); if (questionnaireInfo != null) { int QID = Convert.ToInt32(questionnaireInfo.questionnaireID); var outInfo = db.problemTitleInfo.Where(b => b.questionnaireID == QID); Models.sziit_researchEntities db2 = new Models.sziit_researchEntities(); Int64 uid = Convert.ToInt64(Session["userID"]); foreach (var item in outInfo) { Int64 pid = item.problemID; if (item.problemType == "单选") { Models.problemOptionInfo poi = new Models.problemOptionInfo() { problemID = item.problemID, optionContent = form[item.problemID.ToString()].ToString(), userID = uid }; db2.problemOptionInfo.Add(poi); } else if (item.problemType == "多选") { var getInfo = form[pid.ToString()].Split(','); foreach (var gi in getInfo) { Models.problemOptionInfo poi = new Models.problemOptionInfo() { problemID = item.problemID, optionContent = gi.ToString(), userID = uid }; db2.problemOptionInfo.Add(poi); } } else if (item.problemType == "单选加其他") { if (form[item.problemID.ToString()].ToString() != "otherInfo") { Models.problemOptionInfo poi = new Models.problemOptionInfo() { problemID = item.problemID, optionContent = form[item.problemID.ToString()].ToString(), userID = uid }; db2.problemOptionInfo.Add(poi); } else { Models.problemOptionInfo poi = new Models.problemOptionInfo() { problemID = item.problemID, optionContent = ":" + form[item.problemID.ToString() + "other"].ToString(), userID = uid }; db2.problemOptionInfo.Add(poi); } } else if (item.problemType == "多选加其他") { var getInfo = form[pid.ToString()].Split(','); foreach (var gi in getInfo) { if (gi.ToString() != "otherInfo") { Models.problemOptionInfo poi = new Models.problemOptionInfo() { problemID = item.problemID, optionContent = gi.ToString(), userID = uid }; db2.problemOptionInfo.Add(poi); } else { Models.problemOptionInfo poi = new Models.problemOptionInfo() { problemID = item.problemID, optionContent = ":" + form[item.problemID.ToString() + "other"].ToString(), userID = uid }; db2.problemOptionInfo.Add(poi); } } } else if (item.problemType == "优先顺序题") { Models.problemOptionInfo poi = new Models.problemOptionInfo() { problemID = item.problemID, optionContent = ":" + form[item.problemID.ToString()].ToString(), userID = uid }; db2.problemOptionInfo.Add(poi); } else if (item.problemType == "问答题") { Models.problemOptionInfo poi = new Models.problemOptionInfo() { problemID = item.problemID, optionContent = ":"+form[item.problemID.ToString()].ToString(), userID = uid }; db2.problemOptionInfo.Add(poi); } } Models.countInfo ci = new Models.countInfo() { questionnaireID = ReportID, userID = uid, actualFinishTime=DateTime.Now }; db2.countInfo.Add(ci); db2.SaveChanges(); db.Dispose(); } Session["cuowu"] = null; Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('填写完毕,感谢您的配合',function (){var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);});}</script>"); return View(); } catch { Session["cuowu"] = 1; return RedirectToAction("CompleteReport", "Company", new { ReportID = Session["ReportID"].ToString() }); } } }
public ActionResult ProcessCompanyInformation(FormCollection form) { if (!is_Login()) { return RedirectToAction("Index", "Home"); } else { Models.sziit_researchEntities db = new Models.sziit_researchEntities(); Int64 uid = Convert.ToInt64(Session["userID"]); var info = db.companyInfo.Where(a => a.userID == uid).FirstOrDefault(); info.companyName = form["companyName"]; info.companyAddress = form["companyAddress"]; info.companyWebsite = form["companyWebsite"]; info.userPhone = form["userPhone"]; info.companyPhone = form["companyPhone"]; if (form["companyType"].ToString() != "其他") { info.companyType = form["companyType"]; } else { info.companyType = form["companyOtherType"]; } info.userMail = form["userMail"]; info.is_edit = "是"; App_Class.Mail sm = new App_Class.Mail(); string mailContent = " <div style =\"width: 1003px;font-size:16px; margin: 0 auto;font-family:'Microsoft YaHei UI'\">" + "<div style=\"text-align:center\"><img src=\"http://139.129.23.13:81/Static/img/sziitselogo.jpg\"></div>" + "<p style=\"margin-left:23px;\">尊敬的" +info.userName + "专家:</p><p style=\"margin: 0 23px; text-indent:2em;\">感谢您完善企业信息,您的登陆账号为:" + info.loginName + "</p>" + " <br />" + " <p style=\"float:right\">深圳信息职业技术学院软件学院调研系统 <br/>邮件发送时间:" + DateTime.Now.ToString() + "</p><br/>" + "<p><a href=\"http://139.129.23.13:81\" target=\"_blank\"style=\"-moz-box-shadow: inset 0px 1px 0px 0px #54a3f7; -webkit-box-shadow: inset 0px 1px 0px 0px #54a3f7; box-shadow: inset 0px 1px 0px 0px #54a3f7; background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #007dc1), color-stop(1, #0061a7)); background: -moz-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -webkit-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -o-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -ms-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: linear-gradient(to bottom, #007dc1 5%, #0061a7 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#007dc1', endColorstr='#0061a7',GradientType=0); background-color: #007dc1; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; border: 1px solid #124d77; display: inline-block; cursor: pointer; color: #ffffff; font-family: Arial; font-size: 13px; padding: 6px 24px; text-decoration: none; text-shadow: 0px 1px 0px #154682;\">了解更多</a></p>" + "</div>" + "<div style=\"text-align: center;padding:23px 0 0 0;font-size:12px;color:#909090;\">本邮件由软件学院调研系统自动发出,无需回复。感谢您的支持与合作</div>"; sm.sendMail(info.userMail, info.userName, "软件学院调研系统-感谢您完善企业信息", mailContent); db.SaveChanges(); return RedirectToAction("Index", "Company"); } }
public ActionResult ResetUserPassword(string authenticationInfo) { string timestring=DateTime.Now.ToString("yyyy年MM月dd日HH时mm分ss秒"); Models.sziit_researchEntities db = new Models.sziit_researchEntities(); var ck=db.ResetUserPasswordInfo.Where(b => b.authInfo == authenticationInfo && b.is_Use == "否").FirstOrDefault(); if(ck!=null) { if (DateTime.Now > ck.EXP) { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('该认证码已过期,请重新申请',function (){window.opener=null;window.close();});}</script>"); } else { var ss = db.companyInfo.Where(u => u.userID == ck.userID&&u.is_Del=="否").FirstOrDefault(); if(ss!=null) { ss.loginPwd = "123456"; } ck.is_Use = "是"; db.SaveChanges(); string mailContent = " <div style =\"width: 1003px;font-size:16px; margin: 0 auto;font-family:'Microsoft YaHei UI'\">" + "<div style=\"text-align:center\"><img src=\"http://139.129.23.13:81/Static/img/sziitselogo.jpg\"></div>" + "<p style=\"margin-left:23px;\">尊敬的" + ss.userName + "专家:</p><p style=\"margin: 0 23px; text-indent:2em;\"><span style=\"color:red\">" + "您的密码在" + timestring + "重置成功。新密码为:123456</span></p>" + "<p style=\"margin: 0 23px; text-indent:2em;\">为了保证您帐号的安全性,请登录系统修改您的账户密码! </p>"+ " <p style=\"float:right\">深圳信息职业技术学院软件学院调研系统 <br/>邮件发送时间:" + DateTime.Now.ToString() + "</p><br/>" + "<p><a href=\"http://139.129.23.13:81/\" target=\"_blank\"style=\"-moz-box-shadow: inset 0px 1px 0px 0px #54a3f7; -webkit-box-shadow: inset 0px 1px 0px 0px #54a3f7; box-shadow: inset 0px 1px 0px 0px #54a3f7; background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #007dc1), color-stop(1, #0061a7)); background: -moz-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -webkit-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -o-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -ms-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: linear-gradient(to bottom, #007dc1 5%, #0061a7 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#007dc1', endColorstr='#0061a7',GradientType=0); background-color: #007dc1; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; border: 1px solid #124d77; display: inline-block; cursor: pointer; color: #ffffff; font-family: Arial; font-size: 13px; padding: 6px 24px; text-decoration: none; text-shadow: 0px 1px 0px #154682;\">了解更多</a></p>" + "</div>" + "<div style=\"text-align: center;padding:23px 0 0 0;font-size:12px;color:#909090;\">本邮件由软件学院调研系统自动发出,无需回复。感谢您的支持与合作</div>"; App_Class.Mail sm = new App_Class.Mail(); if (sm.sendMail(ss.userMail, ss.userName, "软件学院调研系统-重置密码成功", mailContent)) { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('重置成功,新密码为:123456',function (){window.opener=null;window.close();});}</script>"); } else { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('重置成功,新密码为:123456。但由于系统故障,暂未能发送邮件',function (){window.opener=null;window.close();});}</script>"); } } } else { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('非法认证码',function (){window.opener=null;window.close();});}</script>"); } return View(); }
public ActionResult ProcessCompanyRegistration(FormCollection form) { try { string companyType = ""; if (form["companyType"] == "其他") { companyType = form["companyTypeOther"]; } else { companyType = form["companyType"]; } Models.sziit_researchEntities db = new Models.sziit_researchEntities(); Models.companyInfo ci = new Models.companyInfo() { companyName = form["companyName"], companyAddress = form["companyAddress"], companyPhone = form["companyPhone"], companyType = companyType, companyWebsite = form["companyWebsite"], userName = form["userName"], userPhone = form["mobliePhone"], loginName = form["userLoginName"], loginPwd = form["userLoginPwd"], userMail = form["userMail"], is_Del = "否", is_Audit = "否", is_edit = "是" }; db.companyInfo.Add(ci); db.SaveChanges(); App_Class.Mail sm = new App_Class.Mail(); string mailContent = " <div style =\"width: 1003px;font-size:16px; margin: 0 auto;font-family:'Microsoft YaHei UI'\">" + "<div style=\"text-align:center\"><img src=\"http://139.129.23.13:81//Static/img/sziitselogo.jpg\"></div>" + "<p style=\"margin-left:23px;\">尊敬的" + form["userName"] + "专家:</p><p style=\"margin: 0 23px; text-indent:2em;\">欢迎您注册信息学院软件学院调研系统的专家,您的登陆账号为:" + form["userLoginName"] + "</p>" + " <p style=\"margin: 0 23px; text-indent:2em;\">当您的账号通过审核后,我们将给您发送确认邮件,请留意邮箱邮件。感谢您的支持与合作</p><br />" + " <p style=\"float:right\">深圳信息职业技术学院软件学院调研系统 <br/>邮件发送时间:" + DateTime.Now.ToString() + "</p><br/>" + "<p><a href=\"http://139.129.23.13:81/\" target=\"_blank\"style=\"-moz-box-shadow: inset 0px 1px 0px 0px #54a3f7; -webkit-box-shadow: inset 0px 1px 0px 0px #54a3f7; box-shadow: inset 0px 1px 0px 0px #54a3f7; background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #007dc1), color-stop(1, #0061a7)); background: -moz-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -webkit-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -o-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: -ms-linear-gradient(top, #007dc1 5%, #0061a7 100%); background: linear-gradient(to bottom, #007dc1 5%, #0061a7 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#007dc1', endColorstr='#0061a7',GradientType=0); background-color: #007dc1; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; border: 1px solid #124d77; display: inline-block; cursor: pointer; color: #ffffff; font-family: Arial; font-size: 13px; padding: 6px 24px; text-decoration: none; text-shadow: 0px 1px 0px #154682;\">了解更多</a></p>" + "</div>" + "<div style=\"text-align: center;padding:23px 0 0 0;font-size:12px;color:#909090;\">本邮件由软件学院调研系统自动发出,无需回复。感谢您的支持与合作</div>"; if (sm.sendMail(form["userMail"], form["userName"], "欢迎您注册信息学院软件学院调研系统的专家", mailContent)) { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('注册成功,请等待审核',function (){var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);});}</script>"); } else { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('注册成功,但邮件发送失败,请等待审核',function (){var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);});}</script>"); } return View(); } catch { Response.Write("<script language='javaScript' type='text/javaScript'>window.onload=function(){layer.alert('登陆账号重复了,注册失败,请重试',function (){var index = parent.layer.getFrameIndex(window.name);parent.layer.close(index);});}</script>"); return View(); } }