Exemple #1
0
        public static PayRateInput AddPayRateInput(string number, bool isVerify)
        {
            PayRateInput item = Get(number, isVerify);

            if (item == null)
            {
                item       = new PayRateInput();
                item.标识    = Guid.NewGuid();
                item.编号    = number;
                item.是验证录入 = isVerify;
                item.录入人   = "   ";
                item.录入时间  = DateTime.Now;

                item.Save();
            }
            return(item);
        }
Exemple #2
0
        protected override void OnSaving()
        {
            if (string.IsNullOrEmpty(编号))
            {
                if (this.标识 == Guid.Empty)
                {
                    this.标识 = Guid.NewGuid();
                }
                this.编号 = GetNewNumber();
                //如果是新编号,更新编号信息的当前序号
                this.NumberInfo.UpdateCurrentSN();

                PayRateInput found = Get(this.编号, this.是验证录入);
                if (found != null && found.标识 != this.标识)
                {
                    throw new Exception(String.Format("同一编号不能重复创建,请稍后重试。", this.编号));
                }
            }

            if (另一人录入的记录 != null)
            {
                TimeSpan ts = DateTime.Now - 另一人录入的记录.录入时间;
                if (ts.TotalMilliseconds > 10000 && 另一人录入的记录.录入人 == AccessController.CurrentUser.姓名)
                {
                    throw new Exception("两次录入不能是同一个人。");
                }
            }

            if (string.IsNullOrEmpty(this.录入人) || (DateTime.Now - this.录入时间).TotalMilliseconds > 10000)
            {
                this.录入人  = AccessController.CurrentUser.姓名;
                this.录入时间 = DateTime.Now;
            }

            base.OnSaving();
        }
Exemple #3
0
        /// <param name="id"></param>
        /// <returns></returns>
        public static PayRateInput Get(Guid id)
        {
            PayRateInput obj = (PayRateInput)MyHelper.XpoSession.GetObjectByKey(typeof(PayRateInput), id);

            return(obj);
        }