public TransferPageViewModel() { ProjectDal = new ProjectDal(); ApplicantDal = new ApplicantDal(); TransferDal = new TransferDal(); // 初始化下拉框 InitialComboBoxList(); AddOrEditApplicantCommand = new DelegateCommand(() => { switch (ApplicantButtonContent) { case "确认新增": AddApplicant(); break; case "确认修改": EditApplicant(); break; default: break; } }); EditTransferCommand = new DelegateCommand(EditTransfer); SelectApplicantCommand = new DelegateCommand <object>(SelectApplicant); AddApplicantCommand = new DelegateCommand(() => { // 重新加载页面 OnNavigatedTo(NavigationContext); }); DelApplicantCommand = new DelegateCommand(DelApplicant); }
public FunctionOpenResult <bool> DeleteByID(List <int> idList) { var r = new FunctionOpenResult <bool>(); r.Data = ProjectDal.Delete(idList); return(r); }
public FunctionOpenResult <bool> UpdateByID(Project info) { var r = new FunctionOpenResult <bool>(); r.Data = ProjectDal.update(info) > 0; return(r); }
/// <summary> /// 添加项目 /// </summary> /// <param name="pro">项目对象</param> /// <returns>添加成功返回true 否则返回false</returns> public bool ProAdd(Project pro) { ProjectDal proDal = new ProjectDal(); bool flag = true; if (!proDal.AddProject(pro)) { flag = false; } return(flag); }
/// <summary> /// 删除员工 /// </summary> /// <param name="id"></param> /// <returns></returns> public bool DeletePro(string id) { ProjectDal proDal = new ProjectDal(); int a = proDal.DeletePro(id); if (a == 1) { return(true); } return(false); }
/// <summary> /// 更新员工 /// </summary> /// <param name="pro"></param> /// <returns></returns> public bool UpdatePro(Project pro) { ProjectDal proDal = new ProjectDal(); int a = proDal.UpdatePro(pro); if (a == 1) { return(true); } return(false); }
public FunctionResult <Project> Create(Project info) { var r = new FunctionResult <Project>(); int id = ProjectDal.Add(info); if (id > 0) { r.Data = info; r.Data.ProjectID = id; } return(r); }
public static HttpResponseMessage SoftDeleteProject(int projectId, bool isOpen) { try { int val = ProjectDal.SoftDeleteProject(projectId, isOpen); return(new HttpResponseMessage(HttpStatusCode.OK)); } catch (Exception ex) { Console.WriteLine("EXCEPTION: " + ex); return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } }
public static HttpResponseMessage UpdateProject(ProjectInfo project) { try { int val = ProjectDal.UpdateProject(project); return(new HttpResponseMessage(HttpStatusCode.OK)); } catch (Exception ex) { Console.WriteLine("EXCEPTION: " + ex); return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } }
public FileManagerPageViewMode() { //EA = ea; FileInfo = new FileInfo(); ProjectDal = new ProjectDal(); FileInfoDal = new FileInfoDal(); // 初始化树 InitTreeView(); FileUpLoadCommand = new DelegateCommand(FileUpLoad); SelectNodeCommand = new DelegateCommand(SelectNode); DelFileCommand = new DelegateCommand <object>(DelFile); }
/// <summary> /// 页面加载 /// </summary> /// <param name="navigationContext"></param> public void OnNavigatedTo(NavigationContext navigationContext) { // 获取选中项目 if (navigationContext.Parameters["Project"] is Project project) { Project = project; } // 初始化登记项目 Project = ProjectDal.InitialRegistrationProject(Project); // 获取附件集合 FileInfoList = new ObservableCollection <FileInfo>(Project.FileInfos); for (int i = 0; i < FileInfoList.Count; i++) { FileInfoList[i].FullPath = FileHelper.ReadConfigInfo() + "\\" + FileInfoList[i].Path + FileInfoList[i].ID + FileInfoList[i].Extension; } }
public override ValidationResult Validate(object value, CultureInfo cultureInfo) { // 非空验证 NotEmptyValidationRule notEmptyValidation = new NotEmptyValidationRule(); if (!notEmptyValidation.Validate(value, cultureInfo).IsValid) { return(notEmptyValidation.Validate(value, cultureInfo)); } // 唯一性验证 ProjectDal projectDal = new ProjectDal(); int count = projectDal.GetListBy(p => p.ProjectName == value.ToString()).Count; return(count < 1 ? ValidationResult.ValidResult : new ValidationResult(false, "项目名称已存在")); }
/// <summary> /// 查询员工的项目 /// </summary> /// <param name="id">员工编号</param> /// <returns>返回项目集合</returns> public List <string> QueryWhenEmpIdLike(string id) { ProjectDal proDal = new ProjectDal(); List <string> list = new List <string>(); list.Clear(); var datas = proDal.QueryByPLOrPMId(id); if (datas != null) { foreach (var item in datas) { list.Add(item.PName); } } return(list); }
/// <summary> /// 修改转移信息 /// </summary> private void EditTransfer() { if (Project == null) { MessageBox.Show("请选择项目", "提示"); return; } try { Transfer.UpdateTime = DateTime.Now; ProjectDal.Modify(Project); TransferDal.Modify(Transfer); } catch (Exception ex) { ErrorDialogViewModel.getInstance().show(ex); return; } }
/// <summary> /// 点击按钮,确认/取消 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> private void ConfirImportRealEstateEventHandler(object sender, DialogClosingEventArgs eventArgs) { if ("False".Equals(eventArgs.Parameter.ToString())) { return; } // cancel the close eventArgs.Cancel(); var FileTextBox = eventArgs.Parameter as System.Windows.Controls.TextBox; String FullPath = FileTextBox.Text; if (string.IsNullOrEmpty(FullPath)) { MessageBox.Show("请选择文件", "提示"); return; } // 判断项目名称是否已经存在 String projectName = Path.GetFileNameWithoutExtension(FullPath); ProjectDal projectDal = new ProjectDal(); var projectList = projectDal.GetListBy(p => p.ProjectName == projectName && p.Type == "1"); if (projectList.Count > 0) { MessageBox.Show("项目名称已存在,请更改excel名称", "提示"); return; } // 开始导入 ImportRealEstateViewModel.FilePath = FullPath; ImportRealEstateViewModel.ImportRealEstateCommand.Execute(); // 显示任务信息模态框 eventArgs.Session.UpdateContent(new TaskInfoDialog()); // run a fake operation for 3 seconds then close this baby. //Task.Delay(TimeSpan.FromSeconds(1)) // .ContinueWith((t, _) => eventArgs.Session.Close(false), null, // TaskScheduler.FromCurrentSynchronizationContext()); }
public void Ongo() { try { TaskInfoDialog = TaskInfoDialogViewModel.getInstance(); String FileName = Path.GetFileName(FullPath); //TaskInfoDialog.Messages.Add("开始导入:" + FileName); TaskMessage taskMessage = new TaskMessage(); taskMessage.Title = "导入项目:" + FileName; taskMessage.Progress = 0.0; TaskInfoDialog.Messages.Insert(0, taskMessage); Task task = new Task(() => { ImportRealEstateBook import = new ImportRealEstateBook(); import.FileName = FullPath; import.Read(); bool canContinue = import.ReadInformation(); if (canContinue) { taskMessage.Progress = 50.00; //var naturalEffective = NaturalEffective(import.ZRZList); var isNaturalBuildingUnique = IsNaturalBuildingUnique(import.NaturalBuildings); var isHouseholdUnique = IsHouseholdUnique(import.Households); if (isNaturalBuildingUnique && isHouseholdUnique) { Project project = InitialProject(); ProjectDal projectDal = new ProjectDal(); NaturalBuildingDal naturalBuildingDal = new NaturalBuildingDal(); LogicalBuildingDal logicalBuildingDal = new LogicalBuildingDal(); FloorDal floorDal = new FloorDal(); HouseholdDal householdDal = new HouseholdDal(); ObligeeDal obligeeDal = new ObligeeDal(); try { foreach (var naturalBuilding in import.NaturalBuildings) { naturalBuilding.ID = Guid.NewGuid(); naturalBuilding.ProjectID = project.ID; naturalBuilding.UpdateTime = DateTime.Now; naturalBuildingDal.Add(naturalBuilding); } } catch (Exception ex) { ErrorMsg.Add("自然幢数据异常:" + ex.Message); } try { foreach (var logicalBuilding in import.LogicalBuildings) { logicalBuilding.ID = Guid.NewGuid(); logicalBuilding.ProjectID = project.ID; logicalBuilding.UpdateTime = DateTime.Now; logicalBuildingDal.Add(logicalBuilding); } } catch (Exception ex) { ErrorMsg.Add("逻辑幢数据异常:" + ex.Message); } try { foreach (var floor in import.Floors) { floor.ID = Guid.NewGuid(); floor.ProjectID = project.ID; floor.UpdateTime = DateTime.Now; floorDal.Add(floor); } } catch (Exception ex) { ErrorMsg.Add("层数据异常:" + ex.Message); } try { foreach (var household in import.Households) { household.ID = Guid.NewGuid(); household.ProjectID = project.ID; household.UpdateTime = DateTime.Now; householdDal.Add(household); } } catch (Exception ex) { ErrorMsg.Add("户数据异常:" + ex.Message); } try { foreach (var obligee in import.Obligees) { obligee.ID = Guid.NewGuid(); obligee.ProjectID = project.ID; obligee.UpdateTime = DateTime.Now; obligeeDal.Add(obligee); } } catch (Exception ex) { ErrorMsg.Add("权利人数据异常:" + ex.Message); } try { projectDal.Add(project); } catch (Exception ex) { ErrorMsg.Add("项目数据异常:" + ex.Message); } } } ErrorMsg.AddRange(import.ErrorMsg); }); task.Start(); task.ContinueWith(t => { ThreadPool.QueueUserWorkItem(delegate { SynchronizationContext.SetSynchronizationContext(new System.Windows.Threading.DispatcherSynchronizationContext(System.Windows.Application.Current.Dispatcher)); SynchronizationContext.Current.Post(pl => { foreach (var error in ErrorMsg) { taskMessage.DetailMessages.Add(error); } if (ErrorMsg != null && ErrorMsg.Count > 0) { taskMessage.DetailMessages.Add("导入失败"); } else { taskMessage.Progress = 100.00; taskMessage.DetailMessages.Add("导入成功"); // 刷新项目列表 } }, null); }); }); } catch (Exception ex) { throw ex; } }
public QualityControlTask() { ErrorMsg = new List <string>(); ProjectDal = new ProjectDal(); }
public GridPager <Project> GetPager(GridPagerPamater <ProjectGridSearch> searchParam) { var r = ProjectDal.GetGridPager(searchParam.PageSize, searchParam.Current, searchParam.SearchPamater.Title); return(r); }
/// <summary> /// 判断项目名是否存在 /// </summary> /// <param name="name">项目名</param> /// <returns>存在返回true</returns> public bool IsNameExist(string name) { ProjectDal proDal = new ProjectDal(); return(proDal.IsNameExist(name)); }
public List <Project> QueryLikeThis(string str) { ProjectDal proDal = new ProjectDal(); return(proDal.QureyLikeThis(str)); }
public static int AddNewProject(ProjectInfo project) { return(ProjectDal.AddNewProject(project)); }
public static ProjectInfo GetProjectById(int projectId) { return(ProjectDal.GetProjectById(projectId)); }
public static ProjectInfo[] GetAllProjects() { ProjectInfo[] projectInfo = ProjectDal.GetAllProjects(); return(projectInfo); }
/// <summary> /// 是否重新下载项目信息 /// </summary> /// <param name="updatejson">是否重新下载配置分类</param> public void LoadConfig(bool isload) { lock (_lockconfig) { string jasonpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "json", "json.txt"); try { bool isupdatelocal = false; DateTime updatetime = DateTime.Now; if (isload) { SystemConfigDal scdal = new SystemConfigDal(); SystemConfig sc = scdal.GetRedisServer(AppDomainContext.Context.ConfigParams.ConfigManagerConnectString); if (sc != null) { AppDomainContext.Context.ConfigParams.RedisServer = sc.ConfigValue; } //更新项目信息 ProjectDal prodal = new ProjectDal(); AppDomainContext.Context.ProjectModel = prodal.GetByName(AppDomainContext.Context.ConfigParams.ConfigManagerConnectString, AppDomainContext.Context.ConfigParams.ProjectName); //更新分类信息 CategoryDal catedal = new CategoryDal(); AppDomainContext.Context.CategoryModels = catedal.GetListByIds(AppDomainContext.Context.ConfigParams.ConfigManagerConnectString, AppDomainContext.Context.ProjectModel.CategoryIds); long[] cids = AppDomainContext.Context.CategoryModels.Select(p => p.Id).ToArray(); //更新配置信息 ConfigDal configdal = new ConfigDal(); List <Config> configs = configdal.GetListByCategoryIds(AppDomainContext.Context.ConfigParams.ConfigManagerConnectString, cids, updatetime); List <ConfigModel> configmodels = ToConfigModel(configs); ConfigInfoOfKeyDic dic = new ConfigInfoOfKeyDic(); foreach (var item in configmodels) { dic.SetConfig(item); } AppDomainContext.Context.ConfigInfoOfKeyDic = dic; if (configs.Count > 0) { configdal.SetUpdatetime(AppDomainContext.Context.ConfigParams.ConfigManagerConnectString, cids, updatetime); isupdatelocal = true; } } else { ConfigDal configdal = new ConfigDal(); long[] cids = AppDomainContext.Context.CategoryModels.Select(p => p.Id).ToArray(); List <Config> configs = configdal.GetListByCategoryIds(AppDomainContext.Context.ConfigParams.ConfigManagerConnectString, cids, updatetime); List <ConfigModel> configmodels = ToConfigModel(configs); foreach (var item in configmodels) { AppDomainContext.Context.ConfigInfoOfKeyDic.SetConfig(item); } if (configs.Count > 0) //本次有配置更新 { configdal.SetUpdatetime(AppDomainContext.Context.ConfigParams.ConfigManagerConnectString, cids, updatetime); isupdatelocal = true; } } if (isupdatelocal) { string json1 = JsonConvert.SerializeObject(AppDomainContext.Context); IOHelper.Write(jasonpath, json1); //写入磁盘 LogHelper.WriteInfo("写入磁盘成功"); } } catch (Exception) { string json2 = IOHelper.Read(jasonpath); JsonConvert.DeserializeObject <ConfigContext>(json2); //从磁盘获得上次正确的配置 LogHelper.WriteInfo("从磁盘读取配置"); } } }
/// <summary> /// 查询所有 /// </summary> /// <returns></returns> public List <Project> QueryAll() { ProjectDal proDal = new ProjectDal(); return(proDal.QueryAll()); }
/// <summary> /// 按项目名查询 /// </summary> /// <param name="name"></param> /// <returns></returns> public List <Project> QueryByName(string name) { ProjectDal proDal = new ProjectDal(); return(proDal.QueryByName(name)); }
/// <summary> /// 按员工编号查询 /// </summary> /// <param name="id"></param> /// <returns>项目名称</returns> public List <Project> QueryByPMOrPLId(string id) { ProjectDal proDal = new ProjectDal(); return(proDal.QueryByPLOrPMId(id)); }