CY_ECommercePlatform/CY.WebForm/Pages/work/MyBaoxiaoAdd.aspx.cs
@@ -15,6 +15,8 @@
using CY.Infrastructure.Query;
using CY.BLL.OA;
using System.Transactions;
using System.Net.Http;
using System.Web.Script.Serialization;
namespace CY.WebForm.Pages.work
{
@@ -32,6 +34,7 @@
        OA_SubjectSetBLL _OA_SubjectSetBLL = null;
        OA_WorkPlan_attachmentBLL oA_WorkPlan_AttachmentBLL = null;
        OA_WorkPlan_shenpiBLL oA_WorkPlan_ShenpiBLL = null;
        string url = "https://yocaisim.51zhengcai.com/api/CYOSSetting/GetShowID";// "http://192.168.0.36:5000/api/CYOSSetting/GetShowID";
        public string reado = "";
        public MyBaoxiaoAdd()
        {
@@ -61,7 +64,7 @@
                //科目名称
                this.selSubject.DataSource = _OA_SubjectSetBLL.getAllSubject(CurrentUser.MemberId, "贷");
                this.selSubject.DataBind();
                this.selSubject.Items.Insert(0, new ListItem("请选择", ""));
               // this.selSubject.Items.Insert(0, new ListItem("请选择", ""));
                InitData();
@@ -73,17 +76,27 @@
        {
            if (Request["keyid"].ToInt32() > 0)
            {
                var oA_WorkPlan_Shenpis = oA_WorkPlan_ShenpiBLL.GetModelByKaipiaoId(Request["keyid"].ToInt32().Value).ToList();
                if (oA_WorkPlan_Shenpis.Count > 0)
                // var oA_WorkPlan_Shenpis = oA_WorkPlan_ShenpiBLL.GetModelByKaipiaoId(Request["keyid"].ToInt32().Value).ToList();
                OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32());
                if (m_OA_WorkPlan.ApprovalStatus  != 3 && string.IsNullOrEmpty(Request["zaici"]) )
                {
                    txtPlanMoney.Disabled = true;
                    selSubject.Disabled = true;
                    txtPlanContent.Disabled = true;
                    selHoubufapiaoStatus.Disabled = true;
                    this.Button1.Enabled = false;
                    this.Button2.Enabled = false;
                }
                OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32());
                if (!string.IsNullOrEmpty(Request["zaici"]))
                {
                    this.Button1.Enabled = false;
                    this.Button2.Enabled = false;
                    this.btn_submit.Text = "再次提交";
                }
                if (m_OA_WorkPlan != null)
                {
@@ -130,7 +143,12 @@
                    DateTime nowTime = DateTime.Now;
                    OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32());
                    OA_WorkPlan m_OA_WorkPlan = null;
                    if (string.IsNullOrEmpty(Request["zaici"]))
                    {
                        m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32()); ;
                    }
                    if (m_OA_WorkPlan == null)
                    {
                        m_OA_WorkPlan = new OA_WorkPlan();
@@ -138,6 +156,277 @@
                        m_OA_WorkPlan.ApprovalStaffId = Guid.Empty;
                        m_OA_WorkPlan.ApprovalStaffName = "";
                        m_OA_WorkPlan.ApprovalStatus = 0;
                        m_OA_WorkPlan.ApprovalTime = nowTime;
                        m_OA_WorkPlan.EvaluationStaff = "";
                        m_OA_WorkPlan.EvaluationStaffId = Guid.Empty;
                        m_OA_WorkPlan.EvaluationStatus = 2;
                        m_OA_WorkPlan.EvaluationTime = nowTime;
                        m_OA_WorkPlan.RewardMoney = 0;
                        m_OA_WorkPlan.RewardType = 1;
                        m_OA_WorkPlan.PlanStartTime = nowTime;
                        m_OA_WorkPlan.PlanStatus = 1;
                        m_OA_WorkPlan.SentStaffId = CurrentUser.TrueMemberId;
                        m_OA_WorkPlan.MemberId = CurrentUser.MemberId;
                        OA_Staff m_OA_Staff = oA_StaffBLL.GetModelByMemberId(CurrentUser.TrueMemberId);
                        if (m_OA_Staff != null)
                            m_OA_WorkPlan.DepartId = m_OA_Staff.DepartmentId;
                        else
                            m_OA_WorkPlan.DepartId = 0;
                        m_OA_WorkPlan.PlanPeople = CurrentUser.TrueName;
                        m_OA_WorkPlan.ReciveStaffId = CurrentUser.TrueMemberId;
                    }
                    else
                    {
                        if (m_OA_WorkPlan.ApprovalStatus == 3)
                        {
                            m_OA_WorkPlan.ApprovalStatus = 0;
                        }
                    }
                    if (string.IsNullOrEmpty(m_OA_WorkPlan.EvaluationContent))
                    {
                        using (var client = new HttpClient())
                        {
                            HttpResponseMessage response = client.GetAsync(url).Result;
                            response.EnsureSuccessStatusCode();
                            string responseBody = response.Content.ReadAsStringAsync().Result;
                            JavaScriptSerializer serializer = new JavaScriptSerializer();
                            var person = serializer.Deserialize<Responsebody>(responseBody);
                            if (person != null && person.code == 1)
                            {
                                m_OA_WorkPlan.EvaluationContent = person.data;
                            }
                            else
                            {
                                JavaScript.MessageBox("生成报销单号失败", this);
                                return;
                            }
                        }
                    }
                    //m_OA_WorkPlan.EvaluationContent = "";
                    m_OA_WorkPlan.RewardResult = this.selSubject.Value;
                    var a_SubjectSet = _OA_SubjectSetBLL.getSingleSubject(this.selSubject.Value.ToInt32());
                    if (a_SubjectSet != null)
                    {
                        m_OA_WorkPlan.RewardContent = a_SubjectSet.SubjectName;
                    }
                    m_OA_WorkPlan.PlanComplany = "";
                    m_OA_WorkPlan.Operator = CurrentUser.ShortName;
                    m_OA_WorkPlan.HoubufapiaoStatus = this.selHoubufapiaoStatus.Value.ToInt32();
                    m_OA_WorkPlan.PlanContent = this.txtPlanContent.Value.Trim();
                    m_OA_WorkPlan.PlanDataType = 17;
                    m_OA_WorkPlan.PlanMoney = this.txtPlanMoney.Value.Trim().ToDecimal2() ?? 0;
                    m_OA_WorkPlan.PlanRemark = "";
                    m_OA_WorkPlan.PlanRunTime = DateTime.Now;
                    m_OA_WorkPlan.PlanTitle = "";
                    m_OA_WorkPlan.PlanType = 3;
                    m_OA_WorkPlan.LastUpdateTime = nowTime;
                    if (Request["keyid"].ToInt32() > 0 && string.IsNullOrEmpty(Request["zaici"]))
                    {
                        bool res = true;
                        var oA_WorkPlan_Shenpis = oA_WorkPlan_ShenpiBLL.GetModelByKaipiaoId(Request["keyid"].ToInt32().Value).ToList();
                        if (oA_WorkPlan_Shenpis.Count == 0)
                        {
                            res = oA_WorkReminderBll.UpdateModel(m_OA_WorkPlan);
                        }
                        if (res)
                        {
                            //var HideKeyidFapiao = Request["HideKeyidFapiao"].Split(',');
                            var HideAttachmentFapiao = Request["HideAttachmentFapiao"].Split(',');
                            var HideKeyidFujian = Request["HideKeyidFujian"].Split(',');
                            var HideAttachmentFujian = Request["HideAttachmentFujian"].Split(',');
                            //需要删除的附件
                          var oA_WorkPlan_Attachments =  oA_WorkPlan_AttachmentBLL.GetModelByKaipiaoId(m_OA_WorkPlan.Keyid.Value);
                            List<int> HideKeyidFujianid = new List<int>();
                            for (int i = 0; i < HideKeyidFapiao.Length; i++)
                            {
                                if (!string.IsNullOrEmpty(HideKeyidFapiao[i]) && HideKeyidFapiao[i].ToInt32() != 0)
                                {
                                    HideKeyidFujianid.Add(HideKeyidFapiao[i].ToInt32().Value);
                                }
                            }
                            for (int i = 0; i < HideKeyidFujian.Length; i++)
                            {
                                if (!string.IsNullOrEmpty(HideKeyidFujian[i]) && HideKeyidFujian[i].ToInt32() != 0)
                                {
                                    HideKeyidFujianid.Add(HideKeyidFujian[i].ToInt32().Value);
                                }
                            }
                            var oA_WorkPlan_Attachments1 = oA_WorkPlan_Attachments.Where(x => !HideKeyidFujianid.Contains(x.Keyid)).ToList();
                            foreach(var oa_WorkPlan_Attachment  in oA_WorkPlan_Attachments1)
                            {
                                res =  oA_WorkPlan_AttachmentBLL.DeleteModel(oa_WorkPlan_Attachment);
                            }
                            for (int i = 0; i < HideKeyidFapiao.Length; i++)
                            {
                                if (string.IsNullOrEmpty(HideKeyidFapiao[i]))
                                {
                                    var a_WorkPlan_Attachment = new OA_WorkPlan_attachment();
                                    a_WorkPlan_Attachment.OA_WorkPlanId = m_OA_WorkPlan.Keyid;
                                    a_WorkPlan_Attachment.AttachmentType = 1;
                                    a_WorkPlan_Attachment.PlanAttachment = HideAttachmentFapiao[i];
                                    a_WorkPlan_Attachment.CreateTime = DateTime.Now;
                                    a_WorkPlan_Attachment.Operator = CurrentUser.TrueName;
                                    var sss = oA_WorkPlan_AttachmentBLL.InsertModel(a_WorkPlan_Attachment);
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            for (int i = 0; i < HideKeyidFujian.Length; i++)
                            {
                                if (string.IsNullOrEmpty(HideKeyidFujian[i]))
                                {
                                    var a_WorkPlan_Attachment = new OA_WorkPlan_attachment();
                                    a_WorkPlan_Attachment.OA_WorkPlanId = m_OA_WorkPlan.Keyid;
                                    a_WorkPlan_Attachment.AttachmentType = 2;
                                    a_WorkPlan_Attachment.PlanAttachment = HideAttachmentFujian[i];
                                    a_WorkPlan_Attachment.CreateTime = DateTime.Now;
                                    a_WorkPlan_Attachment.Operator = CurrentUser.TrueName;
                                    var sss = oA_WorkPlan_AttachmentBLL.InsertModel(a_WorkPlan_Attachment);
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            scope.Complete();
                            JavaScript.MessageBox("更新成功", this, true, true);
                        }
                        else
                            JavaScript.MessageBox("操作失败", this);
                    }
                    else
                    {
                        var aaaa = oA_WorkReminderBll.InserModelAndGetId(m_OA_WorkPlan);
                        m_OA_WorkPlan.Keyid = aaaa;
                        if (aaaa > 0)
                        {
                            //var HideKeyidFapiao = Request["HideKeyidFapiao"].Split(',');
                            var HideAttachmentFapiao = Request["HideAttachmentFapiao"].Split(',');
                            var HideKeyidFujian = Request["HideKeyidFujian"].Split(',');
                            var HideAttachmentFujian = Request["HideAttachmentFujian"].Split(',');
                            for (int i = 0; i < HideKeyidFapiao.Length; i++)
                            {
                                if (HideKeyidFapiao[i]!="0")
                                {
                                    var a_WorkPlan_Attachment = new OA_WorkPlan_attachment();
                                    a_WorkPlan_Attachment.OA_WorkPlanId = m_OA_WorkPlan.Keyid;
                                    a_WorkPlan_Attachment.AttachmentType = 1;
                                    a_WorkPlan_Attachment.PlanAttachment = HideAttachmentFapiao[i];
                                    a_WorkPlan_Attachment.CreateTime = DateTime.Now;
                                    a_WorkPlan_Attachment.Operator = CurrentUser.TrueName;
                                    var sss = oA_WorkPlan_AttachmentBLL.InsertModel(a_WorkPlan_Attachment);
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            for (int i = 0; i < HideKeyidFujian.Length; i++)
                            {
                                if ( HideKeyidFujian[i] != "0")
                                {
                                    var a_WorkPlan_Attachment = new OA_WorkPlan_attachment();
                                    a_WorkPlan_Attachment.OA_WorkPlanId = m_OA_WorkPlan.Keyid;
                                    a_WorkPlan_Attachment.AttachmentType = 2;
                                    a_WorkPlan_Attachment.PlanAttachment = HideAttachmentFujian[i];
                                    a_WorkPlan_Attachment.CreateTime = DateTime.Now;
                                    a_WorkPlan_Attachment.Operator = CurrentUser.TrueName;
                                    var sss = oA_WorkPlan_AttachmentBLL.InsertModel(a_WorkPlan_Attachment);
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            scope.Complete();
                            JavaScript.MessageBox("新增成功", this, true, true);
                        }
                        else
                            JavaScript.MessageBox("操作失败", this);
                    }
                }
                catch (Exception ex)
                {
                    PAGEHandleException(ex);
                    JavaScript.MessageBox("操作失败", this);
                }
                finally
                {
                    // 释放资源
                    scope.Dispose();
                }
            }
        }
        //表单保存
        protected void btn_baocun_form(object sender, EventArgs e)
        {
            var HideKeyidFapiao = Request["HideKeyidFapiao"].Split(',');
            //if (HideKeyidFapiao.Length <= 1 && this.selHoubufapiaoStatus.Value == "1")
            //{
            //    JavaScript.MessageBox("选择有发票必须上传发票", this);
            //    return;
            //}
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
     new TransactionOptions
     {
         IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted,
         Timeout = TransactionManager.MaximumTimeout
     }
     )
              )
            {
                try
                {
                    DateTime nowTime = DateTime.Now;
                    OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32());
                    if (m_OA_WorkPlan == null)
                    {
                        m_OA_WorkPlan = new OA_WorkPlan();
                    }
                    else
                    {
                    }
                    m_OA_WorkPlan.ApprovalContent = "";
                    m_OA_WorkPlan.ApprovalStaffId = Guid.Empty;
                    m_OA_WorkPlan.ApprovalStaffName = "";
                    m_OA_WorkPlan.ApprovalStatus = 3;
                        m_OA_WorkPlan.ApprovalTime = nowTime;
                        m_OA_WorkPlan.EvaluationContent = "";
                        m_OA_WorkPlan.EvaluationStaff = "";
@@ -161,11 +450,6 @@
                        m_OA_WorkPlan.PlanPeople = CurrentUser.TrueName;
                        m_OA_WorkPlan.ReciveStaffId = CurrentUser.TrueMemberId;
                    }
                    else
                    {
                    }
                    m_OA_WorkPlan.RewardResult = this.selSubject.Value;
                    var a_SubjectSet = _OA_SubjectSetBLL.getSingleSubject(this.selSubject.Value.ToInt32());
                    if (a_SubjectSet != null)
@@ -343,5 +627,247 @@
            }
        }
        //表单保存
        protected void btn_jixu_form(object sender, EventArgs e)
        {
            var HideKeyidFapiao = Request["HideKeyidFapiao"].Split(',');
            //if (HideKeyidFapiao.Length <= 1 && this.selHoubufapiaoStatus.Value == "1")
            //{
            //    JavaScript.MessageBox("选择有发票必须上传发票", this);
            //    return;
            //}
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
     new TransactionOptions
     {
         IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted,
         Timeout = TransactionManager.MaximumTimeout
     }
     )
              )
            {
                try
                {
                    DateTime nowTime = DateTime.Now;
                    OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32());
                    if (m_OA_WorkPlan == null)
                    {
                        m_OA_WorkPlan = new OA_WorkPlan();
                    }
                    else
                    {
                    }
                    m_OA_WorkPlan.ApprovalContent = "";
                    m_OA_WorkPlan.ApprovalStaffId = Guid.Empty;
                    m_OA_WorkPlan.ApprovalStaffName = "";
                    m_OA_WorkPlan.ApprovalStatus = 3;
                    m_OA_WorkPlan.ApprovalTime = nowTime;
                    m_OA_WorkPlan.EvaluationContent = "";
                    m_OA_WorkPlan.EvaluationStaff = "";
                    m_OA_WorkPlan.EvaluationStaffId = Guid.Empty;
                    m_OA_WorkPlan.EvaluationStatus = 2;
                    m_OA_WorkPlan.EvaluationTime = nowTime;
                    m_OA_WorkPlan.RewardMoney = 0;
                    m_OA_WorkPlan.RewardType = 1;
                    m_OA_WorkPlan.PlanStartTime = nowTime;
                    m_OA_WorkPlan.PlanStatus = 1;
                    m_OA_WorkPlan.SentStaffId = CurrentUser.TrueMemberId;
                    m_OA_WorkPlan.MemberId = CurrentUser.MemberId;
                    OA_Staff m_OA_Staff = oA_StaffBLL.GetModelByMemberId(CurrentUser.TrueMemberId);
                    if (m_OA_Staff != null)
                        m_OA_WorkPlan.DepartId = m_OA_Staff.DepartmentId;
                    else
                        m_OA_WorkPlan.DepartId = 0;
                    m_OA_WorkPlan.PlanPeople = CurrentUser.TrueName;
                    m_OA_WorkPlan.ReciveStaffId = CurrentUser.TrueMemberId;
                    m_OA_WorkPlan.RewardResult = this.selSubject.Value;
                    var a_SubjectSet = _OA_SubjectSetBLL.getSingleSubject(this.selSubject.Value.ToInt32());
                    if (a_SubjectSet != null)
                    {
                        m_OA_WorkPlan.RewardContent = a_SubjectSet.SubjectName;
                    }
                    m_OA_WorkPlan.PlanComplany = "";
                    m_OA_WorkPlan.Operator = CurrentUser.ShortName;
                    m_OA_WorkPlan.HoubufapiaoStatus = this.selHoubufapiaoStatus.Value.ToInt32();
                    m_OA_WorkPlan.PlanContent = this.txtPlanContent.Value.Trim();
                    m_OA_WorkPlan.PlanDataType = 17;
                    m_OA_WorkPlan.PlanMoney = this.txtPlanMoney.Value.Trim().ToDecimal2() ?? 0;
                    m_OA_WorkPlan.PlanRemark = "";
                    m_OA_WorkPlan.PlanRunTime = DateTime.Now;
                    m_OA_WorkPlan.PlanTitle = "";
                    m_OA_WorkPlan.PlanType = 3;
                    m_OA_WorkPlan.LastUpdateTime = nowTime;
                    if (Request["keyid"].ToInt32() > 0)
                    {
                        bool res = true;
                        var oA_WorkPlan_Shenpis = oA_WorkPlan_ShenpiBLL.GetModelByKaipiaoId(Request["keyid"].ToInt32().Value).ToList();
                        if (oA_WorkPlan_Shenpis.Count == 0)
                        {
                            res = oA_WorkReminderBll.UpdateModel(m_OA_WorkPlan);
                        }
                        if (res)
                        {
                            //var HideKeyidFapiao = Request["HideKeyidFapiao"].Split(',');
                            var HideAttachmentFapiao = Request["HideAttachmentFapiao"].Split(',');
                            var HideKeyidFujian = Request["HideKeyidFujian"].Split(',');
                            var HideAttachmentFujian = Request["HideAttachmentFujian"].Split(',');
                            //需要删除的附件
                            var oA_WorkPlan_Attachments = oA_WorkPlan_AttachmentBLL.GetModelByKaipiaoId(m_OA_WorkPlan.Keyid.Value);
                            List<int> HideKeyidFujianid = new List<int>();
                            for (int i = 0; i < HideKeyidFapiao.Length; i++)
                            {
                                if (!string.IsNullOrEmpty(HideKeyidFapiao[i]) && HideKeyidFapiao[i].ToInt32() != 0)
                                {
                                    HideKeyidFujianid.Add(HideKeyidFapiao[i].ToInt32().Value);
                                }
                            }
                            for (int i = 0; i < HideKeyidFujian.Length; i++)
                            {
                                if (!string.IsNullOrEmpty(HideKeyidFujian[i]) && HideKeyidFujian[i].ToInt32() != 0)
                                {
                                    HideKeyidFujianid.Add(HideKeyidFujian[i].ToInt32().Value);
                                }
                            }
                            var oA_WorkPlan_Attachments1 = oA_WorkPlan_Attachments.Where(x => !HideKeyidFujianid.Contains(x.Keyid)).ToList();
                            foreach (var oa_WorkPlan_Attachment in oA_WorkPlan_Attachments1)
                            {
                                res = oA_WorkPlan_AttachmentBLL.DeleteModel(oa_WorkPlan_Attachment);
                            }
                            for (int i = 0; i < HideKeyidFapiao.Length; i++)
                            {
                                if (string.IsNullOrEmpty(HideKeyidFapiao[i]))
                                {
                                    var a_WorkPlan_Attachment = new OA_WorkPlan_attachment();
                                    a_WorkPlan_Attachment.OA_WorkPlanId = m_OA_WorkPlan.Keyid;
                                    a_WorkPlan_Attachment.AttachmentType = 1;
                                    a_WorkPlan_Attachment.PlanAttachment = HideAttachmentFapiao[i];
                                    a_WorkPlan_Attachment.CreateTime = DateTime.Now;
                                    a_WorkPlan_Attachment.Operator = CurrentUser.TrueName;
                                    var sss = oA_WorkPlan_AttachmentBLL.InsertModel(a_WorkPlan_Attachment);
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            for (int i = 0; i < HideKeyidFujian.Length; i++)
                            {
                                if (string.IsNullOrEmpty(HideKeyidFujian[i]))
                                {
                                    var a_WorkPlan_Attachment = new OA_WorkPlan_attachment();
                                    a_WorkPlan_Attachment.OA_WorkPlanId = m_OA_WorkPlan.Keyid;
                                    a_WorkPlan_Attachment.AttachmentType = 2;
                                    a_WorkPlan_Attachment.PlanAttachment = HideAttachmentFujian[i];
                                    a_WorkPlan_Attachment.CreateTime = DateTime.Now;
                                    a_WorkPlan_Attachment.Operator = CurrentUser.TrueName;
                                    var sss = oA_WorkPlan_AttachmentBLL.InsertModel(a_WorkPlan_Attachment);
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            scope.Complete();
                            JavaScript.MessageBox("更新成功", this);
                            Response.Redirect("/Pages/work/MyBaoxiaoAdd.aspx");
                        }
                        else
                            JavaScript.MessageBox("操作失败", this);
                    }
                    else
                    {
                        var aaaa = oA_WorkReminderBll.InserModelAndGetId(m_OA_WorkPlan);
                        m_OA_WorkPlan.Keyid = aaaa;
                        if (aaaa > 0)
                        {
                            //var HideKeyidFapiao = Request["HideKeyidFapiao"].Split(',');
                            var HideAttachmentFapiao = Request["HideAttachmentFapiao"].Split(',');
                            var HideKeyidFujian = Request["HideKeyidFujian"].Split(',');
                            var HideAttachmentFujian = Request["HideAttachmentFujian"].Split(',');
                            for (int i = 0; i < HideKeyidFapiao.Length; i++)
                            {
                                if (string.IsNullOrEmpty(HideKeyidFapiao[i]))
                                {
                                    var a_WorkPlan_Attachment = new OA_WorkPlan_attachment();
                                    a_WorkPlan_Attachment.OA_WorkPlanId = m_OA_WorkPlan.Keyid;
                                    a_WorkPlan_Attachment.AttachmentType = 1;
                                    a_WorkPlan_Attachment.PlanAttachment = HideAttachmentFapiao[i];
                                    a_WorkPlan_Attachment.CreateTime = DateTime.Now;
                                    a_WorkPlan_Attachment.Operator = CurrentUser.TrueName;
                                    var sss = oA_WorkPlan_AttachmentBLL.InsertModel(a_WorkPlan_Attachment);
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            for (int i = 0; i < HideKeyidFujian.Length; i++)
                            {
                                if (string.IsNullOrEmpty(HideKeyidFujian[i]))
                                {
                                    var a_WorkPlan_Attachment = new OA_WorkPlan_attachment();
                                    a_WorkPlan_Attachment.OA_WorkPlanId = m_OA_WorkPlan.Keyid;
                                    a_WorkPlan_Attachment.AttachmentType = 2;
                                    a_WorkPlan_Attachment.PlanAttachment = HideAttachmentFujian[i];
                                    a_WorkPlan_Attachment.CreateTime = DateTime.Now;
                                    a_WorkPlan_Attachment.Operator = CurrentUser.TrueName;
                                    var sss = oA_WorkPlan_AttachmentBLL.InsertModel(a_WorkPlan_Attachment);
                                }
                                else
                                {
                                    continue;
                                }
                            }
                            scope.Complete();
                            JavaScript.MessageBox("新增成功", this);
                            Response.Redirect("/Pages/work/MyBaoxiaoAdd.aspx");
                        }
                        else
                            JavaScript.MessageBox("操作失败", this);
                    }
                }
                catch (Exception ex)
                {
                    PAGEHandleException(ex);
                    JavaScript.MessageBox("操作失败", this);
                }
                finally
                {
                    // 释放资源
                    scope.Dispose();
                }
            }
        }
    }
}