Exemplo n.º 1
0
        public bool ModifyTask(T_TIME_SHEET_TASK task, T_TIME_SHEET sheet)
        {
            bool isSucess = true;

            using (var tran = DbContext.DbTransaction)
            {
                try
                {
                    DbContext.Update(sheet);
                    DbContext.Update(task);
                }
                catch (Exception e)
                {
                    isSucess = false;
                    throw e;
                }
                finally
                {
                    if (isSucess)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                    }
                }
                return(isSucess);
            }
        }
Exemplo n.º 2
0
        //Todo:暂时性这么解决
        public bool AddTaskList(List <T_TIME_SHEET_TASK> tasks, T_TIME_SHEET sheet)
        {
            bool isSucess = true;

            using (var tran = DbContext.DbTransaction)
            {
                try
                {
                    DbContext.Update(sheet);
                    foreach (var task in tasks)
                    {
                        DbContext.Insert(task);
                    }
                }
                catch (Exception e)
                {
                    isSucess = false;
                    throw e;
                }
                finally
                {
                    if (isSucess)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                    }
                }
                return(isSucess);
            }
        }