using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.BLL; using CY.BLL.Sys; using CY.Model; using CY.Infrastructure.Query; using CY.Infrastructure.Common; namespace CY.WebForm.Pages.work { //吴辉 //我的请示 public partial class BaoxiaoReplyList : BasePage { Sys_DictionaryBLL bll_Sys_DictionaryBLL = null; OA_WorkPlanBll bll_OA_WorkPlanBll = null; OA_WorkPlan_attachmentBLL oA_WorkPlan_AttachmentBLL = null; OA_DepartmentBll oA_DepartmentBll = null; OA_StaffBLL oA_StaffBLL = null; OA_WorkPlan_shenpiBLL oA_WorkPlan_ShenpiBLL = null; public string piliangpifu = null; //初始化 public BaoxiaoReplyList() { bll_Sys_DictionaryBLL = new Sys_DictionaryBLL(); bll_OA_WorkPlanBll = new OA_WorkPlanBll(); oA_WorkPlan_AttachmentBLL = new OA_WorkPlan_attachmentBLL(); oA_DepartmentBll = new OA_DepartmentBll(); oA_StaffBLL = new OA_StaffBLL(); oA_WorkPlan_ShenpiBLL = new OA_WorkPlan_shenpiBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged; if (!IsPostBack) { this.selApprovalStatus.Value = "0"; BindList(); } if (Request["delete"] != null) { OA_WorkPlan model = bll_OA_WorkPlanBll.GetModelByKeyid(Request["delete"].ToInt32()); if (model != null && model.Keyid != null) { bll_OA_WorkPlanBll.DeleteModel(model, CurrentUser.TrueName); JavaScript.MessageBox("删除成功", this); Response.Redirect("/Pages/work/BaoxiaoReplyList.aspx"); } else { JavaScript.MessageBox("删除失败", this); } } if (Request["deleteKeyIds"] != null) { List deleteKeyIdList = new List(); string deleteKeyIds = Request["deleteKeyIds"].ToString(); if (deleteKeyIds.Contains(",")) { string[] keyIdArry = deleteKeyIds.Split(','); foreach (string keyId in keyIdArry) { OA_WorkPlan model = bll_OA_WorkPlanBll.GetModelByKeyid(keyId.ToInt32()); if (model.Keyid != null && model != null) { bll_OA_WorkPlanBll.DeleteModel(model, CurrentUser.TrueName); } else { JavaScript.MessageBox("删除失败", this); break; } } JavaScript.MessageBox("删除成功", this); } else { OA_WorkPlan model = bll_OA_WorkPlanBll.GetModelByKeyid(Request["deleteKeyIds"].ToInt32()); if (model.Keyid != null && model != null) { bll_OA_WorkPlanBll.DeleteModel(model, CurrentUser.TrueName); JavaScript.MessageBox("删除成功", this); } else { JavaScript.MessageBox("删除失败", this); } } Response.Redirect("/Pages/work/BaoxiaoReplyList.aspx"); } } //绑定数据 private void BindList() { Pagination pa = new Pagination(); DateTime? beginTime = null; DateTime? endTime = null; pa.PageSize = UCPager1.AspNetPager.PageSize; pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex; var oA_WorkPlans = bll_OA_WorkPlanBll.SelectModelPage(pa, CurrentUser.MemberId, Guid.Empty, Guid.Empty, 3, 17, "", null, null, string.IsNullOrEmpty(this.txtRegTimeStart.Value) ? beginTime : Convert.ToDateTime(this.txtRegTimeStart.Value), string.IsNullOrEmpty(this.txtRegTimeEnd.Value) ? endTime : Convert.ToDateTime(this.txtRegTimeEnd.Value), this.txtPlanPeople.Value.Trim(), -1, this.selApprovalStatus.Value.ToInt32(), null, null,this.TxtRewardContent.Value.Trim(), this.txtPlanContent.Value.Trim(),"3"); var oA_Staff = oA_StaffBLL.GetModelByMemberId(CurrentUser.TrueMemberId); if (oA_Staff.BF_Isbaoxiaojingli) { piliangpifu = "1"; } else { piliangpifu = "0"; } foreach (var oA_WorkPlan in oA_WorkPlans) { var sss = oA_WorkPlan_AttachmentBLL.GetModelByKaipiaoId(oA_WorkPlan.Keyid.Value); var fapiaos = sss.Where(x => x.AttachmentType == 1).ToList(); var fujians = sss.Where(x => x.AttachmentType == 2).ToList(); if (fapiaos.Count > 0) { int i = 1; oA_WorkPlan.Fapiao = ""; foreach (var oA_WorkPlan_Attachment in fapiaos) { oA_WorkPlan.Fapiao += "发票"+i+" "; i = i + 1; } } if (fujians.Count > 0) { int i = 1; oA_WorkPlan.Fujian = ""; foreach (var oA_WorkPlan_Attachment in fujians) { oA_WorkPlan.Fujian += "附件" + i + " "; i = i + 1; } } var oA_Department = oA_DepartmentBll.GetModelByKeyid(oA_WorkPlan.DepartId); if (oA_Department != null) { oA_WorkPlan.DepartName = oA_Department.Name; } oA_WorkPlan.Nengfoushenpi = 0; var oA_WorkPlan_Shenpis = oA_WorkPlan_ShenpiBLL.GetModelByKaipiaoId(oA_WorkPlan.Keyid.Value).ToList(); if (oA_WorkPlan.ApprovalStatus == 1 || oA_WorkPlan.ApprovalStatus == 2) { oA_WorkPlan.Nengfoushenpi = 1; } else { if (!oA_Staff.BF_IsBaoxiaozhuguan && !oA_Staff.BF_Isbaoxiaojingli) { oA_WorkPlan.Nengfoushenpi = 1; } else if(oA_Staff.BF_IsBaoxiaozhuguan && !oA_Staff.BF_Isbaoxiaojingli) { var oA_WorkPlan_Shenpis1 = oA_WorkPlan_Shenpis.Where(x => x.Buzhou == 1).ToList(); if (oA_WorkPlan_Shenpis1.Count > 1) { oA_WorkPlan.Nengfoushenpi = 1; } var shenpicount = oA_WorkPlan_Shenpis1.Count(x => x.ApprovalStaffId == CurrentUser.TrueMemberId); if (shenpicount > 0) { oA_WorkPlan.Nengfoushenpi = 1; } } else if (!oA_Staff.BF_IsBaoxiaozhuguan && oA_Staff.BF_Isbaoxiaojingli) { if (oA_WorkPlan_Shenpis.Count > 2) { oA_WorkPlan.Nengfoushenpi = 1; } if (oA_WorkPlan_Shenpis.Count < 2) { oA_WorkPlan.Nengfoushenpi = 1; } } else if (oA_Staff.BF_IsBaoxiaozhuguan && oA_Staff.BF_Isbaoxiaojingli) { var oA_WorkPlan_Shenpis1 = oA_WorkPlan_Shenpis.Where(x => x.Buzhou == 1).ToList(); var shenpicount = oA_WorkPlan_Shenpis1.Count(x => x.ApprovalStaffId == CurrentUser.TrueMemberId); if(oA_WorkPlan_Shenpis.Count != 2 && ((oA_WorkPlan_Shenpis1.Count > 1) || shenpicount > 0)) { oA_WorkPlan.Nengfoushenpi = 1; } } } } this.NowMoney.InnerText = oA_WorkPlans.Sum(x => x.PlanMoney).Value.ToString("F2"); this.RepClientList.DataSource = oA_WorkPlans; this.RepClientList.DataBind(); UCPager1.AspNetPager.RecordCount = pa.RecordCount; } //分页事件 protected void AspNetPager1_PageChanged(object src, EventArgs e) { BindList(); } //查询事件 protected void btn_Search_Click(object src, EventArgs e) { BindList(); } } }