/// <summary>
        /// Saves a record to the Localtion table.
        /// </summary>
        private DynamicParameters Param(LocaltionEntity obj, string action = "add")
        {
            var p = new DynamicParameters();

            p.Add("@AccountId", obj.AccountId);
            p.Add("@ProvinceId", obj.ProvinceId);
            p.Add("@DistrictId", obj.DistrictId);
            p.Add("@CustomeType", obj.CustomeType);
            p.Add("@Lag", obj.Lag);
            p.Add("@Lng", obj.Lng);
            p.Add("@Name", obj.Name);
            p.Add("@Avatar", obj.Avatar);
            p.Add("@Email", obj.Email);
            p.Add("@Phone", obj.Phone);
            p.Add("@Address", obj.Address);
            p.Add("@Status", obj.Status);
            p.Add("@Code", obj.Code);
            p.Add("@RepresentActive", obj.RepresentActive);
            p.Add("@MinCheckin", obj.MinCheckin);
            p.Add("@StatusEdit", obj.StatusEdit);

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

            return(p);
        }
 /// <summary>
 /// Updates a record in the Localtion table.
 /// </summary>
 public bool Update(LocaltionEntity obj)
 {
     try
     {
         var p   = Param(obj, "edit");
         var res = unitOfWork.ProcedureExecute("Sp_Localtion_Update", p);
         return(res);
     }
     catch (Exception ex)
     {
         Logging.PutError(ex.Message, ex);
         throw;
     }
 }
 public bool UpdateAvatar(LocaltionEntity obj)
 {
     try
     {
         var p = new DynamicParameters();
         p.Add("@Id", obj.Id);
         var res = unitOfWork.ProcedureExecute("Sp_Localtion_UpdateAvatar", p);
         return(res);
     }
     catch (Exception ex)
     {
         Logging.PutError(ex.Message, ex);
         return(false);
     }
 }
        /// <summary>
        /// Saves a record to the Localtion table.
        /// </summary>
        public long Insert(LocaltionEntity obj)
        {
            long res;

            try
            {
                var p    = Param(obj);
                var flag = unitOfWork.ProcedureExecute("Sp_Localtion_Insert", p);
                res = flag ? p.Get <long>("@Id") : 0;
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
                throw;
            }
            return(res);
        }
 public bool CheckedLocaltion(LocaltionEntity loc)
 {
     try
     {
         var p = new DynamicParameters();
         p.Add("@Id", loc.Id);
         p.Add("@AccountId", loc.AccountId);
         p.Add("@PlaceNumberWrong", loc.PlaceNumberWrong);
         p.Add("@ImageCheckin", loc.ImageCheckin);
         var res = unitOfWork.ProcedureExecute("Sp_Localtion_CheckedLocaltion", p);
         return(res);
     }
     catch (Exception ex)
     {
         Logging.PutError(ex.Message, ex);
         throw;
     }
 }
        public bool EditLocaltion(LocaltionEntity obj)
        {
            try
            {
                var p = new DynamicParameters();
                p.Add("@Id", obj.Id);
                p.Add("@AccountId", obj.AccountId);
                p.Add("@Lag", obj.Lag);
                p.Add("@Lng", obj.Lng);
                p.Add("@Name", obj.Name);
                p.Add("@Avatar", obj.Avatar);
                p.Add("@Phone", obj.Phone);
                p.Add("@Address", obj.Address);
                p.Add("@Code", obj.Code);

                var res = unitOfWork.ProcedureExecute("Sp_Localtion_EditLocaltion", p);
                return(res);
            }
            catch (Exception ex)
            {
                Logging.PutError(ex.Message, ex);
                throw;
            }
        }