• 主页
  • ASP
  • .NET Framework
  • Web Services
  • VB
  • VC
  • 图表区
  • 分析与设计
  • 组件/控件开发
  • LINQ
快乐是看你满足 2013年06月25日
.求大神呀,MVC3下,RedirectToAction();跳不过去,很蛋疼很纠结。
[HttpPost]
public ActionResult AffairsMedical(FormCollection from)
{
var customer = _workContext.CurrentCustomer;
string company = customer.GetAttribute<string>(SystemCustomerAttributeNames.Company);
if (!string.IsNullOrEmpty(company) && company.IndexOf("-") > 0)
{
company = company.Substring(0, company.IndexOf("-"));
}

List<InsSupplementaryMedical> listIE = _premiumService.GetListSupplementaryMedical(company);
//Hr 合并
if (customer.CompanyID == customer.AreaId)
{
List<Organization> listO = _organization.GetListOrganizationBySuperiorsId((int)customer.CompanyID);
List<InsAffairs> listIA = _premiumService.GetAffairs(company, "补充医疗险", 1, 0);
if (listO.Count == listIA.Count)
{
if (listIA.Count > 1)
{
InsAffairs model = new InsAffairs();
model.CompanyName = company;
model.CreatedName = customer.FullName;
model.InsuranceName = "补充医疗险";
model.CreatedTime = DateTime.Now;
model.ApplicationYear = DateTime.Now.Year - 1;
model.Status = 1;
model.AmalgamateId = customer.CompanyID;
_premiumService.insertAffairs(model);
List<InsAffairs> affmax = _premiumService.GetAffairs(company, "补充医疗险", 1, (int)customer.CompanyID);
foreach (InsSupplementaryMedical IE in listIE)
{
IE.IsStatus = affmax[0].Id;
_premiumService.UpdateInsSupplementaryMedical(IE);
}
return RedirectToAction("AffairsMedical");
}
else
{
return Content(@"<script>alert('至少有2条数据时,才能发起合并!');window.location.href='AffairsMedical';</script>");
}
}
else if (listO.Count < listIA.Count)
{
return Content(@"<script>alert('已合并!');window.location.href='AffairsMedical';</script>");
}
else
{
return Content(@"<script>alert('请确认是否所有区域Hr已提交!');window.location.href='AffairsMedical';</script>");
}

}
else
{
if (listIE.Count != 0 && company != null)
{
List<InsAffairs> isAff = _premiumService.GetAffairs(company, "补充医疗险", 0, (int)customer.AreaId);

if (isAff.Count == 0)
{
InsAffairs model = new InsAffairs();
model.CompanyName = company;
model.CreatedName = customer.FullName;
model.InsuranceName = "补充医疗险";
model.CreatedTime = DateTime.Now;
model.ApplicationYear = DateTime.Now.Year - 1;
model.Status = 0;
model.AmalgamateId = customer.AreaId;
_premiumService.insertAffairs(model);
List<InsAffairs> aff = _premiumService.GetAffairs(company, "补充医疗险", 0, (int)customer.AreaId);
List<Customer> ListC = _customerService.GetListCustomersByAreald((int)customer.AreaId);
foreach (Customer Cs in ListC)
{
foreach (InsSupplementaryMedical iel in listIE)
{
if (Cs.IDNo == iel.IdNum)
{
iel.IsStatus = aff[0].Id;
iel.AmalgamateStatus = aff[0].Id;
iel.Year = DateTime.Now.Year;
_premiumService.insertMedicalLiability(iel);
}
}
}

}
return RedirectToAction("AffairsMedical");
}
else
{
return Content(@"<script>alert('上一年没有相关数据,无法发起申请!');window.location.href='AffairsMedical';</script>");
}
}
}

if (customer.CompanyID == customer.AreaId)
是用来判断是Hr管理员还是区域管理员,如果是Hr进if,否则进else,
其中区域管理员点击按钮时,2个foreach完了后,return RedirectToAction("AffairsMedical");
能跳到[HttpGet]AffairsMedical();但是为什么Hr管理员点进来上面foreach完了后就是不跳,页面一直显示等待。我在[HttpGet]AffairsMedical();加了断点,f5一按直接就没跳进去,但是在区域管理员的时候又没问题。但是循环里面的修改硬是都执行了,在页面手动刷新显示的东西是没问题的。
...全文
112 点赞 收藏 8
写回复
8 条回复

还没有回复,快来抢沙发~

发动态
发帖子
.NET技术社区
创建于2007-09-28

4.9w+

社区成员

66.8w+

社区内容

.NET技术交流专区
社区公告
暂无公告