/// <summary> /// 新增员工调查发布申请和分发范围 /// </summary> public bool AddRequireDistribute(V_EmployeeSurveyRequireDistribute AddDistribute) { try { base.BeginTransaction(); string _entityKey = AddDistribute.RequireId; if (AddDistribute.requiredistributeEntity.T_OA_REQUIREReference.EntityKey == null) { AddDistribute.requiredistributeEntity.T_OA_REQUIREReference.EntityKey = Utility.AddEntityKey("T_OA_REQUIRE", "REQUIREID", _entityKey); } bool add = base.Add(AddDistribute.requiredistributeEntity); if (add) { foreach (var item in AddDistribute.distributeuserList) { dal.Add(item); } base.CommitTransaction(); return(true); } base.RollbackTransaction(); return(false); } catch (Exception ex) { base.RollbackTransaction(); Tracer.Debug("员工调查发布申请EmployeeSurveyRequireDistributeBll-AddRequireDistribute" + System.DateTime.Now.ToString() + " " + ex.ToString()); return(false); } }
/// <summary> /// 修改员工调查发布申请和分发范围 /// </summary> public bool UpdRequireDistribute(V_EmployeeSurveyRequireDistribute updDistribute) { try { string _requireID = updDistribute.RequireId; string _childID = updDistribute.requiredistributeEntity.REQUIREDISTRIBUTEID; base.BeginTransaction(); foreach (var ents in updDistribute.oldDistributeuserList) { var ent = from chlidData in dal.GetObjects <T_OA_DISTRIBUTEUSER>() where new { chlidData.MODELNAME, chlidData.FORMID, chlidData.VIEWER, chlidData.VIEWTYPE } == new { ents.MODELNAME, ents.FORMID, ents.VIEWER, ents.VIEWTYPE } select chlidData; if (ent.Count() > 0) { var _delData = ent.FirstOrDefault(); dal.DeleteFromContext(_delData); } } int _delFlag = dal.SaveContextChanges(); if (_delFlag > 0) { var data = from items in dal.GetObjects <T_OA_REQUIREDISTRIBUTE>() where items.REQUIREDISTRIBUTEID == _childID select items; if (data.Count() > 0) { //建立entityKey,表示数据库不更新此字段(主键不允许更新) updDistribute.requiredistributeEntity.EntityKey = Utility.AddEntityKey("T_OA_REQUIREDISTRIBUTE", "REQUIREDISTRIBUTEID", _childID); if (updDistribute.requiredistributeEntity.T_OA_REQUIREReference.EntityKey == null) { updDistribute.requiredistributeEntity.T_OA_REQUIREReference.EntityKey = Utility.AddEntityKey("T_OA_REQUIRE", "REQUIREID", _requireID); } int updFlag = dal.Update(updDistribute.requiredistributeEntity); if (updFlag > 0) { foreach (var users in updDistribute.distributeuserList) { dal.Add(users); } base.CommitTransaction(); return(true); } } } base.RollbackTransaction(); return(false); } catch (Exception ex) { base.RollbackTransaction(); Tracer.Debug("员工调查发布申请EmployeeSurveyRequireDistributeBll-UpdRequireDistribute" + System.DateTime.Now.ToString() + " " + ex.ToString()); return(false); } }
/// <summary> /// 后台事件注册及初始化 /// </summary> private void EventResgister() { client = new SmtOAPersonOfficeClient(); personalClient = new PersonnelServiceClient(); client.AddRequireDistributeCompleted += new EventHandler <AddRequireDistributeCompletedEventArgs>(client_AddRequireDistributeCompleted); client.UpdRequireDistributeCompleted += new EventHandler <UpdRequireDistributeCompletedEventArgs>(client_UpdRequireDistributeCompleted); client.GetDistributeDataCompleted += new EventHandler <GetDistributeDataCompletedEventArgs>(client_GetDistributeDataCompleted); personalClient.GetEmployeeByIDsCompleted += new EventHandler <GetEmployeeByIDsCompletedEventArgs>(personalClient_GetEmployeeByIDsCompleted); distributeView = new V_EmployeeSurveyRequireDistribute(); distributeuserList = new ObservableCollection <T_OA_DISTRIBUTEUSER>(); distributeView.distributeuserList = new ObservableCollection <T_OA_DISTRIBUTEUSER>(); distributeView.requiredistributeEntity = new T_OA_REQUIREDISTRIBUTE(); distributeView.oldDistributeuserList = new ObservableCollection <T_OA_DISTRIBUTEUSER>(); lookupObjectList = new List <ExtOrgObj>(); }
public bool UpdRequireDistribute(V_EmployeeSurveyRequireDistribute UpdDistribute) { try { if (UpdDistribute != null) { using (EmployeeSurveyRequireDistributeBll distributeBll = new EmployeeSurveyRequireDistributeBll()) { return(distributeBll.UpdRequireDistribute(UpdDistribute)); } } return(false); } catch (Exception ex) { Tracer.Debug("员工调查发布EmployeeSurveyRequireDistributeService-UpdRequireDistribute" + System.DateTime.Now.ToString() + " " + ex.ToString()); return(false); } }
void client_GetDistributeDataCompleted(object sender, GetDistributeDataCompletedEventArgs e) { RefreshUI(RefreshedTypes.HideProgressBar); if (e.Error != null) { ShowMessage(true, "ERROR", "GETDATAFAILED", ""); return; } if (e.Result == null) { ShowMessage(false, "NODATA", "DIDNOTFINDRELEVANT", ""); } distributeView = e.Result; this.contextInfo.DataContext = distributeView.requiredistributeEntity; distributeuserList = distributeView.distributeuserList; distributeView.oldDistributeuserList = distributeuserList.Clone(); ConvertByGetData(distributeuserList); BindingDataGrid(); ShowAuditControl(); }
/// <summary> /// 后台事件注册及初始化 /// </summary> private void EventResgister() { client = new SmtOAPersonOfficeClient(); personalClient = new PersonnelServiceClient(); client.AddRequireDistributeCompleted += new EventHandler<AddRequireDistributeCompletedEventArgs>(client_AddRequireDistributeCompleted); client.UpdRequireDistributeCompleted += new EventHandler<UpdRequireDistributeCompletedEventArgs>(client_UpdRequireDistributeCompleted); client.GetDistributeDataCompleted += new EventHandler<GetDistributeDataCompletedEventArgs>(client_GetDistributeDataCompleted); personalClient.GetEmployeeByIDsCompleted += new EventHandler<GetEmployeeByIDsCompletedEventArgs>(personalClient_GetEmployeeByIDsCompleted); distributeView = new V_EmployeeSurveyRequireDistribute(); distributeuserList = new ObservableCollection<T_OA_DISTRIBUTEUSER>(); distributeView.distributeuserList = new ObservableCollection<T_OA_DISTRIBUTEUSER>(); distributeView.requiredistributeEntity = new T_OA_REQUIREDISTRIBUTE(); distributeView.oldDistributeuserList = new ObservableCollection<T_OA_DISTRIBUTEUSER>(); lookupObjectList = new List<ExtOrgObj>(); }