/// <summary>
 /// Updates a record in the SchedulerCheckin table.
 /// </summary>
 public bool Update(SchedulerCheckinEntity obj)
 {
     try
     {
         var p   = Param(obj, "edit");
         var res = unitOfWork.ProcedureExecute("Sp_SchedulerCheckin_Update", p);
         return(res);
     }
     catch (Exception ex)
     {
         Logging.PutError(ex.Message, ex);
         throw;
     }
 }
        /// <summary>
        /// Saves a record to the SchedulerCheckin table.
        /// </summary>
        public long Insert(SchedulerCheckinEntity obj)
        {
            long res;

            try
            {
                var p    = Param(obj);
                var flag = unitOfWork.ProcedureExecute("Sp_SchedulerCheckin_Insert", p);
                res = flag ? p.Get <long>("@Id") : 0;
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
                throw;
            }
            return(res);
        }
        /// <summary>
        /// Saves a record to the SchedulerCheckin table.
        /// </summary>
        private DynamicParameters Param(SchedulerCheckinEntity obj, string action = "add")
        {
            var p = new DynamicParameters();

            p.Add("@AccountId", obj.AccountId);
            p.Add("@LocaltionId", obj.LocaltionId);
            p.Add("@StartDate", obj.StartDate);
            p.Add("@EndDate", obj.EndDate);
            p.Add("@Description", obj.Description);

            if (action == "add")
            {
                p.Add("@Id", dbType: DbType.Int64, direction: ParameterDirection.Output);
            }
            else if (action == "edit")
            {
                p.Add("@Id", obj.Id);
            }

            return(p);
        }