/// 发布资讯 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnRelease_Click(object sender, EventArgs e) { if (Session["loginUser"] == null) { Jscript.AlertAndRedirect("请登录", "/admin/login.aspx"); return; } string peopleCount = txtPeopleCount.Text.Trim(); if (peopleCount.Length == 0) { lblError.Text = "请输入招聘人数"; return; } Invite item = new Invite(); item.inviteType = 0; try { item.inviteType = Convert.ToInt32(txtPeopleCount.Text.Trim()); } catch (Exception je) { lblError.Text = "招聘人数输入错误"; return; } item.inviteName = txtTitle.Text.Trim(); item.inviteInfo = this.content1.Value; item.inviteDesc = txtZhaiYao.Value.Trim(); txtHidInfo.Text = item.inviteInfo; item.inforemark = txtHidInfo.Text.Trim(); txtHidInfo.Text = item.inviteDesc; item.descremark = txtHidInfo.Text; item.addTime = DateTime.Now; item.status = 0; if (id != 0) { item.id = id; if (InviteService.Update(item)) { Jscript.AlertAndRedirect("修改成功", "inviteInfo.aspx"); } else { Jscript.AlertAndRedirect("修改失败", "inviteInfo.aspx"); } } else { int num = InviteService.Add(item); if (num > 0) { Jscript.AlertAndRedirect("添加成功", "inviteInfo.aspx"); } else { Jscript.AlertAndRedirect("添加失败", "inviteInfo.aspx"); } } }
public AjaxMessage CreateInviteContent(FL_InviteDetails inviteDetail) { AjaxMessage ajax = new AjaxMessage(); ajax.IsSuccess = false; ajax.Message = "数据异常,请稍候再试..."; try { if (inviteDetail != null) { int selfEmployeeId = LoginInfo.UserInfo.EmployeeId; inviteDetail.CreateDate = DateTime.Now; inviteDetail.EmployeeId = selfEmployeeId; inviteDetail.StateName = inviteDetail.StateValue.GetDisplayName(); //客户表 修改相应的状态 FL_Customer m_customer = _customerService.GetByGuid(new Guid(inviteDetail.CustomerId.ToString())); m_customer.State = inviteDetail.InviteState; //邀约表 FL_Invite m_invite = _inviteService.GetById(inviteDetail.InviteId); m_invite.FollowCount += 1; m_invite.LastFollowDate = inviteDetail.CreateDate; m_invite.NextFollowDate = inviteDetail.NextFollowDate; //统计表(客户) SS_Report report = _reportService.GetByCustomerId(new Guid(inviteDetail.CustomerId.ToString())); if (inviteDetail.InviteState == 4) //流失 { m_invite.IsLose = true; m_invite.LoseDate = DateTime.Now; report.InviteLoseDate = m_invite.LoseDate; } using (TransactionScope scope = new TransactionScope()) { //客户表 _customerService.Update(m_customer); //邀约详细 _invteiContentService.Add(inviteDetail); //邀约表 _inviteService.Update(m_invite); //统计 _reportService.Update(report); scope.Complete(); } ajax.IsSuccess = true; ajax.Message = "记录成功"; } } catch (Exception e) { ajax.Message = e.Message; } return(ajax); }