private void OnSelectionChanged(object sender, SelectionChangedEventArgs e) { AudioFile f = (AudioFile)e.AddedItems[0]; updatingSelection = true; foreach (Tag t in tags) { t.IsChecked = false; } foreach (int id in f.Tags) { Tag t = tags.FirstOrDefault(obj => obj.ID == id); if (t != null) { t.IsChecked = true; } } updatingSelection = false; }
/// <summary> /// 保存 /// </summary> /// <returns>保存结果</returns> public bool Save() { RefreshUI(RefreshedTypes.ProgressBar); if (EmployeeAddsumInfoList.Count == 0) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("MUSTSEPARATOR"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); RefreshUI(RefreshedTypes.ProgressBar); return false; } if (combProtectType.SelectedIndex == -1) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("加扣款类型不能为空"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); RefreshUI(RefreshedTypes.ProgressBar); return false; } if (FormType == FormTypes.New) { System.Collections.ObjectModel.ObservableCollection<T_HR_EMPLOYEEADDSUM> eaddsum = new System.Collections.ObjectModel.ObservableCollection<T_HR_EMPLOYEEADDSUM>(); // List<V_EmployeeAddsumView> infoList = new List<V_EmployeeAddsumView>(); infoList.AddRange(EmployeeAddsumInfoList); //添加删除的员工加扣款 infoList.AddRange(EmployeeAddsumDelList); foreach (var admSum in infoList) { if (admSum.PROJECTCODE != "del") { //不是删除的则做数据校验 if (admSum.PROJECTMONEY == 0 || isZore()) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("输入的金额不能为0"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); RefreshUI(RefreshedTypes.ProgressBar); return false; } if (admSum.PROJECTMONEY == null) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("请输入正确的金额"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); RefreshUI(RefreshedTypes.ProgressBar); return false; } } T_HR_EMPLOYEEADDSUM EmployeeAddSumNew = new T_HR_EMPLOYEEADDSUM(); //EmployeeAddSumNew.PROJECTNAME = admSum.PROJECTNAME; EmployeeAddSumNew.PROJECTMONEY = admSum.PROJECTMONEY; EmployeeAddSumNew.SYSTEMTYPE = combProtectType.SelectedIndex.ToString(); EmployeeAddSumNew.DEALYEAR = numYear.Value.ToString(); EmployeeAddSumNew.DEALMONTH = numMonth.Value.ToString(); EmployeeAddSumNew.ADDSUMID = admSum.ADDSUMID; EmployeeAddSumNew.EMPLOYEEID = admSum.EMPLOYEEID; EmployeeAddSumNew.EMPLOYEECODE = admSum.EMPLOYEECODE; //string employeeName = admSum.EMPLOYEENAME.Split('-')[0]; EmployeeAddSumNew.EMPLOYEENAME = admSum.EMPLOYEENAME; EmployeeAddSumNew.CREATEDATE = System.DateTime.Now; EmployeeAddSumNew.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; EmployeeAddSumNew.CREATECOMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; EmployeeAddSumNew.CREATEDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; EmployeeAddSumNew.CREATEPOSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID; EmployeeAddSumNew.CHECKSTATE = Convert.ToInt32(CheckStates.UnSubmit).ToString(); EmployeeAddSumNew.OWNERCOMPANYID = admSum.OWNERCOMPANYID; EmployeeAddSumNew.OWNERDEPARTMENTID = admSum.OWNERDEPARTMENTID; EmployeeAddSumNew.OWNERID = admSum.OWNERID; EmployeeAddSumNew.OWNERPOSTID = admSum.OWNERPOSTID; EmployeeAddSumNew.PROJECTCODE = admSum.PROJECTCODE; EmployeeAddSumNew.REMARK = admSum.REMARK; eaddsum.Add(EmployeeAddSumNew); } //只提交第一个 EmployeeAddSum = eaddsum.FirstOrDefault(); client.EmployeeAddSumLotsofADDAsync(eaddsum); } else { initAddSum("2"); if (EmployeeAddSum.PROJECTMONEY == 0 || EmployeeAddSum.PROJECTMONEY == null || isZore()) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("加扣款金额不能为0"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); RefreshUI(RefreshedTypes.ProgressBar); return false; } EmployeeAddSum.UPDATEDATE = System.DateTime.Now; EmployeeAddSum.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; client.EmployeeAddSumUpdateAsync(EmployeeAddSum, "Edit"); } return true; }
/// <summary> /// 保存 /// </summary> /// <returns>保存结果</returns> public bool Save() { RefreshUI(RefreshedTypes.ProgressBar); if (EmployeeAddsumInfoList.Count == 0) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("MUSTSEPARATOR"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); RefreshUI(RefreshedTypes.ProgressBar); return(false); } if (combProtectType.SelectedIndex == -1) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("加扣款类型不能为空"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); RefreshUI(RefreshedTypes.ProgressBar); return(false); } if (FormType == FormTypes.New) { System.Collections.ObjectModel.ObservableCollection <T_HR_EMPLOYEEADDSUM> eaddsum = new System.Collections.ObjectModel.ObservableCollection <T_HR_EMPLOYEEADDSUM>(); // List <V_EmployeeAddsumView> infoList = new List <V_EmployeeAddsumView>(); infoList.AddRange(EmployeeAddsumInfoList); //添加删除的员工加扣款 infoList.AddRange(EmployeeAddsumDelList); foreach (var admSum in infoList) { if (admSum.PROJECTCODE != "del") { //不是删除的则做数据校验 if (admSum.PROJECTMONEY == 0 || isZore()) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("输入的金额不能为0"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); RefreshUI(RefreshedTypes.ProgressBar); return(false); } if (admSum.PROJECTMONEY == null) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("请输入正确的金额"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); RefreshUI(RefreshedTypes.ProgressBar); return(false); } } T_HR_EMPLOYEEADDSUM EmployeeAddSumNew = new T_HR_EMPLOYEEADDSUM(); //EmployeeAddSumNew.PROJECTNAME = admSum.PROJECTNAME; EmployeeAddSumNew.PROJECTMONEY = admSum.PROJECTMONEY; EmployeeAddSumNew.SYSTEMTYPE = combProtectType.SelectedIndex.ToString(); EmployeeAddSumNew.DEALYEAR = numYear.Value.ToString(); EmployeeAddSumNew.DEALMONTH = numMonth.Value.ToString(); EmployeeAddSumNew.ADDSUMID = admSum.ADDSUMID; EmployeeAddSumNew.EMPLOYEEID = admSum.EMPLOYEEID; EmployeeAddSumNew.EMPLOYEECODE = admSum.EMPLOYEECODE; //string employeeName = admSum.EMPLOYEENAME.Split('-')[0]; EmployeeAddSumNew.EMPLOYEENAME = admSum.EMPLOYEENAME; EmployeeAddSumNew.CREATEDATE = System.DateTime.Now; EmployeeAddSumNew.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; EmployeeAddSumNew.CREATECOMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; EmployeeAddSumNew.CREATEDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; EmployeeAddSumNew.CREATEPOSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID; EmployeeAddSumNew.CHECKSTATE = Convert.ToInt32(CheckStates.UnSubmit).ToString(); EmployeeAddSumNew.OWNERCOMPANYID = admSum.OWNERCOMPANYID; EmployeeAddSumNew.OWNERDEPARTMENTID = admSum.OWNERDEPARTMENTID; EmployeeAddSumNew.OWNERID = admSum.OWNERID; EmployeeAddSumNew.OWNERPOSTID = admSum.OWNERPOSTID; EmployeeAddSumNew.PROJECTCODE = admSum.PROJECTCODE; EmployeeAddSumNew.REMARK = admSum.REMARK; eaddsum.Add(EmployeeAddSumNew); } //只提交第一个 EmployeeAddSum = eaddsum.FirstOrDefault(); client.EmployeeAddSumLotsofADDAsync(eaddsum); } else { initAddSum("2"); if (EmployeeAddSum.PROJECTMONEY == 0 || EmployeeAddSum.PROJECTMONEY == null || isZore()) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("加扣款金额不能为0"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); RefreshUI(RefreshedTypes.ProgressBar); return(false); } EmployeeAddSum.UPDATEDATE = System.DateTime.Now; EmployeeAddSum.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; client.EmployeeAddSumUpdateAsync(EmployeeAddSum, "Edit"); } return(true); }