private void BtnDetail_Click(object sender, RoutedEventArgs e)
 {
     var obj = DaGr.SelectedItems;
     if (obj == null || obj.Count == 0)
     {
         ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("SELECTERROR", "VIEW"), Utility.GetResourceStr("CONFIRMBUTTON"), MessageIcon.Exclamation);
         return;
     }
     if (BorrowApply != null)
     {
         BorrowAppForm BrowseWin = new BorrowAppForm(FormTypes.Browse, BorrowApply.BORROWAPPLYMASTERID);
         EntityBrowser browser = new EntityBrowser(BrowseWin);
         browser.FormType = FormTypes.Browse;
         browser.MinWidth = 800;
         browser.MinHeight = 500;
         //browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
         browser.Show<string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }, true, BorrowApply.BORROWAPPLYMASTERID);
         //BorrowApply = null;
     }
     else
     {
         ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "VIEW"), Utility.GetResourceStr("CONFIRMBUTTON"));
         return;
     }
 }
 void btnReSubmit_Click(object sender, RoutedEventArgs e)
 {
     DateTime dt = new DateTime(2012, 2, 18);
     if (BorrowApply != null&&!string .IsNullOrEmpty(BorrowApply.BORROWAPPLYMASTERID))
     {
         if (BorrowApply.CHECKSTATES == (int)CheckStates.UnApproved)
         {
             if(BorrowApply.UPDATEDATE <= dt)   //add zl
             {
                 Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("TIPS"), "2012.2.17号及之前日期的单据不能进行重新提交,请另新建单据!");
                 return;
             }
             BorrowAppForm AddWin = new BorrowAppForm(FormTypes.Resubmit, BorrowApply.BORROWAPPLYMASTERID);
             EntityBrowser browser = new EntityBrowser(AddWin);
             browser.FormType = FormTypes.Resubmit;
             browser.MinWidth = 800;
             browser.MinHeight = 500;
             browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
             browser.Show<string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }, true, BorrowApply.BORROWAPPLYMASTERID);
         }
         else
         {
             SMT.SaaS.FrameworkUI.Common.Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("不能重新提交审核"));
         }
     }
     else
     {
         ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "SUBMITAUDIT"), Utility.GetResourceStr("CONFIRMBUTTON"));
         return;
     }
 }
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (BorrowApply != null)
            {
                if (SMT.SaaS.FrameworkUI.Common.Utility.ToolBarButtonOperationPermission(BorrowApply, "T_FB_BORROWAPPLYMASTER", OperationType.Edit, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID))
                {

                    if (BorrowApply.CHECKSTATES == (int)CheckStates.UnSubmit)
                    {
                        BorrowAppForm AddWin = new BorrowAppForm(FormTypes.Edit, BorrowApply.BORROWAPPLYMASTERID);
                        EntityBrowser browser = new EntityBrowser(AddWin);
                        browser.FormType = FormTypes.Edit;
                        browser.MinWidth = 800;
                        browser.MinHeight = 500;
                        browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
                        browser.Show<string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }, true, BorrowApply.BORROWAPPLYMASTERID);
                        //BorrowApply = null;
                        AddWin.Deleted += (ss, ee) => { browser.Close(); GetData(); };
                    }
                    else
                    {
                        ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ONLYEDITUNSUBMITDATA"),
                        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;
            }

        }
        void btnAudit_Click(object sender, RoutedEventArgs e)
        {

            if (BorrowApply != null)
            {
                if (!string.IsNullOrEmpty(BorrowApply.BORROWAPPLYMASTERID))
                {
                    BorrowAppForm AddWin = new BorrowAppForm(FormTypes.Audit, BorrowApply.BORROWAPPLYMASTERID);

                    EntityBrowser browser = new EntityBrowser(AddWin);
                    browser.FormType = FormTypes.Audit;
                    //browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
                    browser.Show<string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }, true, BorrowApply.BORROWAPPLYMASTERID);
                }
            }
            else
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "AUDIT"), Utility.GetResourceStr("CONFIRMBUTTON"));

            }

        }
 private void btnNew_Click(object sender, RoutedEventArgs e)
 {
     BorrowAppForm AddWin = new BorrowAppForm(FormTypes.New,"" );
     
     EntityBrowser browser = new EntityBrowser(AddWin);
     browser.MinWidth = 800;
     browser.MinHeight = 500;
     browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
     
     var obj = SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot;
     browser.Show<string>(DialogMode.Default, obj, "", (result) => { }, true);
     AddWin.Deleted += (ss, ee) => { browser.Close(); GetData(); };
 }