public ActionResult New(IssueTypeToMaster issueTypeTo) { if (!string.IsNullOrWhiteSpace(issueTypeTo.IssueTypeCode)) { ViewBag.IssueTypeCode = issueTypeTo.IssueTypeCode; IssueType issueType = new IssueType();//this.genericMgr.FindById<IssueType>(issueTypeTo.IssueTypeCode); issueType.Code = issueTypeTo.IssueTypeCode; issueTypeTo.IssueType = issueType; ModelState.Remove("IssueType"); } if (!string.IsNullOrWhiteSpace(issueTypeTo.IssueLevelCode)) { ViewBag.IssueLevelCode = issueTypeTo.IssueLevelCode; IssueLevel issueLevel = new IssueLevel();//this.genericMgr.FindById<IssueLevel>(issueTypeTo.IssueLevelCode); issueLevel.Code = issueTypeTo.IssueLevelCode; issueTypeTo.IssueLevel = issueLevel; ModelState.Remove("IssueLevel"); } if (ModelState.IsValid) { //判断用户名不能重复 if (this.genericMgr.FindAll<long>(codeDuiplicateVerifyStatement, new object[] { issueTypeTo.Code })[0] > 0) { base.SaveErrorMessage(Resources.ISS.IssueTypeToMaster.Errors_Existing_IssueTypeToMaster, issueTypeTo.Code); } else { genericMgr.CreateWithTrim(issueTypeTo); SaveSuccessMessage(Resources.ISS.IssueTypeToMaster.IssueTypeToMaster_Added); return RedirectToAction("Edit/" + issueTypeTo.Code); } } ViewBag.Code = issueTypeTo.Code; return View(issueTypeTo); }
public ActionResult Edit(IssueTypeToMaster issueTypeTo) { if (!string.IsNullOrWhiteSpace(issueTypeTo.IssueTypeCode)) { ViewBag.IssueTypeCode = issueTypeTo.IssueTypeCode; IssueType issueType = new IssueType();//this.genericMgr.FindById<IssueType>(issueTypeTo.IssueTypeCode); issueType.Code = issueTypeTo.IssueTypeCode; issueTypeTo.IssueType = issueType; ModelState.Remove("IssueType"); } if (!string.IsNullOrWhiteSpace(issueTypeTo.IssueLevelCode)) { ViewBag.IssueLevelCode = issueTypeTo.IssueLevelCode; IssueLevel issueLevel = new IssueLevel();//this.genericMgr.FindById<IssueLevel>(issueTypeTo.IssueLevelCode); issueLevel.Code = issueTypeTo.IssueLevelCode; issueTypeTo.IssueLevel = issueLevel; ModelState.Remove("IssueLevel"); } if (ModelState.IsValid) { genericMgr.UpdateWithTrim(issueTypeTo); SaveSuccessMessage(Resources.ISS.IssueTypeToMaster.IssueTypeToMaster_Updated); } return View(issueTypeTo); }
public ActionResult Subscibe(string code, string userIdStr, string emailStr, string smsStr) { if (!string.IsNullOrWhiteSpace(code) && !string.IsNullOrWhiteSpace(userIdStr) && (!string.IsNullOrWhiteSpace(emailStr) || !string.IsNullOrWhiteSpace(smsStr))) { ViewBag.Code = code; IList<string> userIdList = (userIdStr.Split(',')).ToList<string>(); IList<string> emailList = (emailStr.Split(',')).ToList<string>(); IList<string> smsList = (smsStr.Split(',')).ToList<string>(); if (userIdList != null && (emailList != null || smsList != null)) { for (int i = 0; i < userIdList.Count; i++) { IssueTypeToUserDetail issueTypeToUserDetail = new IssueTypeToUserDetail(); IssueTypeToMaster issueTypeToMaster =new IssueTypeToMaster(); issueTypeToMaster.Code = code; issueTypeToUserDetail.IssueTypeTo = issueTypeToMaster; User user = new User(); user.Id = Int32.Parse(userIdList[i]); issueTypeToUserDetail.User = user; if (!string.IsNullOrWhiteSpace(emailList[i]) && bool.Parse(emailList[i]) == true) { issueTypeToUserDetail.IsEmail = true; } else { issueTypeToUserDetail.IsEmail = false; } if (!string.IsNullOrWhiteSpace(smsList[i]) && bool.Parse(smsList[i]) == true) { issueTypeToUserDetail.IsSMS = true; } else { issueTypeToUserDetail.IsSMS = false; } genericMgr.CreateWithTrim(issueTypeToUserDetail); } SaveSuccessMessage(Resources.ISS.IssueTypeToUserDetail.User_Subscibed); } } return this.RedirectToAction("ChooseUser/" + code); }