//修改
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (Companysenddoc != null)
            {
                if (SMT.SaaS.FrameworkUI.Common.Utility.ToolBarButtonOperationPermission(Companysenddoc, "T_OA_SENDDOC", OperationType.Edit, Common.CurrentLoginUserInfo.EmployeeID))
                {
                
                    if (companysenddoc.OACompanySendDoc.CHECKSTATE == "0" || companysenddoc.OACompanySendDoc.CHECKSTATE == "3")
                    {
                        
                        CompanyDocForm AddWin = new CompanyDocForm(FormTypes.Edit, Companysenddoc);
                        EntityBrowser browser = new EntityBrowser(AddWin);
                        browser.FormType = FormTypes.Edit;
                        browser.MinWidth = 850;
                        browser.MinHeight = 600;
                        browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
                        browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true);
                        Companysenddoc = null;
                    }
                    else
                    {
                        //CompanyDocForm AddWin = new CompanyDocForm(FormTypes.Edit, Companysenddoc.OACompanySendDoc.SENDDOCID);
                        //EntityBrowser browser = new EntityBrowser(AddWin);
                        //browser.FormType = FormTypes.Edit;
                        //browser.MinWidth = 850;
                        //browser.MinHeight = 600;
                        //browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
                        //browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true);

                        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("COMPANYDOCNOTEDIT"),
                   Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                    }
                }
                else
                {
                    //Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("YOUDONOTHAVEPERMISSIONTOOPERATETHEDATA"));
                    ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("YOUDONOTHAVEPERMISSIONTOOPERATETHEDATA"),
                   Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation);
                }
                    
            }
            else
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON"));
                return;
            }
            


            
        }
        //新增
        private void btnNew_Click(object sender, RoutedEventArgs e)
        {
            V_BumfCompanySendDoc SendDocInfoT = new V_BumfCompanySendDoc();
            CompanyDocForm AddWin = new CompanyDocForm(FormTypes.New, SendDocInfoT);
            EntityBrowser browser = new EntityBrowser(AddWin);
            browser.MinWidth = 850;
            browser.MinHeight = 550;
            browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
            browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true);


            //OAWebPart AddWin = new OAWebPart();
            //EntityBrowser browser = new EntityBrowser(AddWin);
            //browser.MinWidth = 850;
            //browser.MinHeight = 600;
            //browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
            //browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true);


        }
        void btnAudit_Click(object sender, RoutedEventArgs e)
        {

            if (Companysenddoc != null)
            {
                if (!string.IsNullOrEmpty(Companysenddoc.OACompanySendDoc.SENDDOCID))
                {
                    CompanyDocForm AddWin = new CompanyDocForm(FormTypes.Audit, Companysenddoc);
                    //CompanyDocForm AddWin = new CompanyDocForm(FormTypes.Audit, "582b4077-6bc8-4c1a-9936-1bcea2443e5c");
                    //AuditCompanyDocForm AddWin = new AuditCompanyDocForm(FormTypes.Audit, Companysenddoc.OACompanySendDoc.SENDDOCID);
                    EntityBrowser browser = new EntityBrowser(AddWin);
                    browser.FormType = FormTypes.Audit;
                    browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
                    browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { });
                }
            }
            else
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "AUDIT"), Utility.GetResourceStr("CONFIRMBUTTON"));
                
            }

        }        
        private void SendDocDetailBtn_Click(object sender, RoutedEventArgs e)
        {
            //Button DetailBtn = sender as Button;
            //V_BumfCompanySendDoc VSendDoc = DetailBtn.Tag as V_BumfCompanySendDoc;
            //SendDocDetailInfo DetailWin = new SendDocDetailInfo(VSendDoc);
            //DetailWin.Show();

            if (Companysenddoc != null)
            {
                //SendDocInfoForm DetailWin = new SendDocInfoForm(Companysenddoc);
                //之前一直用审核状态打开,不解
                //CompanyDocForm DetailWin = new CompanyDocForm(FormTypes.Audit,Companysenddoc.senddoc.SENDDOCID);
                CompanyDocForm DetailWin = new CompanyDocForm(FormTypes.Browse, Companysenddoc.senddoc.SENDDOCID);
                EntityBrowser browser = new EntityBrowser(DetailWin);
                browser.FormType = FormTypes.Browse;
                browser.MinWidth = 960;
                browser.MinHeight = 520;
                browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
                browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { });
                Companysenddoc = null;
            }
            else
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "VIEW"), Utility.GetResourceStr("CONFIRMBUTTON"));
                return;
            }
        }
 void btnReSubmit_Click(object sender, RoutedEventArgs e)
 {
     if (Companysenddoc != null)
     {
         if (companysenddoc.OACompanySendDoc.CHECKSTATE == "2" || companysenddoc.OACompanySendDoc.CHECKSTATE == "3")
         {
             CompanyDocForm AddWin = new CompanyDocForm(FormTypes.Resubmit, Companysenddoc);
             EntityBrowser browser = new EntityBrowser(AddWin);
             browser.FormType = FormTypes.Resubmit;
             browser.MinWidth = 850;
             browser.MinHeight = 600;
             browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
             browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true);
         }
         else
         {
             Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("COMPANYDOCNOTRESUBMIT"));
         }
     }
     else
     {
         ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "SUBMITAUDIT"), Utility.GetResourceStr("CONFIRMBUTTON"));
         return;
     }
 }