using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using System.Data;
|
using System.Data.SqlClient;
|
using CY.Model;
|
using CY.BLL;
|
using CY.Infrastructure.Common;
|
using CY.BLL.Sys;
|
using CY.BLL.EC;
|
using CY.Infrastructure.DESEncrypt;
|
using CY.Infrastructure.Query;
|
using System.Transactions;
|
using CY.BLL.OA;
|
|
namespace CY.WebForm.Pages.work
|
{
|
//吴辉
|
//工作考评
|
public partial class BaoxiaoPiliangReply : BasePage
|
{
|
OA_WorkPlanBll oA_WorkReminderBll = null;
|
OA_KaipiaoshenqingBLL _oA_KaipiaoshenqingBLL = null;
|
EC_OrderBLL _eC_OrderBLL = null;
|
OA_FukuanshenqingBLL _oA_FukuanshenqingBLL = null;
|
EC_MemberBasicBLL _eC_MemberBasicBLL = null;
|
OA_WorkPlan_attachmentBLL oA_WorkPlan_AttachmentBLL = null;
|
OA_WorkPlan_shenpiBLL oA_WorkPlan_ShenpiBLL = null;
|
OA_StaffBLL oA_StaffBLL = null;
|
OA_DepartmentBll oA_DepartmentBll = null;
|
public string planDataType = "";
|
OA_SubjectSetBLL _OA_SubjectSetBLL = null;
|
public BaoxiaoPiliangReply()
|
{
|
oA_WorkReminderBll = new OA_WorkPlanBll();
|
_oA_KaipiaoshenqingBLL = new OA_KaipiaoshenqingBLL();
|
_eC_OrderBLL = new EC_OrderBLL();
|
_oA_FukuanshenqingBLL = new OA_FukuanshenqingBLL();
|
_eC_MemberBasicBLL = new EC_MemberBasicBLL();
|
oA_WorkPlan_AttachmentBLL = new OA_WorkPlan_attachmentBLL();
|
oA_WorkPlan_ShenpiBLL = new OA_WorkPlan_shenpiBLL();
|
oA_StaffBLL = new OA_StaffBLL();
|
oA_DepartmentBll = new OA_DepartmentBll();
|
_OA_SubjectSetBLL = new OA_SubjectSetBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
InitData();
|
}
|
}
|
|
//数据加载
|
public void InitData()
|
{
|
//科目名称
|
var keyids = Request["keyids"].Trim(',').Split(',');
|
var sss = "";
|
foreach (var keyid in keyids)
|
{
|
OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(keyid.ToInt32());
|
if (m_OA_WorkPlan != null)
|
{
|
sss += m_OA_WorkPlan.EvaluationContent + ",";
|
}
|
}
|
|
this.spanDepart.InnerText = sss;
|
|
|
}
|
|
//表单提交
|
protected void btn_submit_form(object sender, EventArgs e)
|
{
|
var keyids = Request["keyids"].Trim(',').Split(',');
|
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
|
new TransactionOptions
|
{
|
IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted,
|
Timeout = TransactionManager.MaximumTimeout
|
}
|
)
|
)
|
{
|
try
|
{
|
|
|
string Messagezhuguan = null;
|
string Messagejingli = null;
|
var res = false;
|
var oA_Staff = oA_StaffBLL.GetModelByMemberId(CurrentUser.TrueMemberId);
|
if (!oA_Staff.BF_IsBaoxiaozhuguan && !oA_Staff.BF_Isbaoxiaojingli)
|
{
|
JavaScript.MessageBox("你没有审批权限", this);
|
return;
|
}
|
|
|
foreach (var keyid in keyids)
|
{
|
OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(keyid.ToInt32());
|
if (m_OA_WorkPlan.ApprovalStatus == 1 || m_OA_WorkPlan.ApprovalStatus == 2)
|
{
|
JavaScript.MessageBox(m_OA_WorkPlan.EvaluationContent + "该报销已经审批完成", this);
|
return;
|
}
|
|
|
var oA_WorkPlan_Shenpis = oA_WorkPlan_ShenpiBLL.GetModelByKaipiaoId(keyid.ToInt32().Value).ToList();
|
|
|
if (oA_Staff.BF_IsBaoxiaozhuguan)
|
{
|
var oA_WorkPlan_Shenpis1 = oA_WorkPlan_Shenpis.Where(x => x.Buzhou == 1).ToList();
|
if (oA_WorkPlan_Shenpis1.Count > 1)
|
{
|
Messagezhuguan = m_OA_WorkPlan.EvaluationContent + "该流程已经不在主管审批步骤!";
|
}
|
|
var shenpicount = oA_WorkPlan_Shenpis1.Count(x => x.ApprovalStaffId == CurrentUser.TrueMemberId);
|
if (shenpicount > 0)
|
{
|
Messagezhuguan = m_OA_WorkPlan.EvaluationContent + "你已经审批过该流程!";
|
}
|
}
|
if (oA_Staff.BF_IsBaoxiaozhuguan && !oA_Staff.BF_Isbaoxiaojingli)
|
{
|
if (!string.IsNullOrEmpty(Messagezhuguan))
|
{
|
|
JavaScript.MessageBox(Messagezhuguan, this);
|
return;
|
}
|
}
|
|
if (oA_Staff.BF_Isbaoxiaojingli)
|
{
|
if (oA_WorkPlan_Shenpis.Count > 2)
|
{
|
Messagejingli = "该流程已经审批完成!";
|
}
|
if (oA_WorkPlan_Shenpis.Count < 2)
|
{
|
Messagejingli = "没到经理审批步骤!";
|
}
|
}
|
if (!oA_Staff.BF_IsBaoxiaozhuguan && oA_Staff.BF_Isbaoxiaojingli)
|
{
|
if (!string.IsNullOrEmpty(Messagejingli))
|
{
|
|
JavaScript.MessageBox(Messagejingli, this);
|
return;
|
}
|
}
|
|
if (oA_Staff.BF_IsBaoxiaozhuguan && oA_Staff.BF_Isbaoxiaojingli)
|
{
|
if (!string.IsNullOrEmpty(Messagezhuguan) && !string.IsNullOrEmpty(Messagejingli))
|
{
|
|
JavaScript.MessageBox(Messagezhuguan + Messagejingli, this);
|
return;
|
}
|
}
|
|
DateTime nowTime = DateTime.Now;
|
|
OA_WorkPlan_shenpi oA_WorkPlan_Shenpi = new OA_WorkPlan_shenpi();
|
oA_WorkPlan_Shenpi.OA_WorkPlanId = keyid.ToInt32();
|
oA_WorkPlan_Shenpi.ApprovalStaffId = CurrentUser.TrueMemberId;
|
oA_WorkPlan_Shenpi.ApprovalStatus = this.selApprovalStatus.Value.ToInt32();
|
oA_WorkPlan_Shenpi.ApprovalTime = nowTime;
|
oA_WorkPlan_Shenpi.ApprovalContent = this.txtApprovalContent.Value.Trim();
|
oA_WorkPlan_Shenpi.CreateTime = nowTime;
|
oA_WorkPlan_Shenpi.Operator = CurrentUser.TrueName;
|
if (oA_WorkPlan_Shenpis.Count == 2)
|
{
|
oA_WorkPlan_Shenpi.Buzhou = 2;
|
}
|
else
|
{
|
oA_WorkPlan_Shenpi.Buzhou = 1;
|
}
|
res = oA_WorkPlan_ShenpiBLL.InsertModel(oA_WorkPlan_Shenpi);
|
|
|
if (oA_WorkPlan_Shenpis.Count == 2 || this.selApprovalStatus.Value == "2")
|
{
|
|
m_OA_WorkPlan.ApprovalContent = this.txtApprovalContent.Value.Trim();
|
m_OA_WorkPlan.ApprovalStaffId = CurrentUser.TrueMemberId;
|
m_OA_WorkPlan.ApprovalStaffName = CurrentUser.TrueName;
|
m_OA_WorkPlan.ApprovalStatus = this.selApprovalStatus.Value.ToInt32();
|
m_OA_WorkPlan.ApprovalTime = nowTime;
|
m_OA_WorkPlan.PlanStatus = 2;
|
m_OA_WorkPlan.Operator = CurrentUser.ShortName;
|
m_OA_WorkPlan.LastUpdateTime = nowTime;
|
res = oA_WorkReminderBll.UpdateModel(m_OA_WorkPlan);
|
}
|
else
|
{
|
res = oA_WorkReminderBll.UpdateModel(m_OA_WorkPlan);
|
}
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (keyids.Length > 0)
|
{
|
if (res)
|
{
|
scope.Complete();
|
JavaScript.MessageBox("审批成功", this, true, true);
|
}
|
|
else
|
JavaScript.MessageBox("操作失败", this);
|
}
|
else
|
JavaScript.MessageBox("操作失败", this);
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("操作失败", this);
|
}
|
finally
|
{
|
// 释放资源
|
scope.Dispose();
|
}
|
}
|
}
|
}
|
}
|