Exemplo n.º 1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <bool> Delete(ICExceptionDto input)
        {
            try
            {
                var entity =
                    await JIT_ICException.GetAll().SingleOrDefaultAsync(p =>
                                                                        p.FID == input.FID);

                await JIT_ICException.DeleteAsync(entity);

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加和更改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <bool> CreateAndUpdate(ICExceptionDto input)
        {
            try
            {
                var entity = await JIT_ICException.GetAll()
                             .SingleOrDefaultAsync(p => p.FID == input.FID && p.FSrcID == input.FSrcID);

                var emp = await JIT_Employee.SingleAsync(p => p.FUserId == AbpSession.UserId);

                if (entity == null)
                {
                    entity = new DIME2Barcode.Entities.ICException()
                    {
                        FID          = Guid.NewGuid().ToString(),
                        FSrcID       = input.FSrcID,
                        FBiller      = emp.FName,
                        FNote        = input.FNote,
                        FTime        = input.FTime,
                        FRemark      = input.FRemark,
                        FRecoverTime = input.FRecoverTime
                    };
                    await JIT_ICException.InsertAsync(entity);
                }
                else
                {
                    entity.FBiller      = emp.FName;
                    entity.FNote        = input.FNote;
                    entity.FTime        = input.FTime;
                    entity.FRemark      = input.FRemark;
                    entity.FRecoverTime = input.FRecoverTime;

                    await JIT_ICException.UpdateAsync(entity);
                }

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }