当前位置: 首页>>代码示例>>C#>>正文


C# System.Collections.ObjectModel.ObservableCollection.FirstOrDefault方法代码示例

本文整理汇总了C#中System.Collections.ObjectModel.System.Collections.ObjectModel.ObservableCollection.FirstOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ObjectModel.ObservableCollection.FirstOrDefault方法的具体用法?C# System.Collections.ObjectModel.ObservableCollection.FirstOrDefault怎么用?C# System.Collections.ObjectModel.ObservableCollection.FirstOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.ObjectModel.System.Collections.ObjectModel.ObservableCollection的用法示例。


在下文中一共展示了System.Collections.ObjectModel.ObservableCollection.FirstOrDefault方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Save

        /// <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;
        }
开发者ID:JuRogn,项目名称:OA,代码行数:98,代码来源:EmployeeAddSumForm.xaml.cs


注:本文中的System.Collections.ObjectModel.System.Collections.ObjectModel.ObservableCollection.FirstOrDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。