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

            try
            {
                var p    = Param(obj);
                var flag = unitOfWork.ProcedureExecute("Sp_AccountPlace_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 AccountPlace table.
        /// </summary>
        private DynamicParameters Param(AccountPlaceEntity obj, string action = "add")
        {
            var p = new DynamicParameters();

            p.Add("@AccountId", obj.AccountId);
            p.Add("@Lag", obj.Lag);
            p.Add("@Lng", obj.Lng);

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

            return(p);
        }