コード例 #1
0
        /// <summary>
        /// Saves a record to the Employee table.
        /// </summary>
        public int Insert(Employee_HistoryEntity employee_history)
        {
            int  res  = 0;
            bool flag = false;

            try
            {
                var p = Param(employee_history);
                flag = (bool)unitOfWork.ProcedureExecute("ptgroup_Employee_History_Insert", p);
                if (flag)
                {
                    res = p.Get <int>("@Id");
                }
                else
                {
                    res = 0;
                }
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
                throw;
            }
            return(res);
        }
コード例 #2
0
        /// <summary>
        /// Updates a record in the Employee table.
        /// </summary>
        public bool Update(Employee_HistoryEntity employee_history)
        {
            bool res = false;

            try
            {
                var p = Param(employee_history, "edit");
                res = (bool)unitOfWork.ProcedureExecute("ptgroup_Employee_History_Update", p);
                return(res);
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
                return(res);
            }
        }
コード例 #3
0
        /// <summary>
        /// Saves a record to the Employee table.
        /// </summary>
        private DynamicParameters Param(Employee_HistoryEntity employee_history, string action = "add")
        {
            var p = new DynamicParameters();

            if (action == "add")
            {
                p.Add("@Id", dbType: DbType.Int32, direction: ParameterDirection.Output);
            }
            else
            {
                p.Add("@Id", employee_history.Id);
                p.Add("@TimeOut", employee_history.TimeOut);
            }
            p.Add("@EmployeeId", employee_history.EmployeeId);
            p.Add("@DepartmentId", employee_history.DepartmentId);
            p.Add("@Position", employee_history.Position);
            p.Add("@TimeIn", employee_history.TimeIn);
            p.Add("@Note", employee_history.Note);

            return(p);
        }