private void InitEvent()
 {
     InfoObj = new T_OA_CONTRACTTYPE();
     contractClient = new SmtOADocumentAdminClient();
     contractClient.ContractTypeAddCompleted += new EventHandler<ContractTypeAddCompletedEventArgs>(contractClient_ContractTypeAddCompleted);//添加
     contractClient.UpdateContraTypeCompleted += new EventHandler<UpdateContraTypeCompletedEventArgs>(contractClient_UpdateContraTypeCompleted);//修改
 }
 public ContractTypeDefinitionPages(FormTypes action, T_OA_CONTRACTTYPE contractObj)
 {
     InitializeComponent();
     actions = action;
     this.Loaded += (sender, agrs) =>
     {
         #region 原来的
         InitEvent();
         InfoObj = contractObj;
         if (action == FormTypes.Browse)
         {
             this.ContractType.IsReadOnly = true;
             this.cbContractLevel.IsEnabled = false;
             this.ContractPresentation.IsReadOnly = true;
         }
         #endregion
     };
 }
 [OperationContract]//更新类型信息
 public string UpdateContraType(T_OA_CONTRACTTYPE contraTypeInfo)
 {
     using (ContractTypeDefinitionBLL cdb = new ContractTypeDefinitionBLL())
     {
         string returnStr = "";
         if (!this.IsExistContractType(contraTypeInfo.CONTRACTTYPE, contraTypeInfo.CONTRACTLEVEL))
         {
             if (!cdb.UpdateContraType(contraTypeInfo))
             {
                 returnStr = "更新数据失败!";
             }
         }
         else
         {
             returnStr = "合同类型信息已经存在,更新数据失败";
         }
         return returnStr;
     }
 }
        [OperationContract]//添加合同类型信息
        public string ContractTypeAdd(T_OA_CONTRACTTYPE contractType)
        {
            using (ContractTypeDefinitionBLL cdb = new ContractTypeDefinitionBLL())
            {
                string returnStr = "";
                if (!this.IsExistContractType(contractType.CONTRACTTYPE, contractType.CONTRACTLEVEL))
                {

                    if (!cdb.ContractTypeAdd(contractType))
                    {
                        returnStr = "添加数据失败";
                    }
                }
                else
                {
                    returnStr = "合同类型信息已经存在,添加数据失败";
                }
                return returnStr;
            }
        }
 void btnNew_Click(object sender, RoutedEventArgs e)
 {
     contractType = new T_OA_CONTRACTTYPE();
     ContractTypeDefinitionPages AddWin = new ContractTypeDefinitionPages(FormTypes.New, contractType);
     EntityBrowser browser = new EntityBrowser(AddWin);
     browser.MinWidth = 400;//设置窗体宽度
     browser.MinHeight = 280;
     browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent);
     browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) =>{});
 }