當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。