private void btnNew_Click(object sender, RoutedEventArgs e)
 {           
     DocTypeTemplateForm form = new DocTypeTemplateForm(Action.Add,null);           
     EntityBrowser browser = new EntityBrowser(form);
     browser.MinWidth = 900;
     browser.MinHeight = 400;
     browser.ReloadDataEvent += new EntityBrowser.refreshGridView(AddWin_ReloadDataEvent);
     browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) =>{});
 }
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {

            if (Senddoctemplate != null)
            {
                if (SMT.SaaS.FrameworkUI.Common.Utility.ToolBarButtonOperationPermission(Senddoctemplate, "OABUMFDOCTEMPLATE", OperationType.Edit, Common.CurrentLoginUserInfo.EmployeeID))
                {
                    DocTypeTemplateForm form = new DocTypeTemplateForm(Action.Edit, Senddoctemplate);
                    EntityBrowser browser = new EntityBrowser(form);
                    browser.MinWidth = 900;
                    browser.MinHeight = 400;
                    browser.ReloadDataEvent += new EntityBrowser.refreshGridView(AddWin_ReloadDataEvent);
                    browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { });
                }
                else
                {                    
                    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;
            }


            //T_OA_SENDDOCTEMPLATE DocTypeTemplateInfoT = new T_OA_SENDDOCTEMPLATE();

            //if (DaGr.ItemsSource != null)
            //{
            //    foreach (object obj in DaGr.ItemsSource)
            //    {
            //        if (DaGr.Columns[0].GetCellContent(obj) != null)
            //        {
            //            CheckBox cb1 = DaGr.Columns[0].GetCellContent(obj).FindName("myChkBox") as CheckBox; //cb为
            //            if (cb1.IsChecked == true)
            //            {                            
            //                DocTypeTemplateInfoT = cb1.Tag as T_OA_SENDDOCTEMPLATE;
            //                break;
            //            }
            //        }
            //    }

            //}

            
            //if (!string.IsNullOrEmpty(DocTypeTemplateInfoT.SENDDOCTEMPLATEID))
            //{

            //    DocTypeTemplateForm form = new DocTypeTemplateForm(Action.Edit, DocTypeTemplateInfoT);
            //    EntityBrowser browser = new EntityBrowser(form);
            //    browser.MinWidth = 500;
            //    browser.MinHeight = 440;
            //    browser.ReloadDataEvent += new EntityBrowser.refreshGridView(AddWin_ReloadDataEvent);
            //    browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) =>{});                
            //}
            //else
            //{
            //    //MessageBox.Show("请选择需要修改的公文类型");
            //    ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON"));
            //    return;
            //}

        }
        void BtnView_Click(object sender, RoutedEventArgs e)
        {

            if (Senddoctemplate != null)
            {
                DocTypeTemplateForm form = new DocTypeTemplateForm(Action.Read, Senddoctemplate);
                EntityBrowser browser = new EntityBrowser(form);
                browser.FormType = FormTypes.Browse;
                browser.MinWidth = 900;
                browser.MinHeight = 400;
                browser.ReloadDataEvent += new EntityBrowser.refreshGridView(AddWin_ReloadDataEvent);
                browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { });
            }
            else
            {
                ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "VIEW"), Utility.GetResourceStr("CONFIRMBUTTON"));
                return;
            }
                        
        }